Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

chore(deps): refresh the GitHub Action archive matchers (#2290)

Michael D'Angelo24da27dd592f
diff --git a/github-action/dist/index.cjs b/github-action/dist/index.cjs
index 3c97d6c0d..dc891e403 100644
--- a/github-action/dist/index.cjs
+++ b/github-action/dist/index.cjs
@@ -24738,41 +24738,34 @@ var require_state_cjs2 = __commonJS({
}
});
-// node_modules/readdir-glob/node_modules/minimatch/lib/path.js
-var require_path = __commonJS({
- "node_modules/readdir-glob/node_modules/minimatch/lib/path.js"(exports2, module2) {
- var isWindows = typeof process === "object" && process && process.platform === "win32";
- module2.exports = isWindows ? { sep: "\\" } : { sep: "/" };
- }
-});
-
-// node_modules/balanced-match/index.js
-var require_balanced_match = __commonJS({
- "node_modules/balanced-match/index.js"(exports2, module2) {
+// node_modules/minimatch/node_modules/balanced-match/dist/commonjs/index.js
+var require_commonjs3 = __commonJS({
+ "node_modules/minimatch/node_modules/balanced-match/dist/commonjs/index.js"(exports2) {
"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 = range2(a, b, str);
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.range = exports2.balanced = void 0;
+ var balanced = (a, b, str) => {
+ const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
+ const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
+ const r = ma !== null && mb != null && (0, exports2.range)(ma, mb, 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)
+ body: str.slice(r[0] + ma.length, r[1]),
+ post: str.slice(r[1] + mb.length)
};
- }
- function maybeMatch(reg, str) {
- var m = str.match(reg);
+ };
+ exports2.balanced = balanced;
+ var maybeMatch = (reg, str) => {
+ const m = str.match(reg);
return m ? m[0] : null;
- }
- balanced.range = range2;
- function range2(a, b, str) {
- var begs, beg, left, right, result;
- var ai = str.indexOf(a);
- var bi = str.indexOf(b, ai + 1);
- var i = ai;
+ };
+ var range2 = (a, b, str) => {
+ let begs, beg, left, right = void 0, result;
+ let ai = str.indexOf(a);
+ let bi = str.indexOf(b, ai + 1);
+ let i = ai;
if (ai >= 0 && bi > 0) {
if (a === b) {
return [ai, bi];
@@ -24780,14 +24773,16 @@ var require_balanced_match = __commonJS({
begs = [];
left = str.length;
while (i >= 0 && !result) {
- if (i == ai) {
+ if (i === ai) {
begs.push(i);
ai = str.indexOf(a, i + 1);
- } else if (begs.length == 1) {
- result = [begs.pop(), bi];
+ } else if (begs.length === 1) {
+ const r = begs.pop();
+ if (r !== void 0)
+ result = [r, bi];
} else {
beg = begs.pop();
- if (beg < left) {
+ if (beg !== void 0 && beg < left) {
left = beg;
right = bi;
}
@@ -24795,58 +24790,70 @@ var require_balanced_match = __commonJS({
}
i = ai < bi && ai >= 0 ? ai : bi;
}
- if (begs.length) {
+ if (begs.length && right !== void 0) {
result = [left, right];
}
}
return result;
- }
+ };
+ exports2.range = range2;
}
});
-// node_modules/brace-expansion/index.js
-var require_brace_expansion = __commonJS({
- "node_modules/brace-expansion/index.js"(exports2, module2) {
- var balanced = require_balanced_match();
- module2.exports = expandTop;
+// node_modules/minimatch/node_modules/brace-expansion/dist/commonjs/index.js
+var require_commonjs4 = __commonJS({
+ "node_modules/minimatch/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.EXPANSION_MAX_REWRITES = exports2.EXPANSION_MAX_DEPTH = exports2.EXPANSION_MAX_LENGTH = exports2.EXPANSION_MAX = void 0;
+ exports2.expand = expand2;
+ var balanced_match_1 = require_commonjs3();
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";
- var EXPANSION_MAX = 1e5;
- var EXPANSION_MAX_LENGTH = 4e6;
- var EXPANSION_MAX_DEPTH = 1e3;
- var EXPANSION_MAX_REWRITES = 1e3;
+ var escSlashPattern = new RegExp(escSlash, "g");
+ var escOpenPattern = new RegExp(escOpen, "g");
+ var escClosePattern = new RegExp(escClose, "g");
+ var escCommaPattern = new RegExp(escComma, "g");
+ var escPeriodPattern = new RegExp(escPeriod, "g");
+ var slashPattern = /\\\\/g;
+ var openPattern = /\\{/g;
+ var closePattern = /\\}/g;
+ var commaPattern = /\\,/g;
+ var periodPattern = /\\\./g;
+ exports2.EXPANSION_MAX = 1e5;
+ exports2.EXPANSION_MAX_LENGTH = 4e6;
+ exports2.EXPANSION_MAX_DEPTH = 1e3;
+ exports2.EXPANSION_MAX_REWRITES = 1e3;
function numeric(str) {
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
+ return !isNaN(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);
+ return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
}
function unescapeBraces(str) {
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
+ return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
}
function pushAll(target, items) {
- for (var i = 0; i < items.length; i++) {
+ for (let i = 0; i < items.length; i++) {
target.push(items[i]);
}
}
function parseCommaParts(str) {
- var parts = [];
- var carry = "";
+ const parts = [];
+ let carry = "";
for (; ; ) {
- var m = balanced("{", "}", str);
+ const m = (0, balanced_match_1.balanced)("{", "}", str);
if (!m) {
- var tail = str.split(",");
+ const tail = str.split(",");
tail[0] = carry + tail[0];
pushAll(parts, tail);
return parts;
}
- var pre = m.pre;
- var body2 = m.body;
- var post = m.post;
- var p = pre.split(",");
+ const { pre, body: body2, post } = m;
+ const p = pre.split(",");
p[0] = carry + p[0];
p[p.length - 1] += "{" + body2 + "}";
if (!post.length) {
@@ -24858,18 +24865,15 @@ var require_brace_expansion = __commonJS({
str = post;
}
}
- function expandTop(str, options) {
- if (!str)
+ function expand2(str, options = {}) {
+ if (!str) {
return [];
- options = options || {};
- var max = options.max == null ? EXPANSION_MAX : options.max;
- var maxLength = options.maxLength == null ? EXPANSION_MAX_LENGTH : options.maxLength;
- var maxDepth = options.maxDepth == null ? EXPANSION_MAX_DEPTH : options.maxDepth;
- var maxRewrites = options.maxRewrites == null ? EXPANSION_MAX_REWRITES : options.maxRewrites;
- if (str.substr(0, 2) === "{}") {
- str = "\\{\\}" + str.substr(2);
}
- return expand2(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
+ const { max = exports2.EXPANSION_MAX, maxLength = exports2.EXPANSION_MAX_LENGTH, maxDepth = exports2.EXPANSION_MAX_DEPTH, maxRewrites = exports2.EXPANSION_MAX_REWRITES } = options;
+ if (str.slice(0, 2) === "{}") {
+ str = "\\{\\}" + str.slice(2);
+ }
+ return expand_(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
}
function embrace(str) {
return "{" + str + "}";
@@ -24884,14 +24888,17 @@ var require_brace_expansion = __commonJS({
return i >= y;
}
function combine(acc, pre, values, max, maxLength, dropEmpties) {
- var out = [];
- var length = 0;
- for (var a = 0; a < acc.length; a++) {
- for (var v = 0; v < values.length; v++) {
- if (out.length >= max) return out;
- var expansion = acc[a] + pre + values[v];
- if (dropEmpties && !expansion) continue;
- if (length + expansion.length > maxLength) return out;
+ const out = [];
+ let length = 0;
+ for (let a = 0; a < acc.length; a++) {
+ for (let v = 0; v < values.length; v++) {
+ if (out.length >= max)
+ return out;
+ const expansion = acc[a] + pre + values[v];
+ if (dropEmpties && !expansion)
+ continue;
+ if (length + expansion.length > maxLength)
+ return out;
out.push(expansion);
length += expansion.length;
}
@@ -24899,25 +24906,25 @@ var require_brace_expansion = __commonJS({
return out;
}
function expandSequence(body2, isAlphaSequence, max, maxLength) {
- var n = body2.split(/\.\./);
- var N = [];
+ const n = body2.split(/\.\./);
+ const N = [];
if (n[0] === void 0 || n[1] === void 0) {
return N;
}
- 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 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
- var test = lte;
- var reverse = y < x;
+ const x = numeric(n[0]);
+ const y = numeric(n[1]);
+ const width = Math.max(n[0].length, n[1].length);
+ let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
+ let test = lte;
+ const reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
- var pad = n.some(isPadded);
- var length = 0;
- for (var i = x; test(i, y) && N.length < max; i += incr) {
- var c;
+ const pad = n.some(isPadded);
+ let length = 0;
+ for (let i = x; test(i, y) && N.length < max; i += incr) {
+ let c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === "\\") {
@@ -24926,9 +24933,9 @@ var require_brace_expansion = __commonJS({
} else {
c = String(i);
if (pad) {
- var need = width - c.length;
+ const need = width - c.length;
if (need > 0) {
- var z = new Array(need + 1).join("0");
+ const z = new Array(need + 1).join("0");
if (i < 0) {
c = "-" + z + c.slice(1);
} else {
@@ -24937,44 +24944,39 @@ var require_brace_expansion = __commonJS({
}
}
}
- if (length + c.length > maxLength) break;
+ if (length + c.length > maxLength)
+ break;
N.push(c);
length += c.length;
}
return N;
}
- function expand2(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
+ function expand_(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
if (depth > maxDepth) {
return [str];
}
- var acc = [""];
- var rewrites = 0;
- var dropEmpties = false;
- var firstGroup = true;
+ let acc = [""];
+ let rewrites = 0;
+ let dropEmpties = false;
+ let firstGroup = true;
for (; ; ) {
- const m = balanced("{", "}", str);
+ const m = (0, balanced_match_1.balanced)("{", "}", str);
if (!m) {
return combine(acc, str, [""], max, maxLength, dropEmpties);
}
const pre = m.pre;
if (/\$$/.test(pre)) {
- acc = combine(
- acc,
- pre + "{" + m.body + "}",
- [""],
- max,
- maxLength,
- dropEmpties && !m.post.length
- );
+ acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
firstGroup = false;
- if (!m.post.length) break;
+ if (!m.post.length)
+ break;
str = m.post;
continue;
}
- 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;
+ const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
+ const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
+ const isSequence = isNumericSequence || isAlphaSequence;
+ const isOptions = m.body.indexOf(",") >= 0;
if (!isSequence && !isOptions) {
if (rewrites < maxRewrites && m.post.match(/,(?!,).*\}/)) {
rewrites++;
@@ -24982,53 +24984,41 @@ var require_brace_expansion = __commonJS({
isTop = true;
continue;
}
- return combine(
- acc,
- pre + "{" + m.body + "}" + m.post,
- [""],
- max,
- maxLength,
- dropEmpties
- );
+ return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
}
if (firstGroup) {
dropEmpties = isTop && !isSequence;
firstGroup = false;
}
- var values;
+ let values;
if (isSequence) {
values = expandSequence(m.body, isAlphaSequence, max, maxLength);
} else {
- var n = parseCommaParts(m.body);
+ let n = parseCommaParts(m.body);
if (n.length === 1 && n[0] !== void 0) {
- n = expand2(n[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
+ n = expand_(n[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
if (n.length === 1) {
- acc = combine(
- acc,
- pre + n[0],
- [""],
- max,
- maxLength,
- dropEmpties && !m.post.length
- );
- if (!m.post.length) break;
+ acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
+ if (!m.post.length)
+ break;
str = m.post;
continue;
}
}
- var dropsEmpties = dropEmpties && !m.post.length && !pre;
- for (var d = 0; dropsEmpties && d < acc.length; d++) {
+ let dropsEmpties = dropEmpties && !m.post.length && !pre;
+ for (let d = 0; dropsEmpties && d < acc.length; d++) {
if (acc[d]) {
dropsEmpties = false;
}
}
values = [];
- var valuesLength = 0;
- outer: for (var j = 0; j < n.length; j++) {
- var expanded = expand2(n[j], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
- for (var k = 0; k < expanded.length; k++) {
- var v = expanded[k];
- if (dropsEmpties && !v) continue;
+ let valuesLength = 0;
+ outer: for (let j = 0; j < n.length; j++) {
+ const expanded = expand_(n[j], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
+ for (let k = 0; k < expanded.length; k++) {
+ const v = expanded[k];
+ if (dropsEmpties && !v)
+ continue;
if (values.length >= max || valuesLength + v.length > maxLength) {
break outer;
}
@@ -25038,7 +25028,8 @@ var require_brace_expansion = __commonJS({
}
}
acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
- if (!m.post.length) break;
+ if (!m.post.length)
+ break;
str = m.post;
}
return acc;
@@ -25046,20360 +25037,18366 @@ var require_brace_expansion = __commonJS({
}
});
-// node_modules/readdir-glob/node_modules/minimatch/minimatch.js
-var require_minimatch = __commonJS({
- "node_modules/readdir-glob/node_modules/minimatch/minimatch.js"(exports2, module2) {
- var minimatch = module2.exports = (p, pattern, options = {}) => {
- assertValidPattern(pattern);
- if (!options.nocomment && pattern.charAt(0) === "#") {
- return false;
- }
- return new Minimatch(pattern, options).match(p);
- };
- module2.exports = minimatch;
- var path6 = require_path();
- minimatch.sep = path6.sep;
- var GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
- minimatch.GLOBSTAR = GLOBSTAR;
- var expand2 = 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 charSet = (s) => s.split("").reduce((set, c) => {
- set[c] = true;
- return set;
- }, {});
- var reSpecials = charSet("().*{}+?[]^$\\!");
- var addPatternStartSet = charSet("[.(");
- var slashSplit = /\/+/;
- minimatch.filter = (pattern, options = {}) => (p, i, list) => minimatch(p, pattern, options);
- var ext = (a, b = {}) => {
- const t = {};
- Object.keys(a).forEach((k) => t[k] = a[k]);
- Object.keys(b).forEach((k) => t[k] = b[k]);
- return t;
+// node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js
+var require_parse_class = __commonJS({
+ "node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.parseClass = void 0;
+ var posixClasses = {
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"],
+ "[:alpha:]": ["\\p{L}\\p{Nl}"],
+ "[:ascii:]": ["\\x00-\\x7f"],
+ "[:blank:]": ["\\p{Zs}\\t"],
+ "[:cntrl:]": ["\\p{Cc}"],
+ "[:digit:]": ["\\p{Nd}"],
+ "[:graph:]": ["\\p{Z}\\p{C}", true],
+ "[:lower:]": ["\\p{Ll}"],
+ "[:print:]": ["\\p{C}", true],
+ "[:punct:]": ["\\p{P}\\p{S}"],
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"],
+ "[:upper:]": ["\\p{Lu}"],
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],
+ "[:xdigit:]": ["A-Fa-f0-9"]
};
- minimatch.defaults = (def) => {
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
- return minimatch;
+ var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
+ var noMatch = /$./;
+ var parseClass = (glob, position, nocase = false, form) => {
+ const norm = (c) => {
+ const n = form ? c.normalize(form) : c;
+ return [...n].length === 1 ? n : c;
+ };
+ const pos = position;
+ if (glob.charAt(pos) !== "[") {
+ throw new Error("not in a brace expression");
}
- const orig = minimatch;
- const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
- m.Minimatch = class Minimatch extends orig.Minimatch {
- constructor(pattern, options) {
- super(pattern, ext(def, options));
+ const ranges = [];
+ const negs = [];
+ let i = pos + 1;
+ let sawStart = false;
+ let escaping = false;
+ let negate = false;
+ let endPos = pos;
+ let rangeStart = "";
+ WHILE: while (i < glob.length) {
+ const c = String.fromCodePoint(glob.codePointAt(i));
+ if ((c === "!" || c === "^") && i === pos + 1) {
+ negate = true;
+ i++;
+ continue;
}
- };
- m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
- m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
- m.defaults = (options) => orig.defaults(ext(def, options));
- m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
- m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
- m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
- return m;
- };
- minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
- var braceExpand = (pattern, options = {}) => {
- assertValidPattern(pattern);
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
- return [pattern];
+ if (c === "]" && sawStart && !escaping) {
+ endPos = i + 1;
+ break;
+ }
+ sawStart = true;
+ if (c === "\\") {
+ if (!escaping) {
+ escaping = true;
+ i++;
+ continue;
+ }
+ }
+ if (c === "[" && !escaping) {
+ for (const [cls, [unip, neg]] of Object.entries(posixClasses)) {
+ if (glob.startsWith(cls, i)) {
+ if (rangeStart) {
+ return [noMatch, glob.length - pos];
+ }
+ i += cls.length;
+ if (neg)
+ negs.push(unip);
+ else
+ ranges.push(unip);
+ continue WHILE;
+ }
+ }
+ }
+ escaping = false;
+ const n = norm(c);
+ if (rangeStart) {
+ if (n.codePointAt(0) > rangeStart.codePointAt(0)) {
+ ranges.push(braceEscape(rangeStart) + "-" + braceEscape(n));
+ } else if (n === rangeStart) {
+ ranges.push(braceEscape(n));
+ }
+ rangeStart = "";
+ i += c.length;
+ continue;
+ }
+ if (glob.startsWith("-]", i + c.length)) {
+ ranges.push(braceEscape(n + "-"));
+ i += c.length + 1;
+ continue;
+ }
+ if (glob.startsWith("-", i + c.length)) {
+ rangeStart = n;
+ i += c.length + 1;
+ continue;
+ }
+ ranges.push(braceEscape(n));
+ i += c.length;
}
- return expand2(pattern);
- };
- var MAX_PATTERN_LENGTH = 1024 * 64;
- var assertValidPattern = (pattern) => {
- if (typeof pattern !== "string") {
- throw new TypeError("invalid pattern");
+ if (endPos < i) {
+ return [noMatch, 0];
}
- if (pattern.length > MAX_PATTERN_LENGTH) {
- throw new TypeError("pattern is too long");
+ if (!ranges.length && !negs.length) {
+ return [noMatch, glob.length - pos];
}
+ const sranges = "[" + (negate ? "^" : "") + ranges.join("") + "]";
+ const snegs = "[" + (negate ? "" : "^") + negs.join("") + "]";
+ const comb = "^" + (ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs);
+ return [new RegExp(comb, nocase ? "iu" : "u"), endPos - pos];
};
- var SUBPARSE = /* @__PURE__ */ Symbol("subparse");
- minimatch.makeRe = (pattern, options) => new Minimatch(pattern, options || {}).makeRe();
- minimatch.match = (list, pattern, options = {}) => {
- const mm = new Minimatch(pattern, options);
- list = list.filter((f) => mm.match(f));
- if (mm.options.nonull && !list.length) {
- list.push(pattern);
+ exports2.parseClass = parseClass;
+ }
+});
+
+// node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js
+var require_commonjs5 = __commonJS({
+ "node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.Matcher = void 0;
+ var parse_class_js_1 = require_parse_class();
+ var MATCH = { t: "match", id: 0 };
+ var extTypes = "!?+*@";
+ var lit = (ch) => ({ t: "lit", ch });
+ var reEscape = (s) => s.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
+ var foldRe = (s) => new RegExp(`^${reEscape(s)}$`, "iu");
+ var litMatch = (l, c) => {
+ if (c === l.ch)
+ return true;
+ if (!l.re)
+ return false;
+ const code = c.charCodeAt(0);
+ if (code >= 128)
+ return l.re.test(c);
+ const ascii = l.ascii ??= new Uint8Array(128);
+ ascii[code] ||= l.re.test(c) ? 1 : 2;
+ return ascii[code] === 1;
+ };
+ var tokenize = (p, nocase, noext, form) => {
+ const toks = [];
+ for (let i = 0; i < p.length; ) {
+ const c = String.fromCodePoint(p.codePointAt(i));
+ if (c === "\\") {
+ const e = p.codePointAt(i + 1);
+ const ch = e === void 0 ? c : String.fromCodePoint(e);
+ toks.push(lit(ch));
+ i += 1 + ch.length;
+ continue;
+ }
+ if (c === "[") {
+ const [re, consumed] = (0, parse_class_js_1.parseClass)(p, i, nocase, form);
+ if (consumed) {
+ toks.push({ t: "class", re });
+ i += consumed;
+ continue;
+ }
+ }
+ if (!noext && extTypes.includes(c) && p[i + 1] === "(") {
+ toks.push({ t: "open", type: c });
+ i += 2;
+ continue;
+ }
+ toks.push(!noext && c === "|" ? { t: "bar" } : !noext && c === ")" ? { t: "close" } : c === "*" ? { t: "star" } : c === "?" ? { t: "any" } : lit(c));
+ i += c.length;
}
- return list;
+ return toks;
};
- var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
- var charUnescape = (s) => s.replace(/\\([^-\]])/g, "$1");
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- var braExpEscape = (s) => s.replace(/[[\]\\]/g, "\\$&");
- var Minimatch = class {
- constructor(pattern, options) {
- assertValidPattern(pattern);
- if (!options) options = {};
- this.options = options;
- this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
- this.set = [];
- this.pattern = pattern;
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
- if (this.windowsPathsNoEscape) {
- this.pattern = this.pattern.replace(/\\/g, "/");
+ var pair = (toks) => {
+ const pairs = /* @__PURE__ */ new Map();
+ const stack = [];
+ toks.forEach((tok, i) => {
+ if (tok.t === "open")
+ stack.push(i);
+ else if (tok.t === "close" && stack.length)
+ pairs.set(stack.pop(), i);
+ });
+ return pairs;
+ };
+ var build = (toks, pairs, start, end, top) => {
+ let seq = [];
+ const alts = [seq];
+ for (let i = start; i < end; i++) {
+ const tok = toks[i];
+ const close = pairs.get(i);
+ if (tok.t === "open" && close !== void 0) {
+ const sub = build(toks, pairs, i + 1, close, false);
+ seq.push({ t: "ext", type: tok.type, alts: sub });
+ i = close;
+ } else if (tok.t === "bar" && !top) {
+ alts.push(seq = []);
+ } else if (tok.t === "open") {
+ seq.push(lit(tok.type), lit("("));
+ } else if (tok.t === "bar") {
+ seq.push(lit("|"));
+ } else if (tok.t === "close") {
+ seq.push(lit(")"));
+ } else {
+ seq.push(tok);
}
- this.regexp = null;
- this.negate = false;
- this.comment = false;
- this.empty = false;
- this.partial = !!options.partial;
- this.make();
- }
- debug() {
}
- make() {
- const pattern = this.pattern;
- const options = this.options;
- if (!options.nocomment && pattern.charAt(0) === "#") {
- this.comment = true;
- return;
+ return alts;
+ };
+ var normalize2 = (items, form) => {
+ const out = [];
+ let run = "";
+ const flush = () => {
+ for (const ch of run.normalize(form))
+ out.push(lit(ch));
+ run = "";
+ };
+ for (const it of items) {
+ if (it.t === "lit") {
+ run += it.ch;
+ continue;
}
- if (!pattern) {
- this.empty = true;
+ flush();
+ out.push(it.t === "ext" ? { ...it, alts: it.alts.map((a) => normalize2(a, form)) } : it);
+ }
+ flush();
+ return out;
+ };
+ var compile = (items, nocase) => {
+ let id = 1;
+ const split = (out) => ({ t: "split", id: id++, out });
+ const seq = (items2, next) => items2.reduceRight((next2, it) => item(it, next2), next);
+ const item = (it, next) => {
+ switch (it.t) {
+ case "lit":
+ const re = nocase ? foldRe(it.ch) : void 0;
+ return { t: "lit", id: id++, ch: it.ch, re, next };
+ case "any":
+ case "star":
+ return { t: it.t, id: id++, next };
+ case "class":
+ return { t: "class", id: id++, re: it.re, next };
+ }
+ const alts = (next2) => it.alts.map((a) => seq(a, next2));
+ switch (it.type) {
+ case "@":
+ return split(alts(next));
+ case "?":
+ return split([next, ...alts(next)]);
+ case "!":
+ return { t: "neg", id: id++, sub: split(alts(MATCH)), next };
+ }
+ const after = split([]);
+ const entry = split(alts(after));
+ after.out.push(next, entry);
+ return it.type === "*" ? after : entry;
+ };
+ const start = seq(items, MATCH);
+ return [start, id];
+ };
+ var show = (start) => {
+ const lines = [];
+ const seen = /* @__PURE__ */ new Set();
+ const ref = (n) => n.t === "match" ? "match" : String(n.id);
+ const walk = (n, indent) => {
+ if (n.t === "match" || seen.has(n))
return;
+ seen.add(n);
+ const line = (desc) => lines.push(`${indent}${n.id}: ${desc}`);
+ switch (n.t) {
+ case "split":
+ line(`split -> ${n.out.map(ref).join(", ")}`);
+ for (const o of n.out)
+ walk(o, indent);
+ return;
+ case "neg":
+ line(`!(${ref(n.sub)}) -> ${ref(n.next)}`);
+ walk(n.sub, indent + " ");
+ return walk(n.next, indent);
+ case "lit":
+ line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`);
+ break;
+ case "class":
+ line(`${n.re} -> ${ref(n.next)}`);
+ break;
+ default:
+ line(`${n.t === "any" ? "?" : "*"} -> ${ref(n.next)}`);
}
- this.parseNegate();
- let set = this.globSet = this.braceExpand();
- if (options.debug) this.debug = (...args) => console.error(...args);
- this.debug(this.pattern, set);
- set = this.globParts = set.map((s) => s.split(slashSplit));
- this.debug(this.pattern, set);
- set = set.map((s, si, set2) => s.map(this.parse, this));
- this.debug(this.pattern, set);
- set = set.filter((s) => s.indexOf(false) === -1);
- this.debug(this.pattern, set);
- this.set = set;
+ walk(n.next, indent);
+ };
+ walk(start, "");
+ return [`start -> ${ref(start)}`, ...lines].join("\n");
+ };
+ var State = class {
+ // set by the Sim, to mark the nodes that this state has
+ gen;
+ threads = [];
+ match = false;
+ runs = [];
+ // the sorted ids of the threads, with 0 for a match, once the
+ // state is done
+ ids = [];
+ constructor(gen) {
+ this.gen = gen;
+ }
+ // no threads, so nothing more can match
+ get dead() {
+ return !this.threads.length && !this.match && !this.runs.length;
+ }
+ };
+ var sameState = (a, b) => {
+ if (a.ids.length !== b.ids.length)
+ return false;
+ if (a.runs.length !== b.runs.length)
+ return false;
+ if (a.ids.some((id, i) => id !== b.ids[i]))
+ return false;
+ return a.runs.every((r) => b.runs.some((o) => o.neg === r.neg && sameState(o.state, r.state)));
+ };
+ var marks = (size) => ({
+ has: new Float64Array(size),
+ seen: new Float64Array(size),
+ gen: 0
+ });
+ var Sim = class {
+ // `.` and `..` only match literal dots, even with `dot:true`
+ dots;
+ // the string starts with `.`, and `dot:true` is not set
+ dotStart;
+ #marks;
+ constructor(dots, dotStart, marks2) {
+ this.dots = dots;
+ this.dotStart = dotStart;
+ this.#marks = marks2;
+ }
+ state() {
+ return new State(++this.#marks.gen);
+ }
+ // sort the ids of a state, once it has all of its threads
+ done(state3) {
+ state3.ids = state3.threads.map((n) => n.id).sort((a, b) => a - b);
+ if (state3.match)
+ state3.ids.unshift(MATCH.id);
+ return state3;
}
- parseNegate() {
- if (this.options.nonegate) return;
- const pattern = this.pattern;
- let negate = false;
- let negateOffset = 0;
- for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
- negate = !negate;
- negateOffset++;
+ // true the first time that the state walks through the node, so
+ // that loops in the graph stop
+ #visit(state3, node) {
+ const { seen } = this.#marks;
+ if (seen[node.id] === state3.gen)
+ return false;
+ seen[node.id] = state3.gen;
+ return true;
+ }
+ #addThread(state3, node) {
+ const { has } = this.#marks;
+ if (has[node.id] === state3.gen)
+ return false;
+ has[node.id] = state3.gen;
+ state3.threads.push(node);
+ return true;
+ }
+ // wildcards only match a leading dot if `dot:true`. In a negated
+ // sub-pattern, this does not apply, because the negation itself
+ // can not match a leading dot.
+ restricted(i, top) {
+ return top && (this.dots || this.dotStart && i === 0);
+ }
+ add(state3, node, i, top) {
+ switch (node.t) {
+ case "split":
+ if (!this.#visit(state3, node))
+ return;
+ for (const o of node.out)
+ this.add(state3, o, i, top);
+ return;
+ case "neg":
+ if (!this.#visit(state3, node))
+ return;
+ const sub = this.state();
+ this.add(sub, node.sub, i, false);
+ this.done(sub);
+ return this.addRun(state3, { t: "run", neg: node, state: sub }, i, top);
+ case "star":
+ if (this.restricted(i, top))
+ return;
+ if (this.#addThread(state3, node))
+ this.add(state3, node.next, i, top);
+ return;
+ case "match":
+ state3.match = true;
+ return;
+ default:
+ this.#addThread(state3, node);
}
- if (negateOffset) this.pattern = pattern.slice(negateOffset);
- this.negate = negate;
}
- // set partial to true to test if, for example,
- // "/a/b" matches the start of "/*/b/*/d"
- // Partial means, if you run out of file before you run
- // out of pattern, then that's fine, as long as all
- // the parts match.
- matchOne(file, pattern, partial) {
- if (pattern.indexOf(GLOBSTAR) !== -1) {
- return this._matchGlobstar(file, pattern, partial, 0, 0);
- }
- return this._matchOne(file, pattern, partial, 0, 0);
- }
- _matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
- let firstgs = -1;
- for (let i = patternIndex; i < pattern.length; i++) {
- if (pattern[i] === GLOBSTAR) {
- firstgs = i;
- break;
- }
+ addRun(state3, run, i, top) {
+ for (const r of state3.runs) {
+ if (r.neg === run.neg && sameState(r.state, run.state))
+ return;
}
- let lastgs = -1;
- for (let i = pattern.length - 1; i >= 0; i--) {
- if (pattern[i] === GLOBSTAR) {
- lastgs = i;
- break;
- }
+ state3.runs.push(run);
+ if (!run.state.match) {
+ this.add(state3, run.neg.next, i, top);
}
- const head = pattern.slice(patternIndex, firstgs);
- const body2 = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
- const tail = partial ? [] : pattern.slice(lastgs + 1);
- if (head.length) {
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
- if (!this._matchOne(fileHead, head, partial, 0, 0)) {
- return false;
+ }
+ // the threads after char `c`, at index `i`
+ step(state3, c, i, top) {
+ const next = this.state();
+ for (const th of state3.threads) {
+ switch (th.t) {
+ case "lit":
+ if (litMatch(th, c)) {
+ this.add(next, th.next, i + 1, top);
+ }
+ break;
+ case "any":
+ if (!this.restricted(i, top))
+ this.add(next, th.next, i + 1, top);
+ break;
+ case "class":
+ if (!this.restricted(i, top) && th.re.test(c)) {
+ this.add(next, th.next, i + 1, top);
+ }
+ break;
+ case "star":
+ if (!this.restricted(i, top))
+ this.add(next, th, i + 1, top);
}
- fileIndex += head.length;
}
- let fileTailMatch = 0;
- if (tail.length) {
- if (tail.length + fileIndex > file.length) return false;
- const tailStart = file.length - tail.length;
- if (this._matchOne(file, tail, partial, tailStart, 0)) {
- fileTailMatch = tail.length;
- } else {
- if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
- return false;
- }
- if (!this._matchOne(file, tail, partial, tailStart - 1, 0)) {
- return false;
+ if (!this.restricted(i, top)) {
+ for (const run of state3.runs) {
+ if (run.state.dead) {
+ this.addRun(next, run, i + 1, top);
+ continue;
}
- fileTailMatch = tail.length + 1;
+ const sub = this.step(run.state, c, i, false);
+ this.addRun(next, { t: "run", neg: run.neg, state: sub }, i + 1, top);
}
}
- if (!body2.length) {
- let sawSome = !!fileTailMatch;
- for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
- const f = String(file[i]);
- sawSome = true;
- if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
- return false;
- }
- }
- return partial || sawSome;
+ return this.done(next);
+ }
+ };
+ var stateKey = (state3) => {
+ const ids = state3.ids.join();
+ if (!state3.runs.length)
+ return ids;
+ const runs = state3.runs.map((r) => `${r.neg.id}(${stateKey(r.state)})`);
+ return `${ids}|${runs.sort().join("|")}`;
+ };
+ var DFA_BUDGET = 1 << 18;
+ var Dfa = class {
+ #start;
+ #states = /* @__PURE__ */ new Map();
+ #size = 0;
+ #plain;
+ #dotStart;
+ #sim;
+ #dotSim;
+ constructor(start, marks2) {
+ this.#start = start;
+ this.#sim = new Sim(false, false, marks2);
+ this.#dotSim = new Sim(false, true, marks2);
+ }
+ #make(state3) {
+ return {
+ state: state3,
+ match: state3.match,
+ dead: state3.dead,
+ next: /* @__PURE__ */ new Map()
+ };
+ }
+ #intern(state3) {
+ const key = stateKey(state3);
+ const found = this.#states.get(key);
+ if (found)
+ return found;
+ if (this.#size > DFA_BUDGET)
+ this.#clear();
+ const d = this.#make(state3);
+ this.#states.set(key, d);
+ this.#size += key.length + 1;
+ return d;
+ }
+ #clear() {
+ this.#states.clear();
+ this.#size = 0;
+ this.#plain = void 0;
+ this.#dotStart = void 0;
+ }
+ start(dotStart) {
+ if (dotStart) {
+ if (this.#dotStart)
+ return this.#dotStart;
+ const state4 = this.#dotSim.state();
+ this.#dotSim.add(state4, this.#start, 0, true);
+ return this.#dotStart = this.#make(this.#dotSim.done(state4));
+ }
+ if (this.#plain)
+ return this.#plain;
+ const state3 = this.#sim.state();
+ this.#sim.add(state3, this.#start, 0, true);
+ return this.#plain = this.#intern(this.#sim.done(state3));
+ }
+ // the next state, after a miss in `d.ascii`
+ next(d, c) {
+ const code = c.charCodeAt(0);
+ const found = code < 128 ? void 0 : d.next.get(c);
+ if (found)
+ return found;
+ const n = d === this.#dotStart ? this.#intern(this.#dotSim.step(d.state, c, 0, true)) : this.#intern(this.#sim.step(d.state, c, 1, true));
+ if (code < 128) {
+ if (!d.ascii) {
+ d.ascii = new Array(128);
+ this.#size += 128;
+ }
+ d.ascii[code] = n;
+ } else {
+ d.next.set(c, n);
}
- const bodySegments = [[[], 0]];
- let currentBody = bodySegments[0];
- let nonGsParts = 0;
- const nonGsPartsSums = [0];
- for (const b of body2) {
- if (b === GLOBSTAR) {
- nonGsPartsSums.push(nonGsParts);
- currentBody = [[], 0];
- bodySegments.push(currentBody);
- } else {
- currentBody[0].push(b);
- nonGsParts++;
- }
+ this.#size++;
+ return n;
+ }
+ };
+ var linear = (start) => {
+ const nodes = [];
+ for (let n = start; n.t !== "match"; n = n.next) {
+ if (n.t === "split" || n.t === "neg")
+ return void 0;
+ nodes.push(n);
+ }
+ return nodes;
+ };
+ var testLinear = (nodes, chars, start, end) => {
+ let ni = 0;
+ let ci = start;
+ let starNi = -1;
+ let starCi = 0;
+ while (ci < end) {
+ const n = nodes[ni];
+ if (n?.t === "star") {
+ starNi = ni++;
+ starCi = ci;
+ continue;
}
- let idx = bodySegments.length - 1;
- const fileLength = file.length - fileTailMatch;
- for (const b of bodySegments) {
- b[1] = fileLength - (nonGsPartsSums[idx--] + b[0].length);
+ const c = chars[ci];
+ if (n && (n.t === "any" || n.t === "lit" && litMatch(n, c) || n.t === "class" && n.re.test(c))) {
+ ni++;
+ ci++;
+ continue;
}
- return !!this._matchGlobStarBodySections(
- file,
- bodySegments,
- fileIndex,
- 0,
- partial,
- 0,
- !!fileTailMatch
- );
+ if (starNi === -1)
+ return false;
+ ni = starNi + 1;
+ ci = ++starCi;
+ }
+ while (nodes[ni]?.t === "star")
+ ni++;
+ return ni === nodes.length;
+ };
+ var lengths = (items) => {
+ let min = 0;
+ let max = 0;
+ for (const it of items) {
+ const [lo, hi] = itemLengths(it);
+ min += lo;
+ max += hi;
+ }
+ return [min, max];
+ };
+ var itemLengths = (it) => {
+ if (it.t === "star")
+ return [0, Infinity];
+ if (it.t !== "ext")
+ return [1, 1];
+ if (it.type === "!")
+ return [0, Infinity];
+ const alts = it.alts.map(lengths);
+ const min = Math.min(...alts.map((a) => a[0]));
+ const max = Math.max(...alts.map((a) => a[1]));
+ const loop = max === 0 ? 0 : Infinity;
+ return it.type === "@" ? [min, max] : it.type === "?" ? [0, max] : it.type === "*" ? [0, loop] : [min, loop];
+ };
+ var hasAffix = (lits, chars, start) => {
+ for (let j = 0; j < lits.length; j++) {
+ if (!litMatch(lits[j], chars[start + j]))
+ return false;
}
- // return false for "nope, not matching"
- // return null for "not matching, cannot keep trying"
- _matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
- const bs = bodySegments[bodyIndex];
- if (!bs) {
- for (let i = fileIndex; i < file.length; i++) {
- sawTail = true;
- const f = file[i];
- if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
- return false;
- }
- }
- return sawTail;
+ return true;
+ };
+ var slashOrSurrogate = /[/\ud800-\udfff]/;
+ var surrogate = /[\ud800-\udfff]/;
+ var codePoints = (s) => surrogate.test(s) ? [...s] : s;
+ var noSlash = (s) => {
+ if (s.includes("/")) {
+ throw new Error("can only match a single path portion, got: " + s);
+ }
+ };
+ var Matcher2 = class {
+ pattern;
+ options;
+ #start;
+ // the number of node ids
+ #size;
+ #marks;
+ // the Sim for strings that are only `.` or `..`
+ #dotsSim;
+ // the string to compare, if the pattern has no magic. The RegExp
+ // folds case, if `nocase:true`.
+ #literal;
+ #literalRe;
+ // the nodes between the prefix and suffix, if the graph is a
+ // single chain
+ #linear;
+ // the linear nodes are only `*` and `?`, so the length bounds and
+ // the prefix and suffix decide the match
+ #wild = false;
+ // the least and most chars that a match can have
+ #min = 0;
+ #max = Infinity;
+ // the literals that a match must start and end with. Each one
+ // matches exactly one char, and they are distinct items in the
+ // pattern, so a string that does not have them can not match.
+ #prefix = [];
+ #suffix = [];
+ // the prefix and suffix as strings, if they do not fold case
+ #prefixStr;
+ #suffixStr;
+ // there is a prefix or suffix to check
+ #affix = false;
+ #dfa;
+ #form;
+ constructor(pattern, options = {}) {
+ if (pattern.includes("/")) {
+ throw new Error("can only match a single path portion, got pattern: " + pattern);
}
- const [body2, after] = bs;
- while (fileIndex <= after) {
- const m = this._matchOne(
- file.slice(0, fileIndex + body2.length),
- body2,
- partial,
- fileIndex,
- 0
- );
- if (m && globStarDepth < this.maxGlobstarRecursion) {
- const sub = this._matchGlobStarBodySections(
- file,
- bodySegments,
- fileIndex + body2.length,
- bodyIndex + 1,
- partial,
- globStarDepth + 1,
- sawTail
- );
- if (sub !== false) {
- return sub;
- }
+ this.pattern = pattern;
+ this.options = options;
+ const { nocase = false, noext = false, normalize: n } = options;
+ this.#form = n === true ? "NFC" : n || void 0;
+ const literal = /^[?*+@]\(\)$/.test(pattern);
+ const toks = tokenize(pattern, nocase, noext || literal, this.#form);
+ let [items] = build(toks, pair(toks), 0, toks.length, true);
+ if (this.#form)
+ items = normalize2(items, this.#form);
+ const [start, size] = compile(items, nocase);
+ this.#start = start;
+ this.#size = size;
+ if (items.every((it) => it.t === "lit")) {
+ this.#literal = items.map((it) => it.ch).join("");
+ if (nocase)
+ this.#literalRe = foldRe(this.#literal);
+ } else {
+ const lit2 = (it) => it.t !== "lit" ? void 0 : nocase ? { ch: it.ch, re: foldRe(it.ch) } : { ch: it.ch };
+ for (const it of items) {
+ const l = lit2(it);
+ if (!l)
+ break;
+ this.#prefix.push(l);
}
- const f = file[fileIndex];
- if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
- return false;
+ for (let j = items.length - 1; j >= 0; j--) {
+ const l = lit2(items[j]);
+ if (!l)
+ break;
+ this.#suffix.unshift(l);
}
- fileIndex++;
+ this.#affix = !!(this.#prefix.length || this.#suffix.length);
+ if (!nocase) {
+ this.#prefixStr = this.#prefix.map((l) => l.ch).join("");
+ this.#suffixStr = this.#suffix.map((l) => l.ch).join("");
+ }
+ this.#linear = linear(this.#start)?.slice(this.#prefix.length, -this.#suffix.length || void 0);
+ this.#wild = !!this.#linear?.every((n2) => n2.t === "star" || n2.t === "any");
+ const [min, max] = lengths(items);
+ this.#min = min;
+ this.#max = max;
}
- return partial || null;
}
- _matchOne(file, pattern, partial, fileIndex, patternIndex) {
- let fi, pi, fl, pl;
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
- this.debug("matchOne loop");
- const p = pattern[pi];
- const f = file[fi];
- this.debug(pattern, p, f);
- if (p === false || p === GLOBSTAR) return false;
- let hit;
- if (typeof p === "string") {
- 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;
+ test(s) {
+ if (this.#form) {
+ noSlash(s);
+ return this.#test(s.normalize(this.#form));
}
- if (fi === fl && pi === pl) {
- return true;
- } else if (fi === fl) {
- return partial;
- } else if (pi === pl) {
- return fi === fl - 1 && file[fi] === "";
+ if (slashOrSurrogate.test(s)) {
+ noSlash(s);
+ return this.#test(s, [...s]);
}
- throw new Error("wtf?");
- }
- braceExpand() {
- return braceExpand(this.pattern, this.options);
+ return this.#test(s, s);
}
- parse(pattern, isSub) {
- assertValidPattern(pattern);
- const options = this.options;
- if (pattern === "**") {
- if (!options.noglobstar)
- return GLOBSTAR;
- else
- pattern = "*";
- }
- if (pattern === "") return "";
- let re = "";
- let hasMagic = false;
- let escaping = false;
- const patternListStack = [];
- const negativeLists = [];
- let stateChar;
- let inClass = false;
- let reClassStart = -1;
- let classStart = -1;
- let cs;
- let pl;
- let sp;
- let dotTravAllowed = pattern.charAt(0) === ".";
- let dotFileAllowed = options.dot || dotTravAllowed;
- const patternStart = () => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
- const subPatternStart = (p) => p.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
- const clearStateChar = () => {
- if (stateChar) {
- switch (stateChar) {
- case "*":
- re += star;
- hasMagic = true;
- break;
- case "?":
- re += qmark;
- hasMagic = true;
- break;
- default:
- re += "\\" + stateChar;
- break;
- }
- this.debug("clearStateChar %j %j", stateChar, re);
- stateChar = false;
- }
- };
- for (let i = 0, c; i < pattern.length && (c = pattern.charAt(i)); i++) {
- this.debug("%s %s %s %j", pattern, i, re, c);
- if (escaping) {
- if (c === "/") {
+ /**
+ * The same as {@link Matcher#test}, but the string is not checked
+ * for `/` chars, so the result for a string that has one is not
+ * defined. Only use it for a string that is known to be one path
+ * portion, such as a part of a path that was split on `/`. It can
+ * be faster, because some patterns do not need to look at each char
+ * of the string.
+ */
+ testUnchecked(s) {
+ return this.#test(this.#form ? s.normalize(this.#form) : s);
+ }
+ // Test a string that has no `/`. `chars` indexes it by code point.
+ // If it is not given, it is only found if a step needs it.
+ #test(s, chars) {
+ if (this.#literal !== void 0) {
+ return this.#literalRe ? this.#literalRe.test(s) : s === this.#literal;
+ }
+ const min = this.#min;
+ const max = this.#max;
+ if (chars === void 0) {
+ const most = s.length;
+ const least = most + 1 >> 1;
+ if (most < min || least > max)
+ return false;
+ if (least < min || most > max)
+ chars = codePoints(s);
+ }
+ if (chars !== void 0 && (chars.length < min || chars.length > max)) {
+ return false;
+ }
+ const prefix2 = this.#prefix.length;
+ if (this.#affix) {
+ if (this.#prefixStr !== void 0 && this.#suffixStr !== void 0) {
+ if (!s.startsWith(this.#prefixStr) || !s.endsWith(this.#suffixStr)) {
return false;
}
- if (reSpecials[c]) {
- re += "\\";
- }
- re += c;
- escaping = false;
- continue;
- }
- switch (c) {
- /* istanbul ignore next */
- case "/": {
+ } else {
+ chars ??= codePoints(s);
+ const end = chars.length - this.#suffix.length;
+ if (!hasAffix(this.#prefix, chars, 0) || !hasAffix(this.#suffix, chars, end)) {
return false;
}
- case "\\":
- if (inClass && pattern.charAt(i + 1) === "-") {
- re += c;
- continue;
- }
- clearStateChar();
- escaping = true;
- continue;
- // the various stateChar values
- // for the "extglob" stuff.
- 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;
- }
- if (c === "*" && stateChar === "*") continue;
- this.debug("call clearStateChar %j", stateChar);
- clearStateChar();
- stateChar = c;
- if (options.noext) clearStateChar();
- continue;
- case "(": {
- if (inClass) {
- re += "(";
- continue;
- }
- if (!stateChar) {
- re += "\\(";
- continue;
- }
- const plEntry = {
- type: stateChar,
- start: i - 1,
- reStart: re.length,
- open: plTypes[stateChar].open,
- close: plTypes[stateChar].close
- };
- this.debug(this.pattern, " ", plEntry);
- patternListStack.push(plEntry);
- re += plEntry.open;
- if (plEntry.start === 0 && plEntry.type !== "!") {
- dotTravAllowed = true;
- re += subPatternStart(pattern.slice(i + 1));
- }
- this.debug("plType %j %j", stateChar, re);
- stateChar = false;
- continue;
- }
- case ")": {
- const plEntry = patternListStack[patternListStack.length - 1];
- if (inClass || !plEntry) {
- re += "\\)";
- continue;
- }
- patternListStack.pop();
- clearStateChar();
- hasMagic = true;
- pl = plEntry;
- re += pl.close;
- if (pl.type === "!") {
- negativeLists.push(Object.assign(pl, { reEnd: re.length }));
- }
- continue;
- }
- case "|": {
- const plEntry = patternListStack[patternListStack.length - 1];
- if (inClass || !plEntry) {
- re += "\\|";
- continue;
- }
- clearStateChar();
- re += "|";
- if (plEntry.start === 0 && plEntry.type !== "!") {
- dotTravAllowed = true;
- re += subPatternStart(pattern.slice(i + 1));
- }
- continue;
- }
- // these are mostly the same in regexp and glob
- 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;
- continue;
- }
- cs = pattern.substring(classStart + 1, i);
- try {
- RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
- re += c;
- } catch (er) {
- re = re.substring(0, reClassStart) + "(?:$.)";
- }
- hasMagic = true;
- inClass = false;
- continue;
- default:
- clearStateChar();
- if (reSpecials[c] && !(c === "^" && inClass)) {
- re += "\\";
- }
- re += c;
- break;
}
}
- if (inClass) {
- cs = pattern.slice(classStart + 1);
- sp = this.parse(cs, SUBPARSE);
- re = re.substring(0, reClassStart) + "\\[" + sp[0];
- hasMagic = hasMagic || sp[1];
- }
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- let tail;
- tail = re.slice(pl.reStart + pl.open.length);
- this.debug("setting tail", re, pl);
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_2, $1, $2) => {
- if (!$2) {
- $2 = "\\";
- }
- return $1 + $1 + $2 + "|";
- });
- this.debug("tail=%j\n %s", tail, tail, pl, re);
- const t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
- hasMagic = true;
- re = re.slice(0, pl.reStart) + t + "\\(" + tail;
- }
- clearStateChar();
- if (escaping) {
- re += "\\\\";
- }
- const addPatternStart = addPatternStartSet[re.charAt(0)];
- for (let n = negativeLists.length - 1; n > -1; n--) {
- const nl = negativeLists[n];
- const nlBefore = re.slice(0, nl.reStart);
- const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
- let nlAfter = re.slice(nl.reEnd);
- const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
- const closeParensBefore = nlBefore.split(")").length;
- const openParensBefore = nlBefore.split("(").length - closeParensBefore;
- let cleanAfter = nlAfter;
- for (let i = 0; i < openParensBefore; i++) {
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
- }
- nlAfter = cleanAfter;
- const dollar = nlAfter === "" && isSub !== SUBPARSE ? "(?:$|\\/)" : "";
- re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
- }
- if (re !== "" && hasMagic) {
- re = "(?=.)" + re;
- }
- if (addPatternStart) {
- re = patternStart() + re;
- }
- if (isSub === SUBPARSE) {
- return [re, hasMagic];
- }
- if (options.nocase && !hasMagic) {
- hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
- }
- if (!hasMagic) {
- return globUnescape(pattern);
- }
- const flags = options.nocase ? "i" : "";
- try {
- return Object.assign(new RegExp("^" + re + "$", flags), {
- _glob: pattern,
- _src: re
- });
- } catch (er) {
- return new RegExp("$.");
+ const dotStart = !this.options.dot && s.startsWith(".");
+ if (this.#linear) {
+ if (s === "." || s === "..")
+ return false;
+ if (dotStart && !prefix2)
+ return false;
+ if (this.#wild)
+ return true;
+ chars ??= codePoints(s);
+ const end = chars.length - this.#suffix.length;
+ return testLinear(this.#linear, chars, prefix2, end);
+ }
+ chars ??= codePoints(s);
+ if (s === "." || s === "..") {
+ this.#marks ??= marks(this.#size);
+ const sim = this.#dotsSim ??= new Sim(true, false, this.#marks);
+ const start = sim.state();
+ sim.add(start, this.#start, 0, true);
+ let state3 = sim.done(start);
+ for (let i = 0; i < chars.length; i++) {
+ state3 = sim.step(state3, chars[i], i, true);
+ }
+ return state3.match;
+ }
+ this.#marks ??= marks(this.#size);
+ const dfa = this.#dfa ??= new Dfa(this.#start, this.#marks);
+ let d = dfa.start(dotStart);
+ const str = chars === s;
+ for (let i = 0; i < chars.length; i++) {
+ if (d.dead)
+ return false;
+ const code = str ? s.charCodeAt(i) : chars[i].charCodeAt(0);
+ d = d.ascii?.[code] ?? dfa.next(d, chars[i]);
}
+ return d.match;
}
- makeRe() {
- if (this.regexp || this.regexp === false) return this.regexp;
- const set = this.set;
- if (!set.length) {
- this.regexp = false;
- return this.regexp;
- }
- const options = this.options;
- const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
- const flags = options.nocase ? "i" : "";
- let re = set.map((pattern) => {
- pattern = pattern.map(
- (p) => typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src
- ).reduce((set2, p) => {
- if (!(set2[set2.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
- set2.push(p);
- }
- return set2;
- }, []);
- pattern.forEach((p, i) => {
- if (p !== GLOBSTAR || pattern[i - 1] === GLOBSTAR) {
- return;
- }
- if (i === 0) {
- if (pattern.length > 1) {
- pattern[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i + 1];
- } else {
- pattern[i] = twoStar;
- }
- } else if (i === pattern.length - 1) {
- pattern[i - 1] += "(?:\\/|" + twoStar + ")?";
- } else {
- pattern[i - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i + 1];
- pattern[i + 1] = GLOBSTAR;
- }
- });
- return pattern.filter((p) => p !== GLOBSTAR).join("/");
- }).join("|");
- re = "^(?:" + re + ")$";
- if (this.negate) re = "^(?!" + re + ").*$";
- try {
- this.regexp = new RegExp(re, flags);
- } catch (ex) {
- this.regexp = false;
- }
- return this.regexp;
+ /** a readable listing of the state machine */
+ toString() {
+ return show(this.#start);
}
- match(f, partial = this.partial) {
- this.debug("match", f, this.pattern);
- if (this.comment) return false;
- if (this.empty) return f === "";
- if (f === "/" && partial) return true;
- const options = this.options;
- if (path6.sep !== "/") {
- f = f.split(path6.sep).join("/");
- }
- f = f.split(slashSplit);
- this.debug(this.pattern, "split", f);
- const set = this.set;
- this.debug(this.pattern, "set", set);
- let filename;
- for (let i = f.length - 1; i >= 0; i--) {
- filename = f[i];
- if (filename) break;
- }
- for (let i = 0; i < set.length; i++) {
- const pattern = set[i];
- let file = f;
- if (options.matchBase && pattern.length === 1) {
- file = [filename];
- }
- const hit = this.matchOne(file, pattern, partial);
- if (hit) {
- if (options.flipNegate) return true;
- return !this.negate;
- }
- }
- if (options.flipNegate) return false;
- return this.negate;
+ };
+ exports2.Matcher = Matcher2;
+ }
+});
+
+// node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
+var require_assert_valid_pattern = __commonJS({
+ "node_modules/minimatch/dist/commonjs/assert-valid-pattern.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.assertValidPattern = void 0;
+ var MAX_PATTERN_LENGTH = 1024 * 64;
+ var assertValidPattern = (pattern) => {
+ if (typeof pattern !== "string") {
+ throw new TypeError("invalid pattern");
}
- static defaults(def) {
- return minimatch.defaults(def).Minimatch;
+ if (pattern.length > MAX_PATTERN_LENGTH) {
+ throw new TypeError("pattern is too long");
}
};
- minimatch.Minimatch = Minimatch;
+ exports2.assertValidPattern = assertValidPattern;
}
});
-// node_modules/readdir-glob/index.js
-var require_readdir_glob = __commonJS({
- "node_modules/readdir-glob/index.js"(exports2, module2) {
- module2.exports = readdirGlob;
- var fs9 = require("fs");
- var { EventEmitter: EventEmitter3 } = require("events");
- var { Minimatch } = require_minimatch();
- var { resolve: resolve7 } = require("path");
- function readdir2(dir, strict) {
- return new Promise((resolve8, reject) => {
- fs9.readdir(dir, { withFileTypes: true }, (err, files) => {
- if (err) {
- switch (err.code) {
- case "ENOTDIR":
- if (strict) {
- reject(err);
- } else {
- resolve8([]);
- }
- break;
- case "ENOTSUP":
- // Operation not supported
- case "ENOENT":
- // No such file or directory
- case "ENAMETOOLONG":
- // Filename too long
- case "UNKNOWN":
- resolve8([]);
- break;
- case "ELOOP":
- // Too many levels of symbolic links
- default:
- reject(err);
- break;
- }
- } else {
- resolve8(files);
- }
- });
- });
- }
- function stat2(file, followSymlinks) {
- return new Promise((resolve8, reject) => {
- const statFunc = followSymlinks ? fs9.stat : fs9.lstat;
- statFunc(file, (err, stats) => {
- if (err) {
- switch (err.code) {
- case "ENOENT":
- if (followSymlinks) {
- resolve8(stat2(file, false));
- } else {
- resolve8(null);
- }
- break;
- default:
- resolve8(null);
- break;
- }
- } else {
- resolve8(stats);
- }
- });
- });
- }
- async function* exploreWalkAsync(dir, path6, followSymlinks, useStat, shouldSkip, strict) {
- let files = await readdir2(path6 + dir, strict);
- for (const file of files) {
- let name = file.name;
- if (name === void 0) {
- name = file;
- useStat = true;
- }
- const filename = dir + "/" + name;
- const relative4 = filename.slice(1);
- const absolute = path6 + "/" + relative4;
- let stats = null;
- if (useStat || followSymlinks) {
- stats = await stat2(absolute, followSymlinks);
- }
- if (!stats && file.name !== void 0) {
- stats = file;
- }
- if (stats === null) {
- stats = { isDirectory: () => false };
- }
- if (stats.isDirectory()) {
- if (!shouldSkip(relative4)) {
- yield { relative: relative4, absolute, stats };
- yield* exploreWalkAsync(filename, path6, followSymlinks, useStat, shouldSkip, false);
- }
- } else {
- yield { relative: relative4, absolute, stats };
- }
- }
- }
- async function* explore(path6, followSymlinks, useStat, shouldSkip) {
- yield* exploreWalkAsync("", path6, followSymlinks, useStat, shouldSkip, true);
- }
- function readOptions(options) {
- return {
- pattern: options.pattern,
- dot: !!options.dot,
- noglobstar: !!options.noglobstar,
- matchBase: !!options.matchBase,
- nocase: !!options.nocase,
- ignore: options.ignore,
- skip: options.skip,
- follow: !!options.follow,
- stat: !!options.stat,
- nodir: !!options.nodir,
- mark: !!options.mark,
- silent: !!options.silent,
- absolute: !!options.absolute
- };
- }
- var ReaddirGlob = class extends EventEmitter3 {
- constructor(cwd, options, cb) {
- super();
- if (typeof options === "function") {
- cb = options;
- options = null;
- }
- this.options = readOptions(options || {});
- this.matchers = [];
- if (this.options.pattern) {
- const matchers = Array.isArray(this.options.pattern) ? this.options.pattern : [this.options.pattern];
- this.matchers = matchers.map(
- (m) => new Minimatch(m, {
- dot: this.options.dot,
- noglobstar: this.options.noglobstar,
- matchBase: this.options.matchBase,
- nocase: this.options.nocase
- })
- );
- }
- this.ignoreMatchers = [];
- if (this.options.ignore) {
- const ignorePatterns = Array.isArray(this.options.ignore) ? this.options.ignore : [this.options.ignore];
- this.ignoreMatchers = ignorePatterns.map(
- (ignore) => new Minimatch(ignore, { dot: true })
- );
- }
- this.skipMatchers = [];
- if (this.options.skip) {
- const skipPatterns = Array.isArray(this.options.skip) ? this.options.skip : [this.options.skip];
- this.skipMatchers = skipPatterns.map(
- (skip) => new Minimatch(skip, { dot: true })
- );
- }
- this.iterator = explore(resolve7(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
- this.paused = false;
- this.inactive = false;
- this.aborted = false;
- if (cb) {
- this._matches = [];
- this.on("match", (match) => this._matches.push(this.options.absolute ? match.absolute : match.relative));
- this.on("error", (err) => cb(err));
- this.on("end", () => cb(null, this._matches));
- }
- setTimeout(() => this._next(), 0);
- }
- _shouldSkipDirectory(relative4) {
- return this.skipMatchers.some((m) => m.match(relative4));
- }
- _fileMatches(relative4, isDirectory2) {
- const file = relative4 + (isDirectory2 ? "/" : "");
- return (this.matchers.length === 0 || this.matchers.some((m) => m.match(file))) && !this.ignoreMatchers.some((m) => m.match(file)) && (!this.options.nodir || !isDirectory2);
- }
- _next() {
- if (!this.paused && !this.aborted) {
- this.iterator.next().then((obj) => {
- if (!obj.done) {
- const isDirectory2 = obj.value.stats.isDirectory();
- if (this._fileMatches(obj.value.relative, isDirectory2)) {
- let relative4 = obj.value.relative;
- let absolute = obj.value.absolute;
- if (this.options.mark && isDirectory2) {
- relative4 += "/";
- absolute += "/";
- }
- if (this.options.stat) {
- this.emit("match", { relative: relative4, absolute, stat: obj.value.stats });
- } else {
- this.emit("match", { relative: relative4, absolute });
- }
- }
- this._next(this.iterator);
- } else {
- this.emit("end");
- }
- }).catch((err) => {
- this.abort();
- this.emit("error", err);
- if (!err.code && !this.options.silent) {
- console.error(err);
- }
- });
- } else {
- this.inactive = true;
- }
- }
- abort() {
- this.aborted = true;
- }
- pause() {
- this.paused = true;
- }
- resume() {
- this.paused = false;
- if (this.inactive) {
- this.inactive = false;
- this._next();
- }
+// node_modules/minimatch/dist/commonjs/escape.js
+var require_escape = __commonJS({
+ "node_modules/minimatch/dist/commonjs/escape.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.escape = void 0;
+ var escape2 = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
+ if (magicalBraces) {
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
}
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
};
- function readdirGlob(pattern, options, cb) {
- return new ReaddirGlob(pattern, options, cb);
- }
- readdirGlob.ReaddirGlob = ReaddirGlob;
+ exports2.escape = escape2;
}
});
-// node_modules/async/dist/async.js
-var require_async = __commonJS({
- "node_modules/async/dist/async.js"(exports2, module2) {
- (function(global2, factory) {
- typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.async = {}));
- })(exports2, (function(exports3) {
- "use strict";
- function apply(fn, ...args) {
- return (...callArgs) => fn(...args, ...callArgs);
- }
- function initialParams(fn) {
- return function(...args) {
- var callback = args.pop();
- return fn.call(this, args, callback);
- };
- }
- var hasQueueMicrotask = typeof queueMicrotask === "function" && queueMicrotask;
- var hasSetImmediate = typeof setImmediate === "function" && setImmediate;
- var hasNextTick = typeof process === "object" && typeof process.nextTick === "function";
- function fallback(fn) {
- setTimeout(fn, 0);
+// node_modules/minimatch/dist/commonjs/unescape.js
+var require_unescape = __commonJS({
+ "node_modules/minimatch/dist/commonjs/unescape.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.unescape = void 0;
+ var unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
+ if (magicalBraces) {
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
}
- function wrap(defer) {
- return (fn, ...args) => defer(() => fn(...args));
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
+ };
+ exports2.unescape = unescape;
+ }
+});
+
+// node_modules/minimatch/dist/commonjs/index.js
+var require_commonjs6 = __commonJS({
+ "node_modules/minimatch/dist/commonjs/index.js"(exports2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ exports2.unescape = exports2.escape = exports2.Minimatch = exports2.match = exports2.braceExpand = exports2.defaults = exports2.filter = exports2.GLOBSTAR = exports2.sep = exports2.minimatch = void 0;
+ var brace_expansion_1 = require_commonjs4();
+ var nonrecursive_glob_match_1 = require_commonjs5();
+ var assert_valid_pattern_js_1 = require_assert_valid_pattern();
+ var escape_js_1 = require_escape();
+ var unescape_js_1 = require_unescape();
+ var minimatch = (p, pattern, options = {}) => {
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
+ if (!options.nocomment && pattern.charAt(0) === "#") {
+ return false;
}
- var _defer$1;
- if (hasQueueMicrotask) {
- _defer$1 = queueMicrotask;
- } else if (hasSetImmediate) {
- _defer$1 = setImmediate;
- } else if (hasNextTick) {
- _defer$1 = process.nextTick;
- } else {
- _defer$1 = fallback;
+ return new Minimatch(pattern, options).match(p);
+ };
+ exports2.minimatch = minimatch;
+ var defaultPlatform = typeof process === "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
+ var path6 = {
+ win32: { sep: "\\" },
+ posix: { sep: "/" }
+ };
+ exports2.sep = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
+ exports2.minimatch.sep = exports2.sep;
+ exports2.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
+ exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
+ var filter = (pattern, options = {}) => (p) => (0, exports2.minimatch)(p, pattern, options);
+ exports2.filter = filter;
+ exports2.minimatch.filter = exports2.filter;
+ var ext = (a, b = {}) => Object.assign({}, a, b);
+ var defaults2 = (def) => {
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
+ return exports2.minimatch;
}
- var setImmediate$1 = wrap(_defer$1);
- function asyncify(func) {
- if (isAsync(func)) {
- return function(...args) {
- const callback = args.pop();
- const promise = func.apply(this, args);
- return handlePromise(promise, callback);
- };
- }
- return initialParams(function(args, callback) {
- var result;
- try {
- result = func.apply(this, args);
- } catch (e) {
- return callback(e);
+ const orig = exports2.minimatch;
+ const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
+ return Object.assign(m, {
+ Minimatch: class Minimatch extends orig.Minimatch {
+ constructor(pattern, options = {}) {
+ super(pattern, ext(def, options));
}
- if (result && typeof result.then === "function") {
- return handlePromise(result, callback);
- } else {
- callback(null, result);
+ static defaults(options) {
+ return orig.defaults(ext(def, options)).Minimatch;
}
- });
+ },
+ unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
+ escape: (s, options = {}) => orig.escape(s, ext(def, options)),
+ filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
+ defaults: (options) => orig.defaults(ext(def, options)),
+ braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
+ match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
+ sep: orig.sep,
+ GLOBSTAR: exports2.GLOBSTAR
+ });
+ };
+ exports2.defaults = defaults2;
+ exports2.minimatch.defaults = exports2.defaults;
+ var braceExpand = (pattern, options = {}) => {
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
+ return [pattern];
}
- function handlePromise(promise, callback) {
- return promise.then((value) => {
- invokeCallback(callback, null, value);
- }, (err) => {
- invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
- });
+ return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
+ };
+ exports2.braceExpand = braceExpand;
+ exports2.minimatch.braceExpand = exports2.braceExpand;
+ var match = (list, pattern, options = {}) => {
+ const mm = new Minimatch(pattern, options);
+ list = list.filter((f) => mm.match(f));
+ if (mm.options.nonull && !list.length) {
+ list.push(pattern);
}
- function invokeCallback(callback, error2, value) {
- try {
- callback(error2, value);
- } catch (err) {
- setImmediate$1((e) => {
- throw e;
- }, err);
- }
- }
- function isAsync(fn) {
- return fn[Symbol.toStringTag] === "AsyncFunction";
- }
- function isAsyncGenerator(fn) {
- return fn[Symbol.toStringTag] === "AsyncGenerator";
- }
- function isAsyncIterable(obj) {
- return typeof obj[Symbol.asyncIterator] === "function";
- }
- function wrapAsync(asyncFn) {
- if (typeof asyncFn !== "function") throw new Error("expected a function");
- return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;
+ return list;
+ };
+ exports2.match = match;
+ exports2.minimatch.match = exports2.match;
+ var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
+ var classEnd = (pattern, start) => {
+ let i = start + 1;
+ if (pattern.charAt(i) === "!" || pattern.charAt(i) === "^")
+ i++;
+ let sawStart = false;
+ for (; i < pattern.length; i++) {
+ const c = pattern.charAt(i);
+ if (c === "]" && sawStart)
+ return i;
+ sawStart = true;
+ if (c === "\\")
+ i++;
}
- function awaitify(asyncFn, arity) {
- if (!arity) arity = asyncFn.length;
- if (!arity) throw new Error("arity is undefined");
- function awaitable(...args) {
- if (typeof args[arity - 1] === "function") {
- return asyncFn.apply(this, args);
+ return -1;
+ };
+ var literal = (pattern, noext) => {
+ if (!noext && (pattern === "+()" || pattern === "@()"))
+ return pattern;
+ let lit = "";
+ for (let i = 0; i < pattern.length; i++) {
+ const c = pattern.charAt(i);
+ if (c === "\\") {
+ lit += pattern.charAt(++i) || c;
+ } else if (c === "*" || c === "?") {
+ return void 0;
+ } else if (c === "[") {
+ const close = classEnd(pattern, i);
+ if (close === -1) {
+ lit += c;
+ continue;
}
- return new Promise((resolve7, reject2) => {
- args[arity - 1] = (err, ...cbArgs) => {
- if (err) return reject2(err);
- resolve7(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
- };
- asyncFn.apply(this, args);
- });
+ let body2 = pattern.slice(i + 1, close);
+ if (body2.startsWith("\\"))
+ body2 = body2.slice(1);
+ if ([...body2].length !== 1 || "!^".includes(pattern.charAt(i + 1))) {
+ return void 0;
+ }
+ lit += body2;
+ i = close;
+ } else if (!noext && "+@!".includes(c) && pattern.charAt(i + 1) === "(" && pattern.includes(")", i + 2)) {
+ return void 0;
+ } else {
+ lit += c;
}
- return awaitable;
- }
- function applyEach$1(eachfn) {
- return function applyEach2(fns, ...callArgs) {
- const go = awaitify(function(callback) {
- var that = this;
- return eachfn(fns, (fn, cb) => {
- wrapAsync(fn).apply(that, callArgs.concat(cb));
- }, callback);
- });
- return go;
- };
- }
- function _asyncMap(eachfn, arr, iteratee, callback) {
- arr = arr || [];
- var results = [];
- var counter = 0;
- var _iteratee = wrapAsync(iteratee);
- return eachfn(arr, (value, _2, iterCb) => {
- var index2 = counter++;
- _iteratee(value, (err, v) => {
- results[index2] = v;
- iterCb(err);
- });
- }, (err) => {
- callback(err, results);
- });
}
- function isArrayLike(value) {
- return value && typeof value.length === "number" && value.length >= 0 && value.length % 1 === 0;
+ return lit;
+ };
+ var extSafe = (pattern) => {
+ if (/^[?*+@]\(\)$/.test(pattern) || pattern.includes("[:"))
+ return false;
+ let depth = 0;
+ for (let i = 0; i < pattern.length; i++) {
+ const c = pattern.charAt(i);
+ if (c === "\\") {
+ if (++i === pattern.length)
+ return false;
+ } else if (c === "[") {
+ const close = classEnd(pattern, i);
+ if (close !== -1)
+ i = close;
+ } else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
+ depth++;
+ i++;
+ } else if (c === ")") {
+ if (!depth--)
+ return false;
+ } else if (c === "|" && !depth) {
+ return false;
+ }
}
- const breakLoop = {};
- function once(fn) {
- function wrapper(...args) {
- if (fn === null) return;
- var callFn = fn;
- fn = null;
- callFn.apply(this, args);
+ return !depth;
+ };
+ var lastSplit;
+ var lastChecked;
+ var portionMatch = (p, f) => typeof p === "string" ? f === p : f !== "" && p.testUnchecked(f);
+ var endIndex = (p, last, lastStart, prev, prevStart) => portionMatch(p, last) ? lastStart : prev !== void 0 && portionMatch(p, prev) ? prevStart : -1;
+ var isDots = (p) => p === "." || p === "..";
+ var isDrive = (p) => typeof p === "string" && /^[a-z]:$/i.test(p);
+ var isLongUNC = (p) => typeof p === "string" && /^unc$/i.test(p);
+ var uncHost = (p) => {
+ if (p[0] !== "" || p[1] !== "")
+ return -1;
+ const h = p[2] !== "?" ? 2 : isLongUNC(p[3]) ? 4 : -1;
+ const host = p[h];
+ const share = p[h + 1];
+ return h !== -1 && host !== void 0 && host !== "" && host !== exports2.GLOBSTAR && share !== void 0 && share !== "" && share !== exports2.GLOBSTAR ? h : -1;
+ };
+ var walkable = (p, dot) => !isDots(p) && (dot || !p.startsWith("."));
+ var dotPortion = (f, start, end, dot, sep7) => {
+ for (let k = start; k < end; ) {
+ if (f.charCodeAt(k) === 46) {
+ if (!dot)
+ return true;
+ const n = f.charCodeAt(k + 1) === 46 ? k + 2 : k + 1;
+ if (n >= end || isSep(f.charCodeAt(n), sep7))
+ return true;
}
- Object.assign(wrapper, fn);
- return wrapper;
+ const s = nextSep(f, k, sep7);
+ if (s === -1)
+ return false;
+ k = s + 1;
+ while (k < end && isSep(f.charCodeAt(k), sep7))
+ k++;
}
- function getIterator(coll) {
- return coll[Symbol.iterator] && coll[Symbol.iterator]();
+ return false;
+ };
+ var isSep = (c, sep7) => sep7 === "/" ? c === 47 : sep7 === "\\" ? c === 92 : c === 47 || c === 92;
+ var nextSep = (f, from, sep7) => {
+ if (sep7 !== "both")
+ return f.indexOf(sep7, from);
+ const s = f.indexOf("/", from);
+ const b = f.indexOf("\\", from);
+ return s === -1 ? b : b === -1 ? s : Math.min(s, b);
+ };
+ var lastSep = (f, from, sep7) => sep7 !== "both" ? f.lastIndexOf(sep7, from) : Math.max(f.lastIndexOf("/", from), f.lastIndexOf("\\", from));
+ var Minimatch = class {
+ options;
+ set;
+ pattern;
+ windowsPathsNoEscape;
+ nonegate;
+ negate;
+ comment;
+ empty;
+ preserveMultipleSlashes;
+ partial;
+ globSet;
+ globParts;
+ nocase;
+ isWindows;
+ platform;
+ windowsNoMagicRoot;
+ maxGlobstarRecursion;
+ // the path can be checked against the last portion, and the string
+ // portions, of each row before it is split. See #canMatch.
+ #endCheck;
+ #literalCheck;
+ // level 2 resolves `.` and `..` portions in the path
+ #level2;
+ // the unicode normalization form, if any
+ #form;
+ // the string portions of each row in the set
+ #literals = [];
+ // the rows that #canMatch can match without splitting the path
+ #shapes = [];
+ // the rows whose last portion can be checked against the path's
+ #endRows = [];
+ // brace expansion can make the same portion in many rows, so they
+ // share one Matcher, and the states that it caches
+ #matchers = /* @__PURE__ */ new Map();
+ // the GlobstarParts of each pattern row, by start index and partial
+ #globstarParts = /* @__PURE__ */ new WeakMap();
+ constructor(pattern, options = {}) {
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
+ options = options || {};
+ this.options = options;
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
+ this.pattern = pattern;
+ this.platform = options.platform || defaultPlatform;
+ this.isWindows = this.platform === "win32";
+ const awe = "allowWindowsEscape";
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
+ if (this.windowsPathsNoEscape) {
+ this.pattern = this.pattern.replace(/\\/g, "/");
+ }
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
+ this.negate = false;
+ this.nonegate = !!options.nonegate;
+ this.comment = false;
+ this.empty = false;
+ this.partial = !!options.partial;
+ this.nocase = !!this.options.nocase;
+ this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
+ this.globSet = [];
+ this.globParts = [];
+ this.set = [];
+ this.#endCheck = !this.preserveMultipleSlashes;
+ this.#level2 = (options.optimizationLevel ?? 1) >= 2;
+ const n = options.normalize;
+ this.#form = n === true ? "NFC" : n || void 0;
+ this.make();
+ const drives = this.set.map((row) => this.#rootIndex(row));
+ this.#endRows = this.set.map((row, r) => this.#endCheck && row.length - 1 > drives[r]);
+ this.#literals = this.set.map((row, r) => {
+ const end = this.#endRows[r] ? row.length - 1 : row.length;
+ const lits = row.slice(drives[r] + 1, end).filter((p) => typeof p === "string" && !!p);
+ return [...new Set(lits)];
+ });
+ this.#literalCheck = this.#literals.some((l) => l.length);
+ this.#shapes = this.set.map((row, r) => {
+ const [p0, p1, p2] = row;
+ if (this.#endRows[r] && row.length === 2) {
+ if (p0 === exports2.GLOBSTAR && p1 !== exports2.GLOBSTAR)
+ return "tail";
+ }
+ if (this.#endRows[r] && options.matchBase && row.length === 1 && p0 !== exports2.GLOBSTAR && p0 !== "") {
+ return "base";
+ }
+ if (!this.#endCheck || drives[r] !== -1)
+ return void 0;
+ if (row.length === 3 && p0 === exports2.GLOBSTAR && p2 === exports2.GLOBSTAR && p1 !== exports2.GLOBSTAR && p1 !== "" && // the portion between is only matched below this limit
+ this.maxGlobstarRecursion > 0) {
+ return "mid";
+ }
+ if (row.length === 2 && p1 === exports2.GLOBSTAR && p0 !== exports2.GLOBSTAR && p0 !== "") {
+ return "head";
+ }
+ return void 0;
+ });
}
- function createArrayIterator(coll) {
- var i = -1;
- var len = coll.length;
- return function next() {
- return ++i < len ? { value: coll[i], key: i } : null;
- };
+ // a string portion of a pattern, normalized if the option is set
+ #norm(p) {
+ return this.#form ? p.normalize(this.#form) : p;
}
- function createES2015Iterator(iterator2) {
- var i = -1;
- return function next() {
- var item = iterator2.next();
- if (item.done)
- return null;
- i++;
- return { value: item.value, key: i };
- };
+ // On Windows, the index of the last root portion of a row, as
+ // #matchRow finds it: 0 for `c:/...`, 3 for `//?/c:/...` and
+ // `//host/share/...`, and 5 for `//?/UNC/host/share/...`. Otherwise
+ // -1.
+ #rootIndex(row) {
+ if (!this.isWindows)
+ return -1;
+ if (isDrive(row[0]))
+ return 0;
+ const uncDrive = row[0] === "" && row[1] === "" && row[2] === "?" && isDrive(row[3]);
+ if (uncDrive)
+ return 3;
+ const h = uncHost(row);
+ return h === -1 ? -1 : h + 1;
}
- function createObjectIterator(obj) {
- var okeys = obj ? Object.keys(obj) : [];
- var i = -1;
- var len = okeys.length;
- return function next() {
- var key = okeys[++i];
- if (key === "__proto__") {
- return next();
+ hasMagic() {
+ if (this.options.magicalBraces && this.set.length > 1) {
+ return true;
+ }
+ for (const pattern of this.set) {
+ for (const part of pattern) {
+ if (typeof part !== "string")
+ return true;
}
- return i < len ? { value: obj[key], key } : null;
- };
- }
- function createIterator(coll) {
- if (isArrayLike(coll)) {
- return createArrayIterator(coll);
}
- var iterator2 = getIterator(coll);
- return iterator2 ? createES2015Iterator(iterator2) : createObjectIterator(coll);
+ return false;
}
- function onlyOnce(fn) {
- return function(...args) {
- if (fn === null) throw new Error("Callback was already called.");
- var callFn = fn;
- fn = null;
- callFn.apply(this, args);
- };
+ make() {
+ const pattern = this.pattern;
+ const options = this.options;
+ if (!options.nocomment && pattern.charAt(0) === "#") {
+ this.comment = true;
+ return;
+ }
+ if (!pattern) {
+ this.empty = true;
+ return;
+ }
+ this.parseNegate();
+ this.globSet = [...new Set(this.braceExpand())];
+ const rawGlobParts = this.globSet.map((s) => this.#slashSplit(s));
+ this.globParts = this.preprocess(rawGlobParts);
+ let set = this.globParts.map((s, _2, __) => {
+ if (this.isWindows && this.windowsNoMagicRoot) {
+ const n = s[2] === "?" && isLongUNC(s[3]) ? 6 : 4;
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && s.slice(3, n).every((p) => !globMagic.test(p));
+ const isDrive2 = /^[a-z]:/i.test(s[0]);
+ if (isUNC) {
+ return [
+ ...s.slice(0, n).map((p) => this.#norm(p)),
+ ...s.slice(n).map((ss) => this.parse(ss))
+ ];
+ } else if (isDrive2) {
+ return [
+ this.#norm(s[0]),
+ ...s.slice(1).map((ss) => this.parse(ss))
+ ];
+ }
+ }
+ return s.map((ss) => this.parse(ss));
+ });
+ this.set = set.filter((s) => s.indexOf(false) === -1);
+ if (this.isWindows) {
+ for (let i = 0; i < this.set.length; i++) {
+ const p = this.set[i];
+ if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && (isDrive(p[3]) || isLongUNC(this.globParts[i][3]))) {
+ if (isLongUNC(this.globParts[i][3]))
+ p[3] = "UNC";
+ p[2] = "?";
+ }
+ }
+ }
+ if (!options.noext)
+ this.mergeRows();
}
- function asyncEachOfLimit(generator, limit, iteratee, callback) {
- let done = false;
- let canceled = false;
- let awaiting = false;
- let running = 0;
- let idx = 0;
- function replenish() {
- if (running >= limit || awaiting || done) return;
- awaiting = true;
- generator.next().then(({ value, done: iterDone }) => {
- if (canceled || done) return;
- awaiting = false;
- if (iterDone) {
- done = true;
- if (running <= 0) {
- callback(null);
+ // Merge rows that only differ in one portion, where each of them
+ // is a Matcher, into one row that matches any of them with
+ // `@(a|b|...)`. Then a path is only walked once for all of them,
+ // for example with `**/*.{js,ts}`.
+ mergeRows() {
+ let merged = true;
+ while (merged) {
+ merged = false;
+ const len = Math.max(0, ...this.set.map((r) => r.length));
+ for (let k = 0; k < len; k++) {
+ const groups = /* @__PURE__ */ new Map();
+ this.set.forEach((row, i) => {
+ if (!(row[k] instanceof nonrecursive_glob_match_1.Matcher) || !extSafe(this.globParts[i][k])) {
+ return;
}
- return;
+ const parts = [...this.globParts[i]];
+ parts[k] = "";
+ const key = `${row.length}/${parts.join("/")}`;
+ const g = groups.get(key);
+ if (g)
+ g.push(i);
+ else
+ groups.set(key, [i]);
+ });
+ const drop = /* @__PURE__ */ new Set();
+ for (const g of groups.values()) {
+ if (g.length < 2)
+ continue;
+ const [first, ...rest] = g;
+ const alts = g.map((i) => this.globParts[i][k]);
+ const glob = `@(${alts.join("|")})`;
+ this.globParts[first][k] = glob;
+ this.set[first][k] = this.parse(glob);
+ for (const i of rest)
+ drop.add(i);
+ }
+ if (drop.size) {
+ merged = true;
+ this.set = this.set.filter((_2, i) => !drop.has(i));
+ this.globParts = this.globParts.filter((_2, i) => !drop.has(i));
}
- running++;
- iteratee(value, idx, iterateeCallback);
- idx++;
- replenish();
- }).catch(handleError);
- }
- function iterateeCallback(err, result) {
- running -= 1;
- if (canceled) return;
- if (err) return handleError(err);
- if (err === false) {
- done = true;
- canceled = true;
- return;
- }
- if (result === breakLoop || done && running <= 0) {
- done = true;
- return callback(null);
}
- replenish();
- }
- function handleError(err) {
- if (canceled) return;
- awaiting = false;
- done = true;
- callback(err);
}
- replenish();
}
- var eachOfLimit$2 = (limit) => {
- return (obj, iteratee, callback) => {
- callback = once(callback);
- if (limit <= 0) {
- throw new RangeError("concurrency limit cannot be less than 1");
- }
- if (!obj) {
- return callback(null);
- }
- if (isAsyncGenerator(obj)) {
- return asyncEachOfLimit(obj, limit, iteratee, callback);
- }
- if (isAsyncIterable(obj)) {
- return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback);
- }
- var nextElem = createIterator(obj);
- var done = false;
- var canceled = false;
- var running = 0;
- var looping = false;
- function iterateeCallback(err, value) {
- if (canceled) return;
- running -= 1;
- if (err) {
- done = true;
- callback(err);
- } else if (err === false) {
- done = true;
- canceled = true;
- } else if (value === breakLoop || done && running <= 0) {
- done = true;
- return callback(null);
- } else if (!looping) {
- replenish();
- }
- }
- function replenish() {
- looping = true;
- while (running < limit && !done) {
- var elem = nextElem();
- if (elem === null) {
- done = true;
- if (running <= 0) {
- callback(null);
- }
- return;
+ // various transforms to equivalent pattern sets that are
+ // faster to process in a filesystem walk. The goal is to
+ // eliminate what we can, and push all ** patterns as far
+ // to the right as possible, even if it increases the number
+ // of patterns that we have to process.
+ preprocess(globParts) {
+ if (this.options.noglobstar) {
+ for (const partset of globParts) {
+ for (let j = 0; j < partset.length; j++) {
+ if (partset[j] === "**") {
+ partset[j] = "*";
}
- running += 1;
- iteratee(elem.value, elem.key, onlyOnce(iterateeCallback));
}
- looping = false;
- }
- replenish();
- };
- };
- function eachOfLimit(coll, limit, iteratee, callback) {
- return eachOfLimit$2(limit)(coll, wrapAsync(iteratee), callback);
- }
- var eachOfLimit$1 = awaitify(eachOfLimit, 4);
- function eachOfArrayLike(coll, iteratee, callback) {
- callback = once(callback);
- var index2 = 0, completed = 0, { length } = coll, canceled = false;
- if (length === 0) {
- callback(null);
- }
- function iteratorCallback(err, value) {
- if (err === false) {
- canceled = true;
- }
- if (canceled === true) return;
- if (err) {
- callback(err);
- } else if (++completed === length || value === breakLoop) {
- callback(null);
}
}
- for (; index2 < length; index2++) {
- iteratee(coll[index2], index2, onlyOnce(iteratorCallback));
+ const { optimizationLevel = 1 } = this.options;
+ if (optimizationLevel >= 2) {
+ globParts = this.firstPhasePreProcess(globParts);
+ globParts = this.secondPhasePreProcess(globParts);
+ } else if (optimizationLevel >= 1) {
+ globParts = this.levelOneOptimize(globParts);
+ } else {
+ globParts = this.adjascentGlobstarOptimize(globParts);
}
+ return globParts;
}
- function eachOfGeneric(coll, iteratee, callback) {
- return eachOfLimit$1(coll, Infinity, iteratee, callback);
- }
- function eachOf(coll, iteratee, callback) {
- var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
- return eachOfImplementation(coll, wrapAsync(iteratee), callback);
- }
- var eachOf$1 = awaitify(eachOf, 3);
- function map(coll, iteratee, callback) {
- return _asyncMap(eachOf$1, coll, iteratee, callback);
- }
- var map$1 = awaitify(map, 3);
- var applyEach = applyEach$1(map$1);
- function eachOfSeries(coll, iteratee, callback) {
- return eachOfLimit$1(coll, 1, iteratee, callback);
- }
- var eachOfSeries$1 = awaitify(eachOfSeries, 3);
- function mapSeries(coll, iteratee, callback) {
- return _asyncMap(eachOfSeries$1, coll, iteratee, callback);
+ // just get rid of adjascent ** portions
+ adjascentGlobstarOptimize(globParts) {
+ return globParts.map((parts) => {
+ let gs = -1;
+ while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
+ let i = gs;
+ while (parts[i + 1] === "**") {
+ i++;
+ }
+ if (i !== gs) {
+ parts.splice(gs, i - gs);
+ }
+ }
+ return parts;
+ });
}
- var mapSeries$1 = awaitify(mapSeries, 3);
- var applyEachSeries = applyEach$1(mapSeries$1);
- const PROMISE_SYMBOL = /* @__PURE__ */ Symbol("promiseCallback");
- function promiseCallback() {
- let resolve7, reject2;
- function callback(err, ...args) {
- if (err) return reject2(err);
- resolve7(args.length > 1 ? args : args[0]);
- }
- callback[PROMISE_SYMBOL] = new Promise((res, rej) => {
- resolve7 = res, reject2 = rej;
+ // get rid of adjascent ** and resolve .. portions
+ levelOneOptimize(globParts) {
+ return globParts.map((parts) => {
+ const root = this.#rootIndex(parts) + 1;
+ parts = parts.reduce((set, part) => {
+ const prev = set[set.length - 1];
+ if (part === "**" && prev === "**") {
+ return set;
+ }
+ if (part === "..") {
+ if (set.length > root && prev && prev !== ".." && prev !== "." && prev !== "**") {
+ set.pop();
+ return set;
+ }
+ }
+ set.push(part);
+ return set;
+ }, []);
+ return parts.length === 0 ? [""] : parts;
});
- return callback;
}
- function auto(tasks, concurrency, callback) {
- if (typeof concurrency !== "number") {
- callback = concurrency;
- concurrency = null;
- }
- callback = once(callback || promiseCallback());
- var numTasks = Object.keys(tasks).length;
- if (!numTasks) {
- return callback(null);
- }
- if (!concurrency) {
- concurrency = numTasks;
- }
- var results = {};
- var runningTasks = 0;
- var canceled = false;
- var hasError = false;
- var listeners = /* @__PURE__ */ Object.create(null);
- var readyTasks = [];
- var readyToCheck = [];
- var uncheckedDependencies = {};
- Object.keys(tasks).forEach((key) => {
- var task = tasks[key];
- if (!Array.isArray(task)) {
- enqueueTask(key, [task]);
- readyToCheck.push(key);
- return;
+ // Check the path against each row before it is split. 'no' if no
+ // row can match, so it does not need to be split. 'yes' if a row of
+ // `**` and one more portion matches. 'maybe' if it must be split to
+ // know. None of this applies with partial, where the path can end
+ // before the row does.
+ //
+ // On Windows, `\` is a separator in the path too, and the portions of
+ // a row up to its drive letter or UNC share are not checked (see
+ // #rootIndex).
+ //
+ // Each string portion of a row must be a portion of the path, so the
+ // path must contain it. Level 2 can only take portions out of the
+ // path, so this is still true then.
+ //
+ // The last portion of a row must match the last portion of the path,
+ // or the one before a trailing `/` (as a/* and a/**/* match a/b/).
+ // This does not apply to rows that end in **, rows that end in a
+ // root, or preserveMultipleSlashes (which can leave more
+ // than one '' at the end). At level 2, it does not apply if that
+ // portion is `.` or `..`, which can be
+ // resolved away. Level 2 only takes other portions out of the
+ // middle of the path.
+ //
+ // A row of `**/x` then matches if the ** can walk the portions
+ // before the one that x matches, the same as #matchGlobstar. At
+ // level 2, this is only known if none of them are `.` or `..`, so
+ // that the path does not change when it is resolved.
+ #canMatch(f) {
+ const sep7 = !this.isWindows || !f.includes("\\") ? "/" : f.includes("/") ? "both" : "\\";
+ let ends = this.#endCheck ? 0 : -1;
+ let last = "";
+ let lastStart = 0;
+ let prev;
+ let prevStart = 0;
+ const dot = !!this.options.dot;
+ ROWS: for (let r = 0; r < this.set.length; r++) {
+ const row = this.set[r];
+ const p = row[row.length - 1];
+ let end = ends !== -1 && this.#endRows[r] && p !== exports2.GLOBSTAR;
+ if (end && ends === 0) {
+ const i = lastSep(f, f.length, sep7);
+ lastStart = i + 1;
+ last = f.slice(lastStart);
+ if (last === "" && i >= 0) {
+ let j = i;
+ while (j > 0 && isSep(f.charCodeAt(j - 1), sep7))
+ j--;
+ prevStart = j === 0 ? 0 : lastSep(f, j - 1, sep7) + 1;
+ prev = f.slice(prevStart, j);
+ }
+ const resolves = this.#level2 && (isDots(last) || last === "" && prev !== void 0 && isDots(prev));
+ ends = resolves ? -1 : 1;
+ end = !resolves;
+ }
+ let tailStart = -1;
+ if (end && typeof p === "string") {
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
+ if (tailStart === -1)
+ continue;
}
- var dependencies = task.slice(0, task.length - 1);
- var remainingDependencies = dependencies.length;
- if (remainingDependencies === 0) {
- enqueueTask(key, task);
- readyToCheck.push(key);
- return;
+ if (this.#literalCheck) {
+ for (const l of this.#literals[r]) {
+ if (!f.includes(l))
+ continue ROWS;
+ }
}
- uncheckedDependencies[key] = remainingDependencies;
- dependencies.forEach((dependencyName) => {
- if (!tasks[dependencyName]) {
- throw new Error("async.auto task `" + key + "` has a non-existent dependency `" + dependencyName + "` in " + dependencies.join(", "));
+ if (end && typeof p === "object") {
+ tailStart = endIndex(p, last, lastStart, prev, prevStart);
+ if (tailStart === -1)
+ continue;
+ }
+ const shape = this.#shapes[r];
+ if (shape === "base" && end)
+ return "yes";
+ if (shape === "tail" && end) {
+ if (this.#level2 && dotPortion(f, 0, tailStart, true, sep7)) {
+ return "maybe";
}
- addListener(dependencyName, () => {
- remainingDependencies--;
- if (remainingDependencies === 0) {
- enqueueTask(key, task);
- }
- });
- });
- });
- checkForDeadlocks();
- processQueue();
- function enqueueTask(key, task) {
- readyTasks.push(() => runTask(key, task));
- }
- function processQueue() {
- if (canceled) return;
- if (readyTasks.length === 0 && runningTasks === 0) {
- return callback(null, results);
+ if (!dotPortion(f, 0, tailStart, dot, sep7))
+ return "yes";
+ continue;
}
- while (readyTasks.length && runningTasks < concurrency) {
- var run = readyTasks.shift();
- run();
+ if (shape === "mid" || shape === "head") {
+ const m = this.#walk(f, row, shape === "head", dot, sep7);
+ if (m !== "no")
+ return m;
+ continue;
}
+ return "maybe";
}
- function addListener(taskName, fn) {
- var taskListeners = listeners[taskName];
- if (!taskListeners) {
- taskListeners = listeners[taskName] = [];
+ return "no";
+ }
+ // Match a row of a known shape against the split path, the same as
+ // #matchGlobstar and #matchGlobStarBodySections do. None of these
+ // rows have a drive letter, so they start at the first portion.
+ #matchShape(file, row, shape) {
+ const dot = !!this.options.dot;
+ const n = file.length;
+ if (shape === "head") {
+ if (n < 2 || !portionMatch(row[0], file[0])) {
+ return false;
}
- taskListeners.push(fn);
+ for (let i = 1; i < n; i++)
+ if (!walkable(file[i], dot))
+ return false;
+ return true;
}
- function taskComplete(taskName) {
- var taskListeners = listeners[taskName] || [];
- taskListeners.forEach((fn) => fn());
- processQueue();
- }
- function runTask(key, task) {
- if (hasError) return;
- var taskCallback = onlyOnce((err, ...result) => {
- runningTasks--;
- if (err === false) {
- canceled = true;
- return;
- }
- if (result.length < 2) {
- [result] = result;
- }
- if (err) {
- var safeResults = {};
- Object.keys(results).forEach((rkey) => {
- safeResults[rkey] = results[rkey];
- });
- safeResults[key] = result;
- hasError = true;
- listeners = /* @__PURE__ */ Object.create(null);
- if (canceled) return;
- callback(err, safeResults);
- } else {
- results[key] = result;
- taskComplete(key);
+ const x = row[1];
+ if (shape === "tail") {
+ let t = n - 1;
+ if (!portionMatch(x, file[t])) {
+ if (file[t] !== "" || n === 1 || !portionMatch(x, file[--t])) {
+ return false;
}
- });
- runningTasks++;
- var taskFn = wrapAsync(task[task.length - 1]);
- if (task.length > 1) {
- taskFn(results, taskCallback);
- } else {
- taskFn(taskCallback);
}
+ for (let i = 0; i < t; i++)
+ if (!walkable(file[i], dot))
+ return false;
+ return true;
}
- function checkForDeadlocks() {
- var currentTask;
- var counter = 0;
- while (readyToCheck.length) {
- currentTask = readyToCheck.pop();
- counter++;
- getDependents(currentTask).forEach((dependent) => {
- if (--uncheckedDependencies[dependent] === 0) {
- readyToCheck.push(dependent);
+ for (let k = 0; k < n; k++) {
+ if (portionMatch(x, file[k]) && k + 1 < n) {
+ let i = k + 1;
+ while (i < n && walkable(file[i], dot))
+ i++;
+ if (i === n)
+ return true;
+ }
+ if (!walkable(file[k], dot))
+ return false;
+ }
+ return false;
+ }
+ // Match a row of `**/x/**` or `x/**` against the path, the same as
+ // #matchGlobstar and #matchGlobStarBodySections do once it is split.
+ // x must match a portion (the first one, for `x/**`), the ** before
+ // it must be able to walk the portions before that one, and there
+ // must be a portion after it, which the ** after it can walk. At
+ // level 2, this is only known if no portion is `.` or `..`.
+ #walk(f, row, head, dot, sep7) {
+ if (this.#level2 && dotPortion(f, 0, f.length, true, sep7))
+ return "maybe";
+ const x = row[head ? 0 : 1];
+ let s = 0;
+ for (let e = nextSep(f, s, sep7); e !== -1; e = nextSep(f, s, sep7)) {
+ let next = e + 1;
+ while (next < f.length && isSep(f.charCodeAt(next), sep7))
+ next++;
+ const hit = typeof x === "string" ? e - s === x.length && f.startsWith(x, s) : e > s && x.testUnchecked(f.slice(s, e));
+ if (hit && !dotPortion(f, next, f.length, dot, sep7))
+ return "yes";
+ if (head || dotPortion(f, s, next, dot, sep7))
+ return "no";
+ s = next;
+ }
+ return "no";
+ }
+ // the last split, if it was the same path with the same split
+ // settings
+ #cachedSplit(f) {
+ const last = lastSplit;
+ return last?.f === f && last.isWindows === this.isWindows && last.preserveMultipleSlashes === this.preserveMultipleSlashes && last.normalize === this.#form ? last : void 0;
+ }
+ // split a path for match(), and keep the parts for the next call
+ #split(f) {
+ const { isWindows, preserveMultipleSlashes } = this;
+ let parts = this.#slashSplit(isWindows ? f.split("\\").join("/") : f);
+ const normalize2 = this.#form;
+ if (normalize2)
+ parts = parts.map((p) => p.normalize(normalize2));
+ lastSplit = {
+ f,
+ isWindows,
+ preserveMultipleSlashes,
+ normalize: normalize2,
+ parts
+ };
+ return lastSplit;
+ }
+ // resolve `.` and `..` portions of a path, for level 2
+ #levelTwoFileOptimize(file) {
+ const parts = [...file];
+ let didSomething = false;
+ do {
+ didSomething = false;
+ if (!this.preserveMultipleSlashes) {
+ for (let i = 1; i < parts.length - 1; i++) {
+ const p = parts[i];
+ if (i === 1 && p === "" && parts[0] === "")
+ continue;
+ if (p === "." || p === "") {
+ didSomething = true;
+ parts.splice(i, 1);
+ i--;
}
- });
+ }
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
+ didSomething = true;
+ parts.pop();
+ }
}
- if (counter !== numTasks) {
- throw new Error(
- "async.auto cannot execute tasks due to a recursive dependency"
- );
+ const root = this.#rootIndex(parts) + 1;
+ let dd = root;
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
+ const p = parts[dd - 1];
+ if (p && p !== "." && p !== ".." && p !== "**") {
+ didSomething = true;
+ parts.splice(dd - 1, 2);
+ dd = Math.max(dd - 2, root);
+ }
}
- }
- function getDependents(taskName) {
- var result = [];
- Object.keys(tasks).forEach((key) => {
- const task = tasks[key];
- if (Array.isArray(task) && task.indexOf(taskName) >= 0) {
- result.push(key);
+ } while (didSomething);
+ return parts.length === 0 ? [""] : parts;
+ }
+ // First phase: single-pattern processing
+ // <pre> is 1 or more portions
+ // <rest> is 1 or more portions
+ // <p> is any portion other than ., .., '', or **
+ // <e> is . or ''
+ //
+ // **/.. is *brutal* for filesystem walking performance, because
+ // it effectively resets the recursive walk each time it occurs,
+ // and ** cannot be reduced out by a .. pattern part like a regexp
+ // or most strings (other than .., ., and '') can be.
+ //
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
+ // <pre>/<e>/<rest> -> <pre>/<rest>
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
+ // **/**/<rest> -> **/<rest>
+ //
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
+ firstPhasePreProcess(globParts) {
+ const { braceExpandMax = 1e5 } = this.options;
+ let didSomething = false;
+ do {
+ didSomething = false;
+ for (let parts of globParts) {
+ let gs = -1;
+ while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
+ let gss = gs;
+ while (parts[gss + 1] === "**") {
+ gss++;
+ }
+ if (gss > gs) {
+ parts.splice(gs + 1, gss - gs);
+ }
+ let next = parts[gs + 1];
+ const p = parts[gs + 2];
+ const p2 = parts[gs + 3];
+ if (next !== "..")
+ continue;
+ if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === ".." || globParts.length >= braceExpandMax) {
+ continue;
+ }
+ didSomething = true;
+ parts.splice(gs, 1);
+ const other = parts.slice(0);
+ other[gs] = "**";
+ globParts.push(other);
+ gs--;
}
- });
- return result;
- }
- return callback[PROMISE_SYMBOL];
+ if (!this.preserveMultipleSlashes) {
+ for (let i = 1; i < parts.length - 1; i++) {
+ const p = parts[i];
+ if (i === 1 && p === "" && parts[0] === "")
+ continue;
+ if (p === "." || p === "") {
+ didSomething = true;
+ parts.splice(i, 1);
+ i--;
+ }
+ }
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
+ didSomething = true;
+ parts.pop();
+ }
+ }
+ const root = this.#rootIndex(parts) + 1;
+ let dd = root;
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
+ const p = parts[dd - 1];
+ if (p && p !== "." && p !== ".." && p !== "**") {
+ didSomething = true;
+ const needDot = dd === 1 && parts[dd + 1] === "**";
+ const splin = needDot ? ["."] : [];
+ parts.splice(dd - 1, 2, ...splin);
+ if (parts.length === 0)
+ parts.push("");
+ dd = Math.max(dd - 2, root);
+ }
+ }
+ }
+ } while (didSomething);
+ return globParts;
}
- var FN_ARGS = /^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/;
- var ARROW_FN_ARGS = /^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/;
- var FN_ARG_SPLIT = /,/;
- var FN_ARG = /(=.+)?(\s*)$/;
- function stripComments(string) {
- let stripped = "";
- let index2 = 0;
- let endBlockComment = string.indexOf("*/");
- while (index2 < string.length) {
- if (string[index2] === "/" && string[index2 + 1] === "/") {
- let endIndex = string.indexOf("\n", index2);
- index2 = endIndex === -1 ? string.length : endIndex;
- } else if (endBlockComment !== -1 && string[index2] === "/" && string[index2 + 1] === "*") {
- let endIndex = string.indexOf("*/", index2);
- if (endIndex !== -1) {
- index2 = endIndex + 2;
- endBlockComment = string.indexOf("*/", index2);
- } else {
- stripped += string[index2];
- index2++;
+ // second phase: multi-pattern dedupes
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
+ //
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
+ // ^-- not valid because ** doens't follow symlinks
+ secondPhasePreProcess(globParts) {
+ if (globParts.length > 1e3)
+ return globParts;
+ for (let i = 0; i < globParts.length - 1; i++) {
+ for (let j = i + 1; j < globParts.length; j++) {
+ const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
+ if (matched) {
+ globParts[i] = [];
+ globParts[j] = matched;
+ break;
}
- } else {
- stripped += string[index2];
- index2++;
}
}
- return stripped;
+ return globParts.filter((gs) => gs.length);
}
- function parseParams(func) {
- const src = stripComments(func.toString());
- let match = src.match(FN_ARGS);
- if (!match) {
- match = src.match(ARROW_FN_ARGS);
+ partsMatch(a, b, emptyGSMatch = false) {
+ let ai = 0;
+ let bi = 0;
+ let result = [];
+ let which2 = "";
+ while (ai < a.length && bi < b.length) {
+ if (a[ai] === b[bi]) {
+ result.push(which2 === "b" ? b[bi] : a[ai]);
+ ai++;
+ bi++;
+ } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
+ result.push(a[ai]);
+ ai++;
+ } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
+ result.push(b[bi]);
+ bi++;
+ } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
+ if (which2 === "b")
+ return false;
+ which2 = "a";
+ result.push(a[ai]);
+ ai++;
+ bi++;
+ } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
+ if (which2 === "a")
+ return false;
+ which2 = "b";
+ result.push(b[bi]);
+ ai++;
+ bi++;
+ } else {
+ return false;
+ }
}
- if (!match) throw new Error("could not parse args in autoInject\nSource:\n" + src);
- let [, args] = match;
- return args.replace(/\s/g, "").split(FN_ARG_SPLIT).map((arg) => arg.replace(FN_ARG, "").trim());
+ return a.length === b.length && result;
}
- function autoInject(tasks, callback) {
- var newTasks = {};
- Object.keys(tasks).forEach((key) => {
- var taskFn = tasks[key];
- var params;
- var fnIsAsync = isAsync(taskFn);
- var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0;
- if (Array.isArray(taskFn)) {
- params = [...taskFn];
- taskFn = params.pop();
- newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
- } else if (hasNoDeps) {
- newTasks[key] = taskFn;
+ parseNegate() {
+ if (this.nonegate)
+ return;
+ const pattern = this.pattern;
+ let negate = false;
+ let negateOffset = 0;
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
+ negate = !negate;
+ negateOffset++;
+ }
+ if (negateOffset)
+ this.pattern = pattern.slice(negateOffset);
+ this.negate = negate;
+ }
+ // Match the parts of a path against one row of the set. `resolved`
+ // is the parts after level 2 resolves `.` and `..` in them, or the
+ // same parts below level 2. Set partial to true to test if, for
+ // example, "/a/b" matches the start of "/*/b/*/d". Partial means, if
+ // you run out of file before you run out of pattern, then that's
+ // fine, as long as all the parts match.
+ #matchRow(file, resolved, pattern, partial) {
+ let fileStartIndex = 0;
+ let patternStartIndex = 0;
+ const fh = this.isWindows ? uncHost(resolved) : -1;
+ const ph = fh === -1 ? -1 : uncHost(pattern);
+ if (ph !== -1) {
+ const host = pattern[ph];
+ const share = pattern[ph + 1];
+ if (typeof host !== "string" || typeof share !== "string") {
+ fileStartIndex = fh;
+ patternStartIndex = ph;
+ } else if (resolved[fh].toLowerCase() === host.toLowerCase() && resolved[fh + 1].toLowerCase() === share.toLowerCase()) {
+ fileStartIndex = fh + 2;
+ patternStartIndex = ph + 2;
+ }
+ } else if (this.isWindows) {
+ const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
+ const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
+ const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
+ const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
+ const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
+ const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
+ if (typeof fdi === "number" && typeof pdi === "number") {
+ const [fd, pd] = [
+ file[fdi],
+ pattern[pdi]
+ ];
+ if (fd.toLowerCase() === pd.toLowerCase()) {
+ patternStartIndex = pdi + 1;
+ fileStartIndex = fdi + 1;
+ }
+ }
+ }
+ file = resolved;
+ if (pattern.includes(exports2.GLOBSTAR)) {
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
+ }
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
+ }
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
+ const { head, body: body2, tail, segments } = this.#getGlobstarParts(pattern, partial, patternIndex);
+ if (head.length) {
+ const headEnd = fileIndex + head.length;
+ if (!this.#matchOne(file, head, partial, fileIndex, 0, headEnd)) {
+ return false;
+ }
+ fileIndex += head.length;
+ patternIndex += head.length;
+ }
+ let fileTailMatch = 0;
+ if (tail.length) {
+ if (tail.length + fileIndex > file.length)
+ return false;
+ let tailStart = file.length - tail.length;
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
+ fileTailMatch = tail.length;
} else {
- params = parseParams(taskFn);
- if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {
- throw new Error("autoInject task functions require explicit parameters.");
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
+ return false;
}
- if (!fnIsAsync) params.pop();
- newTasks[key] = params.concat(newTask);
+ tailStart--;
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
+ return false;
+ }
+ fileTailMatch = tail.length + 1;
}
- function newTask(results, taskCb) {
- var newArgs = params.map((name) => results[name]);
- newArgs.push(taskCb);
- wrapAsync(taskFn)(...newArgs);
+ }
+ if (!body2.length) {
+ let sawSome = !!fileTailMatch;
+ for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
+ const f = String(file[i]);
+ sawSome = true;
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
+ return false;
+ }
+ }
+ return partial || sawSome;
+ }
+ return !!this.#matchGlobStarBodySections(file, segments, file.length - fileTailMatch, fileIndex, 0, partial, 0, !!fileTailMatch, /* @__PURE__ */ new Set());
+ }
+ // Split the pattern into head, tail, and middle of ** delimited
+ // parts. The tail has to be at the end, and the others just have to
+ // be found in order from the head. These only depend on the pattern
+ // row, so they are kept for the next path.
+ #getGlobstarParts(pattern, partial, patternIndex) {
+ let byStart = this.#globstarParts.get(pattern);
+ if (!byStart) {
+ byStart = [];
+ this.#globstarParts.set(pattern, byStart);
+ }
+ const key = patternIndex * 2 + (partial ? 1 : 0);
+ const found = byStart[key];
+ if (found)
+ return found;
+ const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex);
+ const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR);
+ const head = pattern.slice(patternIndex, firstgs);
+ const body2 = pattern.slice(firstgs + 1, partial ? void 0 : lastgs);
+ const tail = partial ? [] : pattern.slice(lastgs + 1);
+ const segments = [[[], 0]];
+ let current = segments[0];
+ let nonGsParts = 0;
+ const nonGsPartsSums = [0];
+ for (const b of body2) {
+ if (b === exports2.GLOBSTAR) {
+ nonGsPartsSums.push(nonGsParts);
+ current = [[], 0];
+ segments.push(current);
+ } else {
+ current[0].push(b);
+ nonGsParts++;
}
+ }
+ segments.forEach((b, i) => {
+ b[1] = nonGsParts - nonGsPartsSums[i];
});
- return auto(newTasks, callback);
+ const parts = { head, body: body2, tail, segments };
+ byStart[key] = parts;
+ return parts;
}
- class DLL {
- constructor() {
- this.head = this.tail = null;
- this.length = 0;
+ // return false for "nope, not matching"
+ // return null for "not matching, cannot keep trying"
+ #matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex, bodyIndex, partial, globStarDepth, sawTail, tried) {
+ const bs = bodySegments[bodyIndex];
+ if (!bs) {
+ if (partial) {
+ return fileIndex >= fileLength || fileIndex === fileLength - 1 && file[fileIndex] === "";
+ }
+ for (let i = fileIndex; i < fileLength; i++) {
+ sawTail = true;
+ const f = file[i];
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
+ return false;
+ }
+ }
+ return sawTail;
}
- removeLink(node) {
- if (node.prev) node.prev.next = node.next;
- else this.head = node.next;
- if (node.next) node.next.prev = node.prev;
- else this.tail = node.prev;
- node.prev = node.next = null;
- this.length -= 1;
- return node;
+ const [body2, need] = bs;
+ const after = partial ? fileLength : fileLength - need;
+ while (fileIndex <= after) {
+ const key = bodyIndex * (file.length + 1) + fileIndex;
+ if (tried.has(key))
+ return false;
+ tried.add(key);
+ const m = this.#matchOne(file, body2, partial, fileIndex, 0, fileIndex + body2.length);
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex + body2.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail, tried);
+ if (sub !== false) {
+ return sub;
+ }
+ }
+ if (fileIndex === after)
+ break;
+ const f = file[fileIndex];
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
+ return false;
+ }
+ fileIndex++;
}
- empty() {
- while (this.head) this.shift();
- return this;
+ return partial || null;
+ }
+ #matchOne(file, pattern, partial, fileIndex, patternIndex, fileEnd = file.length) {
+ let fi;
+ let pi;
+ let pl;
+ let fl;
+ for (fi = fileIndex, pi = patternIndex, fl = Math.min(fileEnd, file.length), pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
+ let p = pattern[pi];
+ let f = file[fi];
+ if (p === false || p === exports2.GLOBSTAR) {
+ return false;
+ }
+ if (!portionMatch(p, f))
+ return false;
}
- insertAfter(node, newNode) {
- newNode.prev = node;
- newNode.next = node.next;
- if (node.next) node.next.prev = newNode;
- else this.tail = newNode;
- node.next = newNode;
- this.length += 1;
+ if (fi === fl && pi === pl) {
+ return true;
+ } else if (fi === fl) {
+ return partial;
+ } else if (pi === pl) {
+ return fi === fl - 1 && file[fi] === "";
+ } else {
+ throw new Error("wtf?");
}
- insertBefore(node, newNode) {
- newNode.prev = node.prev;
- newNode.next = node;
- if (node.prev) node.prev.next = newNode;
- else this.head = newNode;
- node.prev = newNode;
- this.length += 1;
+ }
+ braceExpand() {
+ return (0, exports2.braceExpand)(this.pattern, this.options);
+ }
+ parse(pattern) {
+ (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
+ const options = this.options;
+ if (pattern === "**")
+ return exports2.GLOBSTAR;
+ if (pattern === "")
+ return "";
+ const { nocase, nocaseMagicOnly, noext = false, dot, normalize: normalize2 } = options;
+ const lit = literal(pattern, noext);
+ if (lit !== void 0 && !(nocase && !nocaseMagicOnly && pattern.toUpperCase() !== pattern.toLowerCase())) {
+ return this.#norm(lit);
}
- unshift(node) {
- if (this.head) this.insertBefore(this.head, node);
- else setInitial(this, node);
+ let m = this.#matchers.get(pattern);
+ if (!m) {
+ m = new nonrecursive_glob_match_1.Matcher(pattern, { nocase, noext, dot, normalize: normalize2 });
+ this.#matchers.set(pattern, m);
}
- push(node) {
- if (this.tail) this.insertAfter(this.tail, node);
- else setInitial(this, node);
+ return m;
+ }
+ #slashSplit(p) {
+ if (this.preserveMultipleSlashes) {
+ return p.split("/");
+ } else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
+ return ["", ...p.split(/\/+/)];
+ } else {
+ return p.split(/\/+/);
}
- shift() {
- return this.head && this.removeLink(this.head);
+ }
+ match(f, partial = this.partial) {
+ if (this.comment) {
+ return false;
}
- pop() {
- return this.tail && this.removeLink(this.tail);
+ if (this.empty) {
+ return f === "";
}
- toArray() {
- return [...this];
+ if (f === "/" && partial) {
+ return true;
}
- *[Symbol.iterator]() {
- var cur = this.head;
- while (cur) {
- yield cur.data;
- cur = cur.next;
+ const options = this.options;
+ let split = this.#cachedSplit(f);
+ if (!split) {
+ if (!partial && !this.#form && (this.#endCheck || this.#literalCheck) && lastChecked !== f) {
+ lastChecked = f;
+ const can = this.#canMatch(f);
+ if (can === "no")
+ return options.flipNegate ? false : this.negate;
+ if (can === "yes")
+ return options.flipNegate ? true : !this.negate;
+ }
+ split = this.#split(f);
+ }
+ const ff = split.parts;
+ const resolved = this.#level2 ? split.resolved ??= this.#levelTwoFileOptimize(ff) : ff;
+ const set = this.set;
+ let filename = ff[ff.length - 1];
+ if (!filename) {
+ for (let i = ff.length - 2; !filename && i >= 0; i--) {
+ filename = ff[i];
}
}
- remove(testFn) {
- var curr = this.head;
- while (curr) {
- var { next } = curr;
- if (testFn(curr)) {
- this.removeLink(curr);
+ for (let r = 0; r < set.length; r++) {
+ const pattern = set[r];
+ const shape = partial ? void 0 : this.#shapes[r];
+ const hit = shape === "base" ? portionMatch(pattern[0], filename) : shape ? this.#matchShape(resolved, pattern, shape) : options.matchBase && pattern.length === 1 ? this.#matchRow([filename], [filename], pattern, partial) : this.#matchRow(ff, resolved, pattern, partial);
+ if (hit) {
+ if (options.flipNegate) {
+ return true;
}
- curr = next;
+ return !this.negate;
}
- return this;
}
+ if (options.flipNegate) {
+ return false;
+ }
+ return this.negate;
}
- function setInitial(dll, node) {
- dll.length = 1;
- dll.head = dll.tail = node;
+ static defaults(def) {
+ return exports2.minimatch.defaults(def).Minimatch;
}
- function queue$1(worker, concurrency, payload) {
- if (concurrency == null) {
- concurrency = 1;
- } else if (concurrency === 0) {
- throw new RangeError("Concurrency must not be zero");
- }
- var _worker = wrapAsync(worker);
- var numRunning = 0;
- var workersList = [];
- const events = {
- error: [],
- drain: [],
- saturated: [],
- unsaturated: [],
- empty: []
- };
- function on(event, handler2) {
- events[event].push(handler2);
+ };
+ exports2.Minimatch = Minimatch;
+ var escape_js_2 = require_escape();
+ Object.defineProperty(exports2, "escape", { enumerable: true, get: function() {
+ return escape_js_2.escape;
+ } });
+ var unescape_js_2 = require_unescape();
+ Object.defineProperty(exports2, "unescape", { enumerable: true, get: function() {
+ return unescape_js_2.unescape;
+ } });
+ exports2.minimatch.Minimatch = Minimatch;
+ exports2.minimatch.escape = escape_js_1.escape;
+ exports2.minimatch.unescape = unescape_js_1.unescape;
+ }
+});
+
+// node_modules/readdir-glob/index.js
+var require_readdir_glob = __commonJS({
+ "node_modules/readdir-glob/index.js"(exports2, module2) {
+ module2.exports = readdirGlob;
+ var fs9 = require("fs");
+ var { EventEmitter: EventEmitter3 } = require("events");
+ var { Minimatch } = require_commonjs6();
+ var { resolve: resolve7 } = require("path");
+ function readdir2(dir, strict) {
+ return new Promise((resolve8, reject) => {
+ fs9.readdir(dir, { withFileTypes: true }, (err, files) => {
+ if (err) {
+ switch (err.code) {
+ case "ENOTDIR":
+ if (strict) {
+ reject(err);
+ } else {
+ resolve8([]);
+ }
+ break;
+ case "ENOTSUP":
+ // Operation not supported
+ case "ENOENT":
+ // No such file or directory
+ case "ENAMETOOLONG":
+ // Filename too long
+ case "UNKNOWN":
+ resolve8([]);
+ break;
+ case "ELOOP":
+ // Too many levels of symbolic links
+ default:
+ reject(err);
+ break;
+ }
+ } else {
+ resolve8(files);
+ }
+ });
+ });
+ }
+ function stat2(file, followSymlinks) {
+ return new Promise((resolve8, reject) => {
+ const statFunc = followSymlinks ? fs9.stat : fs9.lstat;
+ statFunc(file, (err, stats) => {
+ if (err) {
+ switch (err.code) {
+ case "ENOENT":
+ if (followSymlinks) {
+ resolve8(stat2(file, false));
+ } else {
+ resolve8(null);
+ }
+ break;
+ default:
+ resolve8(null);
+ break;
+ }
+ } else {
+ resolve8(stats);
+ }
+ });
+ });
+ }
+ async function* exploreWalkAsync(dir, path6, followSymlinks, useStat, shouldSkip, strict) {
+ let files = await readdir2(path6 + dir, strict);
+ for (const file of files) {
+ let name = file.name;
+ if (name === void 0) {
+ name = file;
+ useStat = true;
}
- function once2(event, handler2) {
- const handleAndRemove = (...args) => {
- off(event, handleAndRemove);
- handler2(...args);
- };
- events[event].push(handleAndRemove);
+ const filename = dir + "/" + name;
+ const relative4 = filename.slice(1);
+ const absolute = path6 + "/" + relative4;
+ let stats = null;
+ if (useStat || followSymlinks) {
+ stats = await stat2(absolute, followSymlinks);
}
- function off(event, handler2) {
- if (!event) return Object.keys(events).forEach((ev) => events[ev] = []);
- if (!handler2) return events[event] = [];
- events[event] = events[event].filter((ev) => ev !== handler2);
+ if (!stats && file.name !== void 0) {
+ stats = file;
}
- function trigger(event, ...args) {
- events[event].forEach((handler2) => handler2(...args));
+ if (stats === null) {
+ stats = { isDirectory: () => false };
}
- var processingScheduled = false;
- function _insert(data, insertAtFront, rejectOnError, callback) {
- if (callback != null && typeof callback !== "function") {
- throw new Error("task callback must be a function");
- }
- q.started = true;
- var res, rej;
- function promiseCallback2(err, ...args) {
- if (err) return rejectOnError ? rej(err) : res();
- if (args.length <= 1) return res(args[0]);
- res(args);
+ if (stats.isDirectory()) {
+ if (!shouldSkip(relative4)) {
+ yield { relative: relative4, absolute, stats };
+ yield* exploreWalkAsync(filename, path6, followSymlinks, useStat, shouldSkip, false);
}
- var item = q._createTaskItem(
- data,
- rejectOnError ? promiseCallback2 : callback || promiseCallback2
+ } else {
+ yield { relative: relative4, absolute, stats };
+ }
+ }
+ }
+ async function* explore(path6, followSymlinks, useStat, shouldSkip) {
+ yield* exploreWalkAsync("", path6, followSymlinks, useStat, shouldSkip, true);
+ }
+ function readOptions(options) {
+ return {
+ pattern: options.pattern,
+ dot: !!options.dot,
+ noglobstar: !!options.noglobstar,
+ matchBase: !!options.matchBase,
+ nocase: !!options.nocase,
+ ignore: options.ignore,
+ skip: options.skip,
+ follow: !!options.follow,
+ stat: !!options.stat,
+ nodir: !!options.nodir,
+ mark: !!options.mark,
+ silent: !!options.silent,
+ absolute: !!options.absolute
+ };
+ }
+ var ReaddirGlob = class extends EventEmitter3 {
+ constructor(cwd, options, cb) {
+ super();
+ if (typeof options === "function") {
+ cb = options;
+ options = null;
+ }
+ this.options = readOptions(options || {});
+ this.matchers = [];
+ if (this.options.pattern) {
+ const matchers = Array.isArray(this.options.pattern) ? this.options.pattern : [this.options.pattern];
+ this.matchers = matchers.map(
+ (m) => new Minimatch(m, {
+ dot: this.options.dot,
+ noglobstar: this.options.noglobstar,
+ matchBase: this.options.matchBase,
+ nocase: this.options.nocase
+ })
);
- if (insertAtFront) {
- q._tasks.unshift(item);
- } else {
- q._tasks.push(item);
- }
- if (!processingScheduled) {
- processingScheduled = true;
- setImmediate$1(() => {
- processingScheduled = false;
- q.process();
- });
- }
- if (rejectOnError || !callback) {
- return new Promise((resolve7, reject2) => {
- res = resolve7;
- rej = reject2;
- });
- }
}
- function _createCB(tasks) {
- return function(err, ...args) {
- numRunning -= 1;
- for (var i = 0, l = tasks.length; i < l; i++) {
- var task = tasks[i];
- var index2 = workersList.indexOf(task);
- if (index2 === 0) {
- workersList.shift();
- } else if (index2 > 0) {
- workersList.splice(index2, 1);
- }
- task.callback(err, ...args);
- if (err != null) {
- trigger("error", err, task.data);
- }
- }
- if (numRunning <= q.concurrency - q.buffer) {
- trigger("unsaturated");
- }
- if (q.idle()) {
- trigger("drain");
- }
- q.process();
- };
+ this.ignoreMatchers = [];
+ if (this.options.ignore) {
+ const ignorePatterns = Array.isArray(this.options.ignore) ? this.options.ignore : [this.options.ignore];
+ this.ignoreMatchers = ignorePatterns.map(
+ (ignore) => new Minimatch(ignore, { dot: true })
+ );
}
- function _maybeDrain(data) {
- if (data.length === 0 && q.idle()) {
- setImmediate$1(() => trigger("drain"));
- return true;
- }
- return false;
+ this.skipMatchers = [];
+ if (this.options.skip) {
+ const skipPatterns = Array.isArray(this.options.skip) ? this.options.skip : [this.options.skip];
+ this.skipMatchers = skipPatterns.map(
+ (skip) => new Minimatch(skip, { dot: true })
+ );
}
- const eventMethod = (name) => (handler2) => {
- if (!handler2) {
- return new Promise((resolve7, reject2) => {
- once2(name, (err, data) => {
- if (err) return reject2(err);
- resolve7(data);
- });
- });
- }
- off(name);
- on(name, handler2);
- };
- var isProcessing = false;
- var q = {
- _tasks: new DLL(),
- _createTaskItem(data, callback) {
- return {
- data,
- callback
- };
- },
- *[Symbol.iterator]() {
- yield* q._tasks[Symbol.iterator]();
- },
- concurrency,
- payload,
- buffer: concurrency / 4,
- started: false,
- paused: false,
- push(data, callback) {
- if (Array.isArray(data)) {
- if (_maybeDrain(data)) return;
- return data.map((datum) => _insert(datum, false, false, callback));
- }
- return _insert(data, false, false, callback);
- },
- pushAsync(data, callback) {
- if (Array.isArray(data)) {
- if (_maybeDrain(data)) return;
- return data.map((datum) => _insert(datum, false, true, callback));
- }
- return _insert(data, false, true, callback);
- },
- kill() {
- off();
- q._tasks.empty();
- },
- unshift(data, callback) {
- if (Array.isArray(data)) {
- if (_maybeDrain(data)) return;
- return data.map((datum) => _insert(datum, true, false, callback));
- }
- return _insert(data, true, false, callback);
- },
- unshiftAsync(data, callback) {
- if (Array.isArray(data)) {
- if (_maybeDrain(data)) return;
- return data.map((datum) => _insert(datum, true, true, callback));
- }
- return _insert(data, true, true, callback);
- },
- remove(testFn) {
- q._tasks.remove(testFn);
- },
- process() {
- if (isProcessing) {
- return;
- }
- isProcessing = true;
- while (!q.paused && numRunning < q.concurrency && q._tasks.length) {
- var tasks = [], data = [];
- var l = q._tasks.length;
- if (q.payload) l = Math.min(l, q.payload);
- for (var i = 0; i < l; i++) {
- var node = q._tasks.shift();
- tasks.push(node);
- workersList.push(node);
- data.push(node.data);
- }
- numRunning += 1;
- if (q._tasks.length === 0) {
- trigger("empty");
- }
- if (numRunning === q.concurrency) {
- trigger("saturated");
+ this.iterator = explore(resolve7(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
+ this.paused = false;
+ this.inactive = false;
+ this.aborted = false;
+ if (cb) {
+ this._matches = [];
+ this.on("match", (match) => this._matches.push(this.options.absolute ? match.absolute : match.relative));
+ this.on("error", (err) => cb(err));
+ this.on("end", () => cb(null, this._matches));
+ }
+ setTimeout(() => this._next(), 0);
+ }
+ _shouldSkipDirectory(relative4) {
+ return this.skipMatchers.some((m) => m.match(relative4));
+ }
+ _fileMatches(relative4, isDirectory2) {
+ const file = relative4 + (isDirectory2 ? "/" : "");
+ return (this.matchers.length === 0 || this.matchers.some((m) => m.match(file))) && !this.ignoreMatchers.some((m) => m.match(file)) && (!this.options.nodir || !isDirectory2);
+ }
+ _next() {
+ if (!this.paused && !this.aborted) {
+ this.iterator.next().then((obj) => {
+ if (!obj.done) {
+ const isDirectory2 = obj.value.stats.isDirectory();
+ if (this._fileMatches(obj.value.relative, isDirectory2)) {
+ let relative4 = obj.value.relative;
+ let absolute = obj.value.absolute;
+ if (this.options.mark && isDirectory2) {
+ relative4 += "/";
+ absolute += "/";
+ }
+ if (this.options.stat) {
+ this.emit("match", { relative: relative4, absolute, stat: obj.value.stats });
+ } else {
+ this.emit("match", { relative: relative4, absolute });
+ }
}
- var cb = onlyOnce(_createCB(tasks));
- _worker(data, cb);
+ this._next(this.iterator);
+ } else {
+ this.emit("end");
}
- isProcessing = false;
- },
- length() {
- return q._tasks.length;
- },
- running() {
- return numRunning;
- },
- workersList() {
- return workersList;
- },
- idle() {
- return q._tasks.length + numRunning === 0;
- },
- pause() {
- q.paused = true;
- },
- resume() {
- if (q.paused === false) {
- return;
+ }).catch((err) => {
+ this.abort();
+ this.emit("error", err);
+ if (!err.code && !this.options.silent) {
+ console.error(err);
}
- q.paused = false;
- setImmediate$1(q.process);
- }
- };
- Object.defineProperties(q, {
- saturated: {
- writable: false,
- value: eventMethod("saturated")
- },
- unsaturated: {
- writable: false,
- value: eventMethod("unsaturated")
- },
- empty: {
- writable: false,
- value: eventMethod("empty")
- },
- drain: {
- writable: false,
- value: eventMethod("drain")
- },
- error: {
- writable: false,
- value: eventMethod("error")
- }
- });
- return q;
+ });
+ } else {
+ this.inactive = true;
+ }
}
- function cargo$1(worker, payload) {
- return queue$1(worker, 1, payload);
+ abort() {
+ this.aborted = true;
}
- function cargo(worker, concurrency, payload) {
- return queue$1(worker, concurrency, payload);
+ pause() {
+ this.paused = true;
}
- function reduce(coll, memo, iteratee, callback) {
- callback = once(callback);
- var _iteratee = wrapAsync(iteratee);
- return eachOfSeries$1(coll, (x, i, iterCb) => {
- _iteratee(memo, x, (err, v) => {
- memo = v;
- iterCb(err);
- });
- }, (err) => callback(err, memo));
+ resume() {
+ this.paused = false;
+ if (this.inactive) {
+ this.inactive = false;
+ this._next();
+ }
}
- var reduce$1 = awaitify(reduce, 4);
- function seq(...functions) {
- var _functions = functions.map(wrapAsync);
+ };
+ function readdirGlob(pattern, options, cb) {
+ return new ReaddirGlob(pattern, options, cb);
+ }
+ readdirGlob.ReaddirGlob = ReaddirGlob;
+ }
+});
+
+// node_modules/async/dist/async.js
+var require_async = __commonJS({
+ "node_modules/async/dist/async.js"(exports2, module2) {
+ (function(global2, factory) {
+ typeof exports2 === "object" && typeof module2 !== "undefined" ? factory(exports2) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.async = {}));
+ })(exports2, (function(exports3) {
+ "use strict";
+ function apply(fn, ...args) {
+ return (...callArgs) => fn(...args, ...callArgs);
+ }
+ function initialParams(fn) {
return function(...args) {
- var that = this;
- var cb = args[args.length - 1];
- if (typeof cb == "function") {
- args.pop();
- } else {
- cb = promiseCallback();
- }
- reduce$1(
- _functions,
- args,
- (newargs, fn, iterCb) => {
- fn.apply(that, newargs.concat((err, ...nextargs) => {
- iterCb(err, nextargs);
- }));
- },
- (err, results) => cb(err, ...results)
- );
- return cb[PROMISE_SYMBOL];
+ var callback = args.pop();
+ return fn.call(this, args, callback);
};
}
- function compose(...args) {
- return seq(...args.reverse());
- }
- function mapLimit(coll, limit, iteratee, callback) {
- return _asyncMap(eachOfLimit$2(limit), coll, iteratee, callback);
+ var hasQueueMicrotask = typeof queueMicrotask === "function" && queueMicrotask;
+ var hasSetImmediate = typeof setImmediate === "function" && setImmediate;
+ var hasNextTick = typeof process === "object" && typeof process.nextTick === "function";
+ function fallback(fn) {
+ setTimeout(fn, 0);
}
- var mapLimit$1 = awaitify(mapLimit, 4);
- function concatLimit(coll, limit, iteratee, callback) {
- var _iteratee = wrapAsync(iteratee);
- return mapLimit$1(coll, limit, (val, iterCb) => {
- _iteratee(val, (err, ...args) => {
- if (err) return iterCb(err);
- return iterCb(err, args);
- });
- }, (err, mapResults) => {
- var result = [];
- for (var i = 0; i < mapResults.length; i++) {
- if (mapResults[i]) {
- result = result.concat(...mapResults[i]);
- }
- }
- return callback(err, result);
- });
+ function wrap(defer) {
+ return (fn, ...args) => defer(() => fn(...args));
}
- var concatLimit$1 = awaitify(concatLimit, 4);
- function concat2(coll, iteratee, callback) {
- return concatLimit$1(coll, Infinity, iteratee, callback);
- }
- var concat$1 = awaitify(concat2, 3);
- function concatSeries(coll, iteratee, callback) {
- return concatLimit$1(coll, 1, iteratee, callback);
- }
- var concatSeries$1 = awaitify(concatSeries, 3);
- function constant$1(...args) {
- return function(...ignoredArgs) {
- var callback = ignoredArgs.pop();
- return callback(null, ...args);
- };
- }
- function _createTester(check, getResult) {
- return (eachfn, arr, _iteratee, cb) => {
- var testPassed = false;
- var testResult;
- const iteratee = wrapAsync(_iteratee);
- eachfn(arr, (value, _2, callback) => {
- iteratee(value, (err, result) => {
- if (err || err === false) return callback(err);
- if (check(result) && !testResult) {
- testPassed = true;
- testResult = getResult(true, value);
- return callback(null, breakLoop);
- }
- callback();
- });
- }, (err) => {
- if (err) return cb(err);
- cb(null, testPassed ? testResult : getResult(false));
- });
- };
- }
- function detect(coll, iteratee, callback) {
- return _createTester((bool) => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback);
- }
- var detect$1 = awaitify(detect, 3);
- function detectLimit(coll, limit, iteratee, callback) {
- return _createTester((bool) => bool, (res, item) => item)(eachOfLimit$2(limit), coll, iteratee, callback);
- }
- var detectLimit$1 = awaitify(detectLimit, 4);
- function detectSeries(coll, iteratee, callback) {
- return _createTester((bool) => bool, (res, item) => item)(eachOfLimit$2(1), coll, iteratee, callback);
+ var _defer$1;
+ if (hasQueueMicrotask) {
+ _defer$1 = queueMicrotask;
+ } else if (hasSetImmediate) {
+ _defer$1 = setImmediate;
+ } else if (hasNextTick) {
+ _defer$1 = process.nextTick;
+ } else {
+ _defer$1 = fallback;
}
- var detectSeries$1 = awaitify(detectSeries, 3);
- function consoleFunc(name) {
- return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => {
- if (typeof console === "object") {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- } else if (console[name]) {
- resultArgs.forEach((x) => console[name](x));
- }
+ var setImmediate$1 = wrap(_defer$1);
+ function asyncify(func) {
+ if (isAsync(func)) {
+ return function(...args) {
+ const callback = args.pop();
+ const promise = func.apply(this, args);
+ return handlePromise(promise, callback);
+ };
+ }
+ return initialParams(function(args, callback) {
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ if (result && typeof result.then === "function") {
+ return handlePromise(result, callback);
+ } else {
+ callback(null, result);
}
});
}
- var dir = consoleFunc("dir");
- function doWhilst(iteratee, test, callback) {
- callback = onlyOnce(callback);
- var _fn = wrapAsync(iteratee);
- var _test = wrapAsync(test);
- var results;
- function next(err, ...args) {
- if (err) return callback(err);
- if (err === false) return;
- results = args;
- _test(...args, check);
- }
- function check(err, truth) {
- if (err) return callback(err);
- if (err === false) return;
- if (!truth) return callback(null, ...results);
- _fn(next);
- }
- return check(null, true);
+ function handlePromise(promise, callback) {
+ return promise.then((value) => {
+ invokeCallback(callback, null, value);
+ }, (err) => {
+ invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
+ });
}
- var doWhilst$1 = awaitify(doWhilst, 3);
- function doUntil(iteratee, test, callback) {
- const _test = wrapAsync(test);
- return doWhilst$1(iteratee, (...args) => {
- const cb = args.pop();
- _test(...args, (err, truth) => cb(err, !truth));
- }, callback);
+ function invokeCallback(callback, error2, value) {
+ try {
+ callback(error2, value);
+ } catch (err) {
+ setImmediate$1((e) => {
+ throw e;
+ }, err);
+ }
}
- function _withoutIndex(iteratee) {
- return (value, index2, callback) => iteratee(value, callback);
+ function isAsync(fn) {
+ return fn[Symbol.toStringTag] === "AsyncFunction";
}
- function eachLimit$2(coll, iteratee, callback) {
- return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
+ function isAsyncGenerator(fn) {
+ return fn[Symbol.toStringTag] === "AsyncGenerator";
}
- var each = awaitify(eachLimit$2, 3);
- function eachLimit(coll, limit, iteratee, callback) {
- return eachOfLimit$2(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
+ function isAsyncIterable(obj) {
+ return typeof obj[Symbol.asyncIterator] === "function";
}
- var eachLimit$1 = awaitify(eachLimit, 4);
- function eachSeries(coll, iteratee, callback) {
- return eachLimit$1(coll, 1, iteratee, callback);
+ function wrapAsync(asyncFn) {
+ if (typeof asyncFn !== "function") throw new Error("expected a function");
+ return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;
}
- var eachSeries$1 = awaitify(eachSeries, 3);
- function ensureAsync(fn) {
- if (isAsync(fn)) return fn;
- return function(...args) {
- var callback = args.pop();
- var sync = true;
- args.push((...innerArgs) => {
- if (sync) {
- setImmediate$1(() => callback(...innerArgs));
- } else {
- callback(...innerArgs);
- }
+ function awaitify(asyncFn, arity) {
+ if (!arity) arity = asyncFn.length;
+ if (!arity) throw new Error("arity is undefined");
+ function awaitable(...args) {
+ if (typeof args[arity - 1] === "function") {
+ return asyncFn.apply(this, args);
+ }
+ return new Promise((resolve7, reject2) => {
+ args[arity - 1] = (err, ...cbArgs) => {
+ if (err) return reject2(err);
+ resolve7(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
+ };
+ asyncFn.apply(this, args);
});
- fn.apply(this, args);
- sync = false;
- };
- }
- function every(coll, iteratee, callback) {
- return _createTester((bool) => !bool, (res) => !res)(eachOf$1, coll, iteratee, callback);
- }
- var every$1 = awaitify(every, 3);
- function everyLimit(coll, limit, iteratee, callback) {
- return _createTester((bool) => !bool, (res) => !res)(eachOfLimit$2(limit), coll, iteratee, callback);
- }
- var everyLimit$1 = awaitify(everyLimit, 4);
- function everySeries(coll, iteratee, callback) {
- return _createTester((bool) => !bool, (res) => !res)(eachOfSeries$1, coll, iteratee, callback);
+ }
+ return awaitable;
}
- var everySeries$1 = awaitify(everySeries, 3);
- function filterArray(eachfn, arr, iteratee, callback) {
- var truthValues = new Array(arr.length);
- eachfn(arr, (x, index2, iterCb) => {
- iteratee(x, (err, v) => {
- truthValues[index2] = !!v;
- iterCb(err);
+ function applyEach$1(eachfn) {
+ return function applyEach2(fns, ...callArgs) {
+ const go = awaitify(function(callback) {
+ var that = this;
+ return eachfn(fns, (fn, cb) => {
+ wrapAsync(fn).apply(that, callArgs.concat(cb));
+ }, callback);
});
- }, (err) => {
- if (err) return callback(err);
- var results = [];
- for (var i = 0; i < arr.length; i++) {
- if (truthValues[i]) results.push(arr[i]);
- }
- callback(null, results);
- });
+ return go;
+ };
}
- function filterGeneric(eachfn, coll, iteratee, callback) {
+ function _asyncMap(eachfn, arr, iteratee, callback) {
+ arr = arr || [];
var results = [];
- eachfn(coll, (x, index2, iterCb) => {
- iteratee(x, (err, v) => {
- if (err) return iterCb(err);
- if (v) {
- results.push({ index: index2, value: x });
- }
+ var counter = 0;
+ var _iteratee = wrapAsync(iteratee);
+ return eachfn(arr, (value, _2, iterCb) => {
+ var index2 = counter++;
+ _iteratee(value, (err, v) => {
+ results[index2] = v;
iterCb(err);
});
}, (err) => {
- if (err) return callback(err);
- callback(null, results.sort((a, b) => a.index - b.index).map((v) => v.value));
+ callback(err, results);
});
}
- function _filter(eachfn, coll, iteratee, callback) {
- var filter2 = isArrayLike(coll) ? filterArray : filterGeneric;
- return filter2(eachfn, coll, wrapAsync(iteratee), callback);
- }
- function filter(coll, iteratee, callback) {
- return _filter(eachOf$1, coll, iteratee, callback);
+ function isArrayLike(value) {
+ return value && typeof value.length === "number" && value.length >= 0 && value.length % 1 === 0;
}
- var filter$1 = awaitify(filter, 3);
- function filterLimit(coll, limit, iteratee, callback) {
- return _filter(eachOfLimit$2(limit), coll, iteratee, callback);
+ const breakLoop = {};
+ function once(fn) {
+ function wrapper(...args) {
+ if (fn === null) return;
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, args);
+ }
+ Object.assign(wrapper, fn);
+ return wrapper;
}
- var filterLimit$1 = awaitify(filterLimit, 4);
- function filterSeries(coll, iteratee, callback) {
- return _filter(eachOfSeries$1, coll, iteratee, callback);
+ function getIterator(coll) {
+ return coll[Symbol.iterator] && coll[Symbol.iterator]();
}
- var filterSeries$1 = awaitify(filterSeries, 3);
- function forever(fn, errback) {
- var done = onlyOnce(errback);
- var task = wrapAsync(ensureAsync(fn));
- function next(err) {
- if (err) return done(err);
- if (err === false) return;
- task(next);
- }
- return next();
- }
- var forever$1 = awaitify(forever, 2);
- function groupByLimit(coll, limit, iteratee, callback) {
- var _iteratee = wrapAsync(iteratee);
- return mapLimit$1(coll, limit, (val, iterCb) => {
- _iteratee(val, (err, key) => {
- if (err) return iterCb(err);
- return iterCb(err, { key, val });
- });
- }, (err, mapResults) => {
- var result = {};
- var { hasOwnProperty } = Object.prototype;
- for (var i = 0; i < mapResults.length; i++) {
- if (mapResults[i]) {
- var { key } = mapResults[i];
- var { val } = mapResults[i];
- if (hasOwnProperty.call(result, key)) {
- result[key].push(val);
- } else {
- result[key] = [val];
- }
- }
- }
- return callback(err, result);
- });
- }
- var groupByLimit$1 = awaitify(groupByLimit, 4);
- function groupBy(coll, iteratee, callback) {
- return groupByLimit$1(coll, Infinity, iteratee, callback);
+ function createArrayIterator(coll) {
+ var i = -1;
+ var len = coll.length;
+ return function next() {
+ return ++i < len ? { value: coll[i], key: i } : null;
+ };
}
- function groupBySeries(coll, iteratee, callback) {
- return groupByLimit$1(coll, 1, iteratee, callback);
+ function createES2015Iterator(iterator2) {
+ var i = -1;
+ return function next() {
+ var item = iterator2.next();
+ if (item.done)
+ return null;
+ i++;
+ return { value: item.value, key: i };
+ };
}
- var log2 = consoleFunc("log");
- function mapValuesLimit(obj, limit, iteratee, callback) {
- callback = once(callback);
- var newObj = {};
- var _iteratee = wrapAsync(iteratee);
- return eachOfLimit$2(limit)(obj, (val, key, next) => {
- _iteratee(val, key, (err, result) => {
- if (err) return next(err);
- newObj[key] = result;
- next(err);
- });
- }, (err) => callback(err, newObj));
+ function createObjectIterator(obj) {
+ var okeys = obj ? Object.keys(obj) : [];
+ var i = -1;
+ var len = okeys.length;
+ return function next() {
+ var key = okeys[++i];
+ if (key === "__proto__") {
+ return next();
+ }
+ return i < len ? { value: obj[key], key } : null;
+ };
}
- var mapValuesLimit$1 = awaitify(mapValuesLimit, 4);
- function mapValues(obj, iteratee, callback) {
- return mapValuesLimit$1(obj, Infinity, iteratee, callback);
+ function createIterator(coll) {
+ if (isArrayLike(coll)) {
+ return createArrayIterator(coll);
+ }
+ var iterator2 = getIterator(coll);
+ return iterator2 ? createES2015Iterator(iterator2) : createObjectIterator(coll);
}
- function mapValuesSeries(obj, iteratee, callback) {
- return mapValuesLimit$1(obj, 1, iteratee, callback);
+ function onlyOnce(fn) {
+ return function(...args) {
+ if (fn === null) throw new Error("Callback was already called.");
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, args);
+ };
}
- function memoize(fn, hasher = (v) => v) {
- var memo = /* @__PURE__ */ Object.create(null);
- var queues = /* @__PURE__ */ Object.create(null);
- var _fn = wrapAsync(fn);
- var memoized = initialParams((args, callback) => {
- var key = hasher(...args);
- if (key in memo) {
- setImmediate$1(() => callback(null, ...memo[key]));
- } else if (key in queues) {
- queues[key].push(callback);
- } else {
- queues[key] = [callback];
- _fn(...args, (err, ...resultArgs) => {
- if (!err) {
- memo[key] = resultArgs;
- }
- var q = queues[key];
- delete queues[key];
- for (var i = 0, l = q.length; i < l; i++) {
- q[i](err, ...resultArgs);
+ function asyncEachOfLimit(generator, limit, iteratee, callback) {
+ let done = false;
+ let canceled = false;
+ let awaiting = false;
+ let running = 0;
+ let idx = 0;
+ function replenish() {
+ if (running >= limit || awaiting || done) return;
+ awaiting = true;
+ generator.next().then(({ value, done: iterDone }) => {
+ if (canceled || done) return;
+ awaiting = false;
+ if (iterDone) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
}
- });
- }
- });
- memoized.memo = memo;
- memoized.unmemoized = fn;
- return memoized;
- }
- var _defer;
- if (hasNextTick) {
- _defer = process.nextTick;
- } else if (hasSetImmediate) {
- _defer = setImmediate;
- } else {
- _defer = fallback;
- }
- var nextTick = wrap(_defer);
- var _parallel = awaitify((eachfn, tasks, callback) => {
- var results = isArrayLike(tasks) ? [] : {};
- eachfn(tasks, (task, key, taskCb) => {
- wrapAsync(task)((err, ...result) => {
- if (result.length < 2) {
- [result] = result;
+ return;
}
- results[key] = result;
- taskCb(err);
- });
- }, (err) => callback(err, results));
- }, 3);
- function parallel(tasks, callback) {
- return _parallel(eachOf$1, tasks, callback);
- }
- function parallelLimit(tasks, limit, callback) {
- return _parallel(eachOfLimit$2(limit), tasks, callback);
- }
- function queue(worker, concurrency) {
- var _worker = wrapAsync(worker);
- return queue$1((items, cb) => {
- _worker(items[0], cb);
- }, concurrency, 1);
- }
- class Heap {
- constructor() {
- this.heap = [];
- this.pushCount = Number.MIN_SAFE_INTEGER;
- }
- get length() {
- return this.heap.length;
- }
- empty() {
- this.heap = [];
- return this;
+ running++;
+ iteratee(value, idx, iterateeCallback);
+ idx++;
+ replenish();
+ }).catch(handleError);
}
- percUp(index2) {
- let p;
- while (index2 > 0 && smaller(this.heap[index2], this.heap[p = parent(index2)])) {
- let t = this.heap[index2];
- this.heap[index2] = this.heap[p];
- this.heap[p] = t;
- index2 = p;
+ function iterateeCallback(err, result) {
+ running -= 1;
+ if (canceled) return;
+ if (err) return handleError(err);
+ if (err === false) {
+ done = true;
+ canceled = true;
+ return;
}
- }
- percDown(index2) {
- let l;
- while ((l = leftChi(index2)) < this.heap.length) {
- if (l + 1 < this.heap.length && smaller(this.heap[l + 1], this.heap[l])) {
- l = l + 1;
- }
- if (smaller(this.heap[index2], this.heap[l])) {
- break;
- }
- let t = this.heap[index2];
- this.heap[index2] = this.heap[l];
- this.heap[l] = t;
- index2 = l;
+ if (result === breakLoop || done && running <= 0) {
+ done = true;
+ return callback(null);
}
+ replenish();
}
- push(node) {
- node.pushCount = ++this.pushCount;
- this.heap.push(node);
- this.percUp(this.heap.length - 1);
- }
- unshift(node) {
- return this.heap.push(node);
- }
- shift() {
- let [top] = this.heap;
- this.heap[0] = this.heap[this.heap.length - 1];
- this.heap.pop();
- this.percDown(0);
- return top;
- }
- toArray() {
- return [...this];
+ function handleError(err) {
+ if (canceled) return;
+ awaiting = false;
+ done = true;
+ callback(err);
}
- *[Symbol.iterator]() {
- for (let i = 0; i < this.heap.length; i++) {
- yield this.heap[i].data;
+ replenish();
+ }
+ var eachOfLimit$2 = (limit) => {
+ return (obj, iteratee, callback) => {
+ callback = once(callback);
+ if (limit <= 0) {
+ throw new RangeError("concurrency limit cannot be less than 1");
}
- }
- remove(testFn) {
- let j = 0;
- for (let i = 0; i < this.heap.length; i++) {
- if (!testFn(this.heap[i])) {
- this.heap[j] = this.heap[i];
- j++;
- }
+ if (!obj) {
+ return callback(null);
}
- this.heap.splice(j);
- for (let i = parent(this.heap.length - 1); i >= 0; i--) {
- this.percDown(i);
+ if (isAsyncGenerator(obj)) {
+ return asyncEachOfLimit(obj, limit, iteratee, callback);
}
- return this;
- }
- }
- function leftChi(i) {
- return (i << 1) + 1;
- }
- function parent(i) {
- return (i + 1 >> 1) - 1;
- }
- function smaller(x, y) {
- if (x.priority !== y.priority) {
- return x.priority < y.priority;
- } else {
- return x.pushCount < y.pushCount;
- }
- }
- function priorityQueue(worker, concurrency) {
- var q = queue(worker, concurrency);
- var {
- push,
- pushAsync
- } = q;
- q._tasks = new Heap();
- q._createTaskItem = ({ data, priority }, callback) => {
- return {
- data,
- priority,
- callback
- };
- };
- function createDataItems(tasks, priority) {
- if (!Array.isArray(tasks)) {
- return { data: tasks, priority };
+ if (isAsyncIterable(obj)) {
+ return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback);
}
- return tasks.map((data) => {
- return { data, priority };
- });
- }
- q.push = function(data, priority = 0, callback) {
- return push(createDataItems(data, priority), callback);
- };
- q.pushAsync = function(data, priority = 0, callback) {
- return pushAsync(createDataItems(data, priority), callback);
- };
- delete q.unshift;
- delete q.unshiftAsync;
- return q;
- }
- function race(tasks, callback) {
- callback = once(callback);
- if (!Array.isArray(tasks)) return callback(new TypeError("First argument to race must be an array of functions"));
- if (!tasks.length) return callback();
- for (var i = 0, l = tasks.length; i < l; i++) {
- wrapAsync(tasks[i])(callback);
- }
- }
- var race$1 = awaitify(race, 2);
- function reduceRight(array, memo, iteratee, callback) {
- var reversed = [...array].reverse();
- return reduce$1(reversed, memo, iteratee, callback);
- }
- function reflect(fn) {
- var _fn = wrapAsync(fn);
- return initialParams(function reflectOn(args, reflectCallback) {
- args.push((error2, ...cbArgs) => {
- let retVal = {};
- if (error2) {
- retVal.error = error2;
+ var nextElem = createIterator(obj);
+ var done = false;
+ var canceled = false;
+ var running = 0;
+ var looping = false;
+ function iterateeCallback(err, value) {
+ if (canceled) return;
+ running -= 1;
+ if (err) {
+ done = true;
+ callback(err);
+ } else if (err === false) {
+ done = true;
+ canceled = true;
+ } else if (value === breakLoop || done && running <= 0) {
+ done = true;
+ return callback(null);
+ } else if (!looping) {
+ replenish();
}
- if (cbArgs.length > 0) {
- var value = cbArgs;
- if (cbArgs.length <= 1) {
- [value] = cbArgs;
+ }
+ function replenish() {
+ looping = true;
+ while (running < limit && !done) {
+ var elem = nextElem();
+ if (elem === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
}
- retVal.value = value;
+ running += 1;
+ iteratee(elem.value, elem.key, onlyOnce(iterateeCallback));
}
- reflectCallback(null, retVal);
- });
- return _fn.apply(this, args);
- });
+ looping = false;
+ }
+ replenish();
+ };
+ };
+ function eachOfLimit(coll, limit, iteratee, callback) {
+ return eachOfLimit$2(limit)(coll, wrapAsync(iteratee), callback);
}
- function reflectAll(tasks) {
- var results;
- if (Array.isArray(tasks)) {
- results = tasks.map(reflect);
- } else {
- results = {};
- Object.keys(tasks).forEach((key) => {
- results[key] = reflect.call(this, tasks[key]);
- });
+ var eachOfLimit$1 = awaitify(eachOfLimit, 4);
+ function eachOfArrayLike(coll, iteratee, callback) {
+ callback = once(callback);
+ var index2 = 0, completed = 0, { length } = coll, canceled = false;
+ if (length === 0) {
+ callback(null);
+ }
+ function iteratorCallback(err, value) {
+ if (err === false) {
+ canceled = true;
+ }
+ if (canceled === true) return;
+ if (err) {
+ callback(err);
+ } else if (++completed === length || value === breakLoop) {
+ callback(null);
+ }
+ }
+ for (; index2 < length; index2++) {
+ iteratee(coll[index2], index2, onlyOnce(iteratorCallback));
}
- return results;
}
- function reject$2(eachfn, arr, _iteratee, callback) {
- const iteratee = wrapAsync(_iteratee);
- return _filter(eachfn, arr, (value, cb) => {
- iteratee(value, (err, v) => {
- cb(err, !v);
- });
- }, callback);
+ function eachOfGeneric(coll, iteratee, callback) {
+ return eachOfLimit$1(coll, Infinity, iteratee, callback);
}
- function reject(coll, iteratee, callback) {
- return reject$2(eachOf$1, coll, iteratee, callback);
+ function eachOf(coll, iteratee, callback) {
+ var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
+ return eachOfImplementation(coll, wrapAsync(iteratee), callback);
}
- var reject$1 = awaitify(reject, 3);
- function rejectLimit(coll, limit, iteratee, callback) {
- return reject$2(eachOfLimit$2(limit), coll, iteratee, callback);
+ var eachOf$1 = awaitify(eachOf, 3);
+ function map(coll, iteratee, callback) {
+ return _asyncMap(eachOf$1, coll, iteratee, callback);
}
- var rejectLimit$1 = awaitify(rejectLimit, 4);
- function rejectSeries(coll, iteratee, callback) {
- return reject$2(eachOfSeries$1, coll, iteratee, callback);
+ var map$1 = awaitify(map, 3);
+ var applyEach = applyEach$1(map$1);
+ function eachOfSeries(coll, iteratee, callback) {
+ return eachOfLimit$1(coll, 1, iteratee, callback);
}
- var rejectSeries$1 = awaitify(rejectSeries, 3);
- function constant(value) {
- return function() {
- return value;
- };
+ var eachOfSeries$1 = awaitify(eachOfSeries, 3);
+ function mapSeries(coll, iteratee, callback) {
+ return _asyncMap(eachOfSeries$1, coll, iteratee, callback);
}
- const DEFAULT_TIMES = 5;
- const DEFAULT_INTERVAL = 0;
- function retry2(opts, task, callback) {
- var options = {
- times: DEFAULT_TIMES,
- intervalFunc: constant(DEFAULT_INTERVAL)
- };
- if (arguments.length < 3 && typeof opts === "function") {
- callback = task || promiseCallback();
- task = opts;
- } else {
- parseTimes(options, opts);
- callback = callback || promiseCallback();
+ var mapSeries$1 = awaitify(mapSeries, 3);
+ var applyEachSeries = applyEach$1(mapSeries$1);
+ const PROMISE_SYMBOL = /* @__PURE__ */ Symbol("promiseCallback");
+ function promiseCallback() {
+ let resolve7, reject2;
+ function callback(err, ...args) {
+ if (err) return reject2(err);
+ resolve7(args.length > 1 ? args : args[0]);
}
- if (typeof task !== "function") {
- throw new Error("Invalid arguments for async.retry");
+ callback[PROMISE_SYMBOL] = new Promise((res, rej) => {
+ resolve7 = res, reject2 = rej;
+ });
+ return callback;
+ }
+ function auto(tasks, concurrency, callback) {
+ if (typeof concurrency !== "number") {
+ callback = concurrency;
+ concurrency = null;
}
- var _task = wrapAsync(task);
- var attempt = 1;
- function retryAttempt() {
- _task((err, ...args) => {
- if (err === false) return;
- if (err && attempt++ < options.times && (typeof options.errorFilter != "function" || options.errorFilter(err))) {
- setTimeout(retryAttempt, options.intervalFunc(attempt - 1));
- } else {
- callback(err, ...args);
- }
- });
+ callback = once(callback || promiseCallback());
+ var numTasks = Object.keys(tasks).length;
+ if (!numTasks) {
+ return callback(null);
}
- retryAttempt();
- return callback[PROMISE_SYMBOL];
- }
- function parseTimes(acc, t) {
- if (typeof t === "object") {
- acc.times = +t.times || DEFAULT_TIMES;
- acc.intervalFunc = typeof t.interval === "function" ? t.interval : constant(+t.interval || DEFAULT_INTERVAL);
- acc.errorFilter = t.errorFilter;
- } else if (typeof t === "number" || typeof t === "string") {
- acc.times = +t || DEFAULT_TIMES;
- } else {
- throw new Error("Invalid arguments for async.retry");
+ if (!concurrency) {
+ concurrency = numTasks;
}
- }
- function retryable(opts, task) {
- if (!task) {
- task = opts;
- opts = null;
- }
- let arity = opts && opts.arity || task.length;
- if (isAsync(task)) {
- arity += 1;
- }
- var _task = wrapAsync(task);
- return initialParams((args, callback) => {
- if (args.length < arity - 1 || callback == null) {
- args.push(callback);
- callback = promiseCallback();
+ var results = {};
+ var runningTasks = 0;
+ var canceled = false;
+ var hasError = false;
+ var listeners = /* @__PURE__ */ Object.create(null);
+ var readyTasks = [];
+ var readyToCheck = [];
+ var uncheckedDependencies = {};
+ Object.keys(tasks).forEach((key) => {
+ var task = tasks[key];
+ if (!Array.isArray(task)) {
+ enqueueTask(key, [task]);
+ readyToCheck.push(key);
+ return;
}
- function taskFn(cb) {
- _task(...args, cb);
+ var dependencies = task.slice(0, task.length - 1);
+ var remainingDependencies = dependencies.length;
+ if (remainingDependencies === 0) {
+ enqueueTask(key, task);
+ readyToCheck.push(key);
+ return;
}
- if (opts) retry2(opts, taskFn, callback);
- else retry2(taskFn, callback);
- return callback[PROMISE_SYMBOL];
- });
- }
- function series(tasks, callback) {
- return _parallel(eachOfSeries$1, tasks, callback);
- }
- function some(coll, iteratee, callback) {
- return _createTester(Boolean, (res) => res)(eachOf$1, coll, iteratee, callback);
- }
- var some$1 = awaitify(some, 3);
- function someLimit(coll, limit, iteratee, callback) {
- return _createTester(Boolean, (res) => res)(eachOfLimit$2(limit), coll, iteratee, callback);
- }
- var someLimit$1 = awaitify(someLimit, 4);
- function someSeries(coll, iteratee, callback) {
- return _createTester(Boolean, (res) => res)(eachOfSeries$1, coll, iteratee, callback);
- }
- var someSeries$1 = awaitify(someSeries, 3);
- function sortBy(coll, iteratee, callback) {
- var _iteratee = wrapAsync(iteratee);
- return map$1(coll, (x, iterCb) => {
- _iteratee(x, (err, criteria) => {
- if (err) return iterCb(err);
- iterCb(err, { value: x, criteria });
+ uncheckedDependencies[key] = remainingDependencies;
+ dependencies.forEach((dependencyName) => {
+ if (!tasks[dependencyName]) {
+ throw new Error("async.auto task `" + key + "` has a non-existent dependency `" + dependencyName + "` in " + dependencies.join(", "));
+ }
+ addListener(dependencyName, () => {
+ remainingDependencies--;
+ if (remainingDependencies === 0) {
+ enqueueTask(key, task);
+ }
+ });
});
- }, (err, results) => {
- if (err) return callback(err);
- callback(null, results.sort(comparator).map((v) => v.value));
});
- function comparator(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
+ checkForDeadlocks();
+ processQueue();
+ function enqueueTask(key, task) {
+ readyTasks.push(() => runTask(key, task));
}
- }
- var sortBy$1 = awaitify(sortBy, 3);
- function timeout(asyncFn, milliseconds, info2) {
- var fn = wrapAsync(asyncFn);
- return initialParams((args, callback) => {
- var timedOut = false;
- var timer;
- function timeoutCallback() {
- var name = asyncFn.name || "anonymous";
- var error2 = new Error('Callback function "' + name + '" timed out.');
- error2.code = "ETIMEDOUT";
- if (info2) {
- error2.info = info2;
- }
- timedOut = true;
- callback(error2);
+ function processQueue() {
+ if (canceled) return;
+ if (readyTasks.length === 0 && runningTasks === 0) {
+ return callback(null, results);
}
- args.push((...cbArgs) => {
- if (!timedOut) {
- callback(...cbArgs);
- clearTimeout(timer);
+ while (readyTasks.length && runningTasks < concurrency) {
+ var run = readyTasks.shift();
+ run();
+ }
+ }
+ function addListener(taskName, fn) {
+ var taskListeners = listeners[taskName];
+ if (!taskListeners) {
+ taskListeners = listeners[taskName] = [];
+ }
+ taskListeners.push(fn);
+ }
+ function taskComplete(taskName) {
+ var taskListeners = listeners[taskName] || [];
+ taskListeners.forEach((fn) => fn());
+ processQueue();
+ }
+ function runTask(key, task) {
+ if (hasError) return;
+ var taskCallback = onlyOnce((err, ...result) => {
+ runningTasks--;
+ if (err === false) {
+ canceled = true;
+ return;
+ }
+ if (result.length < 2) {
+ [result] = result;
+ }
+ if (err) {
+ var safeResults = {};
+ Object.keys(results).forEach((rkey) => {
+ safeResults[rkey] = results[rkey];
+ });
+ safeResults[key] = result;
+ hasError = true;
+ listeners = /* @__PURE__ */ Object.create(null);
+ if (canceled) return;
+ callback(err, safeResults);
+ } else {
+ results[key] = result;
+ taskComplete(key);
}
});
- timer = setTimeout(timeoutCallback, milliseconds);
- fn(...args);
- });
- }
- function range2(size) {
- var result = Array(size);
- while (size--) {
- result[size] = size;
+ runningTasks++;
+ var taskFn = wrapAsync(task[task.length - 1]);
+ if (task.length > 1) {
+ taskFn(results, taskCallback);
+ } else {
+ taskFn(taskCallback);
+ }
}
- return result;
- }
- function timesLimit(count, limit, iteratee, callback) {
- var _iteratee = wrapAsync(iteratee);
- return mapLimit$1(range2(count), limit, _iteratee, callback);
- }
- function times(n, iteratee, callback) {
- return timesLimit(n, Infinity, iteratee, callback);
- }
- function timesSeries(n, iteratee, callback) {
- return timesLimit(n, 1, iteratee, callback);
- }
- function transform(coll, accumulator, iteratee, callback) {
- if (arguments.length <= 3 && typeof accumulator === "function") {
- callback = iteratee;
- iteratee = accumulator;
- accumulator = Array.isArray(coll) ? [] : {};
+ function checkForDeadlocks() {
+ var currentTask;
+ var counter = 0;
+ while (readyToCheck.length) {
+ currentTask = readyToCheck.pop();
+ counter++;
+ getDependents(currentTask).forEach((dependent) => {
+ if (--uncheckedDependencies[dependent] === 0) {
+ readyToCheck.push(dependent);
+ }
+ });
+ }
+ if (counter !== numTasks) {
+ throw new Error(
+ "async.auto cannot execute tasks due to a recursive dependency"
+ );
+ }
+ }
+ function getDependents(taskName) {
+ var result = [];
+ Object.keys(tasks).forEach((key) => {
+ const task = tasks[key];
+ if (Array.isArray(task) && task.indexOf(taskName) >= 0) {
+ result.push(key);
+ }
+ });
+ return result;
}
- callback = once(callback || promiseCallback());
- var _iteratee = wrapAsync(iteratee);
- eachOf$1(coll, (v, k, cb) => {
- _iteratee(accumulator, v, k, cb);
- }, (err) => callback(err, accumulator));
return callback[PROMISE_SYMBOL];
}
- function tryEach(tasks, callback) {
- var error2 = null;
- var result;
- return eachSeries$1(tasks, (task, taskCb) => {
- wrapAsync(task)((err, ...args) => {
- if (err === false) return taskCb(err);
- if (args.length < 2) {
- [result] = args;
+ var FN_ARGS = /^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/;
+ var ARROW_FN_ARGS = /^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/;
+ var FN_ARG_SPLIT = /,/;
+ var FN_ARG = /(=.+)?(\s*)$/;
+ function stripComments(string) {
+ let stripped = "";
+ let index2 = 0;
+ let endBlockComment = string.indexOf("*/");
+ while (index2 < string.length) {
+ if (string[index2] === "/" && string[index2 + 1] === "/") {
+ let endIndex = string.indexOf("\n", index2);
+ index2 = endIndex === -1 ? string.length : endIndex;
+ } else if (endBlockComment !== -1 && string[index2] === "/" && string[index2 + 1] === "*") {
+ let endIndex = string.indexOf("*/", index2);
+ if (endIndex !== -1) {
+ index2 = endIndex + 2;
+ endBlockComment = string.indexOf("*/", index2);
} else {
- result = args;
+ stripped += string[index2];
+ index2++;
}
- error2 = err;
- taskCb(err ? null : {});
- });
- }, () => callback(error2, result));
- }
- var tryEach$1 = awaitify(tryEach);
- function unmemoize(fn) {
- return (...args) => {
- return (fn.unmemoized || fn)(...args);
- };
+ } else {
+ stripped += string[index2];
+ index2++;
+ }
+ }
+ return stripped;
}
- function whilst(test, iteratee, callback) {
- callback = onlyOnce(callback);
- var _fn = wrapAsync(iteratee);
- var _test = wrapAsync(test);
- var results = [];
- function next(err, ...rest) {
- if (err) return callback(err);
- results = rest;
- if (err === false) return;
- _test(check);
- }
- function check(err, truth) {
- if (err) return callback(err);
- if (err === false) return;
- if (!truth) return callback(null, ...results);
- _fn(next);
+ function parseParams(func) {
+ const src = stripComments(func.toString());
+ let match = src.match(FN_ARGS);
+ if (!match) {
+ match = src.match(ARROW_FN_ARGS);
}
- return _test(check);
+ if (!match) throw new Error("could not parse args in autoInject\nSource:\n" + src);
+ let [, args] = match;
+ return args.replace(/\s/g, "").split(FN_ARG_SPLIT).map((arg) => arg.replace(FN_ARG, "").trim());
}
- var whilst$1 = awaitify(whilst, 3);
- function until(test, iteratee, callback) {
- const _test = wrapAsync(test);
- return whilst$1((cb) => _test((err, truth) => cb(err, !truth)), iteratee, callback);
+ function autoInject(tasks, callback) {
+ var newTasks = {};
+ Object.keys(tasks).forEach((key) => {
+ var taskFn = tasks[key];
+ var params;
+ var fnIsAsync = isAsync(taskFn);
+ var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0;
+ if (Array.isArray(taskFn)) {
+ params = [...taskFn];
+ taskFn = params.pop();
+ newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
+ } else if (hasNoDeps) {
+ newTasks[key] = taskFn;
+ } else {
+ params = parseParams(taskFn);
+ if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {
+ throw new Error("autoInject task functions require explicit parameters.");
+ }
+ if (!fnIsAsync) params.pop();
+ newTasks[key] = params.concat(newTask);
+ }
+ function newTask(results, taskCb) {
+ var newArgs = params.map((name) => results[name]);
+ newArgs.push(taskCb);
+ wrapAsync(taskFn)(...newArgs);
+ }
+ });
+ return auto(newTasks, callback);
}
- function waterfall(tasks, callback) {
- callback = once(callback);
- if (!Array.isArray(tasks)) return callback(new Error("First argument to waterfall must be an array of functions"));
- if (!tasks.length) return callback();
- var taskIndex = 0;
- function nextTask(args) {
- var task = wrapAsync(tasks[taskIndex++]);
- task(...args, onlyOnce(next));
+ class DLL {
+ constructor() {
+ this.head = this.tail = null;
+ this.length = 0;
}
- function next(err, ...args) {
- if (err === false) return;
- if (err || taskIndex === tasks.length) {
- return callback(err, ...args);
+ removeLink(node) {
+ if (node.prev) node.prev.next = node.next;
+ else this.head = node.next;
+ if (node.next) node.next.prev = node.prev;
+ else this.tail = node.prev;
+ node.prev = node.next = null;
+ this.length -= 1;
+ return node;
+ }
+ empty() {
+ while (this.head) this.shift();
+ return this;
+ }
+ insertAfter(node, newNode) {
+ newNode.prev = node;
+ newNode.next = node.next;
+ if (node.next) node.next.prev = newNode;
+ else this.tail = newNode;
+ node.next = newNode;
+ this.length += 1;
+ }
+ insertBefore(node, newNode) {
+ newNode.prev = node.prev;
+ newNode.next = node;
+ if (node.prev) node.prev.next = newNode;
+ else this.head = newNode;
+ node.prev = newNode;
+ this.length += 1;
+ }
+ unshift(node) {
+ if (this.head) this.insertBefore(this.head, node);
+ else setInitial(this, node);
+ }
+ push(node) {
+ if (this.tail) this.insertAfter(this.tail, node);
+ else setInitial(this, node);
+ }
+ shift() {
+ return this.head && this.removeLink(this.head);
+ }
+ pop() {
+ return this.tail && this.removeLink(this.tail);
+ }
+ toArray() {
+ return [...this];
+ }
+ *[Symbol.iterator]() {
+ var cur = this.head;
+ while (cur) {
+ yield cur.data;
+ cur = cur.next;
}
- nextTask(args);
}
- nextTask([]);
+ remove(testFn) {
+ var curr = this.head;
+ while (curr) {
+ var { next } = curr;
+ if (testFn(curr)) {
+ this.removeLink(curr);
+ }
+ curr = next;
+ }
+ return this;
+ }
}
- var waterfall$1 = awaitify(waterfall);
- var index = {
- apply,
- applyEach,
- applyEachSeries,
- asyncify,
- auto,
- autoInject,
- cargo: cargo$1,
- cargoQueue: cargo,
- compose,
- concat: concat$1,
- concatLimit: concatLimit$1,
- concatSeries: concatSeries$1,
- constant: constant$1,
- detect: detect$1,
- detectLimit: detectLimit$1,
- detectSeries: detectSeries$1,
- dir,
- doUntil,
- doWhilst: doWhilst$1,
- each,
- eachLimit: eachLimit$1,
- eachOf: eachOf$1,
- eachOfLimit: eachOfLimit$1,
- eachOfSeries: eachOfSeries$1,
- eachSeries: eachSeries$1,
- ensureAsync,
- every: every$1,
- everyLimit: everyLimit$1,
- everySeries: everySeries$1,
- filter: filter$1,
- filterLimit: filterLimit$1,
- filterSeries: filterSeries$1,
- forever: forever$1,
- groupBy,
- groupByLimit: groupByLimit$1,
- groupBySeries,
- log: log2,
- map: map$1,
- mapLimit: mapLimit$1,
- mapSeries: mapSeries$1,
- mapValues,
- mapValuesLimit: mapValuesLimit$1,
- mapValuesSeries,
- memoize,
- nextTick,
- parallel,
- parallelLimit,
- priorityQueue,
- queue,
- race: race$1,
- reduce: reduce$1,
- reduceRight,
- reflect,
- reflectAll,
- reject: reject$1,
- rejectLimit: rejectLimit$1,
- rejectSeries: rejectSeries$1,
- retry: retry2,
- retryable,
- seq,
- series,
- setImmediate: setImmediate$1,
- some: some$1,
- someLimit: someLimit$1,
- someSeries: someSeries$1,
- sortBy: sortBy$1,
- timeout,
- times,
- timesLimit,
- timesSeries,
- transform,
- tryEach: tryEach$1,
- unmemoize,
- until,
- waterfall: waterfall$1,
- whilst: whilst$1,
- // aliases
- all: every$1,
- allLimit: everyLimit$1,
- allSeries: everySeries$1,
- any: some$1,
- anyLimit: someLimit$1,
- anySeries: someSeries$1,
- find: detect$1,
- findLimit: detectLimit$1,
- findSeries: detectSeries$1,
- flatMap: concat$1,
- flatMapLimit: concatLimit$1,
- flatMapSeries: concatSeries$1,
- forEach: each,
- forEachSeries: eachSeries$1,
- forEachLimit: eachLimit$1,
- forEachOf: eachOf$1,
- forEachOfSeries: eachOfSeries$1,
- forEachOfLimit: eachOfLimit$1,
- inject: reduce$1,
- foldl: reduce$1,
- foldr: reduceRight,
- select: filter$1,
- selectLimit: filterLimit$1,
- selectSeries: filterSeries$1,
- wrapSync: asyncify,
- during: whilst$1,
- doDuring: doWhilst$1
- };
- exports3.all = every$1;
- exports3.allLimit = everyLimit$1;
- exports3.allSeries = everySeries$1;
- exports3.any = some$1;
- exports3.anyLimit = someLimit$1;
- exports3.anySeries = someSeries$1;
- exports3.apply = apply;
- exports3.applyEach = applyEach;
- exports3.applyEachSeries = applyEachSeries;
- exports3.asyncify = asyncify;
- exports3.auto = auto;
- exports3.autoInject = autoInject;
- exports3.cargo = cargo$1;
- exports3.cargoQueue = cargo;
- exports3.compose = compose;
- exports3.concat = concat$1;
- exports3.concatLimit = concatLimit$1;
- exports3.concatSeries = concatSeries$1;
- exports3.constant = constant$1;
- exports3.default = index;
- exports3.detect = detect$1;
- exports3.detectLimit = detectLimit$1;
- exports3.detectSeries = detectSeries$1;
- exports3.dir = dir;
- exports3.doDuring = doWhilst$1;
- exports3.doUntil = doUntil;
- exports3.doWhilst = doWhilst$1;
- exports3.during = whilst$1;
- exports3.each = each;
- exports3.eachLimit = eachLimit$1;
- exports3.eachOf = eachOf$1;
- exports3.eachOfLimit = eachOfLimit$1;
- exports3.eachOfSeries = eachOfSeries$1;
- exports3.eachSeries = eachSeries$1;
- exports3.ensureAsync = ensureAsync;
- exports3.every = every$1;
- exports3.everyLimit = everyLimit$1;
- exports3.everySeries = everySeries$1;
- exports3.filter = filter$1;
- exports3.filterLimit = filterLimit$1;
- exports3.filterSeries = filterSeries$1;
- exports3.find = detect$1;
- exports3.findLimit = detectLimit$1;
- exports3.findSeries = detectSeries$1;
- exports3.flatMap = concat$1;
- exports3.flatMapLimit = concatLimit$1;
- exports3.flatMapSeries = concatSeries$1;
- exports3.foldl = reduce$1;
- exports3.foldr = reduceRight;
- exports3.forEach = each;
- exports3.forEachLimit = eachLimit$1;
- exports3.forEachOf = eachOf$1;
- exports3.forEachOfLimit = eachOfLimit$1;
- exports3.forEachOfSeries = eachOfSeries$1;
- exports3.forEachSeries = eachSeries$1;
- exports3.forever = forever$1;
- exports3.groupBy = groupBy;
- exports3.groupByLimit = groupByLimit$1;
- exports3.groupBySeries = groupBySeries;
- exports3.inject = reduce$1;
- exports3.log = log2;
- exports3.map = map$1;
- exports3.mapLimit = mapLimit$1;
- exports3.mapSeries = mapSeries$1;
- exports3.mapValues = mapValues;
- exports3.mapValuesLimit = mapValuesLimit$1;
- exports3.mapValuesSeries = mapValuesSeries;
- exports3.memoize = memoize;
- exports3.nextTick = nextTick;
- exports3.parallel = parallel;
- exports3.parallelLimit = parallelLimit;
- exports3.priorityQueue = priorityQueue;
- exports3.queue = queue;
- exports3.race = race$1;
- exports3.reduce = reduce$1;
- exports3.reduceRight = reduceRight;
- exports3.reflect = reflect;
- exports3.reflectAll = reflectAll;
- exports3.reject = reject$1;
- exports3.rejectLimit = rejectLimit$1;
- exports3.rejectSeries = rejectSeries$1;
- exports3.retry = retry2;
- exports3.retryable = retryable;
- exports3.select = filter$1;
- exports3.selectLimit = filterLimit$1;
- exports3.selectSeries = filterSeries$1;
- exports3.seq = seq;
- exports3.series = series;
- exports3.setImmediate = setImmediate$1;
- exports3.some = some$1;
- exports3.someLimit = someLimit$1;
- exports3.someSeries = someSeries$1;
- exports3.sortBy = sortBy$1;
- exports3.timeout = timeout;
- exports3.times = times;
- exports3.timesLimit = timesLimit;
- exports3.timesSeries = timesSeries;
- exports3.transform = transform;
- exports3.tryEach = tryEach$1;
- exports3.unmemoize = unmemoize;
- exports3.until = until;
- exports3.waterfall = waterfall$1;
- exports3.whilst = whilst$1;
- exports3.wrapSync = asyncify;
- Object.defineProperty(exports3, "__esModule", { value: true });
- }));
- }
-});
-
-// node_modules/graceful-fs/polyfills.js
-var require_polyfills = __commonJS({
- "node_modules/graceful-fs/polyfills.js"(exports2, module2) {
- var constants4 = require("constants");
- var origCwd = process.cwd;
- var cwd = null;
- var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
- process.cwd = function() {
- if (!cwd)
- cwd = origCwd.call(process);
- return cwd;
- };
- try {
- process.cwd();
- } catch (er) {
- }
- if (typeof process.chdir === "function") {
- chdir = process.chdir;
- process.chdir = function(d) {
- cwd = null;
- chdir.call(process, d);
- };
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
- }
- var chdir;
- module2.exports = patch;
- function patch(fs9) {
- if (constants4.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
- patchLchmod(fs9);
- }
- if (!fs9.lutimes) {
- patchLutimes(fs9);
- }
- fs9.chown = chownFix(fs9.chown);
- fs9.fchown = chownFix(fs9.fchown);
- fs9.lchown = chownFix(fs9.lchown);
- fs9.chmod = chmodFix(fs9.chmod);
- fs9.fchmod = chmodFix(fs9.fchmod);
- fs9.lchmod = chmodFix(fs9.lchmod);
- fs9.chownSync = chownFixSync(fs9.chownSync);
- fs9.fchownSync = chownFixSync(fs9.fchownSync);
- fs9.lchownSync = chownFixSync(fs9.lchownSync);
- fs9.chmodSync = chmodFixSync(fs9.chmodSync);
- fs9.fchmodSync = chmodFixSync(fs9.fchmodSync);
- fs9.lchmodSync = chmodFixSync(fs9.lchmodSync);
- fs9.stat = statFix(fs9.stat);
- fs9.fstat = statFix(fs9.fstat);
- fs9.lstat = statFix(fs9.lstat);
- fs9.statSync = statFixSync(fs9.statSync);
- fs9.fstatSync = statFixSync(fs9.fstatSync);
- fs9.lstatSync = statFixSync(fs9.lstatSync);
- if (fs9.chmod && !fs9.lchmod) {
- fs9.lchmod = function(path6, mode, cb) {
- if (cb) process.nextTick(cb);
- };
- fs9.lchmodSync = function() {
- };
+ function setInitial(dll, node) {
+ dll.length = 1;
+ dll.head = dll.tail = node;
}
- if (fs9.chown && !fs9.lchown) {
- fs9.lchown = function(path6, uid, gid, cb) {
- if (cb) process.nextTick(cb);
- };
- fs9.lchownSync = function() {
+ function queue$1(worker, concurrency, payload) {
+ if (concurrency == null) {
+ concurrency = 1;
+ } else if (concurrency === 0) {
+ throw new RangeError("Concurrency must not be zero");
+ }
+ var _worker = wrapAsync(worker);
+ var numRunning = 0;
+ var workersList = [];
+ const events = {
+ error: [],
+ drain: [],
+ saturated: [],
+ unsaturated: [],
+ empty: []
};
- }
- if (platform2 === "win32") {
- fs9.rename = typeof fs9.rename !== "function" ? fs9.rename : (function(fs$rename) {
- function rename2(from, to, cb) {
- var start = Date.now();
- var backoff = 0;
- fs$rename(from, to, function CB(er) {
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
- setTimeout(function() {
- fs9.stat(to, function(stater, st) {
- if (stater && stater.code === "ENOENT")
- fs$rename(from, to, CB);
- else
- cb(er);
- });
- }, backoff);
- if (backoff < 100)
- backoff += 10;
- return;
- }
- if (cb) cb(er);
- });
- }
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename2, fs$rename);
- return rename2;
- })(fs9.rename);
- }
- fs9.read = typeof fs9.read !== "function" ? fs9.read : (function(fs$read) {
- function read(fd, buffer2, offset, length, position, callback_) {
- var callback;
- if (callback_ && typeof callback_ === "function") {
- var eagCounter = 0;
- callback = function(er, _2, __) {
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
- eagCounter++;
- return fs$read.call(fs9, fd, buffer2, offset, length, position, callback);
- }
- callback_.apply(this, arguments);
- };
- }
- return fs$read.call(fs9, fd, buffer2, offset, length, position, callback);
+ function on(event, handler2) {
+ events[event].push(handler2);
}
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
- return read;
- })(fs9.read);
- fs9.readSync = typeof fs9.readSync !== "function" ? fs9.readSync : /* @__PURE__ */ (function(fs$readSync) {
- return function(fd, buffer2, offset, length, position) {
- var eagCounter = 0;
- while (true) {
- try {
- return fs$readSync.call(fs9, fd, buffer2, offset, length, position);
- } catch (er) {
- if (er.code === "EAGAIN" && eagCounter < 10) {
- eagCounter++;
- continue;
- }
- throw er;
- }
+ function once2(event, handler2) {
+ const handleAndRemove = (...args) => {
+ off(event, handleAndRemove);
+ handler2(...args);
+ };
+ events[event].push(handleAndRemove);
+ }
+ function off(event, handler2) {
+ if (!event) return Object.keys(events).forEach((ev) => events[ev] = []);
+ if (!handler2) return events[event] = [];
+ events[event] = events[event].filter((ev) => ev !== handler2);
+ }
+ function trigger(event, ...args) {
+ events[event].forEach((handler2) => handler2(...args));
+ }
+ var processingScheduled = false;
+ function _insert(data, insertAtFront, rejectOnError, callback) {
+ if (callback != null && typeof callback !== "function") {
+ throw new Error("task callback must be a function");
}
- };
- })(fs9.readSync);
- function patchLchmod(fs10) {
- fs10.lchmod = function(path6, mode, callback) {
- fs10.open(
- path6,
- constants4.O_WRONLY | constants4.O_SYMLINK,
- mode,
- function(err, fd) {
- if (err) {
- if (callback) callback(err);
- return;
- }
- fs10.fchmod(fd, mode, function(err2) {
- fs10.close(fd, function(err22) {
- if (callback) callback(err2 || err22);
- });
- });
- }
+ q.started = true;
+ var res, rej;
+ function promiseCallback2(err, ...args) {
+ if (err) return rejectOnError ? rej(err) : res();
+ if (args.length <= 1) return res(args[0]);
+ res(args);
+ }
+ var item = q._createTaskItem(
+ data,
+ rejectOnError ? promiseCallback2 : callback || promiseCallback2
);
- };
- fs10.lchmodSync = function(path6, mode) {
- var fd = fs10.openSync(path6, constants4.O_WRONLY | constants4.O_SYMLINK, mode);
- var threw = true;
- var ret;
- try {
- ret = fs10.fchmodSync(fd, mode);
- threw = false;
- } finally {
- if (threw) {
- try {
- fs10.closeSync(fd);
- } catch (er) {
- }
- } else {
- fs10.closeSync(fd);
- }
+ if (insertAtFront) {
+ q._tasks.unshift(item);
+ } else {
+ q._tasks.push(item);
}
- return ret;
- };
- }
- function patchLutimes(fs10) {
- if (constants4.hasOwnProperty("O_SYMLINK") && fs10.futimes) {
- fs10.lutimes = function(path6, at, mt, cb) {
- fs10.open(path6, constants4.O_SYMLINK, function(er, fd) {
- if (er) {
- if (cb) cb(er);
- return;
- }
- fs10.futimes(fd, at, mt, function(er2) {
- fs10.close(fd, function(er22) {
- if (cb) cb(er2 || er22);
- });
- });
+ if (!processingScheduled) {
+ processingScheduled = true;
+ setImmediate$1(() => {
+ processingScheduled = false;
+ q.process();
});
- };
- fs10.lutimesSync = function(path6, at, mt) {
- var fd = fs10.openSync(path6, constants4.O_SYMLINK);
- var ret;
- var threw = true;
- try {
- ret = fs10.futimesSync(fd, at, mt);
- threw = false;
- } finally {
- if (threw) {
- try {
- fs10.closeSync(fd);
- } catch (er) {
- }
- } else {
- fs10.closeSync(fd);
+ }
+ if (rejectOnError || !callback) {
+ return new Promise((resolve7, reject2) => {
+ res = resolve7;
+ rej = reject2;
+ });
+ }
+ }
+ function _createCB(tasks) {
+ return function(err, ...args) {
+ numRunning -= 1;
+ for (var i = 0, l = tasks.length; i < l; i++) {
+ var task = tasks[i];
+ var index2 = workersList.indexOf(task);
+ if (index2 === 0) {
+ workersList.shift();
+ } else if (index2 > 0) {
+ workersList.splice(index2, 1);
+ }
+ task.callback(err, ...args);
+ if (err != null) {
+ trigger("error", err, task.data);
}
}
- return ret;
- };
- } else if (fs10.futimes) {
- fs10.lutimes = function(_a, _b, _c, cb) {
- if (cb) process.nextTick(cb);
- };
- fs10.lutimesSync = function() {
+ if (numRunning <= q.concurrency - q.buffer) {
+ trigger("unsaturated");
+ }
+ if (q.idle()) {
+ trigger("drain");
+ }
+ q.process();
};
}
- }
- function chmodFix(orig) {
- if (!orig) return orig;
- return function(target, mode, cb) {
- return orig.call(fs9, target, mode, function(er) {
- if (chownErOk(er)) er = null;
- if (cb) cb.apply(this, arguments);
- });
- };
- }
- function chmodFixSync(orig) {
- if (!orig) return orig;
- return function(target, mode) {
- try {
- return orig.call(fs9, target, mode);
- } catch (er) {
- if (!chownErOk(er)) throw er;
+ function _maybeDrain(data) {
+ if (data.length === 0 && q.idle()) {
+ setImmediate$1(() => trigger("drain"));
+ return true;
}
- };
- }
- function chownFix(orig) {
- if (!orig) return orig;
- return function(target, uid, gid, cb) {
- return orig.call(fs9, target, uid, gid, function(er) {
- if (chownErOk(er)) er = null;
- if (cb) cb.apply(this, arguments);
- });
- };
- }
- function chownFixSync(orig) {
- if (!orig) return orig;
- return function(target, uid, gid) {
- try {
- return orig.call(fs9, target, uid, gid);
- } catch (er) {
- if (!chownErOk(er)) throw er;
+ return false;
+ }
+ const eventMethod = (name) => (handler2) => {
+ if (!handler2) {
+ return new Promise((resolve7, reject2) => {
+ once2(name, (err, data) => {
+ if (err) return reject2(err);
+ resolve7(data);
+ });
+ });
}
+ off(name);
+ on(name, handler2);
};
- }
- function statFix(orig) {
- if (!orig) return orig;
- return function(target, options, cb) {
- if (typeof options === "function") {
- cb = options;
- options = null;
- }
- function callback(er, stats) {
- if (stats) {
- if (stats.uid < 0) stats.uid += 4294967296;
- if (stats.gid < 0) stats.gid += 4294967296;
+ var isProcessing = false;
+ var q = {
+ _tasks: new DLL(),
+ _createTaskItem(data, callback) {
+ return {
+ data,
+ callback
+ };
+ },
+ *[Symbol.iterator]() {
+ yield* q._tasks[Symbol.iterator]();
+ },
+ concurrency,
+ payload,
+ buffer: concurrency / 4,
+ started: false,
+ paused: false,
+ push(data, callback) {
+ if (Array.isArray(data)) {
+ if (_maybeDrain(data)) return;
+ return data.map((datum) => _insert(datum, false, false, callback));
}
- if (cb) cb.apply(this, arguments);
- }
- return options ? orig.call(fs9, target, options, callback) : orig.call(fs9, target, callback);
- };
- }
- function statFixSync(orig) {
- if (!orig) return orig;
- return function(target, options) {
- var stats = options ? orig.call(fs9, target, options) : orig.call(fs9, target);
- if (stats) {
- if (stats.uid < 0) stats.uid += 4294967296;
- if (stats.gid < 0) stats.gid += 4294967296;
- }
- return stats;
- };
- }
- function chownErOk(er) {
- if (!er)
- return true;
- if (er.code === "ENOSYS")
- return true;
- var nonroot = !process.getuid || process.getuid() !== 0;
- if (nonroot) {
- if (er.code === "EINVAL" || er.code === "EPERM")
- return true;
- }
- return false;
- }
- }
- }
-});
-
-// node_modules/graceful-fs/legacy-streams.js
-var require_legacy_streams = __commonJS({
- "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
- var Stream2 = require("stream").Stream;
- module2.exports = legacy;
- function legacy(fs9) {
- return {
- ReadStream,
- WriteStream
- };
- function ReadStream(path6, options) {
- if (!(this instanceof ReadStream)) return new ReadStream(path6, options);
- Stream2.call(this);
- var self2 = this;
- this.path = path6;
- this.fd = null;
- this.readable = true;
- this.paused = false;
- this.flags = "r";
- this.mode = 438;
- this.bufferSize = 64 * 1024;
- options = options || {};
- var keys = Object.keys(options);
- for (var index = 0, length = keys.length; index < length; index++) {
- var key = keys[index];
- this[key] = options[key];
- }
- if (this.encoding) this.setEncoding(this.encoding);
- if (this.start !== void 0) {
- if ("number" !== typeof this.start) {
- throw TypeError("start must be a Number");
+ return _insert(data, false, false, callback);
+ },
+ pushAsync(data, callback) {
+ if (Array.isArray(data)) {
+ if (_maybeDrain(data)) return;
+ return data.map((datum) => _insert(datum, false, true, callback));
+ }
+ return _insert(data, false, true, callback);
+ },
+ kill() {
+ off();
+ q._tasks.empty();
+ },
+ unshift(data, callback) {
+ if (Array.isArray(data)) {
+ if (_maybeDrain(data)) return;
+ return data.map((datum) => _insert(datum, true, false, callback));
+ }
+ return _insert(data, true, false, callback);
+ },
+ unshiftAsync(data, callback) {
+ if (Array.isArray(data)) {
+ if (_maybeDrain(data)) return;
+ return data.map((datum) => _insert(datum, true, true, callback));
+ }
+ return _insert(data, true, true, callback);
+ },
+ remove(testFn) {
+ q._tasks.remove(testFn);
+ },
+ process() {
+ if (isProcessing) {
+ return;
+ }
+ isProcessing = true;
+ while (!q.paused && numRunning < q.concurrency && q._tasks.length) {
+ var tasks = [], data = [];
+ var l = q._tasks.length;
+ if (q.payload) l = Math.min(l, q.payload);
+ for (var i = 0; i < l; i++) {
+ var node = q._tasks.shift();
+ tasks.push(node);
+ workersList.push(node);
+ data.push(node.data);
+ }
+ numRunning += 1;
+ if (q._tasks.length === 0) {
+ trigger("empty");
+ }
+ if (numRunning === q.concurrency) {
+ trigger("saturated");
+ }
+ var cb = onlyOnce(_createCB(tasks));
+ _worker(data, cb);
+ }
+ isProcessing = false;
+ },
+ length() {
+ return q._tasks.length;
+ },
+ running() {
+ return numRunning;
+ },
+ workersList() {
+ return workersList;
+ },
+ idle() {
+ return q._tasks.length + numRunning === 0;
+ },
+ pause() {
+ q.paused = true;
+ },
+ resume() {
+ if (q.paused === false) {
+ return;
+ }
+ q.paused = false;
+ setImmediate$1(q.process);
}
- if (this.end === void 0) {
- this.end = Infinity;
- } else if ("number" !== typeof this.end) {
- throw TypeError("end must be a Number");
+ };
+ Object.defineProperties(q, {
+ saturated: {
+ writable: false,
+ value: eventMethod("saturated")
+ },
+ unsaturated: {
+ writable: false,
+ value: eventMethod("unsaturated")
+ },
+ empty: {
+ writable: false,
+ value: eventMethod("empty")
+ },
+ drain: {
+ writable: false,
+ value: eventMethod("drain")
+ },
+ error: {
+ writable: false,
+ value: eventMethod("error")
}
- if (this.start > this.end) {
- throw new Error("start must be <= end");
+ });
+ return q;
+ }
+ function cargo$1(worker, payload) {
+ return queue$1(worker, 1, payload);
+ }
+ function cargo(worker, concurrency, payload) {
+ return queue$1(worker, concurrency, payload);
+ }
+ function reduce(coll, memo, iteratee, callback) {
+ callback = once(callback);
+ var _iteratee = wrapAsync(iteratee);
+ return eachOfSeries$1(coll, (x, i, iterCb) => {
+ _iteratee(memo, x, (err, v) => {
+ memo = v;
+ iterCb(err);
+ });
+ }, (err) => callback(err, memo));
+ }
+ var reduce$1 = awaitify(reduce, 4);
+ function seq(...functions) {
+ var _functions = functions.map(wrapAsync);
+ return function(...args) {
+ var that = this;
+ var cb = args[args.length - 1];
+ if (typeof cb == "function") {
+ args.pop();
+ } else {
+ cb = promiseCallback();
}
- this.pos = this.start;
- }
- if (this.fd !== null) {
- process.nextTick(function() {
- self2._read();
+ reduce$1(
+ _functions,
+ args,
+ (newargs, fn, iterCb) => {
+ fn.apply(that, newargs.concat((err, ...nextargs) => {
+ iterCb(err, nextargs);
+ }));
+ },
+ (err, results) => cb(err, ...results)
+ );
+ return cb[PROMISE_SYMBOL];
+ };
+ }
+ function compose(...args) {
+ return seq(...args.reverse());
+ }
+ function mapLimit(coll, limit, iteratee, callback) {
+ return _asyncMap(eachOfLimit$2(limit), coll, iteratee, callback);
+ }
+ var mapLimit$1 = awaitify(mapLimit, 4);
+ function concatLimit(coll, limit, iteratee, callback) {
+ var _iteratee = wrapAsync(iteratee);
+ return mapLimit$1(coll, limit, (val, iterCb) => {
+ _iteratee(val, (err, ...args) => {
+ if (err) return iterCb(err);
+ return iterCb(err, args);
});
- return;
- }
- fs9.open(this.path, this.flags, this.mode, function(err, fd) {
- if (err) {
- self2.emit("error", err);
- self2.readable = false;
- return;
+ }, (err, mapResults) => {
+ var result = [];
+ for (var i = 0; i < mapResults.length; i++) {
+ if (mapResults[i]) {
+ result = result.concat(...mapResults[i]);
+ }
}
- self2.fd = fd;
- self2.emit("open", fd);
- self2._read();
+ return callback(err, result);
});
}
- function WriteStream(path6, options) {
- if (!(this instanceof WriteStream)) return new WriteStream(path6, options);
- Stream2.call(this);
- this.path = path6;
- this.fd = null;
- this.writable = true;
- this.flags = "w";
- this.encoding = "binary";
- this.mode = 438;
- this.bytesWritten = 0;
- options = options || {};
- var keys = Object.keys(options);
- for (var index = 0, length = keys.length; index < length; index++) {
- var key = keys[index];
- this[key] = options[key];
- }
- if (this.start !== void 0) {
- if ("number" !== typeof this.start) {
- throw TypeError("start must be a Number");
- }
- if (this.start < 0) {
- throw new Error("start must be >= zero");
- }
- this.pos = this.start;
- }
- this.busy = false;
- this._queue = [];
- if (this.fd === null) {
- this._open = fs9.open;
- this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
- this.flush();
- }
+ var concatLimit$1 = awaitify(concatLimit, 4);
+ function concat2(coll, iteratee, callback) {
+ return concatLimit$1(coll, Infinity, iteratee, callback);
}
- }
- }
-});
-
-// node_modules/graceful-fs/clone.js
-var require_clone = __commonJS({
- "node_modules/graceful-fs/clone.js"(exports2, module2) {
- "use strict";
- module2.exports = clone;
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
- return obj.__proto__;
- };
- function clone(obj) {
- if (obj === null || typeof obj !== "object")
- return obj;
- if (obj instanceof Object)
- var copy = { __proto__: getPrototypeOf(obj) };
- else
- var copy = /* @__PURE__ */ Object.create(null);
- Object.getOwnPropertyNames(obj).forEach(function(key) {
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
- });
- return copy;
- }
- }
-});
-
-// node_modules/graceful-fs/graceful-fs.js
-var require_graceful_fs = __commonJS({
- "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
- var fs9 = require("fs");
- var polyfills = require_polyfills();
- var legacy = require_legacy_streams();
- var clone = require_clone();
- var util3 = require("util");
- var gracefulQueue;
- var previousSymbol;
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
- gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue");
- previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous");
- } else {
- gracefulQueue = "___graceful-fs.queue";
- previousSymbol = "___graceful-fs.previous";
- }
- function noop3() {
- }
- function publishQueue(context6, queue2) {
- Object.defineProperty(context6, gracefulQueue, {
- get: function() {
- return queue2;
- }
- });
- }
- var debug2 = noop3;
- if (util3.debuglog)
- debug2 = util3.debuglog("gfs4");
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
- debug2 = function() {
- var m = util3.format.apply(util3, arguments);
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
- console.error(m);
- };
- if (!fs9[gracefulQueue]) {
- queue = global[gracefulQueue] || [];
- publishQueue(fs9, queue);
- fs9.close = (function(fs$close) {
- function close(fd, cb) {
- return fs$close.call(fs9, fd, function(err) {
- if (!err) {
- resetQueue();
- }
- if (typeof cb === "function")
- cb.apply(this, arguments);
- });
- }
- Object.defineProperty(close, previousSymbol, {
- value: fs$close
- });
- return close;
- })(fs9.close);
- fs9.closeSync = (function(fs$closeSync) {
- function closeSync(fd) {
- fs$closeSync.apply(fs9, arguments);
- resetQueue();
- }
- Object.defineProperty(closeSync, previousSymbol, {
- value: fs$closeSync
- });
- return closeSync;
- })(fs9.closeSync);
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
- process.on("exit", function() {
- debug2(fs9[gracefulQueue]);
- require("assert").equal(fs9[gracefulQueue].length, 0);
- });
+ var concat$1 = awaitify(concat2, 3);
+ function concatSeries(coll, iteratee, callback) {
+ return concatLimit$1(coll, 1, iteratee, callback);
}
- }
- var queue;
- if (!global[gracefulQueue]) {
- publishQueue(global, fs9[gracefulQueue]);
- }
- module2.exports = patch(clone(fs9));
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs9.__patched) {
- module2.exports = patch(fs9);
- fs9.__patched = true;
- }
- function patch(fs10) {
- polyfills(fs10);
- fs10.gracefulify = patch;
- fs10.createReadStream = createReadStream2;
- fs10.createWriteStream = createWriteStream2;
- var fs$readFile = fs10.readFile;
- fs10.readFile = readFile4;
- function readFile4(path6, options, cb) {
- if (typeof options === "function")
- cb = options, options = null;
- return go$readFile(path6, options, cb);
- function go$readFile(path7, options2, cb2, startTime) {
- return fs$readFile(path7, options2, function(err) {
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
- enqueue([go$readFile, [path7, options2, cb2], err, startTime || Date.now(), Date.now()]);
- else {
- if (typeof cb2 === "function")
- cb2.apply(this, arguments);
- }
- });
- }
+ var concatSeries$1 = awaitify(concatSeries, 3);
+ function constant$1(...args) {
+ return function(...ignoredArgs) {
+ var callback = ignoredArgs.pop();
+ return callback(null, ...args);
+ };
}
- var fs$writeFile = fs10.writeFile;
- fs10.writeFile = writeFile4;
- function writeFile4(path6, data, options, cb) {
- if (typeof options === "function")
- cb = options, options = null;
- return go$writeFile(path6, data, options, cb);
- function go$writeFile(path7, data2, options2, cb2, startTime) {
- return fs$writeFile(path7, data2, options2, function(err) {
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
- enqueue([go$writeFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
- else {
- if (typeof cb2 === "function")
- cb2.apply(this, arguments);
- }
+ function _createTester(check, getResult) {
+ return (eachfn, arr, _iteratee, cb) => {
+ var testPassed = false;
+ var testResult;
+ const iteratee = wrapAsync(_iteratee);
+ eachfn(arr, (value, _2, callback) => {
+ iteratee(value, (err, result) => {
+ if (err || err === false) return callback(err);
+ if (check(result) && !testResult) {
+ testPassed = true;
+ testResult = getResult(true, value);
+ return callback(null, breakLoop);
+ }
+ callback();
+ });
+ }, (err) => {
+ if (err) return cb(err);
+ cb(null, testPassed ? testResult : getResult(false));
});
- }
+ };
}
- var fs$appendFile = fs10.appendFile;
- if (fs$appendFile)
- fs10.appendFile = appendFile2;
- function appendFile2(path6, data, options, cb) {
- if (typeof options === "function")
- cb = options, options = null;
- return go$appendFile(path6, data, options, cb);
- function go$appendFile(path7, data2, options2, cb2, startTime) {
- return fs$appendFile(path7, data2, options2, function(err) {
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
- enqueue([go$appendFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
- else {
- if (typeof cb2 === "function")
- cb2.apply(this, arguments);
+ function detect(coll, iteratee, callback) {
+ return _createTester((bool) => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback);
+ }
+ var detect$1 = awaitify(detect, 3);
+ function detectLimit(coll, limit, iteratee, callback) {
+ return _createTester((bool) => bool, (res, item) => item)(eachOfLimit$2(limit), coll, iteratee, callback);
+ }
+ var detectLimit$1 = awaitify(detectLimit, 4);
+ function detectSeries(coll, iteratee, callback) {
+ return _createTester((bool) => bool, (res, item) => item)(eachOfLimit$2(1), coll, iteratee, callback);
+ }
+ var detectSeries$1 = awaitify(detectSeries, 3);
+ function consoleFunc(name) {
+ return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => {
+ if (typeof console === "object") {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ } else if (console[name]) {
+ resultArgs.forEach((x) => console[name](x));
}
- });
- }
+ }
+ });
}
- var fs$copyFile = fs10.copyFile;
- if (fs$copyFile)
- fs10.copyFile = copyFile3;
- function copyFile3(src, dest, flags, cb) {
- if (typeof flags === "function") {
- cb = flags;
- flags = 0;
+ var dir = consoleFunc("dir");
+ function doWhilst(iteratee, test, callback) {
+ callback = onlyOnce(callback);
+ var _fn = wrapAsync(iteratee);
+ var _test = wrapAsync(test);
+ var results;
+ function next(err, ...args) {
+ if (err) return callback(err);
+ if (err === false) return;
+ results = args;
+ _test(...args, check);
}
- return go$copyFile(src, dest, flags, cb);
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
- return fs$copyFile(src2, dest2, flags2, function(err) {
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
- enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
- else {
- if (typeof cb2 === "function")
- cb2.apply(this, arguments);
+ function check(err, truth) {
+ if (err) return callback(err);
+ if (err === false) return;
+ if (!truth) return callback(null, ...results);
+ _fn(next);
+ }
+ return check(null, true);
+ }
+ var doWhilst$1 = awaitify(doWhilst, 3);
+ function doUntil(iteratee, test, callback) {
+ const _test = wrapAsync(test);
+ return doWhilst$1(iteratee, (...args) => {
+ const cb = args.pop();
+ _test(...args, (err, truth) => cb(err, !truth));
+ }, callback);
+ }
+ function _withoutIndex(iteratee) {
+ return (value, index2, callback) => iteratee(value, callback);
+ }
+ function eachLimit$2(coll, iteratee, callback) {
+ return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
+ }
+ var each = awaitify(eachLimit$2, 3);
+ function eachLimit(coll, limit, iteratee, callback) {
+ return eachOfLimit$2(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
+ }
+ var eachLimit$1 = awaitify(eachLimit, 4);
+ function eachSeries(coll, iteratee, callback) {
+ return eachLimit$1(coll, 1, iteratee, callback);
+ }
+ var eachSeries$1 = awaitify(eachSeries, 3);
+ function ensureAsync(fn) {
+ if (isAsync(fn)) return fn;
+ return function(...args) {
+ var callback = args.pop();
+ var sync = true;
+ args.push((...innerArgs) => {
+ if (sync) {
+ setImmediate$1(() => callback(...innerArgs));
+ } else {
+ callback(...innerArgs);
}
});
- }
+ fn.apply(this, args);
+ sync = false;
+ };
}
- var fs$readdir = fs10.readdir;
- fs10.readdir = readdir2;
- var noReaddirOptionVersions = /^v[0-5]\./;
- function readdir2(path6, options, cb) {
- if (typeof options === "function")
- cb = options, options = null;
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path7, options2, cb2, startTime) {
- return fs$readdir(path7, fs$readdirCallback(
- path7,
- options2,
- cb2,
- startTime
- ));
- } : function go$readdir2(path7, options2, cb2, startTime) {
- return fs$readdir(path7, options2, fs$readdirCallback(
- path7,
- options2,
- cb2,
- startTime
- ));
- };
- return go$readdir(path6, options, cb);
- function fs$readdirCallback(path7, options2, cb2, startTime) {
- return function(err, files) {
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
- enqueue([
- go$readdir,
- [path7, options2, cb2],
- err,
- startTime || Date.now(),
- Date.now()
- ]);
- else {
- if (files && files.sort)
- files.sort();
- if (typeof cb2 === "function")
- cb2.call(this, err, files);
- }
- };
- }
- }
- if (process.version.substr(0, 4) === "v0.8") {
- var legStreams = legacy(fs10);
- ReadStream = legStreams.ReadStream;
- WriteStream = legStreams.WriteStream;
- }
- var fs$ReadStream = fs10.ReadStream;
- if (fs$ReadStream) {
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
- ReadStream.prototype.open = ReadStream$open;
+ function every(coll, iteratee, callback) {
+ return _createTester((bool) => !bool, (res) => !res)(eachOf$1, coll, iteratee, callback);
}
- var fs$WriteStream = fs10.WriteStream;
- if (fs$WriteStream) {
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
- WriteStream.prototype.open = WriteStream$open;
+ var every$1 = awaitify(every, 3);
+ function everyLimit(coll, limit, iteratee, callback) {
+ return _createTester((bool) => !bool, (res) => !res)(eachOfLimit$2(limit), coll, iteratee, callback);
}
- Object.defineProperty(fs10, "ReadStream", {
- get: function() {
- return ReadStream;
- },
- set: function(val) {
- ReadStream = val;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(fs10, "WriteStream", {
- get: function() {
- return WriteStream;
- },
- set: function(val) {
- WriteStream = val;
- },
- enumerable: true,
- configurable: true
- });
- var FileReadStream = ReadStream;
- Object.defineProperty(fs10, "FileReadStream", {
- get: function() {
- return FileReadStream;
- },
- set: function(val) {
- FileReadStream = val;
- },
- enumerable: true,
- configurable: true
- });
- var FileWriteStream = WriteStream;
- Object.defineProperty(fs10, "FileWriteStream", {
- get: function() {
- return FileWriteStream;
- },
- set: function(val) {
- FileWriteStream = val;
- },
- enumerable: true,
- configurable: true
- });
- function ReadStream(path6, options) {
- if (this instanceof ReadStream)
- return fs$ReadStream.apply(this, arguments), this;
- else
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
+ var everyLimit$1 = awaitify(everyLimit, 4);
+ function everySeries(coll, iteratee, callback) {
+ return _createTester((bool) => !bool, (res) => !res)(eachOfSeries$1, coll, iteratee, callback);
}
- function ReadStream$open() {
- var that = this;
- open3(that.path, that.flags, that.mode, function(err, fd) {
- if (err) {
- if (that.autoClose)
- that.destroy();
- that.emit("error", err);
- } else {
- that.fd = fd;
- that.emit("open", fd);
- that.read();
+ var everySeries$1 = awaitify(everySeries, 3);
+ function filterArray(eachfn, arr, iteratee, callback) {
+ var truthValues = new Array(arr.length);
+ eachfn(arr, (x, index2, iterCb) => {
+ iteratee(x, (err, v) => {
+ truthValues[index2] = !!v;
+ iterCb(err);
+ });
+ }, (err) => {
+ if (err) return callback(err);
+ var results = [];
+ for (var i = 0; i < arr.length; i++) {
+ if (truthValues[i]) results.push(arr[i]);
}
+ callback(null, results);
});
}
- function WriteStream(path6, options) {
- if (this instanceof WriteStream)
- return fs$WriteStream.apply(this, arguments), this;
- else
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
- }
- function WriteStream$open() {
- var that = this;
- open3(that.path, that.flags, that.mode, function(err, fd) {
- if (err) {
- that.destroy();
- that.emit("error", err);
- } else {
- that.fd = fd;
- that.emit("open", fd);
- }
+ function filterGeneric(eachfn, coll, iteratee, callback) {
+ var results = [];
+ eachfn(coll, (x, index2, iterCb) => {
+ iteratee(x, (err, v) => {
+ if (err) return iterCb(err);
+ if (v) {
+ results.push({ index: index2, value: x });
+ }
+ iterCb(err);
+ });
+ }, (err) => {
+ if (err) return callback(err);
+ callback(null, results.sort((a, b) => a.index - b.index).map((v) => v.value));
});
}
- function createReadStream2(path6, options) {
- return new fs10.ReadStream(path6, options);
+ function _filter(eachfn, coll, iteratee, callback) {
+ var filter2 = isArrayLike(coll) ? filterArray : filterGeneric;
+ return filter2(eachfn, coll, wrapAsync(iteratee), callback);
}
- function createWriteStream2(path6, options) {
- return new fs10.WriteStream(path6, options);
+ function filter(coll, iteratee, callback) {
+ return _filter(eachOf$1, coll, iteratee, callback);
}
- var fs$open = fs10.open;
- fs10.open = open3;
- function open3(path6, flags, mode, cb) {
- if (typeof mode === "function")
- cb = mode, mode = null;
- return go$open(path6, flags, mode, cb);
- function go$open(path7, flags2, mode2, cb2, startTime) {
- return fs$open(path7, flags2, mode2, function(err, fd) {
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
- enqueue([go$open, [path7, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
- else {
- if (typeof cb2 === "function")
- cb2.apply(this, arguments);
- }
- });
- }
+ var filter$1 = awaitify(filter, 3);
+ function filterLimit(coll, limit, iteratee, callback) {
+ return _filter(eachOfLimit$2(limit), coll, iteratee, callback);
}
- return fs10;
- }
- function enqueue(elem) {
- debug2("ENQUEUE", elem[0].name, elem[1]);
- fs9[gracefulQueue].push(elem);
- retry2();
- }
- var retryTimer;
- function resetQueue() {
- var now = Date.now();
- for (var i = 0; i < fs9[gracefulQueue].length; ++i) {
- if (fs9[gracefulQueue][i].length > 2) {
- fs9[gracefulQueue][i][3] = now;
- fs9[gracefulQueue][i][4] = now;
- }
+ var filterLimit$1 = awaitify(filterLimit, 4);
+ function filterSeries(coll, iteratee, callback) {
+ return _filter(eachOfSeries$1, coll, iteratee, callback);
}
- retry2();
- }
- function retry2() {
- clearTimeout(retryTimer);
- retryTimer = void 0;
- if (fs9[gracefulQueue].length === 0)
- return;
- var elem = fs9[gracefulQueue].shift();
- var fn = elem[0];
- var args = elem[1];
- var err = elem[2];
- var startTime = elem[3];
- var lastTime = elem[4];
- if (startTime === void 0) {
- debug2("RETRY", fn.name, args);
- fn.apply(null, args);
- } else if (Date.now() - startTime >= 6e4) {
- debug2("TIMEOUT", fn.name, args);
- var cb = args.pop();
- if (typeof cb === "function")
- cb.call(null, err);
- } else {
- var sinceAttempt = Date.now() - lastTime;
- var sinceStart = Math.max(lastTime - startTime, 1);
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
- if (sinceAttempt >= desiredDelay) {
- debug2("RETRY", fn.name, args);
- fn.apply(null, args.concat([startTime]));
- } else {
- fs9[gracefulQueue].push(elem);
+ var filterSeries$1 = awaitify(filterSeries, 3);
+ function forever(fn, errback) {
+ var done = onlyOnce(errback);
+ var task = wrapAsync(ensureAsync(fn));
+ function next(err) {
+ if (err) return done(err);
+ if (err === false) return;
+ task(next);
}
+ return next();
}
- if (retryTimer === void 0) {
- retryTimer = setTimeout(retry2, 0);
- }
- }
- }
-});
-
-// node_modules/is-stream/index.js
-var require_is_stream = __commonJS({
- "node_modules/is-stream/index.js"(exports2, module2) {
- "use strict";
- var isStream = (stream4) => stream4 !== null && typeof stream4 === "object" && typeof stream4.pipe === "function";
- isStream.writable = (stream4) => isStream(stream4) && stream4.writable !== false && typeof stream4._write === "function" && typeof stream4._writableState === "object";
- isStream.readable = (stream4) => isStream(stream4) && stream4.readable !== false && typeof stream4._read === "function" && typeof stream4._readableState === "object";
- isStream.duplex = (stream4) => isStream.writable(stream4) && isStream.readable(stream4);
- isStream.transform = (stream4) => isStream.duplex(stream4) && typeof stream4._transform === "function";
- module2.exports = isStream;
- }
-});
-
-// node_modules/process-nextick-args/index.js
-var require_process_nextick_args = __commonJS({
- "node_modules/process-nextick-args/index.js"(exports2, module2) {
- "use strict";
- if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
- module2.exports = { nextTick };
- } else {
- module2.exports = process;
- }
- function nextTick(fn, arg1, arg2, arg3) {
- if (typeof fn !== "function") {
- throw new TypeError('"callback" argument must be a function');
- }
- var len = arguments.length;
- var args, i;
- switch (len) {
- case 0:
- case 1:
- return process.nextTick(fn);
- case 2:
- return process.nextTick(function afterTickOne() {
- fn.call(null, arg1);
- });
- case 3:
- return process.nextTick(function afterTickTwo() {
- fn.call(null, arg1, arg2);
- });
- case 4:
- return process.nextTick(function afterTickThree() {
- fn.call(null, arg1, arg2, arg3);
+ var forever$1 = awaitify(forever, 2);
+ function groupByLimit(coll, limit, iteratee, callback) {
+ var _iteratee = wrapAsync(iteratee);
+ return mapLimit$1(coll, limit, (val, iterCb) => {
+ _iteratee(val, (err, key) => {
+ if (err) return iterCb(err);
+ return iterCb(err, { key, val });
});
- default:
- args = new Array(len - 1);
- i = 0;
- while (i < args.length) {
- args[i++] = arguments[i];
+ }, (err, mapResults) => {
+ var result = {};
+ var { hasOwnProperty } = Object.prototype;
+ for (var i = 0; i < mapResults.length; i++) {
+ if (mapResults[i]) {
+ var { key } = mapResults[i];
+ var { val } = mapResults[i];
+ if (hasOwnProperty.call(result, key)) {
+ result[key].push(val);
+ } else {
+ result[key] = [val];
+ }
+ }
}
- return process.nextTick(function afterTick() {
- fn.apply(null, args);
+ return callback(err, result);
+ });
+ }
+ var groupByLimit$1 = awaitify(groupByLimit, 4);
+ function groupBy(coll, iteratee, callback) {
+ return groupByLimit$1(coll, Infinity, iteratee, callback);
+ }
+ function groupBySeries(coll, iteratee, callback) {
+ return groupByLimit$1(coll, 1, iteratee, callback);
+ }
+ var log2 = consoleFunc("log");
+ function mapValuesLimit(obj, limit, iteratee, callback) {
+ callback = once(callback);
+ var newObj = {};
+ var _iteratee = wrapAsync(iteratee);
+ return eachOfLimit$2(limit)(obj, (val, key, next) => {
+ _iteratee(val, key, (err, result) => {
+ if (err) return next(err);
+ newObj[key] = result;
+ next(err);
});
+ }, (err) => callback(err, newObj));
}
- }
- }
-});
-
-// node_modules/isarray/index.js
-var require_isarray = __commonJS({
- "node_modules/isarray/index.js"(exports2, module2) {
- var toString3 = {}.toString;
- module2.exports = Array.isArray || function(arr) {
- return toString3.call(arr) == "[object Array]";
- };
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream.js
-var require_stream = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream.js"(exports2, module2) {
- module2.exports = require("stream");
- }
-});
-
-// node_modules/lazystream/node_modules/safe-buffer/index.js
-var require_safe_buffer = __commonJS({
- "node_modules/lazystream/node_modules/safe-buffer/index.js"(exports2, module2) {
- var buffer2 = require("buffer");
- var Buffer3 = buffer2.Buffer;
- function copyProps(src, dst) {
- for (var key in src) {
- dst[key] = src[key];
+ var mapValuesLimit$1 = awaitify(mapValuesLimit, 4);
+ function mapValues(obj, iteratee, callback) {
+ return mapValuesLimit$1(obj, Infinity, iteratee, callback);
}
- }
- if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
- module2.exports = buffer2;
- } else {
- copyProps(buffer2, exports2);
- exports2.Buffer = SafeBuffer;
- }
- function SafeBuffer(arg, encodingOrOffset, length) {
- return Buffer3(arg, encodingOrOffset, length);
- }
- copyProps(Buffer3, SafeBuffer);
- SafeBuffer.from = function(arg, encodingOrOffset, length) {
- if (typeof arg === "number") {
- throw new TypeError("Argument must not be a number");
+ function mapValuesSeries(obj, iteratee, callback) {
+ return mapValuesLimit$1(obj, 1, iteratee, callback);
}
- return Buffer3(arg, encodingOrOffset, length);
- };
- SafeBuffer.alloc = function(size, fill, encoding) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
+ function memoize(fn, hasher = (v) => v) {
+ var memo = /* @__PURE__ */ Object.create(null);
+ var queues = /* @__PURE__ */ Object.create(null);
+ var _fn = wrapAsync(fn);
+ var memoized = initialParams((args, callback) => {
+ var key = hasher(...args);
+ if (key in memo) {
+ setImmediate$1(() => callback(null, ...memo[key]));
+ } else if (key in queues) {
+ queues[key].push(callback);
+ } else {
+ queues[key] = [callback];
+ _fn(...args, (err, ...resultArgs) => {
+ if (!err) {
+ memo[key] = resultArgs;
+ }
+ var q = queues[key];
+ delete queues[key];
+ for (var i = 0, l = q.length; i < l; i++) {
+ q[i](err, ...resultArgs);
+ }
+ });
+ }
+ });
+ memoized.memo = memo;
+ memoized.unmemoized = fn;
+ return memoized;
}
- var buf = Buffer3(size);
- if (fill !== void 0) {
- if (typeof encoding === "string") {
- buf.fill(fill, encoding);
- } else {
- buf.fill(fill);
- }
+ var _defer;
+ if (hasNextTick) {
+ _defer = process.nextTick;
+ } else if (hasSetImmediate) {
+ _defer = setImmediate;
} else {
- buf.fill(0);
+ _defer = fallback;
}
- return buf;
- };
- SafeBuffer.allocUnsafe = function(size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
+ var nextTick = wrap(_defer);
+ var _parallel = awaitify((eachfn, tasks, callback) => {
+ var results = isArrayLike(tasks) ? [] : {};
+ eachfn(tasks, (task, key, taskCb) => {
+ wrapAsync(task)((err, ...result) => {
+ if (result.length < 2) {
+ [result] = result;
+ }
+ results[key] = result;
+ taskCb(err);
+ });
+ }, (err) => callback(err, results));
+ }, 3);
+ function parallel(tasks, callback) {
+ return _parallel(eachOf$1, tasks, callback);
}
- return Buffer3(size);
- };
- SafeBuffer.allocUnsafeSlow = function(size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
+ function parallelLimit(tasks, limit, callback) {
+ return _parallel(eachOfLimit$2(limit), tasks, callback);
}
- return buffer2.SlowBuffer(size);
- };
- }
-});
-
-// node_modules/core-util-is/lib/util.js
-var require_util9 = __commonJS({
- "node_modules/core-util-is/lib/util.js"(exports2) {
- function isArray(arg) {
- if (Array.isArray) {
- return Array.isArray(arg);
+ function queue(worker, concurrency) {
+ var _worker = wrapAsync(worker);
+ return queue$1((items, cb) => {
+ _worker(items[0], cb);
+ }, concurrency, 1);
}
- return objectToString(arg) === "[object Array]";
- }
- exports2.isArray = isArray;
- function isBoolean(arg) {
- return typeof arg === "boolean";
- }
- exports2.isBoolean = isBoolean;
- function isNull(arg) {
- return arg === null;
- }
- exports2.isNull = isNull;
- function isNullOrUndefined(arg) {
- return arg == null;
- }
- exports2.isNullOrUndefined = isNullOrUndefined;
- function isNumber(arg) {
- return typeof arg === "number";
- }
- exports2.isNumber = isNumber;
- function isString(arg) {
- return typeof arg === "string";
- }
- exports2.isString = isString;
- function isSymbol(arg) {
- return typeof arg === "symbol";
- }
- exports2.isSymbol = isSymbol;
- function isUndefined(arg) {
- return arg === void 0;
- }
- exports2.isUndefined = isUndefined;
- function isRegExp(re) {
- return objectToString(re) === "[object RegExp]";
- }
- exports2.isRegExp = isRegExp;
- function isObject2(arg) {
- return typeof arg === "object" && arg !== null;
- }
- exports2.isObject = isObject2;
- function isDate(d) {
- return objectToString(d) === "[object Date]";
- }
- exports2.isDate = isDate;
- function isError3(e) {
- return objectToString(e) === "[object Error]" || e instanceof Error;
- }
- exports2.isError = isError3;
- function isFunction(arg) {
- return typeof arg === "function";
- }
- exports2.isFunction = isFunction;
- function isPrimitive(arg) {
- return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
- typeof arg === "undefined";
- }
- exports2.isPrimitive = isPrimitive;
- exports2.isBuffer = require("buffer").Buffer.isBuffer;
- function objectToString(o) {
- return Object.prototype.toString.call(o);
- }
- }
-});
-
-// node_modules/inherits/inherits_browser.js
-var require_inherits_browser = __commonJS({
- "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
+ class Heap {
+ constructor() {
+ this.heap = [];
+ this.pushCount = Number.MIN_SAFE_INTEGER;
+ }
+ get length() {
+ return this.heap.length;
+ }
+ empty() {
+ this.heap = [];
+ return this;
+ }
+ percUp(index2) {
+ let p;
+ while (index2 > 0 && smaller(this.heap[index2], this.heap[p = parent(index2)])) {
+ let t = this.heap[index2];
+ this.heap[index2] = this.heap[p];
+ this.heap[p] = t;
+ index2 = p;
+ }
+ }
+ percDown(index2) {
+ let l;
+ while ((l = leftChi(index2)) < this.heap.length) {
+ if (l + 1 < this.heap.length && smaller(this.heap[l + 1], this.heap[l])) {
+ l = l + 1;
}
- });
+ if (smaller(this.heap[index2], this.heap[l])) {
+ break;
+ }
+ let t = this.heap[index2];
+ this.heap[index2] = this.heap[l];
+ this.heap[l] = t;
+ index2 = l;
+ }
}
- };
- } 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;
+ push(node) {
+ node.pushCount = ++this.pushCount;
+ this.heap.push(node);
+ this.percUp(this.heap.length - 1);
}
- };
- }
- }
-});
-
-// node_modules/inherits/inherits.js
-var require_inherits = __commonJS({
- "node_modules/inherits/inherits.js"(exports2, module2) {
- try {
- util3 = require("util");
- if (typeof util3.inherits !== "function") throw "";
- module2.exports = util3.inherits;
- } catch (e) {
- module2.exports = require_inherits_browser();
- }
- var util3;
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/BufferList.js
-var require_BufferList = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports2, module2) {
- "use strict";
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var Buffer3 = require_safe_buffer().Buffer;
- var util3 = require("util");
- function copyBuffer(src, target, offset) {
- src.copy(target, offset);
- }
- module2.exports = (function() {
- function BufferList() {
- _classCallCheck(this, BufferList);
- this.head = null;
- this.tail = null;
- this.length = 0;
- }
- BufferList.prototype.push = function push(v) {
- var entry = { data: v, next: null };
- if (this.length > 0) this.tail.next = entry;
- else this.head = entry;
- this.tail = entry;
- ++this.length;
- };
- BufferList.prototype.unshift = function unshift(v) {
- var entry = { data: v, next: this.head };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
- };
- BufferList.prototype.shift = function shift() {
- if (this.length === 0) return;
- var ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;
- else this.head = this.head.next;
- --this.length;
- return ret;
- };
- BufferList.prototype.clear = function clear() {
- this.head = this.tail = null;
- this.length = 0;
- };
- BufferList.prototype.join = function join8(s) {
- if (this.length === 0) return "";
- var p = this.head;
- var ret = "" + p.data;
- while (p = p.next) {
- ret += s + p.data;
+ unshift(node) {
+ return this.heap.push(node);
}
- return ret;
- };
- BufferList.prototype.concat = function concat2(n) {
- if (this.length === 0) return Buffer3.alloc(0);
- var ret = Buffer3.allocUnsafe(n >>> 0);
- var p = this.head;
- var i = 0;
- while (p) {
- copyBuffer(p.data, ret, i);
- i += p.data.length;
- p = p.next;
+ shift() {
+ let [top] = this.heap;
+ this.heap[0] = this.heap[this.heap.length - 1];
+ this.heap.pop();
+ this.percDown(0);
+ return top;
}
- return ret;
- };
- return BufferList;
- })();
- if (util3 && util3.inspect && util3.inspect.custom) {
- module2.exports.prototype[util3.inspect.custom] = function() {
- var obj = util3.inspect({ length: this.length });
- return this.constructor.name + " " + obj;
- };
- }
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/destroy.js
-var require_destroy = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
- "use strict";
- var pna = require_process_nextick_args();
- function destroy2(err, cb) {
- var _this = this;
- var readableDestroyed = this._readableState && this._readableState.destroyed;
- var writableDestroyed = this._writableState && this._writableState.destroyed;
- if (readableDestroyed || writableDestroyed) {
- if (cb) {
- cb(err);
- } else if (err) {
- if (!this._writableState) {
- pna.nextTick(emitErrorNT, this, err);
- } else if (!this._writableState.errorEmitted) {
- this._writableState.errorEmitted = true;
- pna.nextTick(emitErrorNT, this, err);
+ toArray() {
+ return [...this];
+ }
+ *[Symbol.iterator]() {
+ for (let i = 0; i < this.heap.length; i++) {
+ yield this.heap[i].data;
}
}
- return this;
+ remove(testFn) {
+ let j = 0;
+ for (let i = 0; i < this.heap.length; i++) {
+ if (!testFn(this.heap[i])) {
+ this.heap[j] = this.heap[i];
+ j++;
+ }
+ }
+ this.heap.splice(j);
+ for (let i = parent(this.heap.length - 1); i >= 0; i--) {
+ this.percDown(i);
+ }
+ return this;
+ }
}
- if (this._readableState) {
- this._readableState.destroyed = true;
+ function leftChi(i) {
+ return (i << 1) + 1;
}
- if (this._writableState) {
- this._writableState.destroyed = true;
+ function parent(i) {
+ return (i + 1 >> 1) - 1;
}
- this._destroy(err || null, function(err2) {
- if (!cb && err2) {
- if (!_this._writableState) {
- pna.nextTick(emitErrorNT, _this, err2);
- } else if (!_this._writableState.errorEmitted) {
- _this._writableState.errorEmitted = true;
- pna.nextTick(emitErrorNT, _this, err2);
- }
- } else if (cb) {
- cb(err2);
- }
- });
- return this;
- }
- function undestroy() {
- if (this._readableState) {
- this._readableState.destroyed = false;
- this._readableState.reading = false;
- this._readableState.ended = false;
- this._readableState.endEmitted = false;
+ function smaller(x, y) {
+ if (x.priority !== y.priority) {
+ return x.priority < y.priority;
+ } else {
+ return x.pushCount < y.pushCount;
+ }
}
- if (this._writableState) {
- this._writableState.destroyed = false;
- this._writableState.ended = false;
- this._writableState.ending = false;
- this._writableState.finalCalled = false;
- this._writableState.prefinished = false;
- this._writableState.finished = false;
- this._writableState.errorEmitted = false;
+ function priorityQueue(worker, concurrency) {
+ var q = queue(worker, concurrency);
+ var {
+ push,
+ pushAsync
+ } = q;
+ q._tasks = new Heap();
+ q._createTaskItem = ({ data, priority }, callback) => {
+ return {
+ data,
+ priority,
+ callback
+ };
+ };
+ function createDataItems(tasks, priority) {
+ if (!Array.isArray(tasks)) {
+ return { data: tasks, priority };
+ }
+ return tasks.map((data) => {
+ return { data, priority };
+ });
+ }
+ q.push = function(data, priority = 0, callback) {
+ return push(createDataItems(data, priority), callback);
+ };
+ q.pushAsync = function(data, priority = 0, callback) {
+ return pushAsync(createDataItems(data, priority), callback);
+ };
+ delete q.unshift;
+ delete q.unshiftAsync;
+ return q;
}
- }
- function emitErrorNT(self2, err) {
- self2.emit("error", err);
- }
- module2.exports = {
- destroy: destroy2,
- undestroy
- };
- }
-});
-
-// node_modules/util-deprecate/node.js
-var require_node2 = __commonJS({
- "node_modules/util-deprecate/node.js"(exports2, module2) {
- module2.exports = require("util").deprecate;
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/_stream_writable.js
-var require_stream_writable = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
- "use strict";
- var pna = require_process_nextick_args();
- module2.exports = Writable;
- function CorkedRequest(state3) {
- var _this = this;
- this.next = null;
- this.entry = null;
- this.finish = function() {
- onCorkedFinish(_this, state3);
- };
- }
- var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
- var Duplex;
- Writable.WritableState = WritableState;
- var util3 = Object.create(require_util9());
- util3.inherits = require_inherits();
- var internalUtil = {
- deprecate: require_node2()
- };
- var Stream2 = require_stream();
- var Buffer3 = require_safe_buffer().Buffer;
- var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
- };
- function _uint8ArrayToBuffer(chunk) {
- return Buffer3.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- var destroyImpl = require_destroy();
- util3.inherits(Writable, Stream2);
- function nop() {
- }
- function WritableState(options, stream4) {
- Duplex = Duplex || require_stream_duplex();
- options = options || {};
- var isDuplex = stream4 instanceof Duplex;
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
- var hwm = options.highWaterMark;
- var writableHwm = options.writableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;
- else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;
- else this.highWaterMark = defaultHwm;
- this.highWaterMark = Math.floor(this.highWaterMark);
- this.finalCalled = false;
- this.needDrain = false;
- this.ending = false;
- this.ended = false;
- this.finished = false;
- this.destroyed = false;
- var noDecode = options.decodeStrings === false;
- this.decodeStrings = !noDecode;
- this.defaultEncoding = options.defaultEncoding || "utf8";
- this.length = 0;
- this.writing = false;
- this.corked = 0;
- this.sync = true;
- this.bufferProcessing = false;
- this.onwrite = function(er) {
- onwrite(stream4, er);
- };
- this.writecb = null;
- this.writelen = 0;
- this.bufferedRequest = null;
- this.lastBufferedRequest = null;
- this.pendingcb = 0;
- this.prefinished = false;
- this.errorEmitted = false;
- this.bufferedRequestCount = 0;
- this.corkedRequestsFree = new CorkedRequest(this);
- }
- WritableState.prototype.getBuffer = function getBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
+ function race(tasks, callback) {
+ callback = once(callback);
+ if (!Array.isArray(tasks)) return callback(new TypeError("First argument to race must be an array of functions"));
+ if (!tasks.length) return callback();
+ for (var i = 0, l = tasks.length; i < l; i++) {
+ wrapAsync(tasks[i])(callback);
+ }
}
- return out;
- };
- (function() {
- try {
- Object.defineProperty(WritableState.prototype, "buffer", {
- get: internalUtil.deprecate(function() {
- return this.getBuffer();
- }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
+ var race$1 = awaitify(race, 2);
+ function reduceRight(array, memo, iteratee, callback) {
+ var reversed = [...array].reverse();
+ return reduce$1(reversed, memo, iteratee, callback);
+ }
+ function reflect(fn) {
+ var _fn = wrapAsync(fn);
+ return initialParams(function reflectOn(args, reflectCallback) {
+ args.push((error2, ...cbArgs) => {
+ let retVal = {};
+ if (error2) {
+ retVal.error = error2;
+ }
+ if (cbArgs.length > 0) {
+ var value = cbArgs;
+ if (cbArgs.length <= 1) {
+ [value] = cbArgs;
+ }
+ retVal.value = value;
+ }
+ reflectCallback(null, retVal);
+ });
+ return _fn.apply(this, args);
});
- } catch (_2) {
}
- })();
- var realHasInstance;
- if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
- realHasInstance = Function.prototype[Symbol.hasInstance];
- Object.defineProperty(Writable, Symbol.hasInstance, {
- value: function(object) {
- if (realHasInstance.call(this, object)) return true;
- if (this !== Writable) return false;
- return object && object._writableState instanceof WritableState;
+ function reflectAll(tasks) {
+ var results;
+ if (Array.isArray(tasks)) {
+ results = tasks.map(reflect);
+ } else {
+ results = {};
+ Object.keys(tasks).forEach((key) => {
+ results[key] = reflect.call(this, tasks[key]);
+ });
}
- });
- } else {
- realHasInstance = function(object) {
- return object instanceof this;
- };
- }
- function Writable(options) {
- Duplex = Duplex || require_stream_duplex();
- if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
- return new Writable(options);
+ return results;
}
- this._writableState = new WritableState(options, this);
- this.writable = true;
- if (options) {
- if (typeof options.write === "function") this._write = options.write;
- if (typeof options.writev === "function") this._writev = options.writev;
- if (typeof options.destroy === "function") this._destroy = options.destroy;
- if (typeof options.final === "function") this._final = options.final;
+ function reject$2(eachfn, arr, _iteratee, callback) {
+ const iteratee = wrapAsync(_iteratee);
+ return _filter(eachfn, arr, (value, cb) => {
+ iteratee(value, (err, v) => {
+ cb(err, !v);
+ });
+ }, callback);
}
- Stream2.call(this);
- }
- Writable.prototype.pipe = function() {
- this.emit("error", new Error("Cannot pipe, not readable"));
- };
- function writeAfterEnd(stream4, cb) {
- var er = new Error("write after end");
- stream4.emit("error", er);
- pna.nextTick(cb, er);
- }
- function validChunk(stream4, state3, chunk, cb) {
- var valid = true;
- var er = false;
- if (chunk === null) {
- er = new TypeError("May not write null values to stream");
- } else if (typeof chunk !== "string" && chunk !== void 0 && !state3.objectMode) {
- er = new TypeError("Invalid non-string/buffer chunk");
+ function reject(coll, iteratee, callback) {
+ return reject$2(eachOf$1, coll, iteratee, callback);
}
- if (er) {
- stream4.emit("error", er);
- pna.nextTick(cb, er);
- valid = false;
- }
- return valid;
- }
- Writable.prototype.write = function(chunk, encoding, cb) {
- var state3 = this._writableState;
- var ret = false;
- var isBuf = !state3.objectMode && _isUint8Array(chunk);
- if (isBuf && !Buffer3.isBuffer(chunk)) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (typeof encoding === "function") {
- cb = encoding;
- encoding = null;
- }
- if (isBuf) encoding = "buffer";
- else if (!encoding) encoding = state3.defaultEncoding;
- if (typeof cb !== "function") cb = nop;
- if (state3.ended) writeAfterEnd(this, cb);
- else if (isBuf || validChunk(this, state3, chunk, cb)) {
- state3.pendingcb++;
- ret = writeOrBuffer(this, state3, isBuf, chunk, encoding, cb);
- }
- return ret;
- };
- Writable.prototype.cork = function() {
- var state3 = this._writableState;
- state3.corked++;
- };
- Writable.prototype.uncork = function() {
- var state3 = this._writableState;
- if (state3.corked) {
- state3.corked--;
- if (!state3.writing && !state3.corked && !state3.bufferProcessing && state3.bufferedRequest) clearBuffer(this, state3);
- }
- };
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- if (typeof encoding === "string") encoding = encoding.toLowerCase();
- if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + encoding);
- this._writableState.defaultEncoding = encoding;
- return this;
- };
- function decodeChunk(state3, chunk, encoding) {
- if (!state3.objectMode && state3.decodeStrings !== false && typeof chunk === "string") {
- chunk = Buffer3.from(chunk, encoding);
+ var reject$1 = awaitify(reject, 3);
+ function rejectLimit(coll, limit, iteratee, callback) {
+ return reject$2(eachOfLimit$2(limit), coll, iteratee, callback);
}
- return chunk;
- }
- Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function() {
- return this._writableState.highWaterMark;
+ var rejectLimit$1 = awaitify(rejectLimit, 4);
+ function rejectSeries(coll, iteratee, callback) {
+ return reject$2(eachOfSeries$1, coll, iteratee, callback);
}
- });
- function writeOrBuffer(stream4, state3, isBuf, chunk, encoding, cb) {
- if (!isBuf) {
- var newChunk = decodeChunk(state3, chunk, encoding);
- if (chunk !== newChunk) {
- isBuf = true;
- encoding = "buffer";
- chunk = newChunk;
- }
+ var rejectSeries$1 = awaitify(rejectSeries, 3);
+ function constant(value) {
+ return function() {
+ return value;
+ };
}
- var len = state3.objectMode ? 1 : chunk.length;
- state3.length += len;
- var ret = state3.length < state3.highWaterMark;
- if (!ret) state3.needDrain = true;
- if (state3.writing || state3.corked) {
- var last = state3.lastBufferedRequest;
- state3.lastBufferedRequest = {
- chunk,
- encoding,
- isBuf,
- callback: cb,
- next: null
+ const DEFAULT_TIMES = 5;
+ const DEFAULT_INTERVAL = 0;
+ function retry2(opts, task, callback) {
+ var options = {
+ times: DEFAULT_TIMES,
+ intervalFunc: constant(DEFAULT_INTERVAL)
};
- if (last) {
- last.next = state3.lastBufferedRequest;
+ if (arguments.length < 3 && typeof opts === "function") {
+ callback = task || promiseCallback();
+ task = opts;
} else {
- state3.bufferedRequest = state3.lastBufferedRequest;
+ parseTimes(options, opts);
+ callback = callback || promiseCallback();
}
- state3.bufferedRequestCount += 1;
- } else {
- doWrite(stream4, state3, false, len, chunk, encoding, cb);
- }
- return ret;
- }
- function doWrite(stream4, state3, writev, len, chunk, encoding, cb) {
- state3.writelen = len;
- state3.writecb = cb;
- state3.writing = true;
- state3.sync = true;
- if (writev) stream4._writev(chunk, state3.onwrite);
- else stream4._write(chunk, encoding, state3.onwrite);
- state3.sync = false;
- }
- function onwriteError(stream4, state3, sync, er, cb) {
- --state3.pendingcb;
- if (sync) {
- pna.nextTick(cb, er);
- pna.nextTick(finishMaybe, stream4, state3);
- stream4._writableState.errorEmitted = true;
- stream4.emit("error", er);
- } else {
- cb(er);
- stream4._writableState.errorEmitted = true;
- stream4.emit("error", er);
- finishMaybe(stream4, state3);
- }
- }
- function onwriteStateUpdate(state3) {
- state3.writing = false;
- state3.writecb = null;
- state3.length -= state3.writelen;
- state3.writelen = 0;
- }
- function onwrite(stream4, er) {
- var state3 = stream4._writableState;
- var sync = state3.sync;
- var cb = state3.writecb;
- onwriteStateUpdate(state3);
- if (er) onwriteError(stream4, state3, sync, er, cb);
- else {
- var finished = needFinish(state3);
- if (!finished && !state3.corked && !state3.bufferProcessing && state3.bufferedRequest) {
- clearBuffer(stream4, state3);
+ if (typeof task !== "function") {
+ throw new Error("Invalid arguments for async.retry");
}
- if (sync) {
- asyncWrite(afterWrite, stream4, state3, finished, cb);
- } else {
- afterWrite(stream4, state3, finished, cb);
+ var _task = wrapAsync(task);
+ var attempt = 1;
+ function retryAttempt() {
+ _task((err, ...args) => {
+ if (err === false) return;
+ if (err && attempt++ < options.times && (typeof options.errorFilter != "function" || options.errorFilter(err))) {
+ setTimeout(retryAttempt, options.intervalFunc(attempt - 1));
+ } else {
+ callback(err, ...args);
+ }
+ });
}
+ retryAttempt();
+ return callback[PROMISE_SYMBOL];
}
- }
- function afterWrite(stream4, state3, finished, cb) {
- if (!finished) onwriteDrain(stream4, state3);
- state3.pendingcb--;
- cb();
- finishMaybe(stream4, state3);
- }
- function onwriteDrain(stream4, state3) {
- if (state3.length === 0 && state3.needDrain) {
- state3.needDrain = false;
- stream4.emit("drain");
+ function parseTimes(acc, t) {
+ if (typeof t === "object") {
+ acc.times = +t.times || DEFAULT_TIMES;
+ acc.intervalFunc = typeof t.interval === "function" ? t.interval : constant(+t.interval || DEFAULT_INTERVAL);
+ acc.errorFilter = t.errorFilter;
+ } else if (typeof t === "number" || typeof t === "string") {
+ acc.times = +t || DEFAULT_TIMES;
+ } else {
+ throw new Error("Invalid arguments for async.retry");
+ }
}
- }
- function clearBuffer(stream4, state3) {
- state3.bufferProcessing = true;
- var entry = state3.bufferedRequest;
- if (stream4._writev && entry && entry.next) {
- var l = state3.bufferedRequestCount;
- var buffer2 = new Array(l);
- var holder = state3.corkedRequestsFree;
- holder.entry = entry;
- var count = 0;
- var allBuffers = true;
- while (entry) {
- buffer2[count] = entry;
- if (!entry.isBuf) allBuffers = false;
- entry = entry.next;
- count += 1;
+ function retryable(opts, task) {
+ if (!task) {
+ task = opts;
+ opts = null;
}
- buffer2.allBuffers = allBuffers;
- doWrite(stream4, state3, true, state3.length, buffer2, "", holder.finish);
- state3.pendingcb++;
- state3.lastBufferedRequest = null;
- if (holder.next) {
- state3.corkedRequestsFree = holder.next;
- holder.next = null;
- } else {
- state3.corkedRequestsFree = new CorkedRequest(state3);
+ let arity = opts && opts.arity || task.length;
+ if (isAsync(task)) {
+ arity += 1;
}
- state3.bufferedRequestCount = 0;
- } else {
- while (entry) {
- var chunk = entry.chunk;
- var encoding = entry.encoding;
- var cb = entry.callback;
- var len = state3.objectMode ? 1 : chunk.length;
- doWrite(stream4, state3, false, len, chunk, encoding, cb);
- entry = entry.next;
- state3.bufferedRequestCount--;
- if (state3.writing) {
- break;
+ var _task = wrapAsync(task);
+ return initialParams((args, callback) => {
+ if (args.length < arity - 1 || callback == null) {
+ args.push(callback);
+ callback = promiseCallback();
}
- }
- if (entry === null) state3.lastBufferedRequest = null;
+ function taskFn(cb) {
+ _task(...args, cb);
+ }
+ if (opts) retry2(opts, taskFn, callback);
+ else retry2(taskFn, callback);
+ return callback[PROMISE_SYMBOL];
+ });
}
- state3.bufferedRequest = entry;
- state3.bufferProcessing = false;
- }
- Writable.prototype._write = function(chunk, encoding, cb) {
- cb(new Error("_write() is not implemented"));
- };
- Writable.prototype._writev = null;
- Writable.prototype.end = function(chunk, encoding, cb) {
- var state3 = this._writableState;
- if (typeof chunk === "function") {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === "function") {
- cb = encoding;
- encoding = null;
+ function series(tasks, callback) {
+ return _parallel(eachOfSeries$1, tasks, callback);
}
- if (chunk !== null && chunk !== void 0) this.write(chunk, encoding);
- if (state3.corked) {
- state3.corked = 1;
- this.uncork();
+ function some(coll, iteratee, callback) {
+ return _createTester(Boolean, (res) => res)(eachOf$1, coll, iteratee, callback);
}
- if (!state3.ending) endWritable(this, state3, cb);
- };
- function needFinish(state3) {
- return state3.ending && state3.length === 0 && state3.bufferedRequest === null && !state3.finished && !state3.writing;
- }
- function callFinal(stream4, state3) {
- stream4._final(function(err) {
- state3.pendingcb--;
- if (err) {
- stream4.emit("error", err);
- }
- state3.prefinished = true;
- stream4.emit("prefinish");
- finishMaybe(stream4, state3);
- });
- }
- function prefinish(stream4, state3) {
- if (!state3.prefinished && !state3.finalCalled) {
- if (typeof stream4._final === "function") {
- state3.pendingcb++;
- state3.finalCalled = true;
- pna.nextTick(callFinal, stream4, state3);
- } else {
- state3.prefinished = true;
- stream4.emit("prefinish");
+ var some$1 = awaitify(some, 3);
+ function someLimit(coll, limit, iteratee, callback) {
+ return _createTester(Boolean, (res) => res)(eachOfLimit$2(limit), coll, iteratee, callback);
+ }
+ var someLimit$1 = awaitify(someLimit, 4);
+ function someSeries(coll, iteratee, callback) {
+ return _createTester(Boolean, (res) => res)(eachOfSeries$1, coll, iteratee, callback);
+ }
+ var someSeries$1 = awaitify(someSeries, 3);
+ function sortBy(coll, iteratee, callback) {
+ var _iteratee = wrapAsync(iteratee);
+ return map$1(coll, (x, iterCb) => {
+ _iteratee(x, (err, criteria) => {
+ if (err) return iterCb(err);
+ iterCb(err, { value: x, criteria });
+ });
+ }, (err, results) => {
+ if (err) return callback(err);
+ callback(null, results.sort(comparator).map((v) => v.value));
+ });
+ function comparator(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
}
}
- }
- function finishMaybe(stream4, state3) {
- var need = needFinish(state3);
- if (need) {
- prefinish(stream4, state3);
- if (state3.pendingcb === 0) {
- state3.finished = true;
- stream4.emit("finish");
+ var sortBy$1 = awaitify(sortBy, 3);
+ function timeout(asyncFn, milliseconds, info2) {
+ var fn = wrapAsync(asyncFn);
+ return initialParams((args, callback) => {
+ var timedOut = false;
+ var timer;
+ function timeoutCallback() {
+ var name = asyncFn.name || "anonymous";
+ var error2 = new Error('Callback function "' + name + '" timed out.');
+ error2.code = "ETIMEDOUT";
+ if (info2) {
+ error2.info = info2;
+ }
+ timedOut = true;
+ callback(error2);
+ }
+ args.push((...cbArgs) => {
+ if (!timedOut) {
+ callback(...cbArgs);
+ clearTimeout(timer);
+ }
+ });
+ timer = setTimeout(timeoutCallback, milliseconds);
+ fn(...args);
+ });
+ }
+ function range2(size) {
+ var result = Array(size);
+ while (size--) {
+ result[size] = size;
}
+ return result;
}
- return need;
- }
- function endWritable(stream4, state3, cb) {
- state3.ending = true;
- finishMaybe(stream4, state3);
- if (cb) {
- if (state3.finished) pna.nextTick(cb);
- else stream4.once("finish", cb);
+ function timesLimit(count, limit, iteratee, callback) {
+ var _iteratee = wrapAsync(iteratee);
+ return mapLimit$1(range2(count), limit, _iteratee, callback);
}
- state3.ended = true;
- stream4.writable = false;
- }
- function onCorkedFinish(corkReq, state3, err) {
- var entry = corkReq.entry;
- corkReq.entry = null;
- while (entry) {
- var cb = entry.callback;
- state3.pendingcb--;
- cb(err);
- entry = entry.next;
+ function times(n, iteratee, callback) {
+ return timesLimit(n, Infinity, iteratee, callback);
}
- state3.corkedRequestsFree.next = corkReq;
- }
- Object.defineProperty(Writable.prototype, "destroyed", {
- get: function() {
- if (this._writableState === void 0) {
- return false;
- }
- return this._writableState.destroyed;
- },
- set: function(value) {
- if (!this._writableState) {
- return;
- }
- this._writableState.destroyed = value;
+ function timesSeries(n, iteratee, callback) {
+ return timesLimit(n, 1, iteratee, callback);
}
- });
- Writable.prototype.destroy = destroyImpl.destroy;
- Writable.prototype._undestroy = destroyImpl.undestroy;
- Writable.prototype._destroy = function(err, cb) {
- this.end();
- cb(err);
- };
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/_stream_duplex.js
-var require_stream_duplex = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/_stream_duplex.js"(exports2, module2) {
- "use strict";
- var pna = require_process_nextick_args();
- var objectKeys = Object.keys || function(obj) {
- var keys2 = [];
- for (var key in obj) {
- keys2.push(key);
+ function transform(coll, accumulator, iteratee, callback) {
+ if (arguments.length <= 3 && typeof accumulator === "function") {
+ callback = iteratee;
+ iteratee = accumulator;
+ accumulator = Array.isArray(coll) ? [] : {};
+ }
+ callback = once(callback || promiseCallback());
+ var _iteratee = wrapAsync(iteratee);
+ eachOf$1(coll, (v, k, cb) => {
+ _iteratee(accumulator, v, k, cb);
+ }, (err) => callback(err, accumulator));
+ return callback[PROMISE_SYMBOL];
}
- return keys2;
- };
- module2.exports = Duplex;
- var util3 = Object.create(require_util9());
- util3.inherits = require_inherits();
- var Readable7 = require_stream_readable();
- var Writable = require_stream_writable();
- util3.inherits(Duplex, Readable7);
- {
- keys = objectKeys(Writable.prototype);
- for (v = 0; v < keys.length; v++) {
- method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
+ function tryEach(tasks, callback) {
+ var error2 = null;
+ var result;
+ return eachSeries$1(tasks, (task, taskCb) => {
+ wrapAsync(task)((err, ...args) => {
+ if (err === false) return taskCb(err);
+ if (args.length < 2) {
+ [result] = args;
+ } else {
+ result = args;
+ }
+ error2 = err;
+ taskCb(err ? null : {});
+ });
+ }, () => callback(error2, result));
}
- }
- var keys;
- var method;
- var v;
- function Duplex(options) {
- if (!(this instanceof Duplex)) return new Duplex(options);
- Readable7.call(this, options);
- Writable.call(this, options);
- if (options && options.readable === false) this.readable = false;
- if (options && options.writable === false) this.writable = false;
- this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
- this.once("end", onend);
- }
- Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function() {
- return this._writableState.highWaterMark;
+ var tryEach$1 = awaitify(tryEach);
+ function unmemoize(fn) {
+ return (...args) => {
+ return (fn.unmemoized || fn)(...args);
+ };
}
- });
- function onend() {
- if (this.allowHalfOpen || this._writableState.ended) return;
- pna.nextTick(onEndNT, this);
- }
- function onEndNT(self2) {
- self2.end();
- }
- Object.defineProperty(Duplex.prototype, "destroyed", {
- get: function() {
- if (this._readableState === void 0 || this._writableState === void 0) {
- return false;
+ function whilst(test, iteratee, callback) {
+ callback = onlyOnce(callback);
+ var _fn = wrapAsync(iteratee);
+ var _test = wrapAsync(test);
+ var results = [];
+ function next(err, ...rest) {
+ if (err) return callback(err);
+ results = rest;
+ if (err === false) return;
+ _test(check);
}
- return this._readableState.destroyed && this._writableState.destroyed;
- },
- set: function(value) {
- if (this._readableState === void 0 || this._writableState === void 0) {
- return;
+ function check(err, truth) {
+ if (err) return callback(err);
+ if (err === false) return;
+ if (!truth) return callback(null, ...results);
+ _fn(next);
}
- this._readableState.destroyed = value;
- this._writableState.destroyed = value;
- }
- });
- Duplex.prototype._destroy = function(err, cb) {
- this.push(null);
- this.end();
- pna.nextTick(cb, err);
- };
- }
-});
-
-// node_modules/lazystream/node_modules/string_decoder/lib/string_decoder.js
-var require_string_decoder = __commonJS({
- "node_modules/lazystream/node_modules/string_decoder/lib/string_decoder.js"(exports2) {
- "use strict";
- var Buffer3 = require_safe_buffer().Buffer;
- var isEncoding = Buffer3.isEncoding || function(encoding) {
- encoding = "" + encoding;
- switch (encoding && encoding.toLowerCase()) {
- case "hex":
- case "utf8":
- case "utf-8":
- case "ascii":
- case "binary":
- case "base64":
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- case "raw":
- return true;
- default:
- return false;
- }
- };
- function _normalizeEncoding(enc) {
- if (!enc) return "utf8";
- var retried;
- while (true) {
- switch (enc) {
- case "utf8":
- case "utf-8":
- return "utf8";
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return "utf16le";
- case "latin1":
- case "binary":
- return "latin1";
- case "base64":
- case "ascii":
- case "hex":
- return enc;
- default:
- if (retried) return;
- enc = ("" + enc).toLowerCase();
- retried = true;
- }
- }
- }
- function normalizeEncoding(enc) {
- var nenc = _normalizeEncoding(enc);
- if (typeof nenc !== "string" && (Buffer3.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
- return nenc || enc;
- }
- exports2.StringDecoder = StringDecoder2;
- function StringDecoder2(encoding) {
- this.encoding = normalizeEncoding(encoding);
- var nb;
- switch (this.encoding) {
- case "utf16le":
- this.text = utf16Text;
- this.end = utf16End;
- nb = 4;
- break;
- case "utf8":
- this.fillLast = utf8FillLast;
- nb = 4;
- break;
- case "base64":
- this.text = base64Text;
- this.end = base64End;
- nb = 3;
- break;
- default:
- this.write = simpleWrite;
- this.end = simpleEnd;
- return;
- }
- this.lastNeed = 0;
- this.lastTotal = 0;
- this.lastChar = Buffer3.allocUnsafe(nb);
- }
- StringDecoder2.prototype.write = function(buf) {
- if (buf.length === 0) return "";
- var r;
- var i;
- if (this.lastNeed) {
- r = this.fillLast(buf);
- if (r === void 0) return "";
- i = this.lastNeed;
- this.lastNeed = 0;
- } else {
- i = 0;
- }
- if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
- return r || "";
- };
- StringDecoder2.prototype.end = utf8End;
- StringDecoder2.prototype.text = utf8Text;
- StringDecoder2.prototype.fillLast = function(buf) {
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
- this.lastNeed -= buf.length;
- };
- function utf8CheckByte(byte) {
- if (byte <= 127) return 0;
- else if (byte >> 5 === 6) return 2;
- else if (byte >> 4 === 14) return 3;
- else if (byte >> 3 === 30) return 4;
- return byte >> 6 === 2 ? -1 : -2;
- }
- function utf8CheckIncomplete(self2, buf, i) {
- var j = buf.length - 1;
- if (j < i) return 0;
- var nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self2.lastNeed = nb - 1;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self2.lastNeed = nb - 2;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) {
- if (nb === 2) nb = 0;
- else self2.lastNeed = nb - 3;
- }
- return nb;
+ return _test(check);
}
- return 0;
- }
- function utf8CheckExtraBytes(self2, buf, p) {
- if ((buf[0] & 192) !== 128) {
- self2.lastNeed = 0;
- return "\uFFFD";
+ var whilst$1 = awaitify(whilst, 3);
+ function until(test, iteratee, callback) {
+ const _test = wrapAsync(test);
+ return whilst$1((cb) => _test((err, truth) => cb(err, !truth)), iteratee, callback);
}
- if (self2.lastNeed > 1 && buf.length > 1) {
- if ((buf[1] & 192) !== 128) {
- self2.lastNeed = 1;
- return "\uFFFD";
- }
- if (self2.lastNeed > 2 && buf.length > 2) {
- if ((buf[2] & 192) !== 128) {
- self2.lastNeed = 2;
- return "\uFFFD";
- }
+ function waterfall(tasks, callback) {
+ callback = once(callback);
+ if (!Array.isArray(tasks)) return callback(new Error("First argument to waterfall must be an array of functions"));
+ if (!tasks.length) return callback();
+ var taskIndex = 0;
+ function nextTask(args) {
+ var task = wrapAsync(tasks[taskIndex++]);
+ task(...args, onlyOnce(next));
}
- }
- }
- function utf8FillLast(buf) {
- var p = this.lastTotal - this.lastNeed;
- var r = utf8CheckExtraBytes(this, buf, p);
- if (r !== void 0) return r;
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, p, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, p, 0, buf.length);
- this.lastNeed -= buf.length;
- }
- function utf8Text(buf, i) {
- var total = utf8CheckIncomplete(this, buf, i);
- if (!this.lastNeed) return buf.toString("utf8", i);
- this.lastTotal = total;
- var end = buf.length - (total - this.lastNeed);
- buf.copy(this.lastChar, 0, end);
- return buf.toString("utf8", i, end);
- }
- function utf8End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) return r + "\uFFFD";
- return r;
- }
- function utf16Text(buf, i) {
- if ((buf.length - i) % 2 === 0) {
- var r = buf.toString("utf16le", i);
- if (r) {
- var c = r.charCodeAt(r.length - 1);
- if (c >= 55296 && c <= 56319) {
- this.lastNeed = 2;
- this.lastTotal = 4;
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- return r.slice(0, -1);
+ function next(err, ...args) {
+ if (err === false) return;
+ if (err || taskIndex === tasks.length) {
+ return callback(err, ...args);
}
+ nextTask(args);
}
- return r;
- }
- this.lastNeed = 1;
- this.lastTotal = 2;
- this.lastChar[0] = buf[buf.length - 1];
- return buf.toString("utf16le", i, buf.length - 1);
- }
- function utf16End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) {
- var end = this.lastTotal - this.lastNeed;
- return r + this.lastChar.toString("utf16le", 0, end);
- }
- return r;
- }
- function base64Text(buf, i) {
- var n = (buf.length - i) % 3;
- if (n === 0) return buf.toString("base64", i);
- this.lastNeed = 3 - n;
- this.lastTotal = 3;
- if (n === 1) {
- this.lastChar[0] = buf[buf.length - 1];
- } else {
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
+ nextTask([]);
}
- return buf.toString("base64", i, buf.length - n);
- }
- function base64End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
- return r;
- }
- function simpleWrite(buf) {
- return buf.toString(this.encoding);
- }
- function simpleEnd(buf) {
- return buf && buf.length ? this.write(buf) : "";
- }
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js
-var require_stream_readable = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js"(exports2, module2) {
- "use strict";
- var pna = require_process_nextick_args();
- module2.exports = Readable7;
- var isArray = require_isarray();
- var Duplex;
- Readable7.ReadableState = ReadableState;
- var EE = require("events").EventEmitter;
- var EElistenerCount = function(emitter, type) {
- return emitter.listeners(type).length;
- };
- var Stream2 = require_stream();
- var Buffer3 = require_safe_buffer().Buffer;
- var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
- };
- function _uint8ArrayToBuffer(chunk) {
- return Buffer3.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- var util3 = Object.create(require_util9());
- util3.inherits = require_inherits();
- var debugUtil = require("util");
- var debug2 = void 0;
- if (debugUtil && debugUtil.debuglog) {
- debug2 = debugUtil.debuglog("stream");
- } else {
- debug2 = function() {
- };
- }
- var BufferList = require_BufferList();
- var destroyImpl = require_destroy();
- var StringDecoder2;
- util3.inherits(Readable7, Stream2);
- var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
- function prependListener(emitter, event, fn) {
- if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
- else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);
- else emitter._events[event] = [fn, emitter._events[event]];
- }
- function ReadableState(options, stream4) {
- Duplex = Duplex || require_stream_duplex();
- options = options || {};
- var isDuplex = stream4 instanceof Duplex;
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
- var hwm = options.highWaterMark;
- var readableHwm = options.readableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;
- else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;
- else this.highWaterMark = defaultHwm;
- this.highWaterMark = Math.floor(this.highWaterMark);
- this.buffer = new BufferList();
- this.length = 0;
- this.pipes = null;
- this.pipesCount = 0;
- this.flowing = null;
- this.ended = false;
- this.endEmitted = false;
- this.reading = false;
- this.sync = true;
- this.needReadable = false;
- this.emittedReadable = false;
- this.readableListening = false;
- this.resumeScheduled = false;
- this.destroyed = false;
- this.defaultEncoding = options.defaultEncoding || "utf8";
- this.awaitDrain = 0;
- this.readingMore = false;
- this.decoder = null;
- this.encoding = null;
- if (options.encoding) {
- if (!StringDecoder2) StringDecoder2 = require_string_decoder().StringDecoder;
- this.decoder = new StringDecoder2(options.encoding);
- this.encoding = options.encoding;
- }
- }
- function Readable7(options) {
- Duplex = Duplex || require_stream_duplex();
- if (!(this instanceof Readable7)) return new Readable7(options);
- this._readableState = new ReadableState(options, this);
- this.readable = true;
- if (options) {
- if (typeof options.read === "function") this._read = options.read;
- if (typeof options.destroy === "function") this._destroy = options.destroy;
- }
- Stream2.call(this);
- }
- Object.defineProperty(Readable7.prototype, "destroyed", {
- get: function() {
- if (this._readableState === void 0) {
- return false;
- }
- return this._readableState.destroyed;
- },
- set: function(value) {
- if (!this._readableState) {
- return;
- }
- this._readableState.destroyed = value;
- }
- });
- Readable7.prototype.destroy = destroyImpl.destroy;
- Readable7.prototype._undestroy = destroyImpl.undestroy;
- Readable7.prototype._destroy = function(err, cb) {
- this.push(null);
- cb(err);
- };
- Readable7.prototype.push = function(chunk, encoding) {
- var state3 = this._readableState;
- var skipChunkCheck;
- if (!state3.objectMode) {
- if (typeof chunk === "string") {
- encoding = encoding || state3.defaultEncoding;
- if (encoding !== state3.encoding) {
- chunk = Buffer3.from(chunk, encoding);
- encoding = "";
- }
- skipChunkCheck = true;
- }
- } else {
- skipChunkCheck = true;
- }
- return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
- };
- Readable7.prototype.unshift = function(chunk) {
- return readableAddChunk(this, chunk, null, true, false);
- };
- function readableAddChunk(stream4, chunk, encoding, addToFront, skipChunkCheck) {
- var state3 = stream4._readableState;
- if (chunk === null) {
- state3.reading = false;
- onEofChunk(stream4, state3);
- } else {
- var er;
- if (!skipChunkCheck) er = chunkInvalid(state3, chunk);
- if (er) {
- stream4.emit("error", er);
- } else if (state3.objectMode || chunk && chunk.length > 0) {
- if (typeof chunk !== "string" && !state3.objectMode && Object.getPrototypeOf(chunk) !== Buffer3.prototype) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (addToFront) {
- if (state3.endEmitted) stream4.emit("error", new Error("stream.unshift() after end event"));
- else addChunk(stream4, state3, chunk, true);
- } else if (state3.ended) {
- stream4.emit("error", new Error("stream.push() after EOF"));
- } else {
- state3.reading = false;
- if (state3.decoder && !encoding) {
- chunk = state3.decoder.write(chunk);
- if (state3.objectMode || chunk.length !== 0) addChunk(stream4, state3, chunk, false);
- else maybeReadMore(stream4, state3);
- } else {
- addChunk(stream4, state3, chunk, false);
- }
- }
- } else if (!addToFront) {
- state3.reading = false;
- }
- }
- return needMoreData(state3);
- }
- function addChunk(stream4, state3, chunk, addToFront) {
- if (state3.flowing && state3.length === 0 && !state3.sync) {
- stream4.emit("data", chunk);
- stream4.read(0);
- } else {
- state3.length += state3.objectMode ? 1 : chunk.length;
- if (addToFront) state3.buffer.unshift(chunk);
- else state3.buffer.push(chunk);
- if (state3.needReadable) emitReadable(stream4);
- }
- maybeReadMore(stream4, state3);
- }
- function chunkInvalid(state3, chunk) {
- var er;
- if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state3.objectMode) {
- er = new TypeError("Invalid non-string/buffer chunk");
- }
- return er;
- }
- function needMoreData(state3) {
- return !state3.ended && (state3.needReadable || state3.length < state3.highWaterMark || state3.length === 0);
- }
- Readable7.prototype.isPaused = function() {
- return this._readableState.flowing === false;
- };
- Readable7.prototype.setEncoding = function(enc) {
- if (!StringDecoder2) StringDecoder2 = require_string_decoder().StringDecoder;
- this._readableState.decoder = new StringDecoder2(enc);
- this._readableState.encoding = enc;
- return this;
- };
- var MAX_HWM = 8388608;
- function computeNewHighWaterMark(n) {
- if (n >= MAX_HWM) {
- n = MAX_HWM;
- } else {
- n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- n++;
- }
- return n;
- }
- function howMuchToRead(n, state3) {
- if (n <= 0 || state3.length === 0 && state3.ended) return 0;
- if (state3.objectMode) return 1;
- if (n !== n) {
- if (state3.flowing && state3.length) return state3.buffer.head.data.length;
- else return state3.length;
- }
- if (n > state3.highWaterMark) state3.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state3.length) return n;
- if (!state3.ended) {
- state3.needReadable = true;
- return 0;
- }
- return state3.length;
- }
- Readable7.prototype.read = function(n) {
- debug2("read", n);
- n = parseInt(n, 10);
- var state3 = this._readableState;
- var nOrig = n;
- if (n !== 0) state3.emittedReadable = false;
- if (n === 0 && state3.needReadable && (state3.length >= state3.highWaterMark || state3.ended)) {
- debug2("read: emitReadable", state3.length, state3.ended);
- if (state3.length === 0 && state3.ended) endReadable(this);
- else emitReadable(this);
- return null;
- }
- n = howMuchToRead(n, state3);
- if (n === 0 && state3.ended) {
- if (state3.length === 0) endReadable(this);
- return null;
- }
- var doRead = state3.needReadable;
- debug2("need readable", doRead);
- if (state3.length === 0 || state3.length - n < state3.highWaterMark) {
- doRead = true;
- debug2("length less than watermark", doRead);
- }
- if (state3.ended || state3.reading) {
- doRead = false;
- debug2("reading or ended", doRead);
- } else if (doRead) {
- debug2("do read");
- state3.reading = true;
- state3.sync = true;
- if (state3.length === 0) state3.needReadable = true;
- this._read(state3.highWaterMark);
- state3.sync = false;
- if (!state3.reading) n = howMuchToRead(nOrig, state3);
- }
- var ret;
- if (n > 0) ret = fromList(n, state3);
- else ret = null;
- if (ret === null) {
- state3.needReadable = true;
- n = 0;
- } else {
- state3.length -= n;
- }
- if (state3.length === 0) {
- if (!state3.ended) state3.needReadable = true;
- if (nOrig !== n && state3.ended) endReadable(this);
- }
- if (ret !== null) this.emit("data", ret);
- return ret;
- };
- function onEofChunk(stream4, state3) {
- if (state3.ended) return;
- if (state3.decoder) {
- var chunk = state3.decoder.end();
- if (chunk && chunk.length) {
- state3.buffer.push(chunk);
- state3.length += state3.objectMode ? 1 : chunk.length;
- }
- }
- state3.ended = true;
- emitReadable(stream4);
- }
- function emitReadable(stream4) {
- var state3 = stream4._readableState;
- state3.needReadable = false;
- if (!state3.emittedReadable) {
- debug2("emitReadable", state3.flowing);
- state3.emittedReadable = true;
- if (state3.sync) pna.nextTick(emitReadable_, stream4);
- else emitReadable_(stream4);
- }
- }
- function emitReadable_(stream4) {
- debug2("emit readable");
- stream4.emit("readable");
- flow(stream4);
- }
- function maybeReadMore(stream4, state3) {
- if (!state3.readingMore) {
- state3.readingMore = true;
- pna.nextTick(maybeReadMore_, stream4, state3);
- }
- }
- function maybeReadMore_(stream4, state3) {
- var len = state3.length;
- while (!state3.reading && !state3.flowing && !state3.ended && state3.length < state3.highWaterMark) {
- debug2("maybeReadMore read 0");
- stream4.read(0);
- if (len === state3.length)
- break;
- else len = state3.length;
- }
- state3.readingMore = false;
- }
- Readable7.prototype._read = function(n) {
- this.emit("error", new Error("_read() is not implemented"));
- };
- Readable7.prototype.pipe = function(dest, pipeOpts) {
- var src = this;
- var state3 = this._readableState;
- switch (state3.pipesCount) {
- case 0:
- state3.pipes = dest;
- break;
- case 1:
- state3.pipes = [state3.pipes, dest];
- break;
- default:
- state3.pipes.push(dest);
- break;
- }
- state3.pipesCount += 1;
- debug2("pipe count=%d opts=%j", state3.pipesCount, pipeOpts);
- var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
- var endFn = doEnd ? onend : unpipe;
- if (state3.endEmitted) pna.nextTick(endFn);
- else src.once("end", endFn);
- dest.on("unpipe", onunpipe);
- function onunpipe(readable, unpipeInfo) {
- debug2("onunpipe");
- if (readable === src) {
- if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
- unpipeInfo.hasUnpiped = true;
- cleanup();
- }
- }
- }
- function onend() {
- debug2("onend");
- dest.end();
- }
- var ondrain = pipeOnDrain(src);
- dest.on("drain", ondrain);
- var cleanedUp = false;
- function cleanup() {
- debug2("cleanup");
- dest.removeListener("close", onclose);
- dest.removeListener("finish", onfinish);
- dest.removeListener("drain", ondrain);
- dest.removeListener("error", onerror);
- dest.removeListener("unpipe", onunpipe);
- src.removeListener("end", onend);
- src.removeListener("end", unpipe);
- src.removeListener("data", ondata);
- cleanedUp = true;
- if (state3.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
- }
- var increasedAwaitDrain = false;
- src.on("data", ondata);
- function ondata(chunk) {
- debug2("ondata");
- increasedAwaitDrain = false;
- var ret = dest.write(chunk);
- if (false === ret && !increasedAwaitDrain) {
- if ((state3.pipesCount === 1 && state3.pipes === dest || state3.pipesCount > 1 && indexOf(state3.pipes, dest) !== -1) && !cleanedUp) {
- debug2("false write response, pause", state3.awaitDrain);
- state3.awaitDrain++;
- increasedAwaitDrain = true;
- }
- src.pause();
- }
- }
- function onerror(er) {
- debug2("onerror", er);
- unpipe();
- dest.removeListener("error", onerror);
- if (EElistenerCount(dest, "error") === 0) dest.emit("error", er);
- }
- prependListener(dest, "error", onerror);
- function onclose() {
- dest.removeListener("finish", onfinish);
- unpipe();
- }
- dest.once("close", onclose);
- function onfinish() {
- debug2("onfinish");
- dest.removeListener("close", onclose);
- unpipe();
- }
- dest.once("finish", onfinish);
- function unpipe() {
- debug2("unpipe");
- src.unpipe(dest);
- }
- dest.emit("pipe", src);
- if (!state3.flowing) {
- debug2("pipe resume");
- src.resume();
- }
- return dest;
- };
- function pipeOnDrain(src) {
- return function() {
- var state3 = src._readableState;
- debug2("pipeOnDrain", state3.awaitDrain);
- if (state3.awaitDrain) state3.awaitDrain--;
- if (state3.awaitDrain === 0 && EElistenerCount(src, "data")) {
- state3.flowing = true;
- flow(src);
- }
- };
- }
- Readable7.prototype.unpipe = function(dest) {
- var state3 = this._readableState;
- var unpipeInfo = { hasUnpiped: false };
- if (state3.pipesCount === 0) return this;
- if (state3.pipesCount === 1) {
- if (dest && dest !== state3.pipes) return this;
- if (!dest) dest = state3.pipes;
- state3.pipes = null;
- state3.pipesCount = 0;
- state3.flowing = false;
- if (dest) dest.emit("unpipe", this, unpipeInfo);
- return this;
- }
- if (!dest) {
- var dests = state3.pipes;
- var len = state3.pipesCount;
- state3.pipes = null;
- state3.pipesCount = 0;
- state3.flowing = false;
- for (var i = 0; i < len; i++) {
- dests[i].emit("unpipe", this, { hasUnpiped: false });
- }
- return this;
- }
- var index = indexOf(state3.pipes, dest);
- if (index === -1) return this;
- state3.pipes.splice(index, 1);
- state3.pipesCount -= 1;
- if (state3.pipesCount === 1) state3.pipes = state3.pipes[0];
- dest.emit("unpipe", this, unpipeInfo);
- return this;
- };
- Readable7.prototype.on = function(ev, fn) {
- var res = Stream2.prototype.on.call(this, ev, fn);
- if (ev === "data") {
- if (this._readableState.flowing !== false) this.resume();
- } else if (ev === "readable") {
- var state3 = this._readableState;
- if (!state3.endEmitted && !state3.readableListening) {
- state3.readableListening = state3.needReadable = true;
- state3.emittedReadable = false;
- if (!state3.reading) {
- pna.nextTick(nReadingNextTick, this);
- } else if (state3.length) {
- emitReadable(this);
- }
- }
- }
- return res;
- };
- Readable7.prototype.addListener = Readable7.prototype.on;
- function nReadingNextTick(self2) {
- debug2("readable nexttick read 0");
- self2.read(0);
- }
- Readable7.prototype.resume = function() {
- var state3 = this._readableState;
- if (!state3.flowing) {
- debug2("resume");
- state3.flowing = true;
- resume(this, state3);
- }
- return this;
- };
- function resume(stream4, state3) {
- if (!state3.resumeScheduled) {
- state3.resumeScheduled = true;
- pna.nextTick(resume_, stream4, state3);
- }
- }
- function resume_(stream4, state3) {
- if (!state3.reading) {
- debug2("resume read 0");
- stream4.read(0);
- }
- state3.resumeScheduled = false;
- state3.awaitDrain = 0;
- stream4.emit("resume");
- flow(stream4);
- if (state3.flowing && !state3.reading) stream4.read(0);
- }
- Readable7.prototype.pause = function() {
- debug2("call pause flowing=%j", this._readableState.flowing);
- if (false !== this._readableState.flowing) {
- debug2("pause");
- this._readableState.flowing = false;
- this.emit("pause");
- }
- return this;
- };
- function flow(stream4) {
- var state3 = stream4._readableState;
- debug2("flow", state3.flowing);
- while (state3.flowing && stream4.read() !== null) {
- }
- }
- Readable7.prototype.wrap = function(stream4) {
- var _this = this;
- var state3 = this._readableState;
- var paused = false;
- stream4.on("end", function() {
- debug2("wrapped end");
- if (state3.decoder && !state3.ended) {
- var chunk = state3.decoder.end();
- if (chunk && chunk.length) _this.push(chunk);
- }
- _this.push(null);
- });
- stream4.on("data", function(chunk) {
- debug2("wrapped data");
- if (state3.decoder) chunk = state3.decoder.write(chunk);
- if (state3.objectMode && (chunk === null || chunk === void 0)) return;
- else if (!state3.objectMode && (!chunk || !chunk.length)) return;
- var ret = _this.push(chunk);
- if (!ret) {
- paused = true;
- stream4.pause();
- }
- });
- for (var i in stream4) {
- if (this[i] === void 0 && typeof stream4[i] === "function") {
- this[i] = /* @__PURE__ */ (function(method) {
- return function() {
- return stream4[method].apply(stream4, arguments);
- };
- })(i);
- }
- }
- for (var n = 0; n < kProxyEvents.length; n++) {
- stream4.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
- }
- this._read = function(n2) {
- debug2("wrapped _read", n2);
- if (paused) {
- paused = false;
- stream4.resume();
- }
- };
- return this;
- };
- Object.defineProperty(Readable7.prototype, "readableHighWaterMark", {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function() {
- return this._readableState.highWaterMark;
- }
- });
- Readable7._fromList = fromList;
- function fromList(n, state3) {
- if (state3.length === 0) return null;
- var ret;
- if (state3.objectMode) ret = state3.buffer.shift();
- else if (!n || n >= state3.length) {
- if (state3.decoder) ret = state3.buffer.join("");
- else if (state3.buffer.length === 1) ret = state3.buffer.head.data;
- else ret = state3.buffer.concat(state3.length);
- state3.buffer.clear();
- } else {
- ret = fromListPartial(n, state3.buffer, state3.decoder);
- }
- return ret;
- }
- function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- ret = list.shift();
- } else {
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
- }
- function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;
- else ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) list.head = p.next;
- else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- function copyFromBuffer(n, list) {
- var ret = Buffer3.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) list.head = p.next;
- else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- function endReadable(stream4) {
- var state3 = stream4._readableState;
- if (state3.length > 0) throw new Error('"endReadable()" called on non-empty stream');
- if (!state3.endEmitted) {
- state3.ended = true;
- pna.nextTick(endReadableNT, state3, stream4);
- }
- }
- function endReadableNT(state3, stream4) {
- if (!state3.endEmitted && state3.length === 0) {
- state3.endEmitted = true;
- stream4.readable = false;
- stream4.emit("end");
- }
- }
- function indexOf(xs, x) {
- for (var i = 0, l = xs.length; i < l; i++) {
- if (xs[i] === x) return i;
- }
- return -1;
- }
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/_stream_transform.js
-var require_stream_transform = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/_stream_transform.js"(exports2, module2) {
- "use strict";
- module2.exports = Transform4;
- var Duplex = require_stream_duplex();
- var util3 = Object.create(require_util9());
- util3.inherits = require_inherits();
- util3.inherits(Transform4, Duplex);
- function afterTransform(er, data) {
- var ts = this._transformState;
- ts.transforming = false;
- var cb = ts.writecb;
- if (!cb) {
- return this.emit("error", new Error("write callback called multiple times"));
- }
- ts.writechunk = null;
- ts.writecb = null;
- if (data != null)
- this.push(data);
- cb(er);
- var rs = this._readableState;
- rs.reading = false;
- if (rs.needReadable || rs.length < rs.highWaterMark) {
- this._read(rs.highWaterMark);
- }
- }
- function Transform4(options) {
- if (!(this instanceof Transform4)) return new Transform4(options);
- Duplex.call(this, options);
- this._transformState = {
- afterTransform: afterTransform.bind(this),
- needTransform: false,
- transforming: false,
- writecb: null,
- writechunk: null,
- writeencoding: null
- };
- this._readableState.needReadable = true;
- this._readableState.sync = false;
- if (options) {
- if (typeof options.transform === "function") this._transform = options.transform;
- if (typeof options.flush === "function") this._flush = options.flush;
- }
- this.on("prefinish", prefinish);
- }
- function prefinish() {
- var _this = this;
- if (typeof this._flush === "function") {
- this._flush(function(er, data) {
- done(_this, er, data);
- });
- } else {
- done(this, null, null);
- }
- }
- Transform4.prototype.push = function(chunk, encoding) {
- this._transformState.needTransform = false;
- return Duplex.prototype.push.call(this, chunk, encoding);
- };
- Transform4.prototype._transform = function(chunk, encoding, cb) {
- throw new Error("_transform() is not implemented");
- };
- Transform4.prototype._write = function(chunk, encoding, cb) {
- var ts = this._transformState;
- ts.writecb = cb;
- ts.writechunk = chunk;
- ts.writeencoding = encoding;
- if (!ts.transforming) {
- var rs = this._readableState;
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
- }
- };
- Transform4.prototype._read = function(n) {
- var ts = this._transformState;
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
- ts.transforming = true;
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
- } else {
- ts.needTransform = true;
- }
- };
- Transform4.prototype._destroy = function(err, cb) {
- var _this2 = this;
- Duplex.prototype._destroy.call(this, err, function(err2) {
- cb(err2);
- _this2.emit("close");
- });
- };
- function done(stream4, er, data) {
- if (er) return stream4.emit("error", er);
- if (data != null)
- stream4.push(data);
- if (stream4._writableState.length) throw new Error("Calling transform done when ws.length != 0");
- if (stream4._transformState.transforming) throw new Error("Calling transform done when still transforming");
- return stream4.push(null);
- }
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/lib/_stream_passthrough.js
-var require_stream_passthrough = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/lib/_stream_passthrough.js"(exports2, module2) {
- "use strict";
- module2.exports = PassThrough2;
- var Transform4 = require_stream_transform();
- var util3 = Object.create(require_util9());
- util3.inherits = require_inherits();
- util3.inherits(PassThrough2, Transform4);
- function PassThrough2(options) {
- if (!(this instanceof PassThrough2)) return new PassThrough2(options);
- Transform4.call(this, options);
- }
- PassThrough2.prototype._transform = function(chunk, encoding, cb) {
- cb(null, chunk);
- };
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/readable.js
-var require_readable2 = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/readable.js"(exports2, module2) {
- var Stream2 = require("stream");
- if (process.env.READABLE_STREAM === "disable" && Stream2) {
- module2.exports = Stream2;
- exports2 = module2.exports = Stream2.Readable;
- exports2.Readable = Stream2.Readable;
- exports2.Writable = Stream2.Writable;
- exports2.Duplex = Stream2.Duplex;
- exports2.Transform = Stream2.Transform;
- exports2.PassThrough = Stream2.PassThrough;
- exports2.Stream = Stream2;
- } else {
- exports2 = module2.exports = require_stream_readable();
- exports2.Stream = Stream2 || exports2;
- exports2.Readable = exports2;
- exports2.Writable = require_stream_writable();
- exports2.Duplex = require_stream_duplex();
- exports2.Transform = require_stream_transform();
- exports2.PassThrough = require_stream_passthrough();
- }
- }
-});
-
-// node_modules/lazystream/node_modules/readable-stream/passthrough.js
-var require_passthrough = __commonJS({
- "node_modules/lazystream/node_modules/readable-stream/passthrough.js"(exports2, module2) {
- module2.exports = require_readable2().PassThrough;
- }
-});
-
-// node_modules/lazystream/lib/lazystream.js
-var require_lazystream = __commonJS({
- "node_modules/lazystream/lib/lazystream.js"(exports2, module2) {
- var util3 = require("util");
- var PassThrough2 = require_passthrough();
- module2.exports = {
- Readable: Readable7,
- Writable
- };
- util3.inherits(Readable7, PassThrough2);
- util3.inherits(Writable, PassThrough2);
- function beforeFirstCall(instance, method, callback) {
- instance[method] = function() {
- delete instance[method];
- callback.apply(this, arguments);
- return this[method].apply(this, arguments);
- };
- }
- function Readable7(fn, options) {
- if (!(this instanceof Readable7))
- return new Readable7(fn, options);
- PassThrough2.call(this, options);
- beforeFirstCall(this, "_read", function() {
- var source = fn.call(this, options);
- var emit = this.emit.bind(this, "error");
- source.on("error", emit);
- source.pipe(this);
- });
- this.emit("readable");
- }
- function Writable(fn, options) {
- if (!(this instanceof Writable))
- return new Writable(fn, options);
- PassThrough2.call(this, options);
- beforeFirstCall(this, "_write", function() {
- var destination = fn.call(this, options);
- var emit = this.emit.bind(this, "error");
- destination.on("error", emit);
- this.pipe(destination);
- });
- this.emit("writable");
- }
- }
-});
-
-// node_modules/normalize-path/index.js
-var require_normalize_path = __commonJS({
- "node_modules/normalize-path/index.js"(exports2, module2) {
- module2.exports = function(path6, stripTrailing) {
- if (typeof path6 !== "string") {
- throw new TypeError("expected path to be a string");
- }
- if (path6 === "\\" || path6 === "/") return "/";
- var len = path6.length;
- if (len <= 1) return path6;
- var prefix2 = "";
- if (len > 4 && path6[3] === "\\") {
- var ch = path6[2];
- if ((ch === "?" || ch === ".") && path6.slice(0, 2) === "\\\\") {
- path6 = path6.slice(2);
- prefix2 = "//";
- }
- }
- var segs = path6.split(/[/\\]+/);
- if (stripTrailing !== false && segs[segs.length - 1] === "") {
- segs.pop();
- }
- return prefix2 + segs.join("/");
- };
- }
-});
-
-// node_modules/lodash/identity.js
-var require_identity = __commonJS({
- "node_modules/lodash/identity.js"(exports2, module2) {
- function identity(value) {
- return value;
- }
- module2.exports = identity;
- }
-});
-
-// node_modules/lodash/_apply.js
-var require_apply = __commonJS({
- "node_modules/lodash/_apply.js"(exports2, module2) {
- function apply(func, thisArg, args) {
- switch (args.length) {
- case 0:
- return func.call(thisArg);
- case 1:
- return func.call(thisArg, args[0]);
- case 2:
- return func.call(thisArg, args[0], args[1]);
- case 3:
- return func.call(thisArg, args[0], args[1], args[2]);
- }
- return func.apply(thisArg, args);
- }
- module2.exports = apply;
- }
-});
-
-// node_modules/lodash/_overRest.js
-var require_overRest = __commonJS({
- "node_modules/lodash/_overRest.js"(exports2, module2) {
- var apply = require_apply();
- var nativeMax = Math.max;
- function overRest(func, start, transform) {
- start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
- return function() {
- var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
- while (++index < length) {
- array[index] = args[start + index];
- }
- index = -1;
- var otherArgs = Array(start + 1);
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = transform(array);
- return apply(func, this, otherArgs);
- };
- }
- module2.exports = overRest;
- }
-});
-
-// node_modules/lodash/constant.js
-var require_constant = __commonJS({
- "node_modules/lodash/constant.js"(exports2, module2) {
- function constant(value) {
- return function() {
- return value;
- };
- }
- module2.exports = constant;
- }
-});
-
-// node_modules/lodash/_freeGlobal.js
-var require_freeGlobal = __commonJS({
- "node_modules/lodash/_freeGlobal.js"(exports2, module2) {
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
- module2.exports = freeGlobal;
- }
-});
-
-// node_modules/lodash/_root.js
-var require_root = __commonJS({
- "node_modules/lodash/_root.js"(exports2, module2) {
- var freeGlobal = require_freeGlobal();
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
- var root = freeGlobal || freeSelf || Function("return this")();
- module2.exports = root;
- }
-});
-
-// node_modules/lodash/_Symbol.js
-var require_Symbol = __commonJS({
- "node_modules/lodash/_Symbol.js"(exports2, module2) {
- var root = require_root();
- var Symbol2 = root.Symbol;
- module2.exports = Symbol2;
- }
-});
-
-// node_modules/lodash/_getRawTag.js
-var require_getRawTag = __commonJS({
- "node_modules/lodash/_getRawTag.js"(exports2, module2) {
- var Symbol2 = require_Symbol();
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var nativeObjectToString = objectProto.toString;
- var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
- function getRawTag(value) {
- var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
- try {
- value[symToStringTag] = void 0;
- var unmasked = true;
- } catch (e) {
- }
- var result = nativeObjectToString.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag] = tag;
- } else {
- delete value[symToStringTag];
- }
- }
- return result;
- }
- module2.exports = getRawTag;
- }
-});
-
-// node_modules/lodash/_objectToString.js
-var require_objectToString = __commonJS({
- "node_modules/lodash/_objectToString.js"(exports2, module2) {
- var objectProto = Object.prototype;
- var nativeObjectToString = objectProto.toString;
- function objectToString(value) {
- return nativeObjectToString.call(value);
- }
- module2.exports = objectToString;
- }
-});
-
-// node_modules/lodash/_baseGetTag.js
-var require_baseGetTag = __commonJS({
- "node_modules/lodash/_baseGetTag.js"(exports2, module2) {
- var Symbol2 = require_Symbol();
- var getRawTag = require_getRawTag();
- var objectToString = require_objectToString();
- var nullTag = "[object Null]";
- var undefinedTag = "[object Undefined]";
- var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
- function baseGetTag(value) {
- if (value == null) {
- return value === void 0 ? undefinedTag : nullTag;
- }
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
- }
- module2.exports = baseGetTag;
- }
-});
-
-// node_modules/lodash/isObject.js
-var require_isObject = __commonJS({
- "node_modules/lodash/isObject.js"(exports2, module2) {
- function isObject2(value) {
- var type = typeof value;
- return value != null && (type == "object" || type == "function");
- }
- module2.exports = isObject2;
- }
-});
-
-// node_modules/lodash/isFunction.js
-var require_isFunction = __commonJS({
- "node_modules/lodash/isFunction.js"(exports2, module2) {
- var baseGetTag = require_baseGetTag();
- var isObject2 = require_isObject();
- var asyncTag = "[object AsyncFunction]";
- var funcTag = "[object Function]";
- var genTag = "[object GeneratorFunction]";
- var proxyTag = "[object Proxy]";
- function isFunction(value) {
- if (!isObject2(value)) {
- return false;
- }
- var tag = baseGetTag(value);
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
- }
- module2.exports = isFunction;
- }
-});
-
-// node_modules/lodash/_coreJsData.js
-var require_coreJsData = __commonJS({
- "node_modules/lodash/_coreJsData.js"(exports2, module2) {
- var root = require_root();
- var coreJsData = root["__core-js_shared__"];
- module2.exports = coreJsData;
- }
-});
-
-// node_modules/lodash/_isMasked.js
-var require_isMasked = __commonJS({
- "node_modules/lodash/_isMasked.js"(exports2, module2) {
- var coreJsData = require_coreJsData();
- var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
- return uid ? "Symbol(src)_1." + uid : "";
- })();
- function isMasked(func) {
- return !!maskSrcKey && maskSrcKey in func;
- }
- module2.exports = isMasked;
- }
-});
-
-// node_modules/lodash/_toSource.js
-var require_toSource = __commonJS({
- "node_modules/lodash/_toSource.js"(exports2, module2) {
- var funcProto = Function.prototype;
- var funcToString = funcProto.toString;
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {
- }
- try {
- return func + "";
- } catch (e) {
- }
- }
- return "";
- }
- module2.exports = toSource;
- }
-});
-
-// node_modules/lodash/_baseIsNative.js
-var require_baseIsNative = __commonJS({
- "node_modules/lodash/_baseIsNative.js"(exports2, module2) {
- var isFunction = require_isFunction();
- var isMasked = require_isMasked();
- var isObject2 = require_isObject();
- var toSource = require_toSource();
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- var funcProto = Function.prototype;
- var objectProto = Object.prototype;
- var funcToString = funcProto.toString;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var reIsNative = RegExp(
- "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
- );
- function baseIsNative(value) {
- if (!isObject2(value) || isMasked(value)) {
- return false;
- }
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
- }
- module2.exports = baseIsNative;
- }
-});
-
-// node_modules/lodash/_getValue.js
-var require_getValue = __commonJS({
- "node_modules/lodash/_getValue.js"(exports2, module2) {
- function getValue(object, key) {
- return object == null ? void 0 : object[key];
- }
- module2.exports = getValue;
- }
-});
-
-// node_modules/lodash/_getNative.js
-var require_getNative = __commonJS({
- "node_modules/lodash/_getNative.js"(exports2, module2) {
- var baseIsNative = require_baseIsNative();
- var getValue = require_getValue();
- function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : void 0;
- }
- module2.exports = getNative;
- }
-});
-
-// node_modules/lodash/_defineProperty.js
-var require_defineProperty = __commonJS({
- "node_modules/lodash/_defineProperty.js"(exports2, module2) {
- var getNative = require_getNative();
- var defineProperty = (function() {
- try {
- var func = getNative(Object, "defineProperty");
- func({}, "", {});
- return func;
- } catch (e) {
- }
- })();
- module2.exports = defineProperty;
- }
-});
-
-// node_modules/lodash/_baseSetToString.js
-var require_baseSetToString = __commonJS({
- "node_modules/lodash/_baseSetToString.js"(exports2, module2) {
- var constant = require_constant();
- var defineProperty = require_defineProperty();
- var identity = require_identity();
- var baseSetToString = !defineProperty ? identity : function(func, string) {
- return defineProperty(func, "toString", {
- "configurable": true,
- "enumerable": false,
- "value": constant(string),
- "writable": true
- });
- };
- module2.exports = baseSetToString;
- }
-});
-
-// node_modules/lodash/_shortOut.js
-var require_shortOut = __commonJS({
- "node_modules/lodash/_shortOut.js"(exports2, module2) {
- var HOT_COUNT = 800;
- var HOT_SPAN = 16;
- var nativeNow = Date.now;
- function shortOut(func) {
- var count = 0, lastCalled = 0;
- return function() {
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
- lastCalled = stamp;
- if (remaining > 0) {
- if (++count >= HOT_COUNT) {
- return arguments[0];
- }
- } else {
- count = 0;
- }
- return func.apply(void 0, arguments);
- };
- }
- module2.exports = shortOut;
- }
-});
-
-// node_modules/lodash/_setToString.js
-var require_setToString = __commonJS({
- "node_modules/lodash/_setToString.js"(exports2, module2) {
- var baseSetToString = require_baseSetToString();
- var shortOut = require_shortOut();
- var setToString = shortOut(baseSetToString);
- module2.exports = setToString;
- }
-});
-
-// node_modules/lodash/_baseRest.js
-var require_baseRest = __commonJS({
- "node_modules/lodash/_baseRest.js"(exports2, module2) {
- var identity = require_identity();
- var overRest = require_overRest();
- var setToString = require_setToString();
- function baseRest(func, start) {
- return setToString(overRest(func, start, identity), func + "");
- }
- module2.exports = baseRest;
- }
-});
-
-// node_modules/lodash/eq.js
-var require_eq = __commonJS({
- "node_modules/lodash/eq.js"(exports2, module2) {
- function eq(value, other) {
- return value === other || value !== value && other !== other;
- }
- module2.exports = eq;
- }
-});
-
-// node_modules/lodash/isLength.js
-var require_isLength = __commonJS({
- "node_modules/lodash/isLength.js"(exports2, module2) {
- var MAX_SAFE_INTEGER = 9007199254740991;
- function isLength(value) {
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- module2.exports = isLength;
- }
-});
-
-// node_modules/lodash/isArrayLike.js
-var require_isArrayLike = __commonJS({
- "node_modules/lodash/isArrayLike.js"(exports2, module2) {
- var isFunction = require_isFunction();
- var isLength = require_isLength();
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- module2.exports = isArrayLike;
- }
-});
-
-// node_modules/lodash/_isIndex.js
-var require_isIndex = __commonJS({
- "node_modules/lodash/_isIndex.js"(exports2, module2) {
- var MAX_SAFE_INTEGER = 9007199254740991;
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- function isIndex(value, length) {
- var type = typeof value;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
- }
- module2.exports = isIndex;
- }
-});
-
-// node_modules/lodash/_isIterateeCall.js
-var require_isIterateeCall = __commonJS({
- "node_modules/lodash/_isIterateeCall.js"(exports2, module2) {
- var eq = require_eq();
- var isArrayLike = require_isArrayLike();
- var isIndex = require_isIndex();
- var isObject2 = require_isObject();
- function isIterateeCall(value, index, object) {
- if (!isObject2(object)) {
- return false;
- }
- var type = typeof index;
- if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
- return eq(object[index], value);
- }
- return false;
- }
- module2.exports = isIterateeCall;
- }
-});
-
-// node_modules/lodash/_baseTimes.js
-var require_baseTimes = __commonJS({
- "node_modules/lodash/_baseTimes.js"(exports2, module2) {
- function baseTimes(n, iteratee) {
- var index = -1, result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- module2.exports = baseTimes;
- }
-});
-
-// node_modules/lodash/isObjectLike.js
-var require_isObjectLike = __commonJS({
- "node_modules/lodash/isObjectLike.js"(exports2, module2) {
- function isObjectLike(value) {
- return value != null && typeof value == "object";
- }
- module2.exports = isObjectLike;
- }
-});
-
-// node_modules/lodash/_baseIsArguments.js
-var require_baseIsArguments = __commonJS({
- "node_modules/lodash/_baseIsArguments.js"(exports2, module2) {
- var baseGetTag = require_baseGetTag();
- var isObjectLike = require_isObjectLike();
- var argsTag = "[object Arguments]";
- function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag;
- }
- module2.exports = baseIsArguments;
- }
-});
-
-// node_modules/lodash/isArguments.js
-var require_isArguments = __commonJS({
- "node_modules/lodash/isArguments.js"(exports2, module2) {
- var baseIsArguments = require_baseIsArguments();
- var isObjectLike = require_isObjectLike();
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
- var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
- return arguments;
- })()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
- };
- module2.exports = isArguments;
- }
-});
-
-// node_modules/lodash/isArray.js
-var require_isArray = __commonJS({
- "node_modules/lodash/isArray.js"(exports2, module2) {
- var isArray = Array.isArray;
- module2.exports = isArray;
- }
-});
-
-// node_modules/lodash/stubFalse.js
-var require_stubFalse = __commonJS({
- "node_modules/lodash/stubFalse.js"(exports2, module2) {
- function stubFalse() {
- return false;
- }
- module2.exports = stubFalse;
- }
-});
-
-// node_modules/lodash/isBuffer.js
-var require_isBuffer = __commonJS({
- "node_modules/lodash/isBuffer.js"(exports2, module2) {
- var root = require_root();
- var stubFalse = require_stubFalse();
- var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
- var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
- var moduleExports = freeModule && freeModule.exports === freeExports;
- var Buffer3 = moduleExports ? root.Buffer : void 0;
- var nativeIsBuffer = Buffer3 ? Buffer3.isBuffer : void 0;
- var isBuffer = nativeIsBuffer || stubFalse;
- module2.exports = isBuffer;
- }
-});
-
-// node_modules/lodash/_baseIsTypedArray.js
-var require_baseIsTypedArray = __commonJS({
- "node_modules/lodash/_baseIsTypedArray.js"(exports2, module2) {
- var baseGetTag = require_baseGetTag();
- var isLength = require_isLength();
- var isObjectLike = require_isObjectLike();
- var argsTag = "[object Arguments]";
- var arrayTag = "[object Array]";
- var boolTag = "[object Boolean]";
- var dateTag = "[object Date]";
- var errorTag = "[object Error]";
- var funcTag = "[object Function]";
- var mapTag = "[object Map]";
- var numberTag = "[object Number]";
- var objectTag = "[object Object]";
- var regexpTag = "[object RegExp]";
- var setTag = "[object Set]";
- var stringTag = "[object String]";
- var weakMapTag = "[object WeakMap]";
- var arrayBufferTag = "[object ArrayBuffer]";
- var dataViewTag = "[object DataView]";
- var float32Tag = "[object Float32Array]";
- var float64Tag = "[object Float64Array]";
- var int8Tag = "[object Int8Array]";
- var int16Tag = "[object Int16Array]";
- var int32Tag = "[object Int32Array]";
- var uint8Tag = "[object Uint8Array]";
- var uint8ClampedTag = "[object Uint8ClampedArray]";
- var uint16Tag = "[object Uint16Array]";
- var uint32Tag = "[object Uint32Array]";
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
- function baseIsTypedArray(value) {
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
- }
- module2.exports = baseIsTypedArray;
- }
-});
-
-// node_modules/lodash/_baseUnary.js
-var require_baseUnary = __commonJS({
- "node_modules/lodash/_baseUnary.js"(exports2, module2) {
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
- module2.exports = baseUnary;
- }
-});
-
-// node_modules/lodash/_nodeUtil.js
-var require_nodeUtil = __commonJS({
- "node_modules/lodash/_nodeUtil.js"(exports2, module2) {
- var freeGlobal = require_freeGlobal();
- var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
- var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
- var moduleExports = freeModule && freeModule.exports === freeExports;
- var freeProcess = moduleExports && freeGlobal.process;
- var nodeUtil = (function() {
- try {
- var types = freeModule && freeModule.require && freeModule.require("util").types;
- if (types) {
- return types;
- }
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
- } catch (e) {
- }
- })();
- module2.exports = nodeUtil;
- }
-});
-
-// node_modules/lodash/isTypedArray.js
-var require_isTypedArray = __commonJS({
- "node_modules/lodash/isTypedArray.js"(exports2, module2) {
- var baseIsTypedArray = require_baseIsTypedArray();
- var baseUnary = require_baseUnary();
- var nodeUtil = require_nodeUtil();
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
- module2.exports = isTypedArray;
- }
-});
-
-// node_modules/lodash/_arrayLikeKeys.js
-var require_arrayLikeKeys = __commonJS({
- "node_modules/lodash/_arrayLikeKeys.js"(exports2, module2) {
- var baseTimes = require_baseTimes();
- var isArguments = require_isArguments();
- var isArray = require_isArray();
- var isBuffer = require_isBuffer();
- var isIndex = require_isIndex();
- var isTypedArray = require_isTypedArray();
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- function arrayLikeKeys(value, inherited) {
- var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
- isIndex(key, length)))) {
- result.push(key);
- }
- }
- return result;
- }
- module2.exports = arrayLikeKeys;
- }
-});
-
-// node_modules/lodash/_isPrototype.js
-var require_isPrototype = __commonJS({
- "node_modules/lodash/_isPrototype.js"(exports2, module2) {
- var objectProto = Object.prototype;
- function isPrototype(value) {
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
- return value === proto;
- }
- module2.exports = isPrototype;
- }
-});
-
-// node_modules/lodash/_nativeKeysIn.js
-var require_nativeKeysIn = __commonJS({
- "node_modules/lodash/_nativeKeysIn.js"(exports2, module2) {
- function nativeKeysIn(object) {
- var result = [];
- if (object != null) {
- for (var key in Object(object)) {
- result.push(key);
- }
- }
- return result;
- }
- module2.exports = nativeKeysIn;
- }
-});
-
-// node_modules/lodash/_baseKeysIn.js
-var require_baseKeysIn = __commonJS({
- "node_modules/lodash/_baseKeysIn.js"(exports2, module2) {
- var isObject2 = require_isObject();
- var isPrototype = require_isPrototype();
- var nativeKeysIn = require_nativeKeysIn();
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- function baseKeysIn(object) {
- if (!isObject2(object)) {
- return nativeKeysIn(object);
- }
- var isProto = isPrototype(object), result = [];
- for (var key in object) {
- if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
- result.push(key);
- }
- }
- return result;
- }
- module2.exports = baseKeysIn;
- }
-});
-
-// node_modules/lodash/keysIn.js
-var require_keysIn = __commonJS({
- "node_modules/lodash/keysIn.js"(exports2, module2) {
- var arrayLikeKeys = require_arrayLikeKeys();
- var baseKeysIn = require_baseKeysIn();
- var isArrayLike = require_isArrayLike();
- function keysIn(object) {
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
- }
- module2.exports = keysIn;
- }
-});
-
-// node_modules/lodash/defaults.js
-var require_defaults = __commonJS({
- "node_modules/lodash/defaults.js"(exports2, module2) {
- var baseRest = require_baseRest();
- var eq = require_eq();
- var isIterateeCall = require_isIterateeCall();
- var keysIn = require_keysIn();
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var defaults2 = baseRest(function(object, sources) {
- object = Object(object);
- var index = -1;
- var length = sources.length;
- var guard = length > 2 ? sources[2] : void 0;
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
- length = 1;
- }
- while (++index < length) {
- var source = sources[index];
- var props = keysIn(source);
- var propsIndex = -1;
- var propsLength = props.length;
- while (++propsIndex < propsLength) {
- var key = props[propsIndex];
- var value = object[key];
- if (value === void 0 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) {
- object[key] = source[key];
- }
- }
- }
- return object;
- });
- module2.exports = defaults2;
- }
-});
-
-// node_modules/readable-stream/lib/ours/primordials.js
-var require_primordials = __commonJS({
- "node_modules/readable-stream/lib/ours/primordials.js"(exports2, module2) {
- "use strict";
- var AggregateError = class extends Error {
- constructor(errors) {
- if (!Array.isArray(errors)) {
- throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
- }
- let message = "";
- for (let i = 0; i < errors.length; i++) {
- message += ` ${errors[i].stack}
-`;
- }
- super(message);
- this.name = "AggregateError";
- this.errors = errors;
- }
- };
- module2.exports = {
- AggregateError,
- ArrayIsArray(self2) {
- return Array.isArray(self2);
- },
- ArrayPrototypeIncludes(self2, el) {
- return self2.includes(el);
- },
- ArrayPrototypeIndexOf(self2, el) {
- return self2.indexOf(el);
- },
- ArrayPrototypeJoin(self2, sep7) {
- return self2.join(sep7);
- },
- ArrayPrototypeMap(self2, fn) {
- return self2.map(fn);
- },
- ArrayPrototypePop(self2, el) {
- return self2.pop(el);
- },
- ArrayPrototypePush(self2, el) {
- return self2.push(el);
- },
- ArrayPrototypeSlice(self2, start, end) {
- return self2.slice(start, end);
- },
- Error,
- FunctionPrototypeCall(fn, thisArgs, ...args) {
- return fn.call(thisArgs, ...args);
- },
- FunctionPrototypeSymbolHasInstance(self2, instance) {
- return Function.prototype[Symbol.hasInstance].call(self2, instance);
- },
- MathFloor: Math.floor,
- Number,
- NumberIsInteger: Number.isInteger,
- NumberIsNaN: Number.isNaN,
- NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,
- NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,
- NumberParseInt: Number.parseInt,
- ObjectDefineProperties(self2, props) {
- return Object.defineProperties(self2, props);
- },
- ObjectDefineProperty(self2, name, prop) {
- return Object.defineProperty(self2, name, prop);
- },
- ObjectGetOwnPropertyDescriptor(self2, name) {
- return Object.getOwnPropertyDescriptor(self2, name);
- },
- ObjectKeys(obj) {
- return Object.keys(obj);
- },
- ObjectSetPrototypeOf(target, proto) {
- return Object.setPrototypeOf(target, proto);
- },
- Promise,
- PromisePrototypeCatch(self2, fn) {
- return self2.catch(fn);
- },
- PromisePrototypeThen(self2, thenFn, catchFn) {
- return self2.then(thenFn, catchFn);
- },
- PromiseReject(err) {
- return Promise.reject(err);
- },
- PromiseResolve(val) {
- return Promise.resolve(val);
- },
- ReflectApply: Reflect.apply,
- RegExpPrototypeTest(self2, value) {
- return self2.test(value);
- },
- SafeSet: Set,
- String,
- StringPrototypeSlice(self2, start, end) {
- return self2.slice(start, end);
- },
- StringPrototypeToLowerCase(self2) {
- return self2.toLowerCase();
- },
- StringPrototypeToUpperCase(self2) {
- return self2.toUpperCase();
- },
- StringPrototypeTrim(self2) {
- return self2.trim();
- },
- Symbol,
- SymbolFor: Symbol.for,
- SymbolAsyncIterator: Symbol.asyncIterator,
- SymbolHasInstance: Symbol.hasInstance,
- SymbolIterator: Symbol.iterator,
- SymbolDispose: Symbol.dispose || /* @__PURE__ */ Symbol("Symbol.dispose"),
- SymbolAsyncDispose: Symbol.asyncDispose || /* @__PURE__ */ Symbol("Symbol.asyncDispose"),
- TypedArrayPrototypeSet(self2, buf, len) {
- return self2.set(buf, len);
- },
- Boolean,
- Uint8Array
- };
- }
-});
-
-// node_modules/readable-stream/lib/ours/util/inspect.js
-var require_inspect = __commonJS({
- "node_modules/readable-stream/lib/ours/util/inspect.js"(exports2, module2) {
- "use strict";
- module2.exports = {
- format(format, ...args) {
- return format.replace(/%([sdifj])/g, function(...[_unused, type]) {
- const replacement = args.shift();
- if (type === "f") {
- return replacement.toFixed(6);
- } else if (type === "j") {
- return JSON.stringify(replacement);
- } else if (type === "s" && typeof replacement === "object") {
- const ctor = replacement.constructor !== Object ? replacement.constructor.name : "";
- return `${ctor} {}`.trim();
- } else {
- return replacement.toString();
- }
- });
- },
- inspect(value) {
- switch (typeof value) {
- case "string":
- if (value.includes("'")) {
- if (!value.includes('"')) {
- return `"${value}"`;
- } else if (!value.includes("`") && !value.includes("${")) {
- return `\`${value}\``;
- }
- }
- return `'${value}'`;
- case "number":
- if (isNaN(value)) {
- return "NaN";
- } else if (Object.is(value, -0)) {
- return String(value);
- }
- return value;
- case "bigint":
- return `${String(value)}n`;
- case "boolean":
- case "undefined":
- return String(value);
- case "object":
- return "{}";
- }
- }
- };
+ var waterfall$1 = awaitify(waterfall);
+ var index = {
+ apply,
+ applyEach,
+ applyEachSeries,
+ asyncify,
+ auto,
+ autoInject,
+ cargo: cargo$1,
+ cargoQueue: cargo,
+ compose,
+ concat: concat$1,
+ concatLimit: concatLimit$1,
+ concatSeries: concatSeries$1,
+ constant: constant$1,
+ detect: detect$1,
+ detectLimit: detectLimit$1,
+ detectSeries: detectSeries$1,
+ dir,
+ doUntil,
+ doWhilst: doWhilst$1,
+ each,
+ eachLimit: eachLimit$1,
+ eachOf: eachOf$1,
+ eachOfLimit: eachOfLimit$1,
+ eachOfSeries: eachOfSeries$1,
+ eachSeries: eachSeries$1,
+ ensureAsync,
+ every: every$1,
+ everyLimit: everyLimit$1,
+ everySeries: everySeries$1,
+ filter: filter$1,
+ filterLimit: filterLimit$1,
+ filterSeries: filterSeries$1,
+ forever: forever$1,
+ groupBy,
+ groupByLimit: groupByLimit$1,
+ groupBySeries,
+ log: log2,
+ map: map$1,
+ mapLimit: mapLimit$1,
+ mapSeries: mapSeries$1,
+ mapValues,
+ mapValuesLimit: mapValuesLimit$1,
+ mapValuesSeries,
+ memoize,
+ nextTick,
+ parallel,
+ parallelLimit,
+ priorityQueue,
+ queue,
+ race: race$1,
+ reduce: reduce$1,
+ reduceRight,
+ reflect,
+ reflectAll,
+ reject: reject$1,
+ rejectLimit: rejectLimit$1,
+ rejectSeries: rejectSeries$1,
+ retry: retry2,
+ retryable,
+ seq,
+ series,
+ setImmediate: setImmediate$1,
+ some: some$1,
+ someLimit: someLimit$1,
+ someSeries: someSeries$1,
+ sortBy: sortBy$1,
+ timeout,
+ times,
+ timesLimit,
+ timesSeries,
+ transform,
+ tryEach: tryEach$1,
+ unmemoize,
+ until,
+ waterfall: waterfall$1,
+ whilst: whilst$1,
+ // aliases
+ all: every$1,
+ allLimit: everyLimit$1,
+ allSeries: everySeries$1,
+ any: some$1,
+ anyLimit: someLimit$1,
+ anySeries: someSeries$1,
+ find: detect$1,
+ findLimit: detectLimit$1,
+ findSeries: detectSeries$1,
+ flatMap: concat$1,
+ flatMapLimit: concatLimit$1,
+ flatMapSeries: concatSeries$1,
+ forEach: each,
+ forEachSeries: eachSeries$1,
+ forEachLimit: eachLimit$1,
+ forEachOf: eachOf$1,
+ forEachOfSeries: eachOfSeries$1,
+ forEachOfLimit: eachOfLimit$1,
+ inject: reduce$1,
+ foldl: reduce$1,
+ foldr: reduceRight,
+ select: filter$1,
+ selectLimit: filterLimit$1,
+ selectSeries: filterSeries$1,
+ wrapSync: asyncify,
+ during: whilst$1,
+ doDuring: doWhilst$1
+ };
+ exports3.all = every$1;
+ exports3.allLimit = everyLimit$1;
+ exports3.allSeries = everySeries$1;
+ exports3.any = some$1;
+ exports3.anyLimit = someLimit$1;
+ exports3.anySeries = someSeries$1;
+ exports3.apply = apply;
+ exports3.applyEach = applyEach;
+ exports3.applyEachSeries = applyEachSeries;
+ exports3.asyncify = asyncify;
+ exports3.auto = auto;
+ exports3.autoInject = autoInject;
+ exports3.cargo = cargo$1;
+ exports3.cargoQueue = cargo;
+ exports3.compose = compose;
+ exports3.concat = concat$1;
+ exports3.concatLimit = concatLimit$1;
+ exports3.concatSeries = concatSeries$1;
+ exports3.constant = constant$1;
+ exports3.default = index;
+ exports3.detect = detect$1;
+ exports3.detectLimit = detectLimit$1;
+ exports3.detectSeries = detectSeries$1;
+ exports3.dir = dir;
+ exports3.doDuring = doWhilst$1;
+ exports3.doUntil = doUntil;
+ exports3.doWhilst = doWhilst$1;
+ exports3.during = whilst$1;
+ exports3.each = each;
+ exports3.eachLimit = eachLimit$1;
+ exports3.eachOf = eachOf$1;
+ exports3.eachOfLimit = eachOfLimit$1;
+ exports3.eachOfSeries = eachOfSeries$1;
+ exports3.eachSeries = eachSeries$1;
+ exports3.ensureAsync = ensureAsync;
+ exports3.every = every$1;
+ exports3.everyLimit = everyLimit$1;
+ exports3.everySeries = everySeries$1;
+ exports3.filter = filter$1;
+ exports3.filterLimit = filterLimit$1;
+ exports3.filterSeries = filterSeries$1;
+ exports3.find = detect$1;
+ exports3.findLimit = detectLimit$1;
+ exports3.findSeries = detectSeries$1;
+ exports3.flatMap = concat$1;
+ exports3.flatMapLimit = concatLimit$1;
+ exports3.flatMapSeries = concatSeries$1;
+ exports3.foldl = reduce$1;
+ exports3.foldr = reduceRight;
+ exports3.forEach = each;
+ exports3.forEachLimit = eachLimit$1;
+ exports3.forEachOf = eachOf$1;
+ exports3.forEachOfLimit = eachOfLimit$1;
+ exports3.forEachOfSeries = eachOfSeries$1;
+ exports3.forEachSeries = eachSeries$1;
+ exports3.forever = forever$1;
+ exports3.groupBy = groupBy;
+ exports3.groupByLimit = groupByLimit$1;
+ exports3.groupBySeries = groupBySeries;
+ exports3.inject = reduce$1;
+ exports3.log = log2;
+ exports3.map = map$1;
+ exports3.mapLimit = mapLimit$1;
+ exports3.mapSeries = mapSeries$1;
+ exports3.mapValues = mapValues;
+ exports3.mapValuesLimit = mapValuesLimit$1;
+ exports3.mapValuesSeries = mapValuesSeries;
+ exports3.memoize = memoize;
+ exports3.nextTick = nextTick;
+ exports3.parallel = parallel;
+ exports3.parallelLimit = parallelLimit;
+ exports3.priorityQueue = priorityQueue;
+ exports3.queue = queue;
+ exports3.race = race$1;
+ exports3.reduce = reduce$1;
+ exports3.reduceRight = reduceRight;
+ exports3.reflect = reflect;
+ exports3.reflectAll = reflectAll;
+ exports3.reject = reject$1;
+ exports3.rejectLimit = rejectLimit$1;
+ exports3.rejectSeries = rejectSeries$1;
+ exports3.retry = retry2;
+ exports3.retryable = retryable;
+ exports3.select = filter$1;
+ exports3.selectLimit = filterLimit$1;
+ exports3.selectSeries = filterSeries$1;
+ exports3.seq = seq;
+ exports3.series = series;
+ exports3.setImmediate = setImmediate$1;
+ exports3.some = some$1;
+ exports3.someLimit = someLimit$1;
+ exports3.someSeries = someSeries$1;
+ exports3.sortBy = sortBy$1;
+ exports3.timeout = timeout;
+ exports3.times = times;
+ exports3.timesLimit = timesLimit;
+ exports3.timesSeries = timesSeries;
+ exports3.transform = transform;
+ exports3.tryEach = tryEach$1;
+ exports3.unmemoize = unmemoize;
+ exports3.until = until;
+ exports3.waterfall = waterfall$1;
+ exports3.whilst = whilst$1;
+ exports3.wrapSync = asyncify;
+ Object.defineProperty(exports3, "__esModule", { value: true });
+ }));
}
});
-// node_modules/readable-stream/lib/ours/errors.js
-var require_errors2 = __commonJS({
- "node_modules/readable-stream/lib/ours/errors.js"(exports2, module2) {
- "use strict";
- var { format, inspect: inspect2 } = require_inspect();
- var { AggregateError: CustomAggregateError } = require_primordials();
- var AggregateError = globalThis.AggregateError || CustomAggregateError;
- var kIsNodeError = /* @__PURE__ */ Symbol("kIsNodeError");
- var kTypes = [
- "string",
- "function",
- "number",
- "object",
- // Accept 'Function' and 'Object' as alternative to the lower cased version.
- "Function",
- "Object",
- "boolean",
- "bigint",
- "symbol"
- ];
- var classRegExp = /^([A-Z][a-z0-9]*)+$/;
- var nodeInternalPrefix = "__node_internal_";
- var codes = {};
- function assert(value, message) {
- if (!value) {
- throw new codes.ERR_INTERNAL_ASSERTION(message);
- }
- }
- function addNumericalSeparator(val) {
- let res = "";
- let i = val.length;
- const start = val[0] === "-" ? 1 : 0;
- for (; i >= start + 4; i -= 3) {
- res = `_${val.slice(i - 3, i)}${res}`;
- }
- return `${val.slice(0, i)}${res}`;
- }
- function getMessage(key, msg, args) {
- if (typeof msg === "function") {
- assert(
- msg.length <= args.length,
- // Default options do not count.
- `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`
- );
- return msg(...args);
- }
- const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length;
- assert(
- expectedLength === args.length,
- `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
- );
- if (args.length === 0) {
- return msg;
- }
- return format(msg, ...args);
+// node_modules/graceful-fs/polyfills.js
+var require_polyfills = __commonJS({
+ "node_modules/graceful-fs/polyfills.js"(exports2, module2) {
+ var constants4 = require("constants");
+ var origCwd = process.cwd;
+ var cwd = null;
+ var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
+ process.cwd = function() {
+ if (!cwd)
+ cwd = origCwd.call(process);
+ return cwd;
+ };
+ try {
+ process.cwd();
+ } catch (er) {
}
- function E(code, message, Base) {
- if (!Base) {
- Base = Error;
+ if (typeof process.chdir === "function") {
+ chdir = process.chdir;
+ process.chdir = function(d) {
+ cwd = null;
+ chdir.call(process, d);
+ };
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
+ }
+ var chdir;
+ module2.exports = patch;
+ function patch(fs9) {
+ if (constants4.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
+ patchLchmod(fs9);
}
- class NodeError extends Base {
- constructor(...args) {
- super(getMessage(code, message, args));
- }
- toString() {
- return `${this.name} [${code}]: ${this.message}`;
- }
+ if (!fs9.lutimes) {
+ patchLutimes(fs9);
}
- Object.defineProperties(NodeError.prototype, {
- name: {
- value: Base.name,
- writable: true,
- enumerable: false,
- configurable: true
- },
- toString: {
- value() {
- return `${this.name} [${code}]: ${this.message}`;
- },
- writable: true,
- enumerable: false,
- configurable: true
- }
- });
- NodeError.prototype.code = code;
- NodeError.prototype[kIsNodeError] = true;
- codes[code] = NodeError;
- }
- function hideStackFrames(fn) {
- const hidden = nodeInternalPrefix + fn.name;
- Object.defineProperty(fn, "name", {
- value: hidden
- });
- return fn;
- }
- function aggregateTwoErrors(innerError, outerError) {
- if (innerError && outerError && innerError !== outerError) {
- if (Array.isArray(outerError.errors)) {
- outerError.errors.push(innerError);
- return outerError;
- }
- const err = new AggregateError([outerError, innerError], outerError.message);
- err.code = outerError.code;
- return err;
+ fs9.chown = chownFix(fs9.chown);
+ fs9.fchown = chownFix(fs9.fchown);
+ fs9.lchown = chownFix(fs9.lchown);
+ fs9.chmod = chmodFix(fs9.chmod);
+ fs9.fchmod = chmodFix(fs9.fchmod);
+ fs9.lchmod = chmodFix(fs9.lchmod);
+ fs9.chownSync = chownFixSync(fs9.chownSync);
+ fs9.fchownSync = chownFixSync(fs9.fchownSync);
+ fs9.lchownSync = chownFixSync(fs9.lchownSync);
+ fs9.chmodSync = chmodFixSync(fs9.chmodSync);
+ fs9.fchmodSync = chmodFixSync(fs9.fchmodSync);
+ fs9.lchmodSync = chmodFixSync(fs9.lchmodSync);
+ fs9.stat = statFix(fs9.stat);
+ fs9.fstat = statFix(fs9.fstat);
+ fs9.lstat = statFix(fs9.lstat);
+ fs9.statSync = statFixSync(fs9.statSync);
+ fs9.fstatSync = statFixSync(fs9.fstatSync);
+ fs9.lstatSync = statFixSync(fs9.lstatSync);
+ if (fs9.chmod && !fs9.lchmod) {
+ fs9.lchmod = function(path6, mode, cb) {
+ if (cb) process.nextTick(cb);
+ };
+ fs9.lchmodSync = function() {
+ };
}
- return innerError || outerError;
- }
- var AbortError3 = class extends Error {
- constructor(message = "The operation was aborted", options = void 0) {
- if (options !== void 0 && typeof options !== "object") {
- throw new codes.ERR_INVALID_ARG_TYPE("options", "Object", options);
- }
- super(message, options);
- this.code = "ABORT_ERR";
- this.name = "AbortError";
+ if (fs9.chown && !fs9.lchown) {
+ fs9.lchown = function(path6, uid, gid, cb) {
+ if (cb) process.nextTick(cb);
+ };
+ fs9.lchownSync = function() {
+ };
}
- };
- E("ERR_ASSERTION", "%s", Error);
- E(
- "ERR_INVALID_ARG_TYPE",
- (name, expected, actual) => {
- assert(typeof name === "string", "'name' must be a string");
- if (!Array.isArray(expected)) {
- expected = [expected];
- }
- let msg = "The ";
- if (name.endsWith(" argument")) {
- msg += `${name} `;
- } else {
- msg += `"${name}" ${name.includes(".") ? "property" : "argument"} `;
+ if (platform2 === "win32") {
+ fs9.rename = typeof fs9.rename !== "function" ? fs9.rename : (function(fs$rename) {
+ function rename2(from, to, cb) {
+ var start = Date.now();
+ var backoff = 0;
+ fs$rename(from, to, function CB(er) {
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
+ setTimeout(function() {
+ fs9.stat(to, function(stater, st) {
+ if (stater && stater.code === "ENOENT")
+ fs$rename(from, to, CB);
+ else
+ cb(er);
+ });
+ }, backoff);
+ if (backoff < 100)
+ backoff += 10;
+ return;
+ }
+ if (cb) cb(er);
+ });
+ }
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename2, fs$rename);
+ return rename2;
+ })(fs9.rename);
+ }
+ fs9.read = typeof fs9.read !== "function" ? fs9.read : (function(fs$read) {
+ function read(fd, buffer2, offset, length, position, callback_) {
+ var callback;
+ if (callback_ && typeof callback_ === "function") {
+ var eagCounter = 0;
+ callback = function(er, _2, __) {
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
+ eagCounter++;
+ return fs$read.call(fs9, fd, buffer2, offset, length, position, callback);
+ }
+ callback_.apply(this, arguments);
+ };
+ }
+ return fs$read.call(fs9, fd, buffer2, offset, length, position, callback);
}
- msg += "must be ";
- const types = [];
- const instances = [];
- const other = [];
- for (const value of expected) {
- assert(typeof value === "string", "All expected entries have to be of type string");
- if (kTypes.includes(value)) {
- types.push(value.toLowerCase());
- } else if (classRegExp.test(value)) {
- instances.push(value);
- } else {
- assert(value !== "object", 'The value "object" should be written as "Object"');
- other.push(value);
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
+ return read;
+ })(fs9.read);
+ fs9.readSync = typeof fs9.readSync !== "function" ? fs9.readSync : /* @__PURE__ */ (function(fs$readSync) {
+ return function(fd, buffer2, offset, length, position) {
+ var eagCounter = 0;
+ while (true) {
+ try {
+ return fs$readSync.call(fs9, fd, buffer2, offset, length, position);
+ } catch (er) {
+ if (er.code === "EAGAIN" && eagCounter < 10) {
+ eagCounter++;
+ continue;
+ }
+ throw er;
+ }
}
+ };
+ })(fs9.readSync);
+ function patchLchmod(fs10) {
+ fs10.lchmod = function(path6, mode, callback) {
+ fs10.open(
+ path6,
+ constants4.O_WRONLY | constants4.O_SYMLINK,
+ mode,
+ function(err, fd) {
+ if (err) {
+ if (callback) callback(err);
+ return;
+ }
+ fs10.fchmod(fd, mode, function(err2) {
+ fs10.close(fd, function(err22) {
+ if (callback) callback(err2 || err22);
+ });
+ });
+ }
+ );
+ };
+ fs10.lchmodSync = function(path6, mode) {
+ var fd = fs10.openSync(path6, constants4.O_WRONLY | constants4.O_SYMLINK, mode);
+ var threw = true;
+ var ret;
+ try {
+ ret = fs10.fchmodSync(fd, mode);
+ threw = false;
+ } finally {
+ if (threw) {
+ try {
+ fs10.closeSync(fd);
+ } catch (er) {
+ }
+ } else {
+ fs10.closeSync(fd);
+ }
+ }
+ return ret;
+ };
+ }
+ function patchLutimes(fs10) {
+ if (constants4.hasOwnProperty("O_SYMLINK") && fs10.futimes) {
+ fs10.lutimes = function(path6, at, mt, cb) {
+ fs10.open(path6, constants4.O_SYMLINK, function(er, fd) {
+ if (er) {
+ if (cb) cb(er);
+ return;
+ }
+ fs10.futimes(fd, at, mt, function(er2) {
+ fs10.close(fd, function(er22) {
+ if (cb) cb(er2 || er22);
+ });
+ });
+ });
+ };
+ fs10.lutimesSync = function(path6, at, mt) {
+ var fd = fs10.openSync(path6, constants4.O_SYMLINK);
+ var ret;
+ var threw = true;
+ try {
+ ret = fs10.futimesSync(fd, at, mt);
+ threw = false;
+ } finally {
+ if (threw) {
+ try {
+ fs10.closeSync(fd);
+ } catch (er) {
+ }
+ } else {
+ fs10.closeSync(fd);
+ }
+ }
+ return ret;
+ };
+ } else if (fs10.futimes) {
+ fs10.lutimes = function(_a, _b, _c, cb) {
+ if (cb) process.nextTick(cb);
+ };
+ fs10.lutimesSync = function() {
+ };
}
- if (instances.length > 0) {
- const pos = types.indexOf("object");
- if (pos !== -1) {
- types.splice(types, pos, 1);
- instances.push("Object");
+ }
+ function chmodFix(orig) {
+ if (!orig) return orig;
+ return function(target, mode, cb) {
+ return orig.call(fs9, target, mode, function(er) {
+ if (chownErOk(er)) er = null;
+ if (cb) cb.apply(this, arguments);
+ });
+ };
+ }
+ function chmodFixSync(orig) {
+ if (!orig) return orig;
+ return function(target, mode) {
+ try {
+ return orig.call(fs9, target, mode);
+ } catch (er) {
+ if (!chownErOk(er)) throw er;
}
- }
- if (types.length > 0) {
- switch (types.length) {
- case 1:
- msg += `of type ${types[0]}`;
- break;
- case 2:
- msg += `one of type ${types[0]} or ${types[1]}`;
- break;
- default: {
- const last = types.pop();
- msg += `one of type ${types.join(", ")}, or ${last}`;
- }
+ };
+ }
+ function chownFix(orig) {
+ if (!orig) return orig;
+ return function(target, uid, gid, cb) {
+ return orig.call(fs9, target, uid, gid, function(er) {
+ if (chownErOk(er)) er = null;
+ if (cb) cb.apply(this, arguments);
+ });
+ };
+ }
+ function chownFixSync(orig) {
+ if (!orig) return orig;
+ return function(target, uid, gid) {
+ try {
+ return orig.call(fs9, target, uid, gid);
+ } catch (er) {
+ if (!chownErOk(er)) throw er;
}
- if (instances.length > 0 || other.length > 0) {
- msg += " or ";
+ };
+ }
+ function statFix(orig) {
+ if (!orig) return orig;
+ return function(target, options, cb) {
+ if (typeof options === "function") {
+ cb = options;
+ options = null;
}
- }
- if (instances.length > 0) {
- switch (instances.length) {
- case 1:
- msg += `an instance of ${instances[0]}`;
- break;
- case 2:
- msg += `an instance of ${instances[0]} or ${instances[1]}`;
- break;
- default: {
- const last = instances.pop();
- msg += `an instance of ${instances.join(", ")}, or ${last}`;
+ function callback(er, stats) {
+ if (stats) {
+ if (stats.uid < 0) stats.uid += 4294967296;
+ if (stats.gid < 0) stats.gid += 4294967296;
}
+ if (cb) cb.apply(this, arguments);
}
- if (other.length > 0) {
- msg += " or ";
+ return options ? orig.call(fs9, target, options, callback) : orig.call(fs9, target, callback);
+ };
+ }
+ function statFixSync(orig) {
+ if (!orig) return orig;
+ return function(target, options) {
+ var stats = options ? orig.call(fs9, target, options) : orig.call(fs9, target);
+ if (stats) {
+ if (stats.uid < 0) stats.uid += 4294967296;
+ if (stats.gid < 0) stats.gid += 4294967296;
}
+ return stats;
+ };
+ }
+ function chownErOk(er) {
+ if (!er)
+ return true;
+ if (er.code === "ENOSYS")
+ return true;
+ var nonroot = !process.getuid || process.getuid() !== 0;
+ if (nonroot) {
+ if (er.code === "EINVAL" || er.code === "EPERM")
+ return true;
}
- switch (other.length) {
- case 0:
- break;
- case 1:
- if (other[0].toLowerCase() !== other[0]) {
- msg += "an ";
- }
- msg += `${other[0]}`;
- break;
- case 2:
- msg += `one of ${other[0]} or ${other[1]}`;
- break;
- default: {
- const last = other.pop();
- msg += `one of ${other.join(", ")}, or ${last}`;
- }
+ return false;
+ }
+ }
+ }
+});
+
+// node_modules/graceful-fs/legacy-streams.js
+var require_legacy_streams = __commonJS({
+ "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
+ var Stream2 = require("stream").Stream;
+ module2.exports = legacy;
+ function legacy(fs9) {
+ return {
+ ReadStream,
+ WriteStream
+ };
+ function ReadStream(path6, options) {
+ if (!(this instanceof ReadStream)) return new ReadStream(path6, options);
+ Stream2.call(this);
+ var self2 = this;
+ this.path = path6;
+ this.fd = null;
+ this.readable = true;
+ this.paused = false;
+ this.flags = "r";
+ this.mode = 438;
+ this.bufferSize = 64 * 1024;
+ options = options || {};
+ var keys = Object.keys(options);
+ for (var index = 0, length = keys.length; index < length; index++) {
+ var key = keys[index];
+ this[key] = options[key];
}
- if (actual == null) {
- msg += `. Received ${actual}`;
- } else if (typeof actual === "function" && actual.name) {
- msg += `. Received function ${actual.name}`;
- } else if (typeof actual === "object") {
- var _actual$constructor;
- if ((_actual$constructor = actual.constructor) !== null && _actual$constructor !== void 0 && _actual$constructor.name) {
- msg += `. Received an instance of ${actual.constructor.name}`;
- } else {
- const inspected = inspect2(actual, {
- depth: -1
- });
- msg += `. Received ${inspected}`;
+ if (this.encoding) this.setEncoding(this.encoding);
+ if (this.start !== void 0) {
+ if ("number" !== typeof this.start) {
+ throw TypeError("start must be a Number");
}
- } else {
- let inspected = inspect2(actual, {
- colors: false
- });
- if (inspected.length > 25) {
- inspected = `${inspected.slice(0, 25)}...`;
+ if (this.end === void 0) {
+ this.end = Infinity;
+ } else if ("number" !== typeof this.end) {
+ throw TypeError("end must be a Number");
}
- msg += `. Received type ${typeof actual} (${inspected})`;
+ if (this.start > this.end) {
+ throw new Error("start must be <= end");
+ }
+ this.pos = this.start;
}
- return msg;
- },
- TypeError
- );
- E(
- "ERR_INVALID_ARG_VALUE",
- (name, value, reason = "is invalid") => {
- let inspected = inspect2(value);
- if (inspected.length > 128) {
- inspected = inspected.slice(0, 128) + "...";
+ if (this.fd !== null) {
+ process.nextTick(function() {
+ self2._read();
+ });
+ return;
}
- const type = name.includes(".") ? "property" : "argument";
- return `The ${type} '${name}' ${reason}. Received ${inspected}`;
- },
- TypeError
- );
- E(
- "ERR_INVALID_RETURN_VALUE",
- (input, name, value) => {
- var _value$constructor;
- const type = value !== null && value !== void 0 && (_value$constructor = value.constructor) !== null && _value$constructor !== void 0 && _value$constructor.name ? `instance of ${value.constructor.name}` : `type ${typeof value}`;
- return `Expected ${input} to be returned from the "${name}" function but got ${type}.`;
- },
- TypeError
- );
- E(
- "ERR_MISSING_ARGS",
- (...args) => {
- assert(args.length > 0, "At least one arg needs to be specified");
- let msg = "";
- const len = args.length;
- args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`);
- switch (len) {
- case 1:
- msg += `The ${args[0]} argument`;
- break;
- case 2:
- msg += `The ${args[0]} and ${args[1]} arguments`;
- break;
- default:
- {
- const last = args.pop();
- msg += `The ${args.join(", ")}, and ${last} arguments`;
- }
- break;
+ fs9.open(this.path, this.flags, this.mode, function(err, fd) {
+ if (err) {
+ self2.emit("error", err);
+ self2.readable = false;
+ return;
+ }
+ self2.fd = fd;
+ self2.emit("open", fd);
+ self2._read();
+ });
+ }
+ function WriteStream(path6, options) {
+ if (!(this instanceof WriteStream)) return new WriteStream(path6, options);
+ Stream2.call(this);
+ this.path = path6;
+ this.fd = null;
+ this.writable = true;
+ this.flags = "w";
+ this.encoding = "binary";
+ this.mode = 438;
+ this.bytesWritten = 0;
+ options = options || {};
+ var keys = Object.keys(options);
+ for (var index = 0, length = keys.length; index < length; index++) {
+ var key = keys[index];
+ this[key] = options[key];
}
- return `${msg} must be specified`;
- },
- TypeError
- );
- E(
- "ERR_OUT_OF_RANGE",
- (str, range2, input) => {
- assert(range2, 'Missing "range" argument');
- let received;
- if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
- received = addNumericalSeparator(String(input));
- } else if (typeof input === "bigint") {
- received = String(input);
- const limit = BigInt(2) ** BigInt(32);
- if (input > limit || input < -limit) {
- received = addNumericalSeparator(received);
+ if (this.start !== void 0) {
+ if ("number" !== typeof this.start) {
+ throw TypeError("start must be a Number");
}
- received += "n";
- } else {
- received = inspect2(input);
+ if (this.start < 0) {
+ throw new Error("start must be >= zero");
+ }
+ this.pos = this.start;
}
- return `The value of "${str}" is out of range. It must be ${range2}. Received ${received}`;
- },
- RangeError
- );
- E("ERR_MULTIPLE_CALLBACK", "Callback called multiple times", Error);
- E("ERR_METHOD_NOT_IMPLEMENTED", "The %s method is not implemented", Error);
- E("ERR_STREAM_ALREADY_FINISHED", "Cannot call %s after a stream was finished", Error);
- E("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable", Error);
- E("ERR_STREAM_DESTROYED", "Cannot call %s after a stream was destroyed", Error);
- E("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
- E("ERR_STREAM_PREMATURE_CLOSE", "Premature close", Error);
- E("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF", Error);
- E("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event", Error);
- E("ERR_STREAM_WRITE_AFTER_END", "write after end", Error);
- E("ERR_UNKNOWN_ENCODING", "Unknown encoding: %s", TypeError);
- module2.exports = {
- AbortError: AbortError3,
- aggregateTwoErrors: hideStackFrames(aggregateTwoErrors),
- hideStackFrames,
- codes
- };
+ this.busy = false;
+ this._queue = [];
+ if (this.fd === null) {
+ this._open = fs9.open;
+ this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
+ this.flush();
+ }
+ }
+ }
}
});
-// node_modules/event-target-shim/dist/event-target-shim.js
-var require_event_target_shim = __commonJS({
- "node_modules/event-target-shim/dist/event-target-shim.js"(exports2, module2) {
+// node_modules/graceful-fs/clone.js
+var require_clone = __commonJS({
+ "node_modules/graceful-fs/clone.js"(exports2, module2) {
"use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- var privateData = /* @__PURE__ */ new WeakMap();
- var wrappers = /* @__PURE__ */ new WeakMap();
- function pd(event) {
- const retv = privateData.get(event);
- console.assert(
- retv != null,
- "'this' is expected an Event object, but got",
- event
- );
- return retv;
+ module2.exports = clone;
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
+ return obj.__proto__;
+ };
+ function clone(obj) {
+ if (obj === null || typeof obj !== "object")
+ return obj;
+ if (obj instanceof Object)
+ var copy = { __proto__: getPrototypeOf(obj) };
+ else
+ var copy = /* @__PURE__ */ Object.create(null);
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
+ });
+ return copy;
}
- function setCancelFlag(data) {
- if (data.passiveListener != null) {
- if (typeof console !== "undefined" && typeof console.error === "function") {
- console.error(
- "Unable to preventDefault inside passive event listener invocation.",
- data.passiveListener
- );
- }
- return;
- }
- if (!data.event.cancelable) {
- return;
- }
- data.canceled = true;
- if (typeof data.event.preventDefault === "function") {
- data.event.preventDefault();
- }
+ }
+});
+
+// node_modules/graceful-fs/graceful-fs.js
+var require_graceful_fs = __commonJS({
+ "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
+ var fs9 = require("fs");
+ var polyfills = require_polyfills();
+ var legacy = require_legacy_streams();
+ var clone = require_clone();
+ var util3 = require("util");
+ var gracefulQueue;
+ var previousSymbol;
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
+ gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue");
+ previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous");
+ } else {
+ gracefulQueue = "___graceful-fs.queue";
+ previousSymbol = "___graceful-fs.previous";
}
- function Event2(eventTarget, event) {
- privateData.set(this, {
- eventTarget,
- event,
- eventPhase: 2,
- currentTarget: eventTarget,
- canceled: false,
- stopped: false,
- immediateStopped: false,
- passiveListener: null,
- timeStamp: event.timeStamp || Date.now()
+ function noop3() {
+ }
+ function publishQueue(context6, queue2) {
+ Object.defineProperty(context6, gracefulQueue, {
+ get: function() {
+ return queue2;
+ }
});
- Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
- const keys = Object.keys(event);
- for (let i = 0; i < keys.length; ++i) {
- const key = keys[i];
- if (!(key in this)) {
- Object.defineProperty(this, key, defineRedirectDescriptor(key));
+ }
+ var debug2 = noop3;
+ if (util3.debuglog)
+ debug2 = util3.debuglog("gfs4");
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
+ debug2 = function() {
+ var m = util3.format.apply(util3, arguments);
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
+ console.error(m);
+ };
+ if (!fs9[gracefulQueue]) {
+ queue = global[gracefulQueue] || [];
+ publishQueue(fs9, queue);
+ fs9.close = (function(fs$close) {
+ function close(fd, cb) {
+ return fs$close.call(fs9, fd, function(err) {
+ if (!err) {
+ resetQueue();
+ }
+ if (typeof cb === "function")
+ cb.apply(this, arguments);
+ });
+ }
+ Object.defineProperty(close, previousSymbol, {
+ value: fs$close
+ });
+ return close;
+ })(fs9.close);
+ fs9.closeSync = (function(fs$closeSync) {
+ function closeSync(fd) {
+ fs$closeSync.apply(fs9, arguments);
+ resetQueue();
}
+ Object.defineProperty(closeSync, previousSymbol, {
+ value: fs$closeSync
+ });
+ return closeSync;
+ })(fs9.closeSync);
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
+ process.on("exit", function() {
+ debug2(fs9[gracefulQueue]);
+ require("assert").equal(fs9[gracefulQueue].length, 0);
+ });
}
}
- Event2.prototype = {
- /**
- * The type of this event.
- * @type {string}
- */
- get type() {
- return pd(this).event.type;
- },
- /**
- * The target of this event.
- * @type {EventTarget}
- */
- get target() {
- return pd(this).eventTarget;
- },
- /**
- * The target of this event.
- * @type {EventTarget}
- */
- get currentTarget() {
- return pd(this).currentTarget;
- },
- /**
- * @returns {EventTarget[]} The composed path of this event.
- */
- composedPath() {
- const currentTarget = pd(this).currentTarget;
- if (currentTarget == null) {
- return [];
+ var queue;
+ if (!global[gracefulQueue]) {
+ publishQueue(global, fs9[gracefulQueue]);
+ }
+ module2.exports = patch(clone(fs9));
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs9.__patched) {
+ module2.exports = patch(fs9);
+ fs9.__patched = true;
+ }
+ function patch(fs10) {
+ polyfills(fs10);
+ fs10.gracefulify = patch;
+ fs10.createReadStream = createReadStream2;
+ fs10.createWriteStream = createWriteStream2;
+ var fs$readFile = fs10.readFile;
+ fs10.readFile = readFile4;
+ function readFile4(path6, options, cb) {
+ if (typeof options === "function")
+ cb = options, options = null;
+ return go$readFile(path6, options, cb);
+ function go$readFile(path7, options2, cb2, startTime) {
+ return fs$readFile(path7, options2, function(err) {
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
+ enqueue([go$readFile, [path7, options2, cb2], err, startTime || Date.now(), Date.now()]);
+ else {
+ if (typeof cb2 === "function")
+ cb2.apply(this, arguments);
+ }
+ });
}
- return [currentTarget];
- },
- /**
- * Constant of NONE.
- * @type {number}
- */
- get NONE() {
- return 0;
- },
- /**
- * Constant of CAPTURING_PHASE.
- * @type {number}
- */
- get CAPTURING_PHASE() {
- return 1;
- },
- /**
- * Constant of AT_TARGET.
- * @type {number}
- */
- get AT_TARGET() {
- return 2;
- },
- /**
- * Constant of BUBBLING_PHASE.
- * @type {number}
- */
- get BUBBLING_PHASE() {
- return 3;
- },
- /**
- * The target of this event.
- * @type {number}
- */
- get eventPhase() {
- return pd(this).eventPhase;
- },
- /**
- * Stop event bubbling.
- * @returns {void}
- */
- stopPropagation() {
- const data = pd(this);
- data.stopped = true;
- if (typeof data.event.stopPropagation === "function") {
- data.event.stopPropagation();
+ }
+ var fs$writeFile = fs10.writeFile;
+ fs10.writeFile = writeFile4;
+ function writeFile4(path6, data, options, cb) {
+ if (typeof options === "function")
+ cb = options, options = null;
+ return go$writeFile(path6, data, options, cb);
+ function go$writeFile(path7, data2, options2, cb2, startTime) {
+ return fs$writeFile(path7, data2, options2, function(err) {
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
+ enqueue([go$writeFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
+ else {
+ if (typeof cb2 === "function")
+ cb2.apply(this, arguments);
+ }
+ });
}
- },
- /**
- * Stop event bubbling.
- * @returns {void}
- */
- stopImmediatePropagation() {
- const data = pd(this);
- data.stopped = true;
- data.immediateStopped = true;
- if (typeof data.event.stopImmediatePropagation === "function") {
- data.event.stopImmediatePropagation();
+ }
+ var fs$appendFile = fs10.appendFile;
+ if (fs$appendFile)
+ fs10.appendFile = appendFile2;
+ function appendFile2(path6, data, options, cb) {
+ if (typeof options === "function")
+ cb = options, options = null;
+ return go$appendFile(path6, data, options, cb);
+ function go$appendFile(path7, data2, options2, cb2, startTime) {
+ return fs$appendFile(path7, data2, options2, function(err) {
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
+ enqueue([go$appendFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
+ else {
+ if (typeof cb2 === "function")
+ cb2.apply(this, arguments);
+ }
+ });
}
- },
- /**
- * The flag to be bubbling.
- * @type {boolean}
- */
- get bubbles() {
- return Boolean(pd(this).event.bubbles);
- },
- /**
- * The flag to be cancelable.
- * @type {boolean}
- */
- get cancelable() {
- return Boolean(pd(this).event.cancelable);
- },
- /**
- * Cancel this event.
- * @returns {void}
- */
- preventDefault() {
- setCancelFlag(pd(this));
- },
- /**
- * The flag to indicate cancellation state.
- * @type {boolean}
- */
- get defaultPrevented() {
- return pd(this).canceled;
- },
- /**
- * The flag to be composed.
- * @type {boolean}
- */
- get composed() {
- return Boolean(pd(this).event.composed);
- },
- /**
- * The unix time of this event.
- * @type {number}
- */
- get timeStamp() {
- return pd(this).timeStamp;
- },
- /**
- * The target of this event.
- * @type {EventTarget}
- * @deprecated
- */
- get srcElement() {
- return pd(this).eventTarget;
- },
- /**
- * The flag to stop event bubbling.
- * @type {boolean}
- * @deprecated
- */
- get cancelBubble() {
- return pd(this).stopped;
- },
- set cancelBubble(value) {
- if (!value) {
- return;
+ }
+ var fs$copyFile = fs10.copyFile;
+ if (fs$copyFile)
+ fs10.copyFile = copyFile3;
+ function copyFile3(src, dest, flags, cb) {
+ if (typeof flags === "function") {
+ cb = flags;
+ flags = 0;
}
- const data = pd(this);
- data.stopped = true;
- if (typeof data.event.cancelBubble === "boolean") {
- data.event.cancelBubble = true;
+ return go$copyFile(src, dest, flags, cb);
+ function go$copyFile(src2, dest2, flags2, cb2, startTime) {
+ return fs$copyFile(src2, dest2, flags2, function(err) {
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
+ enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
+ else {
+ if (typeof cb2 === "function")
+ cb2.apply(this, arguments);
+ }
+ });
}
- },
- /**
- * The flag to indicate cancellation state.
- * @type {boolean}
- * @deprecated
- */
- get returnValue() {
- return !pd(this).canceled;
- },
- set returnValue(value) {
- if (!value) {
- setCancelFlag(pd(this));
+ }
+ var fs$readdir = fs10.readdir;
+ fs10.readdir = readdir2;
+ var noReaddirOptionVersions = /^v[0-5]\./;
+ function readdir2(path6, options, cb) {
+ if (typeof options === "function")
+ cb = options, options = null;
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path7, options2, cb2, startTime) {
+ return fs$readdir(path7, fs$readdirCallback(
+ path7,
+ options2,
+ cb2,
+ startTime
+ ));
+ } : function go$readdir2(path7, options2, cb2, startTime) {
+ return fs$readdir(path7, options2, fs$readdirCallback(
+ path7,
+ options2,
+ cb2,
+ startTime
+ ));
+ };
+ return go$readdir(path6, options, cb);
+ function fs$readdirCallback(path7, options2, cb2, startTime) {
+ return function(err, files) {
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
+ enqueue([
+ go$readdir,
+ [path7, options2, cb2],
+ err,
+ startTime || Date.now(),
+ Date.now()
+ ]);
+ else {
+ if (files && files.sort)
+ files.sort();
+ if (typeof cb2 === "function")
+ cb2.call(this, err, files);
+ }
+ };
}
- },
- /**
- * Initialize this event object. But do nothing under event dispatching.
- * @param {string} type The event type.
- * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
- * @param {boolean} [cancelable=false] The flag to be possible to cancel.
- * @deprecated
- */
- initEvent() {
}
- };
- Object.defineProperty(Event2.prototype, "constructor", {
- value: Event2,
- configurable: true,
- writable: true
- });
- if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
- Object.setPrototypeOf(Event2.prototype, window.Event.prototype);
- wrappers.set(window.Event.prototype, Event2);
- }
- function defineRedirectDescriptor(key) {
- return {
- get() {
- return pd(this).event[key];
+ if (process.version.substr(0, 4) === "v0.8") {
+ var legStreams = legacy(fs10);
+ ReadStream = legStreams.ReadStream;
+ WriteStream = legStreams.WriteStream;
+ }
+ var fs$ReadStream = fs10.ReadStream;
+ if (fs$ReadStream) {
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
+ ReadStream.prototype.open = ReadStream$open;
+ }
+ var fs$WriteStream = fs10.WriteStream;
+ if (fs$WriteStream) {
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
+ WriteStream.prototype.open = WriteStream$open;
+ }
+ Object.defineProperty(fs10, "ReadStream", {
+ get: function() {
+ return ReadStream;
},
- set(value) {
- pd(this).event[key] = value;
+ set: function(val) {
+ ReadStream = val;
},
- configurable: true,
- enumerable: true
- };
- }
- function defineCallDescriptor(key) {
- return {
- value() {
- const event = pd(this).event;
- return event[key].apply(event, arguments);
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(fs10, "WriteStream", {
+ get: function() {
+ return WriteStream;
},
- configurable: true,
- enumerable: true
- };
- }
- function defineWrapper(BaseEvent, proto) {
- const keys = Object.keys(proto);
- if (keys.length === 0) {
- return BaseEvent;
+ set: function(val) {
+ WriteStream = val;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ var FileReadStream = ReadStream;
+ Object.defineProperty(fs10, "FileReadStream", {
+ get: function() {
+ return FileReadStream;
+ },
+ set: function(val) {
+ FileReadStream = val;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ var FileWriteStream = WriteStream;
+ Object.defineProperty(fs10, "FileWriteStream", {
+ get: function() {
+ return FileWriteStream;
+ },
+ set: function(val) {
+ FileWriteStream = val;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ function ReadStream(path6, options) {
+ if (this instanceof ReadStream)
+ return fs$ReadStream.apply(this, arguments), this;
+ else
+ return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
}
- function CustomEvent(eventTarget, event) {
- BaseEvent.call(this, eventTarget, event);
+ function ReadStream$open() {
+ var that = this;
+ open3(that.path, that.flags, that.mode, function(err, fd) {
+ if (err) {
+ if (that.autoClose)
+ that.destroy();
+ that.emit("error", err);
+ } else {
+ that.fd = fd;
+ that.emit("open", fd);
+ that.read();
+ }
+ });
}
- CustomEvent.prototype = Object.create(BaseEvent.prototype, {
- constructor: { value: CustomEvent, configurable: true, writable: true }
- });
- for (let i = 0; i < keys.length; ++i) {
- const key = keys[i];
- if (!(key in BaseEvent.prototype)) {
- const descriptor = Object.getOwnPropertyDescriptor(proto, key);
- const isFunc = typeof descriptor.value === "function";
- Object.defineProperty(
- CustomEvent.prototype,
- key,
- isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key)
- );
- }
+ function WriteStream(path6, options) {
+ if (this instanceof WriteStream)
+ return fs$WriteStream.apply(this, arguments), this;
+ else
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
}
- return CustomEvent;
- }
- function getWrapper(proto) {
- if (proto == null || proto === Object.prototype) {
- return Event2;
+ function WriteStream$open() {
+ var that = this;
+ open3(that.path, that.flags, that.mode, function(err, fd) {
+ if (err) {
+ that.destroy();
+ that.emit("error", err);
+ } else {
+ that.fd = fd;
+ that.emit("open", fd);
+ }
+ });
}
- let wrapper = wrappers.get(proto);
- if (wrapper == null) {
- wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
- wrappers.set(proto, wrapper);
+ function createReadStream2(path6, options) {
+ return new fs10.ReadStream(path6, options);
}
- return wrapper;
- }
- function wrapEvent(eventTarget, event) {
- const Wrapper = getWrapper(Object.getPrototypeOf(event));
- return new Wrapper(eventTarget, event);
- }
- function isStopped(event) {
- return pd(event).immediateStopped;
- }
- function setEventPhase(event, eventPhase) {
- pd(event).eventPhase = eventPhase;
- }
- function setCurrentTarget(event, currentTarget) {
- pd(event).currentTarget = currentTarget;
- }
- function setPassiveListener(event, passiveListener) {
- pd(event).passiveListener = passiveListener;
- }
- var listenersMap = /* @__PURE__ */ new WeakMap();
- var CAPTURE = 1;
- var BUBBLE = 2;
- var ATTRIBUTE = 3;
- function isObject2(x) {
- return x !== null && typeof x === "object";
- }
- function getListeners(eventTarget) {
- const listeners = listenersMap.get(eventTarget);
- if (listeners == null) {
- throw new TypeError(
- "'this' is expected an EventTarget object, but got another value."
- );
+ function createWriteStream2(path6, options) {
+ return new fs10.WriteStream(path6, options);
}
- return listeners;
- }
- function defineEventAttributeDescriptor(eventName) {
- return {
- get() {
- const listeners = getListeners(this);
- let node = listeners.get(eventName);
- while (node != null) {
- if (node.listenerType === ATTRIBUTE) {
- return node.listener;
- }
- node = node.next;
- }
- return null;
- },
- set(listener) {
- if (typeof listener !== "function" && !isObject2(listener)) {
- listener = null;
- }
- const listeners = getListeners(this);
- let prev = null;
- let node = listeners.get(eventName);
- while (node != null) {
- if (node.listenerType === ATTRIBUTE) {
- if (prev !== null) {
- prev.next = node.next;
- } else if (node.next !== null) {
- listeners.set(eventName, node.next);
- } else {
- listeners.delete(eventName);
- }
- } else {
- prev = node;
- }
- node = node.next;
- }
- if (listener !== null) {
- const newNode = {
- listener,
- listenerType: ATTRIBUTE,
- passive: false,
- once: false,
- next: null
- };
- if (prev === null) {
- listeners.set(eventName, newNode);
- } else {
- prev.next = newNode;
+ var fs$open = fs10.open;
+ fs10.open = open3;
+ function open3(path6, flags, mode, cb) {
+ if (typeof mode === "function")
+ cb = mode, mode = null;
+ return go$open(path6, flags, mode, cb);
+ function go$open(path7, flags2, mode2, cb2, startTime) {
+ return fs$open(path7, flags2, mode2, function(err, fd) {
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
+ enqueue([go$open, [path7, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
+ else {
+ if (typeof cb2 === "function")
+ cb2.apply(this, arguments);
}
- }
- },
- configurable: true,
- enumerable: true
- };
- }
- function defineEventAttribute(eventTargetPrototype, eventName) {
- Object.defineProperty(
- eventTargetPrototype,
- `on${eventName}`,
- defineEventAttributeDescriptor(eventName)
- );
- }
- function defineCustomEventTarget(eventNames) {
- function CustomEventTarget() {
- EventTarget2.call(this);
+ });
+ }
}
- CustomEventTarget.prototype = Object.create(EventTarget2.prototype, {
- constructor: {
- value: CustomEventTarget,
- configurable: true,
- writable: true
+ return fs10;
+ }
+ function enqueue(elem) {
+ debug2("ENQUEUE", elem[0].name, elem[1]);
+ fs9[gracefulQueue].push(elem);
+ retry2();
+ }
+ var retryTimer;
+ function resetQueue() {
+ var now = Date.now();
+ for (var i = 0; i < fs9[gracefulQueue].length; ++i) {
+ if (fs9[gracefulQueue][i].length > 2) {
+ fs9[gracefulQueue][i][3] = now;
+ fs9[gracefulQueue][i][4] = now;
}
- });
- for (let i = 0; i < eventNames.length; ++i) {
- defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
}
- return CustomEventTarget;
+ retry2();
}
- function EventTarget2() {
- if (this instanceof EventTarget2) {
- listenersMap.set(this, /* @__PURE__ */ new Map());
+ function retry2() {
+ clearTimeout(retryTimer);
+ retryTimer = void 0;
+ if (fs9[gracefulQueue].length === 0)
return;
- }
- if (arguments.length === 1 && Array.isArray(arguments[0])) {
- return defineCustomEventTarget(arguments[0]);
- }
- if (arguments.length > 0) {
- const types = new Array(arguments.length);
- for (let i = 0; i < arguments.length; ++i) {
- types[i] = arguments[i];
+ var elem = fs9[gracefulQueue].shift();
+ var fn = elem[0];
+ var args = elem[1];
+ var err = elem[2];
+ var startTime = elem[3];
+ var lastTime = elem[4];
+ if (startTime === void 0) {
+ debug2("RETRY", fn.name, args);
+ fn.apply(null, args);
+ } else if (Date.now() - startTime >= 6e4) {
+ debug2("TIMEOUT", fn.name, args);
+ var cb = args.pop();
+ if (typeof cb === "function")
+ cb.call(null, err);
+ } else {
+ var sinceAttempt = Date.now() - lastTime;
+ var sinceStart = Math.max(lastTime - startTime, 1);
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
+ if (sinceAttempt >= desiredDelay) {
+ debug2("RETRY", fn.name, args);
+ fn.apply(null, args.concat([startTime]));
+ } else {
+ fs9[gracefulQueue].push(elem);
}
- return defineCustomEventTarget(types);
}
- throw new TypeError("Cannot call a class as a function");
+ if (retryTimer === void 0) {
+ retryTimer = setTimeout(retry2, 0);
+ }
}
- EventTarget2.prototype = {
- /**
- * Add a given listener to this event target.
- * @param {string} eventName The event name to add.
- * @param {Function} listener The listener to add.
- * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
- * @returns {void}
- */
- addEventListener(eventName, listener, options) {
- if (listener == null) {
- return;
- }
- if (typeof listener !== "function" && !isObject2(listener)) {
- throw new TypeError("'listener' should be a function or an object.");
- }
- const listeners = getListeners(this);
- const optionsIsObj = isObject2(options);
- const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
- const listenerType = capture ? CAPTURE : BUBBLE;
- const newNode = {
- listener,
- listenerType,
- passive: optionsIsObj && Boolean(options.passive),
- once: optionsIsObj && Boolean(options.once),
- next: null
- };
- let node = listeners.get(eventName);
- if (node === void 0) {
- listeners.set(eventName, newNode);
- return;
- }
- let prev = null;
- while (node != null) {
- if (node.listener === listener && node.listenerType === listenerType) {
- return;
- }
- prev = node;
- node = node.next;
- }
- prev.next = newNode;
- },
- /**
- * Remove a given listener from this event target.
- * @param {string} eventName The event name to remove.
- * @param {Function} listener The listener to remove.
- * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
- * @returns {void}
- */
- removeEventListener(eventName, listener, options) {
- if (listener == null) {
- return;
- }
- const listeners = getListeners(this);
- const capture = isObject2(options) ? Boolean(options.capture) : Boolean(options);
- const listenerType = capture ? CAPTURE : BUBBLE;
- let prev = null;
- let node = listeners.get(eventName);
- while (node != null) {
- if (node.listener === listener && node.listenerType === listenerType) {
- if (prev !== null) {
- prev.next = node.next;
- } else if (node.next !== null) {
- listeners.set(eventName, node.next);
- } else {
- listeners.delete(eventName);
- }
- return;
- }
- prev = node;
- node = node.next;
- }
- },
- /**
- * Dispatch a given event.
- * @param {Event|{type:string}} event The event to dispatch.
- * @returns {boolean} `false` if canceled.
- */
- dispatchEvent(event) {
- if (event == null || typeof event.type !== "string") {
- throw new TypeError('"event.type" should be a string.');
- }
- const listeners = getListeners(this);
- const eventName = event.type;
- let node = listeners.get(eventName);
- if (node == null) {
- return true;
- }
- const wrappedEvent = wrapEvent(this, event);
- let prev = null;
- while (node != null) {
- if (node.once) {
- if (prev !== null) {
- prev.next = node.next;
- } else if (node.next !== null) {
- listeners.set(eventName, node.next);
- } else {
- listeners.delete(eventName);
- }
- } else {
- prev = node;
- }
- setPassiveListener(
- wrappedEvent,
- node.passive ? node.listener : null
- );
- if (typeof node.listener === "function") {
- try {
- node.listener.call(this, wrappedEvent);
- } catch (err) {
- if (typeof console !== "undefined" && typeof console.error === "function") {
- console.error(err);
- }
- }
- } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
- node.listener.handleEvent(wrappedEvent);
- }
- if (isStopped(wrappedEvent)) {
- break;
+ }
+});
+
+// node_modules/is-stream/index.js
+var require_is_stream = __commonJS({
+ "node_modules/is-stream/index.js"(exports2, module2) {
+ "use strict";
+ var isStream = (stream4) => stream4 !== null && typeof stream4 === "object" && typeof stream4.pipe === "function";
+ isStream.writable = (stream4) => isStream(stream4) && stream4.writable !== false && typeof stream4._write === "function" && typeof stream4._writableState === "object";
+ isStream.readable = (stream4) => isStream(stream4) && stream4.readable !== false && typeof stream4._read === "function" && typeof stream4._readableState === "object";
+ isStream.duplex = (stream4) => isStream.writable(stream4) && isStream.readable(stream4);
+ isStream.transform = (stream4) => isStream.duplex(stream4) && typeof stream4._transform === "function";
+ module2.exports = isStream;
+ }
+});
+
+// node_modules/process-nextick-args/index.js
+var require_process_nextick_args = __commonJS({
+ "node_modules/process-nextick-args/index.js"(exports2, module2) {
+ "use strict";
+ if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
+ module2.exports = { nextTick };
+ } else {
+ module2.exports = process;
+ }
+ function nextTick(fn, arg1, arg2, arg3) {
+ if (typeof fn !== "function") {
+ throw new TypeError('"callback" argument must be a function');
+ }
+ var len = arguments.length;
+ var args, i;
+ switch (len) {
+ case 0:
+ case 1:
+ return process.nextTick(fn);
+ case 2:
+ return process.nextTick(function afterTickOne() {
+ fn.call(null, arg1);
+ });
+ case 3:
+ return process.nextTick(function afterTickTwo() {
+ fn.call(null, arg1, arg2);
+ });
+ case 4:
+ return process.nextTick(function afterTickThree() {
+ fn.call(null, arg1, arg2, arg3);
+ });
+ default:
+ args = new Array(len - 1);
+ i = 0;
+ while (i < args.length) {
+ args[i++] = arguments[i];
}
- node = node.next;
- }
- setPassiveListener(wrappedEvent, null);
- setEventPhase(wrappedEvent, 0);
- setCurrentTarget(wrappedEvent, null);
- return !wrappedEvent.defaultPrevented;
+ return process.nextTick(function afterTick() {
+ fn.apply(null, args);
+ });
}
- };
- Object.defineProperty(EventTarget2.prototype, "constructor", {
- value: EventTarget2,
- configurable: true,
- writable: true
- });
- if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
- Object.setPrototypeOf(EventTarget2.prototype, window.EventTarget.prototype);
- }
- exports2.defineEventAttribute = defineEventAttribute;
- exports2.EventTarget = EventTarget2;
- exports2.default = EventTarget2;
- module2.exports = EventTarget2;
- module2.exports.EventTarget = module2.exports["default"] = EventTarget2;
- module2.exports.defineEventAttribute = defineEventAttribute;
+ }
}
});
-// node_modules/abort-controller/dist/abort-controller.js
-var require_abort_controller = __commonJS({
- "node_modules/abort-controller/dist/abort-controller.js"(exports2, module2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- var eventTargetShim = require_event_target_shim();
- var AbortSignal2 = class extends eventTargetShim.EventTarget {
- /**
- * AbortSignal cannot be constructed directly.
- */
- constructor() {
- super();
- throw new TypeError("AbortSignal cannot be constructed directly");
- }
- /**
- * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
- */
- get aborted() {
- const aborted = abortedFlags.get(this);
- if (typeof aborted !== "boolean") {
- throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
- }
- return aborted;
- }
+// node_modules/isarray/index.js
+var require_isarray = __commonJS({
+ "node_modules/isarray/index.js"(exports2, module2) {
+ var toString3 = {}.toString;
+ module2.exports = Array.isArray || function(arr) {
+ return toString3.call(arr) == "[object Array]";
};
- eventTargetShim.defineEventAttribute(AbortSignal2.prototype, "abort");
- function createAbortSignal() {
- const signal = Object.create(AbortSignal2.prototype);
- eventTargetShim.EventTarget.call(signal);
- abortedFlags.set(signal, false);
- return signal;
- }
- function abortSignal(signal) {
- if (abortedFlags.get(signal) !== false) {
- return;
+ }
+});
+
+// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream.js
+var require_stream = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream.js"(exports2, module2) {
+ module2.exports = require("stream");
+ }
+});
+
+// node_modules/lazystream/node_modules/safe-buffer/index.js
+var require_safe_buffer = __commonJS({
+ "node_modules/lazystream/node_modules/safe-buffer/index.js"(exports2, module2) {
+ var buffer2 = require("buffer");
+ var Buffer3 = buffer2.Buffer;
+ function copyProps(src, dst) {
+ for (var key in src) {
+ dst[key] = src[key];
}
- abortedFlags.set(signal, true);
- signal.dispatchEvent({ type: "abort" });
}
- var abortedFlags = /* @__PURE__ */ new WeakMap();
- Object.defineProperties(AbortSignal2.prototype, {
- aborted: { enumerable: true }
- });
- if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
- Object.defineProperty(AbortSignal2.prototype, Symbol.toStringTag, {
- configurable: true,
- value: "AbortSignal"
- });
+ if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
+ module2.exports = buffer2;
+ } else {
+ copyProps(buffer2, exports2);
+ exports2.Buffer = SafeBuffer;
}
- var AbortController2 = class {
- /**
- * Initialize this controller.
- */
- constructor() {
- signals.set(this, createAbortSignal());
+ function SafeBuffer(arg, encodingOrOffset, length) {
+ return Buffer3(arg, encodingOrOffset, length);
+ }
+ copyProps(Buffer3, SafeBuffer);
+ SafeBuffer.from = function(arg, encodingOrOffset, length) {
+ if (typeof arg === "number") {
+ throw new TypeError("Argument must not be a number");
}
- /**
- * Returns the `AbortSignal` object associated with this object.
- */
- get signal() {
- return getSignal(this);
+ return Buffer3(arg, encodingOrOffset, length);
+ };
+ SafeBuffer.alloc = function(size, fill, encoding) {
+ if (typeof size !== "number") {
+ throw new TypeError("Argument must be a number");
}
- /**
- * Abort and signal to any observers that the associated activity is to be aborted.
- */
- abort() {
- abortSignal(getSignal(this));
+ var buf = Buffer3(size);
+ if (fill !== void 0) {
+ if (typeof encoding === "string") {
+ buf.fill(fill, encoding);
+ } else {
+ buf.fill(fill);
+ }
+ } else {
+ buf.fill(0);
}
+ return buf;
};
- var signals = /* @__PURE__ */ new WeakMap();
- function getSignal(controller) {
- const signal = signals.get(controller);
- if (signal == null) {
- throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
+ SafeBuffer.allocUnsafe = function(size) {
+ if (typeof size !== "number") {
+ throw new TypeError("Argument must be a number");
}
- return signal;
+ return Buffer3(size);
+ };
+ SafeBuffer.allocUnsafeSlow = function(size) {
+ if (typeof size !== "number") {
+ throw new TypeError("Argument must be a number");
+ }
+ return buffer2.SlowBuffer(size);
+ };
+ }
+});
+
+// node_modules/core-util-is/lib/util.js
+var require_util9 = __commonJS({
+ "node_modules/core-util-is/lib/util.js"(exports2) {
+ function isArray(arg) {
+ if (Array.isArray) {
+ return Array.isArray(arg);
+ }
+ return objectToString(arg) === "[object Array]";
}
- Object.defineProperties(AbortController2.prototype, {
- signal: { enumerable: true },
- abort: { enumerable: true }
- });
- if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
- Object.defineProperty(AbortController2.prototype, Symbol.toStringTag, {
- configurable: true,
- value: "AbortController"
- });
+ exports2.isArray = isArray;
+ function isBoolean(arg) {
+ return typeof arg === "boolean";
}
- exports2.AbortController = AbortController2;
- exports2.AbortSignal = AbortSignal2;
- exports2.default = AbortController2;
- module2.exports = AbortController2;
- module2.exports.AbortController = module2.exports["default"] = AbortController2;
- module2.exports.AbortSignal = AbortSignal2;
+ exports2.isBoolean = isBoolean;
+ function isNull(arg) {
+ return arg === null;
+ }
+ exports2.isNull = isNull;
+ function isNullOrUndefined(arg) {
+ return arg == null;
+ }
+ exports2.isNullOrUndefined = isNullOrUndefined;
+ function isNumber(arg) {
+ return typeof arg === "number";
+ }
+ exports2.isNumber = isNumber;
+ function isString(arg) {
+ return typeof arg === "string";
+ }
+ exports2.isString = isString;
+ function isSymbol(arg) {
+ return typeof arg === "symbol";
+ }
+ exports2.isSymbol = isSymbol;
+ function isUndefined(arg) {
+ return arg === void 0;
+ }
+ exports2.isUndefined = isUndefined;
+ function isRegExp(re) {
+ return objectToString(re) === "[object RegExp]";
+ }
+ exports2.isRegExp = isRegExp;
+ function isObject2(arg) {
+ return typeof arg === "object" && arg !== null;
+ }
+ exports2.isObject = isObject2;
+ function isDate(d) {
+ return objectToString(d) === "[object Date]";
+ }
+ exports2.isDate = isDate;
+ function isError3(e) {
+ return objectToString(e) === "[object Error]" || e instanceof Error;
+ }
+ exports2.isError = isError3;
+ function isFunction(arg) {
+ return typeof arg === "function";
+ }
+ exports2.isFunction = isFunction;
+ function isPrimitive(arg) {
+ return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
+ typeof arg === "undefined";
+ }
+ exports2.isPrimitive = isPrimitive;
+ exports2.isBuffer = require("buffer").Buffer.isBuffer;
+ function objectToString(o) {
+ return Object.prototype.toString.call(o);
+ }
+ }
+});
+
+// node_modules/inherits/inherits_browser.js
+var require_inherits_browser = __commonJS({
+ "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/inherits/inherits.js
+var require_inherits = __commonJS({
+ "node_modules/inherits/inherits.js"(exports2, module2) {
+ try {
+ util3 = require("util");
+ if (typeof util3.inherits !== "function") throw "";
+ module2.exports = util3.inherits;
+ } catch (e) {
+ module2.exports = require_inherits_browser();
+ }
+ var util3;
}
});
-// node_modules/readable-stream/lib/ours/util.js
-var require_util10 = __commonJS({
- "node_modules/readable-stream/lib/ours/util.js"(exports2, module2) {
+// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/BufferList.js
+var require_BufferList = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports2, module2) {
"use strict";
- var bufferModule = require("buffer");
- var { format, inspect: inspect2 } = require_inspect();
- var {
- codes: { ERR_INVALID_ARG_TYPE }
- } = require_errors2();
- var { kResistStopPropagation, AggregateError, SymbolDispose } = require_primordials();
- var AbortSignal2 = globalThis.AbortSignal || require_abort_controller().AbortSignal;
- var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
- var AsyncFunction = Object.getPrototypeOf(async function() {
- }).constructor;
- var Blob2 = globalThis.Blob || bufferModule.Blob;
- var isBlob2 = typeof Blob2 !== "undefined" ? function isBlob3(b) {
- return b instanceof Blob2;
- } : function isBlob3(b) {
- return false;
- };
- var validateAbortSignal = (signal, name) => {
- if (signal !== void 0 && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
- throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
+ function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
}
- };
- var validateFunction = (value, name) => {
- if (typeof value !== "function") {
- throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
+ }
+ var Buffer3 = require_safe_buffer().Buffer;
+ var util3 = require("util");
+ function copyBuffer(src, target, offset) {
+ src.copy(target, offset);
+ }
+ module2.exports = (function() {
+ function BufferList() {
+ _classCallCheck(this, BufferList);
+ this.head = null;
+ this.tail = null;
+ this.length = 0;
}
- };
- module2.exports = {
- AggregateError,
- kEmptyObject: Object.freeze({}),
- once(callback) {
- let called = false;
- return function(...args) {
- if (called) {
- return;
- }
- called = true;
- callback.apply(this, args);
- };
- },
- createDeferredPromise: function() {
- let resolve7;
- let reject;
- const promise = new Promise((res, rej) => {
- resolve7 = res;
- reject = rej;
- });
- return {
- promise,
- resolve: resolve7,
- reject
- };
- },
- promisify(fn) {
- return new Promise((resolve7, reject) => {
- fn((err, ...args) => {
- if (err) {
- return reject(err);
- }
- return resolve7(...args);
- });
- });
- },
- debuglog() {
- return function() {
- };
- },
- format,
- inspect: inspect2,
- types: {
- isAsyncFunction(fn) {
- return fn instanceof AsyncFunction;
- },
- isArrayBufferView(arr) {
- return ArrayBuffer.isView(arr);
- }
- },
- isBlob: isBlob2,
- deprecate(fn, message) {
- return fn;
- },
- addAbortListener: require("events").addAbortListener || function addAbortListener(signal, listener) {
- if (signal === void 0) {
- throw new ERR_INVALID_ARG_TYPE("signal", "AbortSignal", signal);
+ BufferList.prototype.push = function push(v) {
+ var entry = { data: v, next: null };
+ if (this.length > 0) this.tail.next = entry;
+ else this.head = entry;
+ this.tail = entry;
+ ++this.length;
+ };
+ BufferList.prototype.unshift = function unshift(v) {
+ var entry = { data: v, next: this.head };
+ if (this.length === 0) this.tail = entry;
+ this.head = entry;
+ ++this.length;
+ };
+ BufferList.prototype.shift = function shift() {
+ if (this.length === 0) return;
+ var ret = this.head.data;
+ if (this.length === 1) this.head = this.tail = null;
+ else this.head = this.head.next;
+ --this.length;
+ return ret;
+ };
+ BufferList.prototype.clear = function clear() {
+ this.head = this.tail = null;
+ this.length = 0;
+ };
+ BufferList.prototype.join = function join8(s) {
+ if (this.length === 0) return "";
+ var p = this.head;
+ var ret = "" + p.data;
+ while (p = p.next) {
+ ret += s + p.data;
}
- validateAbortSignal(signal, "signal");
- validateFunction(listener, "listener");
- let removeEventListener;
- if (signal.aborted) {
- queueMicrotask(() => listener());
- } else {
- signal.addEventListener("abort", listener, {
- __proto__: null,
- once: true,
- [kResistStopPropagation]: true
- });
- removeEventListener = () => {
- signal.removeEventListener("abort", listener);
- };
+ return ret;
+ };
+ BufferList.prototype.concat = function concat2(n) {
+ if (this.length === 0) return Buffer3.alloc(0);
+ var ret = Buffer3.allocUnsafe(n >>> 0);
+ var p = this.head;
+ var i = 0;
+ while (p) {
+ copyBuffer(p.data, ret, i);
+ i += p.data.length;
+ p = p.next;
}
- return {
- __proto__: null,
- [SymbolDispose]() {
- var _removeEventListener;
- (_removeEventListener = removeEventListener) === null || _removeEventListener === void 0 ? void 0 : _removeEventListener();
+ return ret;
+ };
+ return BufferList;
+ })();
+ if (util3 && util3.inspect && util3.inspect.custom) {
+ module2.exports.prototype[util3.inspect.custom] = function() {
+ var obj = util3.inspect({ length: this.length });
+ return this.constructor.name + " " + obj;
+ };
+ }
+ }
+});
+
+// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/destroy.js
+var require_destroy = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
+ "use strict";
+ var pna = require_process_nextick_args();
+ function destroy2(err, cb) {
+ var _this = this;
+ var readableDestroyed = this._readableState && this._readableState.destroyed;
+ var writableDestroyed = this._writableState && this._writableState.destroyed;
+ if (readableDestroyed || writableDestroyed) {
+ if (cb) {
+ cb(err);
+ } else if (err) {
+ if (!this._writableState) {
+ pna.nextTick(emitErrorNT, this, err);
+ } else if (!this._writableState.errorEmitted) {
+ this._writableState.errorEmitted = true;
+ pna.nextTick(emitErrorNT, this, err);
}
- };
- },
- AbortSignalAny: AbortSignal2.any || function AbortSignalAny(signals) {
- if (signals.length === 1) {
- return signals[0];
}
- const ac = new AbortController2();
- const abort = () => ac.abort();
- signals.forEach((signal) => {
- validateAbortSignal(signal, "signals");
- signal.addEventListener("abort", abort, {
- once: true
- });
- });
- ac.signal.addEventListener(
- "abort",
- () => {
- signals.forEach((signal) => signal.removeEventListener("abort", abort));
- },
- {
- once: true
+ return this;
+ }
+ if (this._readableState) {
+ this._readableState.destroyed = true;
+ }
+ if (this._writableState) {
+ this._writableState.destroyed = true;
+ }
+ this._destroy(err || null, function(err2) {
+ if (!cb && err2) {
+ if (!_this._writableState) {
+ pna.nextTick(emitErrorNT, _this, err2);
+ } else if (!_this._writableState.errorEmitted) {
+ _this._writableState.errorEmitted = true;
+ pna.nextTick(emitErrorNT, _this, err2);
}
- );
- return ac.signal;
+ } else if (cb) {
+ cb(err2);
+ }
+ });
+ return this;
+ }
+ function undestroy() {
+ if (this._readableState) {
+ this._readableState.destroyed = false;
+ this._readableState.reading = false;
+ this._readableState.ended = false;
+ this._readableState.endEmitted = false;
+ }
+ if (this._writableState) {
+ this._writableState.destroyed = false;
+ this._writableState.ended = false;
+ this._writableState.ending = false;
+ this._writableState.finalCalled = false;
+ this._writableState.prefinished = false;
+ this._writableState.finished = false;
+ this._writableState.errorEmitted = false;
}
+ }
+ function emitErrorNT(self2, err) {
+ self2.emit("error", err);
+ }
+ module2.exports = {
+ destroy: destroy2,
+ undestroy
};
- module2.exports.promisify.custom = /* @__PURE__ */ Symbol.for("nodejs.util.promisify.custom");
}
});
-// node_modules/readable-stream/lib/internal/validators.js
-var require_validators = __commonJS({
- "node_modules/readable-stream/lib/internal/validators.js"(exports2, module2) {
+// node_modules/util-deprecate/node.js
+var require_node2 = __commonJS({
+ "node_modules/util-deprecate/node.js"(exports2, module2) {
+ module2.exports = require("util").deprecate;
+ }
+});
+
+// node_modules/lazystream/node_modules/readable-stream/lib/_stream_writable.js
+var require_stream_writable = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
"use strict";
- var {
- ArrayIsArray,
- ArrayPrototypeIncludes,
- ArrayPrototypeJoin,
- ArrayPrototypeMap,
- NumberIsInteger,
- NumberIsNaN,
- NumberMAX_SAFE_INTEGER,
- NumberMIN_SAFE_INTEGER,
- NumberParseInt,
- ObjectPrototypeHasOwnProperty,
- RegExpPrototypeExec,
- String: String2,
- StringPrototypeToUpperCase,
- StringPrototypeTrim
- } = require_primordials();
- var {
- hideStackFrames,
- codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL }
- } = require_errors2();
- var { normalizeEncoding } = require_util10();
- var { isAsyncFunction, isArrayBufferView } = require_util10().types;
- var signals = {};
- function isInt32(value) {
- return value === (value | 0);
+ var pna = require_process_nextick_args();
+ module2.exports = Writable;
+ function CorkedRequest(state3) {
+ var _this = this;
+ this.next = null;
+ this.entry = null;
+ this.finish = function() {
+ onCorkedFinish(_this, state3);
+ };
}
- function isUint32(value) {
- return value === value >>> 0;
+ var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
+ var Duplex;
+ Writable.WritableState = WritableState;
+ var util3 = Object.create(require_util9());
+ util3.inherits = require_inherits();
+ var internalUtil = {
+ deprecate: require_node2()
+ };
+ var Stream2 = require_stream();
+ var Buffer3 = require_safe_buffer().Buffer;
+ var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
+ };
+ function _uint8ArrayToBuffer(chunk) {
+ return Buffer3.from(chunk);
}
- var octalReg = /^[0-7]+$/;
- var modeDesc = "must be a 32-bit unsigned integer or an octal string";
- function parseFileMode(value, name, def) {
- if (typeof value === "undefined") {
- value = def;
+ function _isUint8Array(obj) {
+ return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
+ }
+ var destroyImpl = require_destroy();
+ util3.inherits(Writable, Stream2);
+ function nop() {
+ }
+ function WritableState(options, stream4) {
+ Duplex = Duplex || require_stream_duplex();
+ options = options || {};
+ var isDuplex = stream4 instanceof Duplex;
+ this.objectMode = !!options.objectMode;
+ if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
+ var hwm = options.highWaterMark;
+ var writableHwm = options.writableHighWaterMark;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
+ if (hwm || hwm === 0) this.highWaterMark = hwm;
+ else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;
+ else this.highWaterMark = defaultHwm;
+ this.highWaterMark = Math.floor(this.highWaterMark);
+ this.finalCalled = false;
+ this.needDrain = false;
+ this.ending = false;
+ this.ended = false;
+ this.finished = false;
+ this.destroyed = false;
+ var noDecode = options.decodeStrings === false;
+ this.decodeStrings = !noDecode;
+ this.defaultEncoding = options.defaultEncoding || "utf8";
+ this.length = 0;
+ this.writing = false;
+ this.corked = 0;
+ this.sync = true;
+ this.bufferProcessing = false;
+ this.onwrite = function(er) {
+ onwrite(stream4, er);
+ };
+ this.writecb = null;
+ this.writelen = 0;
+ this.bufferedRequest = null;
+ this.lastBufferedRequest = null;
+ this.pendingcb = 0;
+ this.prefinished = false;
+ this.errorEmitted = false;
+ this.bufferedRequestCount = 0;
+ this.corkedRequestsFree = new CorkedRequest(this);
+ }
+ WritableState.prototype.getBuffer = function getBuffer() {
+ var current = this.bufferedRequest;
+ var out = [];
+ while (current) {
+ out.push(current);
+ current = current.next;
}
- if (typeof value === "string") {
- if (RegExpPrototypeExec(octalReg, value) === null) {
- throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);
+ return out;
+ };
+ (function() {
+ try {
+ Object.defineProperty(WritableState.prototype, "buffer", {
+ get: internalUtil.deprecate(function() {
+ return this.getBuffer();
+ }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
+ });
+ } catch (_2) {
+ }
+ })();
+ var realHasInstance;
+ if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
+ realHasInstance = Function.prototype[Symbol.hasInstance];
+ Object.defineProperty(Writable, Symbol.hasInstance, {
+ value: function(object) {
+ if (realHasInstance.call(this, object)) return true;
+ if (this !== Writable) return false;
+ return object && object._writableState instanceof WritableState;
}
- value = NumberParseInt(value, 8);
+ });
+ } else {
+ realHasInstance = function(object) {
+ return object instanceof this;
+ };
+ }
+ function Writable(options) {
+ Duplex = Duplex || require_stream_duplex();
+ if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
+ return new Writable(options);
}
- validateUint32(value, name);
- return value;
+ this._writableState = new WritableState(options, this);
+ this.writable = true;
+ if (options) {
+ if (typeof options.write === "function") this._write = options.write;
+ if (typeof options.writev === "function") this._writev = options.writev;
+ if (typeof options.destroy === "function") this._destroy = options.destroy;
+ if (typeof options.final === "function") this._final = options.final;
+ }
+ Stream2.call(this);
}
- var validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {
- if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
- if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, "an integer", value);
- if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
- });
- var validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {
- if (typeof value !== "number") {
- throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ Writable.prototype.pipe = function() {
+ this.emit("error", new Error("Cannot pipe, not readable"));
+ };
+ function writeAfterEnd(stream4, cb) {
+ var er = new Error("write after end");
+ stream4.emit("error", er);
+ pna.nextTick(cb, er);
+ }
+ function validChunk(stream4, state3, chunk, cb) {
+ var valid = true;
+ var er = false;
+ if (chunk === null) {
+ er = new TypeError("May not write null values to stream");
+ } else if (typeof chunk !== "string" && chunk !== void 0 && !state3.objectMode) {
+ er = new TypeError("Invalid non-string/buffer chunk");
}
- if (!NumberIsInteger(value)) {
- throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ if (er) {
+ stream4.emit("error", er);
+ pna.nextTick(cb, er);
+ valid = false;
}
- if (value < min || value > max) {
- throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+ return valid;
+ }
+ Writable.prototype.write = function(chunk, encoding, cb) {
+ var state3 = this._writableState;
+ var ret = false;
+ var isBuf = !state3.objectMode && _isUint8Array(chunk);
+ if (isBuf && !Buffer3.isBuffer(chunk)) {
+ chunk = _uint8ArrayToBuffer(chunk);
+ }
+ if (typeof encoding === "function") {
+ cb = encoding;
+ encoding = null;
+ }
+ if (isBuf) encoding = "buffer";
+ else if (!encoding) encoding = state3.defaultEncoding;
+ if (typeof cb !== "function") cb = nop;
+ if (state3.ended) writeAfterEnd(this, cb);
+ else if (isBuf || validChunk(this, state3, chunk, cb)) {
+ state3.pendingcb++;
+ ret = writeOrBuffer(this, state3, isBuf, chunk, encoding, cb);
+ }
+ return ret;
+ };
+ Writable.prototype.cork = function() {
+ var state3 = this._writableState;
+ state3.corked++;
+ };
+ Writable.prototype.uncork = function() {
+ var state3 = this._writableState;
+ if (state3.corked) {
+ state3.corked--;
+ if (!state3.writing && !state3.corked && !state3.bufferProcessing && state3.bufferedRequest) clearBuffer(this, state3);
+ }
+ };
+ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
+ if (typeof encoding === "string") encoding = encoding.toLowerCase();
+ if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + encoding);
+ this._writableState.defaultEncoding = encoding;
+ return this;
+ };
+ function decodeChunk(state3, chunk, encoding) {
+ if (!state3.objectMode && state3.decodeStrings !== false && typeof chunk === "string") {
+ chunk = Buffer3.from(chunk, encoding);
+ }
+ return chunk;
+ }
+ Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
+ // making it explicit this property is not enumerable
+ // because otherwise some prototype manipulation in
+ // userland will fail
+ enumerable: false,
+ get: function() {
+ return this._writableState.highWaterMark;
}
});
- var validateUint32 = hideStackFrames((value, name, positive = false) => {
- if (typeof value !== "number") {
- throw new ERR_INVALID_ARG_TYPE(name, "number", value);
- }
- if (!NumberIsInteger(value)) {
- throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ function writeOrBuffer(stream4, state3, isBuf, chunk, encoding, cb) {
+ if (!isBuf) {
+ var newChunk = decodeChunk(state3, chunk, encoding);
+ if (chunk !== newChunk) {
+ isBuf = true;
+ encoding = "buffer";
+ chunk = newChunk;
+ }
}
- const min = positive ? 1 : 0;
- const max = 4294967295;
- if (value < min || value > max) {
- throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+ var len = state3.objectMode ? 1 : chunk.length;
+ state3.length += len;
+ var ret = state3.length < state3.highWaterMark;
+ if (!ret) state3.needDrain = true;
+ if (state3.writing || state3.corked) {
+ var last = state3.lastBufferedRequest;
+ state3.lastBufferedRequest = {
+ chunk,
+ encoding,
+ isBuf,
+ callback: cb,
+ next: null
+ };
+ if (last) {
+ last.next = state3.lastBufferedRequest;
+ } else {
+ state3.bufferedRequest = state3.lastBufferedRequest;
+ }
+ state3.bufferedRequestCount += 1;
+ } else {
+ doWrite(stream4, state3, false, len, chunk, encoding, cb);
}
- });
- function validateString(value, name) {
- if (typeof value !== "string") throw new ERR_INVALID_ARG_TYPE(name, "string", value);
+ return ret;
}
- function validateNumber(value, name, min = void 0, max) {
- if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
- if (min != null && value < min || max != null && value > max || (min != null || max != null) && NumberIsNaN(value)) {
- throw new ERR_OUT_OF_RANGE(
- name,
- `${min != null ? `>= ${min}` : ""}${min != null && max != null ? " && " : ""}${max != null ? `<= ${max}` : ""}`,
- value
- );
- }
+ function doWrite(stream4, state3, writev, len, chunk, encoding, cb) {
+ state3.writelen = len;
+ state3.writecb = cb;
+ state3.writing = true;
+ state3.sync = true;
+ if (writev) stream4._writev(chunk, state3.onwrite);
+ else stream4._write(chunk, encoding, state3.onwrite);
+ state3.sync = false;
}
- var validateOneOf = hideStackFrames((value, name, oneOf) => {
- if (!ArrayPrototypeIncludes(oneOf, value)) {
- const allowed = ArrayPrototypeJoin(
- ArrayPrototypeMap(oneOf, (v) => typeof v === "string" ? `'${v}'` : String2(v)),
- ", "
- );
- const reason = "must be one of: " + allowed;
- throw new ERR_INVALID_ARG_VALUE(name, value, reason);
+ function onwriteError(stream4, state3, sync, er, cb) {
+ --state3.pendingcb;
+ if (sync) {
+ pna.nextTick(cb, er);
+ pna.nextTick(finishMaybe, stream4, state3);
+ stream4._writableState.errorEmitted = true;
+ stream4.emit("error", er);
+ } else {
+ cb(er);
+ stream4._writableState.errorEmitted = true;
+ stream4.emit("error", er);
+ finishMaybe(stream4, state3);
}
- });
- function validateBoolean(value, name) {
- if (typeof value !== "boolean") throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
}
- function getOwnPropertyValueOrDefault(options, key, defaultValue) {
- return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key];
+ function onwriteStateUpdate(state3) {
+ state3.writing = false;
+ state3.writecb = null;
+ state3.length -= state3.writelen;
+ state3.writelen = 0;
}
- var validateObject = hideStackFrames((value, name, options = null) => {
- const allowArray = getOwnPropertyValueOrDefault(options, "allowArray", false);
- const allowFunction = getOwnPropertyValueOrDefault(options, "allowFunction", false);
- const nullable = getOwnPropertyValueOrDefault(options, "nullable", false);
- if (!nullable && value === null || !allowArray && ArrayIsArray(value) || typeof value !== "object" && (!allowFunction || typeof value !== "function")) {
- throw new ERR_INVALID_ARG_TYPE(name, "Object", value);
- }
- });
- var validateDictionary = hideStackFrames((value, name) => {
- if (value != null && typeof value !== "object" && typeof value !== "function") {
- throw new ERR_INVALID_ARG_TYPE(name, "a dictionary", value);
- }
- });
- var validateArray = hideStackFrames((value, name, minLength = 0) => {
- if (!ArrayIsArray(value)) {
- throw new ERR_INVALID_ARG_TYPE(name, "Array", value);
- }
- if (value.length < minLength) {
- const reason = `must be longer than ${minLength}`;
- throw new ERR_INVALID_ARG_VALUE(name, value, reason);
- }
- });
- function validateStringArray(value, name) {
- validateArray(value, name);
- for (let i = 0; i < value.length; i++) {
- validateString(value[i], `${name}[${i}]`);
+ function onwrite(stream4, er) {
+ var state3 = stream4._writableState;
+ var sync = state3.sync;
+ var cb = state3.writecb;
+ onwriteStateUpdate(state3);
+ if (er) onwriteError(stream4, state3, sync, er, cb);
+ else {
+ var finished = needFinish(state3);
+ if (!finished && !state3.corked && !state3.bufferProcessing && state3.bufferedRequest) {
+ clearBuffer(stream4, state3);
+ }
+ if (sync) {
+ asyncWrite(afterWrite, stream4, state3, finished, cb);
+ } else {
+ afterWrite(stream4, state3, finished, cb);
+ }
}
}
- function validateBooleanArray(value, name) {
- validateArray(value, name);
- for (let i = 0; i < value.length; i++) {
- validateBoolean(value[i], `${name}[${i}]`);
- }
+ function afterWrite(stream4, state3, finished, cb) {
+ if (!finished) onwriteDrain(stream4, state3);
+ state3.pendingcb--;
+ cb();
+ finishMaybe(stream4, state3);
}
- function validateAbortSignalArray(value, name) {
- validateArray(value, name);
- for (let i = 0; i < value.length; i++) {
- const signal = value[i];
- const indexedName = `${name}[${i}]`;
- if (signal == null) {
- throw new ERR_INVALID_ARG_TYPE(indexedName, "AbortSignal", signal);
- }
- validateAbortSignal(signal, indexedName);
+ function onwriteDrain(stream4, state3) {
+ if (state3.length === 0 && state3.needDrain) {
+ state3.needDrain = false;
+ stream4.emit("drain");
}
}
- function validateSignalName(signal, name = "signal") {
- validateString(signal, name);
- if (signals[signal] === void 0) {
- if (signals[StringPrototypeToUpperCase(signal)] !== void 0) {
- throw new ERR_UNKNOWN_SIGNAL(signal + " (signals must use all capital letters)");
+ function clearBuffer(stream4, state3) {
+ state3.bufferProcessing = true;
+ var entry = state3.bufferedRequest;
+ if (stream4._writev && entry && entry.next) {
+ var l = state3.bufferedRequestCount;
+ var buffer2 = new Array(l);
+ var holder = state3.corkedRequestsFree;
+ holder.entry = entry;
+ var count = 0;
+ var allBuffers = true;
+ while (entry) {
+ buffer2[count] = entry;
+ if (!entry.isBuf) allBuffers = false;
+ entry = entry.next;
+ count += 1;
}
- throw new ERR_UNKNOWN_SIGNAL(signal);
+ buffer2.allBuffers = allBuffers;
+ doWrite(stream4, state3, true, state3.length, buffer2, "", holder.finish);
+ state3.pendingcb++;
+ state3.lastBufferedRequest = null;
+ if (holder.next) {
+ state3.corkedRequestsFree = holder.next;
+ holder.next = null;
+ } else {
+ state3.corkedRequestsFree = new CorkedRequest(state3);
+ }
+ state3.bufferedRequestCount = 0;
+ } else {
+ while (entry) {
+ var chunk = entry.chunk;
+ var encoding = entry.encoding;
+ var cb = entry.callback;
+ var len = state3.objectMode ? 1 : chunk.length;
+ doWrite(stream4, state3, false, len, chunk, encoding, cb);
+ entry = entry.next;
+ state3.bufferedRequestCount--;
+ if (state3.writing) {
+ break;
+ }
+ }
+ if (entry === null) state3.lastBufferedRequest = null;
}
+ state3.bufferedRequest = entry;
+ state3.bufferProcessing = false;
}
- var validateBuffer = hideStackFrames((buffer2, name = "buffer") => {
- if (!isArrayBufferView(buffer2)) {
- throw new ERR_INVALID_ARG_TYPE(name, ["Buffer", "TypedArray", "DataView"], buffer2);
+ Writable.prototype._write = function(chunk, encoding, cb) {
+ cb(new Error("_write() is not implemented"));
+ };
+ Writable.prototype._writev = null;
+ Writable.prototype.end = function(chunk, encoding, cb) {
+ var state3 = this._writableState;
+ if (typeof chunk === "function") {
+ cb = chunk;
+ chunk = null;
+ encoding = null;
+ } else if (typeof encoding === "function") {
+ cb = encoding;
+ encoding = null;
}
- });
- function validateEncoding(data, encoding) {
- const normalizedEncoding = normalizeEncoding(encoding);
- const length = data.length;
- if (normalizedEncoding === "hex" && length % 2 !== 0) {
- throw new ERR_INVALID_ARG_VALUE("encoding", encoding, `is invalid for data of length ${length}`);
+ if (chunk !== null && chunk !== void 0) this.write(chunk, encoding);
+ if (state3.corked) {
+ state3.corked = 1;
+ this.uncork();
+ }
+ if (!state3.ending) endWritable(this, state3, cb);
+ };
+ function needFinish(state3) {
+ return state3.ending && state3.length === 0 && state3.bufferedRequest === null && !state3.finished && !state3.writing;
+ }
+ function callFinal(stream4, state3) {
+ stream4._final(function(err) {
+ state3.pendingcb--;
+ if (err) {
+ stream4.emit("error", err);
+ }
+ state3.prefinished = true;
+ stream4.emit("prefinish");
+ finishMaybe(stream4, state3);
+ });
+ }
+ function prefinish(stream4, state3) {
+ if (!state3.prefinished && !state3.finalCalled) {
+ if (typeof stream4._final === "function") {
+ state3.pendingcb++;
+ state3.finalCalled = true;
+ pna.nextTick(callFinal, stream4, state3);
+ } else {
+ state3.prefinished = true;
+ stream4.emit("prefinish");
+ }
}
}
- function validatePort(port, name = "Port", allowZero = true) {
- if (typeof port !== "number" && typeof port !== "string" || typeof port === "string" && StringPrototypeTrim(port).length === 0 || +port !== +port >>> 0 || port > 65535 || port === 0 && !allowZero) {
- throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);
+ function finishMaybe(stream4, state3) {
+ var need = needFinish(state3);
+ if (need) {
+ prefinish(stream4, state3);
+ if (state3.pendingcb === 0) {
+ state3.finished = true;
+ stream4.emit("finish");
+ }
}
- return port | 0;
+ return need;
}
- var validateAbortSignal = hideStackFrames((signal, name) => {
- if (signal !== void 0 && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
- throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
- }
- });
- var validateFunction = hideStackFrames((value, name) => {
- if (typeof value !== "function") throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
- });
- var validatePlainFunction = hideStackFrames((value, name) => {
- if (typeof value !== "function" || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
- });
- var validateUndefined = hideStackFrames((value, name) => {
- if (value !== void 0) throw new ERR_INVALID_ARG_TYPE(name, "undefined", value);
- });
- function validateUnion(value, name, union) {
- if (!ArrayPrototypeIncludes(union, value)) {
- throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, "|")}')`, value);
+ function endWritable(stream4, state3, cb) {
+ state3.ending = true;
+ finishMaybe(stream4, state3);
+ if (cb) {
+ if (state3.finished) pna.nextTick(cb);
+ else stream4.once("finish", cb);
}
+ state3.ended = true;
+ stream4.writable = false;
}
- var linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;
- function validateLinkHeaderFormat(value, name) {
- if (typeof value === "undefined" || !RegExpPrototypeExec(linkValueRegExp, value)) {
- throw new ERR_INVALID_ARG_VALUE(
- name,
- value,
- 'must be an array or string of format "</styles.css>; rel=preload; as=style"'
- );
+ function onCorkedFinish(corkReq, state3, err) {
+ var entry = corkReq.entry;
+ corkReq.entry = null;
+ while (entry) {
+ var cb = entry.callback;
+ state3.pendingcb--;
+ cb(err);
+ entry = entry.next;
}
+ state3.corkedRequestsFree.next = corkReq;
}
- function validateLinkHeaderValue(hints) {
- if (typeof hints === "string") {
- validateLinkHeaderFormat(hints, "hints");
- return hints;
- } else if (ArrayIsArray(hints)) {
- const hintsLength = hints.length;
- let result = "";
- if (hintsLength === 0) {
- return result;
+ Object.defineProperty(Writable.prototype, "destroyed", {
+ get: function() {
+ if (this._writableState === void 0) {
+ return false;
}
- for (let i = 0; i < hintsLength; i++) {
- const link = hints[i];
- validateLinkHeaderFormat(link, "hints");
- result += link;
- if (i !== hintsLength - 1) {
- result += ", ";
- }
+ return this._writableState.destroyed;
+ },
+ set: function(value) {
+ if (!this._writableState) {
+ return;
}
- return result;
+ this._writableState.destroyed = value;
}
- throw new ERR_INVALID_ARG_VALUE(
- "hints",
- hints,
- 'must be an array or string of format "</styles.css>; rel=preload; as=style"'
- );
- }
- module2.exports = {
- isInt32,
- isUint32,
- parseFileMode,
- validateArray,
- validateStringArray,
- validateBooleanArray,
- validateAbortSignalArray,
- validateBoolean,
- validateBuffer,
- validateDictionary,
- validateEncoding,
- validateFunction,
- validateInt32,
- validateInteger,
- validateNumber,
- validateObject,
- validateOneOf,
- validatePlainFunction,
- validatePort,
- validateSignalName,
- validateString,
- validateUint32,
- validateUndefined,
- validateUnion,
- validateAbortSignal,
- validateLinkHeaderValue
+ });
+ Writable.prototype.destroy = destroyImpl.destroy;
+ Writable.prototype._undestroy = destroyImpl.undestroy;
+ Writable.prototype._destroy = function(err, cb) {
+ this.end();
+ cb(err);
};
}
});
-// node_modules/process/index.js
-var require_process = __commonJS({
- "node_modules/process/index.js"(exports2, module2) {
- module2.exports = global.process;
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/utils.js
-var require_utils2 = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/utils.js"(exports2, module2) {
+// node_modules/lazystream/node_modules/readable-stream/lib/_stream_duplex.js
+var require_stream_duplex = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/_stream_duplex.js"(exports2, module2) {
"use strict";
- var { SymbolAsyncIterator, SymbolIterator, SymbolFor } = require_primordials();
- var kIsDestroyed = SymbolFor("nodejs.stream.destroyed");
- var kIsErrored = SymbolFor("nodejs.stream.errored");
- var kIsReadable = SymbolFor("nodejs.stream.readable");
- var kIsWritable = SymbolFor("nodejs.stream.writable");
- var kIsDisturbed = SymbolFor("nodejs.stream.disturbed");
- var kIsClosedPromise = SymbolFor("nodejs.webstream.isClosedPromise");
- var kControllerErrorFunction = SymbolFor("nodejs.webstream.controllerErrorFunction");
- function isReadableNodeStream(obj, strict = false) {
- var _obj$_readableState;
- return !!(obj && typeof obj.pipe === "function" && typeof obj.on === "function" && (!strict || typeof obj.pause === "function" && typeof obj.resume === "function") && (!obj._writableState || ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === void 0 ? void 0 : _obj$_readableState.readable) !== false) && // Duplex
- (!obj._writableState || obj._readableState));
- }
- function isWritableNodeStream(obj) {
- var _obj$_writableState;
- return !!(obj && typeof obj.write === "function" && typeof obj.on === "function" && (!obj._readableState || ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === void 0 ? void 0 : _obj$_writableState.writable) !== false));
- }
- function isDuplexNodeStream(obj) {
- return !!(obj && typeof obj.pipe === "function" && obj._readableState && typeof obj.on === "function" && typeof obj.write === "function");
- }
- function isNodeStream(obj) {
- return obj && (obj._readableState || obj._writableState || typeof obj.write === "function" && typeof obj.on === "function" || typeof obj.pipe === "function" && typeof obj.on === "function");
- }
- function isReadableStream3(obj) {
- return !!(obj && !isNodeStream(obj) && typeof obj.pipeThrough === "function" && typeof obj.getReader === "function" && typeof obj.cancel === "function");
- }
- function isWritableStream(obj) {
- return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === "function" && typeof obj.abort === "function");
- }
- function isTransformStream(obj) {
- return !!(obj && !isNodeStream(obj) && typeof obj.readable === "object" && typeof obj.writable === "object");
- }
- function isWebStream(obj) {
- return isReadableStream3(obj) || isWritableStream(obj) || isTransformStream(obj);
- }
- function isIterable(obj, isAsync) {
- if (obj == null) return false;
- if (isAsync === true) return typeof obj[SymbolAsyncIterator] === "function";
- if (isAsync === false) return typeof obj[SymbolIterator] === "function";
- return typeof obj[SymbolAsyncIterator] === "function" || typeof obj[SymbolIterator] === "function";
- }
- function isDestroyed(stream4) {
- if (!isNodeStream(stream4)) return null;
- const wState = stream4._writableState;
- const rState = stream4._readableState;
- const state3 = wState || rState;
- return !!(stream4.destroyed || stream4[kIsDestroyed] || state3 !== null && state3 !== void 0 && state3.destroyed);
- }
- function isWritableEnded(stream4) {
- if (!isWritableNodeStream(stream4)) return null;
- if (stream4.writableEnded === true) return true;
- const wState = stream4._writableState;
- if (wState !== null && wState !== void 0 && wState.errored) return false;
- if (typeof (wState === null || wState === void 0 ? void 0 : wState.ended) !== "boolean") return null;
- return wState.ended;
- }
- function isWritableFinished(stream4, strict) {
- if (!isWritableNodeStream(stream4)) return null;
- if (stream4.writableFinished === true) return true;
- const wState = stream4._writableState;
- if (wState !== null && wState !== void 0 && wState.errored) return false;
- if (typeof (wState === null || wState === void 0 ? void 0 : wState.finished) !== "boolean") return null;
- return !!(wState.finished || strict === false && wState.ended === true && wState.length === 0);
- }
- function isReadableEnded(stream4) {
- if (!isReadableNodeStream(stream4)) return null;
- if (stream4.readableEnded === true) return true;
- const rState = stream4._readableState;
- if (!rState || rState.errored) return false;
- if (typeof (rState === null || rState === void 0 ? void 0 : rState.ended) !== "boolean") return null;
- return rState.ended;
+ var pna = require_process_nextick_args();
+ var objectKeys = Object.keys || function(obj) {
+ var keys2 = [];
+ for (var key in obj) {
+ keys2.push(key);
+ }
+ return keys2;
+ };
+ module2.exports = Duplex;
+ var util3 = Object.create(require_util9());
+ util3.inherits = require_inherits();
+ var Readable7 = require_stream_readable();
+ var Writable = require_stream_writable();
+ util3.inherits(Duplex, Readable7);
+ {
+ keys = objectKeys(Writable.prototype);
+ for (v = 0; v < keys.length; v++) {
+ method = keys[v];
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
+ }
}
- function isReadableFinished(stream4, strict) {
- if (!isReadableNodeStream(stream4)) return null;
- const rState = stream4._readableState;
- if (rState !== null && rState !== void 0 && rState.errored) return false;
- if (typeof (rState === null || rState === void 0 ? void 0 : rState.endEmitted) !== "boolean") return null;
- return !!(rState.endEmitted || strict === false && rState.ended === true && rState.length === 0);
+ var keys;
+ var method;
+ var v;
+ function Duplex(options) {
+ if (!(this instanceof Duplex)) return new Duplex(options);
+ Readable7.call(this, options);
+ Writable.call(this, options);
+ if (options && options.readable === false) this.readable = false;
+ if (options && options.writable === false) this.writable = false;
+ this.allowHalfOpen = true;
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
+ this.once("end", onend);
}
- function isReadable(stream4) {
- if (stream4 && stream4[kIsReadable] != null) return stream4[kIsReadable];
- if (typeof (stream4 === null || stream4 === void 0 ? void 0 : stream4.readable) !== "boolean") return null;
- if (isDestroyed(stream4)) return false;
- return isReadableNodeStream(stream4) && stream4.readable && !isReadableFinished(stream4);
+ Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
+ // making it explicit this property is not enumerable
+ // because otherwise some prototype manipulation in
+ // userland will fail
+ enumerable: false,
+ get: function() {
+ return this._writableState.highWaterMark;
+ }
+ });
+ function onend() {
+ if (this.allowHalfOpen || this._writableState.ended) return;
+ pna.nextTick(onEndNT, this);
}
- function isWritable(stream4) {
- if (stream4 && stream4[kIsWritable] != null) return stream4[kIsWritable];
- if (typeof (stream4 === null || stream4 === void 0 ? void 0 : stream4.writable) !== "boolean") return null;
- if (isDestroyed(stream4)) return false;
- return isWritableNodeStream(stream4) && stream4.writable && !isWritableEnded(stream4);
+ function onEndNT(self2) {
+ self2.end();
}
- function isFinished(stream4, opts) {
- if (!isNodeStream(stream4)) {
- return null;
+ Object.defineProperty(Duplex.prototype, "destroyed", {
+ get: function() {
+ if (this._readableState === void 0 || this._writableState === void 0) {
+ return false;
+ }
+ return this._readableState.destroyed && this._writableState.destroyed;
+ },
+ set: function(value) {
+ if (this._readableState === void 0 || this._writableState === void 0) {
+ return;
+ }
+ this._readableState.destroyed = value;
+ this._writableState.destroyed = value;
}
- if (isDestroyed(stream4)) {
- return true;
+ });
+ Duplex.prototype._destroy = function(err, cb) {
+ this.push(null);
+ this.end();
+ pna.nextTick(cb, err);
+ };
+ }
+});
+
+// node_modules/lazystream/node_modules/string_decoder/lib/string_decoder.js
+var require_string_decoder = __commonJS({
+ "node_modules/lazystream/node_modules/string_decoder/lib/string_decoder.js"(exports2) {
+ "use strict";
+ var Buffer3 = require_safe_buffer().Buffer;
+ var isEncoding = Buffer3.isEncoding || function(encoding) {
+ encoding = "" + encoding;
+ switch (encoding && encoding.toLowerCase()) {
+ case "hex":
+ case "utf8":
+ case "utf-8":
+ case "ascii":
+ case "binary":
+ case "base64":
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ case "raw":
+ return true;
+ default:
+ return false;
}
- if ((opts === null || opts === void 0 ? void 0 : opts.readable) !== false && isReadable(stream4)) {
- return false;
+ };
+ function _normalizeEncoding(enc) {
+ if (!enc) return "utf8";
+ var retried;
+ while (true) {
+ switch (enc) {
+ case "utf8":
+ case "utf-8":
+ return "utf8";
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ return "utf16le";
+ case "latin1":
+ case "binary":
+ return "latin1";
+ case "base64":
+ case "ascii":
+ case "hex":
+ return enc;
+ default:
+ if (retried) return;
+ enc = ("" + enc).toLowerCase();
+ retried = true;
+ }
}
- if ((opts === null || opts === void 0 ? void 0 : opts.writable) !== false && isWritable(stream4)) {
- return false;
+ }
+ function normalizeEncoding(enc) {
+ var nenc = _normalizeEncoding(enc);
+ if (typeof nenc !== "string" && (Buffer3.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
+ return nenc || enc;
+ }
+ exports2.StringDecoder = StringDecoder2;
+ function StringDecoder2(encoding) {
+ this.encoding = normalizeEncoding(encoding);
+ var nb;
+ switch (this.encoding) {
+ case "utf16le":
+ this.text = utf16Text;
+ this.end = utf16End;
+ nb = 4;
+ break;
+ case "utf8":
+ this.fillLast = utf8FillLast;
+ nb = 4;
+ break;
+ case "base64":
+ this.text = base64Text;
+ this.end = base64End;
+ nb = 3;
+ break;
+ default:
+ this.write = simpleWrite;
+ this.end = simpleEnd;
+ return;
}
- return true;
+ this.lastNeed = 0;
+ this.lastTotal = 0;
+ this.lastChar = Buffer3.allocUnsafe(nb);
}
- function isWritableErrored(stream4) {
- var _stream$_writableStat, _stream$_writableStat2;
- if (!isNodeStream(stream4)) {
- return null;
+ StringDecoder2.prototype.write = function(buf) {
+ if (buf.length === 0) return "";
+ var r;
+ var i;
+ if (this.lastNeed) {
+ r = this.fillLast(buf);
+ if (r === void 0) return "";
+ i = this.lastNeed;
+ this.lastNeed = 0;
+ } else {
+ i = 0;
}
- if (stream4.writableErrored) {
- return stream4.writableErrored;
+ if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
+ return r || "";
+ };
+ StringDecoder2.prototype.end = utf8End;
+ StringDecoder2.prototype.text = utf8Text;
+ StringDecoder2.prototype.fillLast = function(buf) {
+ if (this.lastNeed <= buf.length) {
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
- return (_stream$_writableStat = (_stream$_writableStat2 = stream4._writableState) === null || _stream$_writableStat2 === void 0 ? void 0 : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== void 0 ? _stream$_writableStat : null;
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
+ this.lastNeed -= buf.length;
+ };
+ function utf8CheckByte(byte) {
+ if (byte <= 127) return 0;
+ else if (byte >> 5 === 6) return 2;
+ else if (byte >> 4 === 14) return 3;
+ else if (byte >> 3 === 30) return 4;
+ return byte >> 6 === 2 ? -1 : -2;
}
- function isReadableErrored(stream4) {
- var _stream$_readableStat, _stream$_readableStat2;
- if (!isNodeStream(stream4)) {
- return null;
+ function utf8CheckIncomplete(self2, buf, i) {
+ var j = buf.length - 1;
+ if (j < i) return 0;
+ var nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) self2.lastNeed = nb - 1;
+ return nb;
}
- if (stream4.readableErrored) {
- return stream4.readableErrored;
+ if (--j < i || nb === -2) return 0;
+ nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) self2.lastNeed = nb - 2;
+ return nb;
}
- return (_stream$_readableStat = (_stream$_readableStat2 = stream4._readableState) === null || _stream$_readableStat2 === void 0 ? void 0 : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== void 0 ? _stream$_readableStat : null;
- }
- function isClosed(stream4) {
- if (!isNodeStream(stream4)) {
- return null;
+ if (--j < i || nb === -2) return 0;
+ nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) {
+ if (nb === 2) nb = 0;
+ else self2.lastNeed = nb - 3;
+ }
+ return nb;
}
- if (typeof stream4.closed === "boolean") {
- return stream4.closed;
+ return 0;
+ }
+ function utf8CheckExtraBytes(self2, buf, p) {
+ if ((buf[0] & 192) !== 128) {
+ self2.lastNeed = 0;
+ return "\uFFFD";
}
- const wState = stream4._writableState;
- const rState = stream4._readableState;
- if (typeof (wState === null || wState === void 0 ? void 0 : wState.closed) === "boolean" || typeof (rState === null || rState === void 0 ? void 0 : rState.closed) === "boolean") {
- return (wState === null || wState === void 0 ? void 0 : wState.closed) || (rState === null || rState === void 0 ? void 0 : rState.closed);
+ if (self2.lastNeed > 1 && buf.length > 1) {
+ if ((buf[1] & 192) !== 128) {
+ self2.lastNeed = 1;
+ return "\uFFFD";
+ }
+ if (self2.lastNeed > 2 && buf.length > 2) {
+ if ((buf[2] & 192) !== 128) {
+ self2.lastNeed = 2;
+ return "\uFFFD";
+ }
+ }
}
- if (typeof stream4._closed === "boolean" && isOutgoingMessage(stream4)) {
- return stream4._closed;
+ }
+ function utf8FillLast(buf) {
+ var p = this.lastTotal - this.lastNeed;
+ var r = utf8CheckExtraBytes(this, buf, p);
+ if (r !== void 0) return r;
+ if (this.lastNeed <= buf.length) {
+ buf.copy(this.lastChar, p, 0, this.lastNeed);
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
- return null;
+ buf.copy(this.lastChar, p, 0, buf.length);
+ this.lastNeed -= buf.length;
}
- function isOutgoingMessage(stream4) {
- return typeof stream4._closed === "boolean" && typeof stream4._defaultKeepAlive === "boolean" && typeof stream4._removedConnection === "boolean" && typeof stream4._removedContLen === "boolean";
+ function utf8Text(buf, i) {
+ var total = utf8CheckIncomplete(this, buf, i);
+ if (!this.lastNeed) return buf.toString("utf8", i);
+ this.lastTotal = total;
+ var end = buf.length - (total - this.lastNeed);
+ buf.copy(this.lastChar, 0, end);
+ return buf.toString("utf8", i, end);
+ }
+ function utf8End(buf) {
+ var r = buf && buf.length ? this.write(buf) : "";
+ if (this.lastNeed) return r + "\uFFFD";
+ return r;
+ }
+ function utf16Text(buf, i) {
+ if ((buf.length - i) % 2 === 0) {
+ var r = buf.toString("utf16le", i);
+ if (r) {
+ var c = r.charCodeAt(r.length - 1);
+ if (c >= 55296 && c <= 56319) {
+ this.lastNeed = 2;
+ this.lastTotal = 4;
+ this.lastChar[0] = buf[buf.length - 2];
+ this.lastChar[1] = buf[buf.length - 1];
+ return r.slice(0, -1);
+ }
+ }
+ return r;
+ }
+ this.lastNeed = 1;
+ this.lastTotal = 2;
+ this.lastChar[0] = buf[buf.length - 1];
+ return buf.toString("utf16le", i, buf.length - 1);
}
- function isServerResponse(stream4) {
- return typeof stream4._sent100 === "boolean" && isOutgoingMessage(stream4);
+ function utf16End(buf) {
+ var r = buf && buf.length ? this.write(buf) : "";
+ if (this.lastNeed) {
+ var end = this.lastTotal - this.lastNeed;
+ return r + this.lastChar.toString("utf16le", 0, end);
+ }
+ return r;
}
- function isServerRequest(stream4) {
- var _stream$req;
- return typeof stream4._consuming === "boolean" && typeof stream4._dumped === "boolean" && ((_stream$req = stream4.req) === null || _stream$req === void 0 ? void 0 : _stream$req.upgradeOrConnect) === void 0;
+ function base64Text(buf, i) {
+ var n = (buf.length - i) % 3;
+ if (n === 0) return buf.toString("base64", i);
+ this.lastNeed = 3 - n;
+ this.lastTotal = 3;
+ if (n === 1) {
+ this.lastChar[0] = buf[buf.length - 1];
+ } else {
+ this.lastChar[0] = buf[buf.length - 2];
+ this.lastChar[1] = buf[buf.length - 1];
+ }
+ return buf.toString("base64", i, buf.length - n);
}
- function willEmitClose(stream4) {
- if (!isNodeStream(stream4)) return null;
- const wState = stream4._writableState;
- const rState = stream4._readableState;
- const state3 = wState || rState;
- return !state3 && isServerResponse(stream4) || !!(state3 && state3.autoDestroy && state3.emitClose && state3.closed === false);
+ function base64End(buf) {
+ var r = buf && buf.length ? this.write(buf) : "";
+ if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
+ return r;
}
- function isDisturbed(stream4) {
- var _stream$kIsDisturbed;
- return !!(stream4 && ((_stream$kIsDisturbed = stream4[kIsDisturbed]) !== null && _stream$kIsDisturbed !== void 0 ? _stream$kIsDisturbed : stream4.readableDidRead || stream4.readableAborted));
+ function simpleWrite(buf) {
+ return buf.toString(this.encoding);
}
- function isErrored(stream4) {
- var _ref, _ref2, _ref3, _ref4, _ref5, _stream$kIsErrored, _stream$_readableStat3, _stream$_writableStat3, _stream$_readableStat4, _stream$_writableStat4;
- return !!(stream4 && ((_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_stream$kIsErrored = stream4[kIsErrored]) !== null && _stream$kIsErrored !== void 0 ? _stream$kIsErrored : stream4.readableErrored) !== null && _ref5 !== void 0 ? _ref5 : stream4.writableErrored) !== null && _ref4 !== void 0 ? _ref4 : (_stream$_readableStat3 = stream4._readableState) === null || _stream$_readableStat3 === void 0 ? void 0 : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== void 0 ? _ref3 : (_stream$_writableStat3 = stream4._writableState) === null || _stream$_writableStat3 === void 0 ? void 0 : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== void 0 ? _ref2 : (_stream$_readableStat4 = stream4._readableState) === null || _stream$_readableStat4 === void 0 ? void 0 : _stream$_readableStat4.errored) !== null && _ref !== void 0 ? _ref : (_stream$_writableStat4 = stream4._writableState) === null || _stream$_writableStat4 === void 0 ? void 0 : _stream$_writableStat4.errored));
+ function simpleEnd(buf) {
+ return buf && buf.length ? this.write(buf) : "";
}
- module2.exports = {
- isDestroyed,
- kIsDestroyed,
- isDisturbed,
- kIsDisturbed,
- isErrored,
- kIsErrored,
- isReadable,
- kIsReadable,
- kIsClosedPromise,
- kControllerErrorFunction,
- kIsWritable,
- isClosed,
- isDuplexNodeStream,
- isFinished,
- isIterable,
- isReadableNodeStream,
- isReadableStream: isReadableStream3,
- isReadableEnded,
- isReadableFinished,
- isReadableErrored,
- isNodeStream,
- isWebStream,
- isWritable,
- isWritableNodeStream,
- isWritableStream,
- isWritableEnded,
- isWritableFinished,
- isWritableErrored,
- isServerRequest,
- isServerResponse,
- willEmitClose,
- isTransformStream
- };
}
});
-// node_modules/readable-stream/lib/internal/streams/end-of-stream.js
-var require_end_of_stream = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2, module2) {
+// node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js
+var require_stream_readable = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js"(exports2, module2) {
"use strict";
- var process5 = require_process();
- var { AbortError: AbortError3, codes } = require_errors2();
- var { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes;
- var { kEmptyObject, once } = require_util10();
- var { validateAbortSignal, validateFunction, validateObject, validateBoolean } = require_validators();
- var { Promise: Promise2, PromisePrototypeThen, SymbolDispose } = require_primordials();
- var {
- isClosed,
- isReadable,
- isReadableNodeStream,
- isReadableStream: isReadableStream3,
- isReadableFinished,
- isReadableErrored,
- isWritable,
- isWritableNodeStream,
- isWritableStream,
- isWritableFinished,
- isWritableErrored,
- isNodeStream,
- willEmitClose: _willEmitClose,
- kIsClosedPromise
- } = require_utils2();
- var addAbortListener;
- function isRequest(stream4) {
- return stream4.setHeader && typeof stream4.abort === "function";
- }
- var nop = () => {
+ var pna = require_process_nextick_args();
+ module2.exports = Readable7;
+ var isArray = require_isarray();
+ var Duplex;
+ Readable7.ReadableState = ReadableState;
+ var EE = require("events").EventEmitter;
+ var EElistenerCount = function(emitter, type) {
+ return emitter.listeners(type).length;
};
- function eos(stream4, options, callback) {
- var _options$readable, _options$writable;
- if (arguments.length === 2) {
- callback = options;
- options = kEmptyObject;
- } else if (options == null) {
- options = kEmptyObject;
- } else {
- validateObject(options, "options");
- }
- validateFunction(callback, "callback");
- validateAbortSignal(options.signal, "options.signal");
- callback = once(callback);
- if (isReadableStream3(stream4) || isWritableStream(stream4)) {
- return eosWeb(stream4, options, callback);
- }
- if (!isNodeStream(stream4)) {
- throw new ERR_INVALID_ARG_TYPE("stream", ["ReadableStream", "WritableStream", "Stream"], stream4);
- }
- const readable = (_options$readable = options.readable) !== null && _options$readable !== void 0 ? _options$readable : isReadableNodeStream(stream4);
- const writable = (_options$writable = options.writable) !== null && _options$writable !== void 0 ? _options$writable : isWritableNodeStream(stream4);
- const wState = stream4._writableState;
- const rState = stream4._readableState;
- const onlegacyfinish = () => {
- if (!stream4.writable) {
- onfinish();
- }
- };
- let willEmitClose = _willEmitClose(stream4) && isReadableNodeStream(stream4) === readable && isWritableNodeStream(stream4) === writable;
- let writableFinished = isWritableFinished(stream4, false);
- const onfinish = () => {
- writableFinished = true;
- if (stream4.destroyed) {
- willEmitClose = false;
- }
- if (willEmitClose && (!stream4.readable || readable)) {
- return;
- }
- if (!readable || readableFinished) {
- callback.call(stream4);
- }
- };
- let readableFinished = isReadableFinished(stream4, false);
- const onend = () => {
- readableFinished = true;
- if (stream4.destroyed) {
- willEmitClose = false;
- }
- if (willEmitClose && (!stream4.writable || writable)) {
- return;
- }
- if (!writable || writableFinished) {
- callback.call(stream4);
- }
- };
- const onerror = (err) => {
- callback.call(stream4, err);
- };
- let closed = isClosed(stream4);
- const onclose = () => {
- closed = true;
- const errored = isWritableErrored(stream4) || isReadableErrored(stream4);
- if (errored && typeof errored !== "boolean") {
- return callback.call(stream4, errored);
- }
- if (readable && !readableFinished && isReadableNodeStream(stream4, true)) {
- if (!isReadableFinished(stream4, false)) return callback.call(stream4, new ERR_STREAM_PREMATURE_CLOSE());
- }
- if (writable && !writableFinished) {
- if (!isWritableFinished(stream4, false)) return callback.call(stream4, new ERR_STREAM_PREMATURE_CLOSE());
- }
- callback.call(stream4);
- };
- const onclosed = () => {
- closed = true;
- const errored = isWritableErrored(stream4) || isReadableErrored(stream4);
- if (errored && typeof errored !== "boolean") {
- return callback.call(stream4, errored);
- }
- callback.call(stream4);
- };
- const onrequest = () => {
- stream4.req.on("finish", onfinish);
+ var Stream2 = require_stream();
+ var Buffer3 = require_safe_buffer().Buffer;
+ var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
+ };
+ function _uint8ArrayToBuffer(chunk) {
+ return Buffer3.from(chunk);
+ }
+ function _isUint8Array(obj) {
+ return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
+ }
+ var util3 = Object.create(require_util9());
+ util3.inherits = require_inherits();
+ var debugUtil = require("util");
+ var debug2 = void 0;
+ if (debugUtil && debugUtil.debuglog) {
+ debug2 = debugUtil.debuglog("stream");
+ } else {
+ debug2 = function() {
};
- if (isRequest(stream4)) {
- stream4.on("complete", onfinish);
- if (!willEmitClose) {
- stream4.on("abort", onclose);
- }
- if (stream4.req) {
- onrequest();
- } else {
- stream4.on("request", onrequest);
- }
- } else if (writable && !wState) {
- stream4.on("end", onlegacyfinish);
- stream4.on("close", onlegacyfinish);
- }
- if (!willEmitClose && typeof stream4.aborted === "boolean") {
- stream4.on("aborted", onclose);
+ }
+ var BufferList = require_BufferList();
+ var destroyImpl = require_destroy();
+ var StringDecoder2;
+ util3.inherits(Readable7, Stream2);
+ var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
+ function prependListener(emitter, event, fn) {
+ if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
+ else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);
+ else emitter._events[event] = [fn, emitter._events[event]];
+ }
+ function ReadableState(options, stream4) {
+ Duplex = Duplex || require_stream_duplex();
+ options = options || {};
+ var isDuplex = stream4 instanceof Duplex;
+ this.objectMode = !!options.objectMode;
+ if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
+ var hwm = options.highWaterMark;
+ var readableHwm = options.readableHighWaterMark;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
+ if (hwm || hwm === 0) this.highWaterMark = hwm;
+ else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;
+ else this.highWaterMark = defaultHwm;
+ this.highWaterMark = Math.floor(this.highWaterMark);
+ this.buffer = new BufferList();
+ this.length = 0;
+ this.pipes = null;
+ this.pipesCount = 0;
+ this.flowing = null;
+ this.ended = false;
+ this.endEmitted = false;
+ this.reading = false;
+ this.sync = true;
+ this.needReadable = false;
+ this.emittedReadable = false;
+ this.readableListening = false;
+ this.resumeScheduled = false;
+ this.destroyed = false;
+ this.defaultEncoding = options.defaultEncoding || "utf8";
+ this.awaitDrain = 0;
+ this.readingMore = false;
+ this.decoder = null;
+ this.encoding = null;
+ if (options.encoding) {
+ if (!StringDecoder2) StringDecoder2 = require_string_decoder().StringDecoder;
+ this.decoder = new StringDecoder2(options.encoding);
+ this.encoding = options.encoding;
}
- stream4.on("end", onend);
- stream4.on("finish", onfinish);
- if (options.error !== false) {
- stream4.on("error", onerror);
+ }
+ function Readable7(options) {
+ Duplex = Duplex || require_stream_duplex();
+ if (!(this instanceof Readable7)) return new Readable7(options);
+ this._readableState = new ReadableState(options, this);
+ this.readable = true;
+ if (options) {
+ if (typeof options.read === "function") this._read = options.read;
+ if (typeof options.destroy === "function") this._destroy = options.destroy;
}
- stream4.on("close", onclose);
- if (closed) {
- process5.nextTick(onclose);
- } else if (wState !== null && wState !== void 0 && wState.errorEmitted || rState !== null && rState !== void 0 && rState.errorEmitted) {
- if (!willEmitClose) {
- process5.nextTick(onclosed);
+ Stream2.call(this);
+ }
+ Object.defineProperty(Readable7.prototype, "destroyed", {
+ get: function() {
+ if (this._readableState === void 0) {
+ return false;
}
- } else if (!readable && (!willEmitClose || isReadable(stream4)) && (writableFinished || isWritable(stream4) === false)) {
- process5.nextTick(onclosed);
- } else if (!writable && (!willEmitClose || isWritable(stream4)) && (readableFinished || isReadable(stream4) === false)) {
- process5.nextTick(onclosed);
- } else if (rState && stream4.req && stream4.aborted) {
- process5.nextTick(onclosed);
- }
- const cleanup = () => {
- callback = nop;
- stream4.removeListener("aborted", onclose);
- stream4.removeListener("complete", onfinish);
- stream4.removeListener("abort", onclose);
- stream4.removeListener("request", onrequest);
- if (stream4.req) stream4.req.removeListener("finish", onfinish);
- stream4.removeListener("end", onlegacyfinish);
- stream4.removeListener("close", onlegacyfinish);
- stream4.removeListener("finish", onfinish);
- stream4.removeListener("end", onend);
- stream4.removeListener("error", onerror);
- stream4.removeListener("close", onclose);
- };
- if (options.signal && !closed) {
- const abort = () => {
- const endCallback = callback;
- cleanup();
- endCallback.call(
- stream4,
- new AbortError3(void 0, {
- cause: options.signal.reason
- })
- );
- };
- if (options.signal.aborted) {
- process5.nextTick(abort);
- } else {
- addAbortListener = addAbortListener || require_util10().addAbortListener;
- const disposable = addAbortListener(options.signal, abort);
- const originalCallback = callback;
- callback = once((...args) => {
- disposable[SymbolDispose]();
- originalCallback.apply(stream4, args);
- });
+ return this._readableState.destroyed;
+ },
+ set: function(value) {
+ if (!this._readableState) {
+ return;
}
+ this._readableState.destroyed = value;
}
- return cleanup;
- }
- function eosWeb(stream4, options, callback) {
- let isAborted = false;
- let abort = nop;
- if (options.signal) {
- abort = () => {
- isAborted = true;
- callback.call(
- stream4,
- new AbortError3(void 0, {
- cause: options.signal.reason
- })
- );
- };
- if (options.signal.aborted) {
- process5.nextTick(abort);
- } else {
- addAbortListener = addAbortListener || require_util10().addAbortListener;
- const disposable = addAbortListener(options.signal, abort);
- const originalCallback = callback;
- callback = once((...args) => {
- disposable[SymbolDispose]();
- originalCallback.apply(stream4, args);
- });
+ });
+ Readable7.prototype.destroy = destroyImpl.destroy;
+ Readable7.prototype._undestroy = destroyImpl.undestroy;
+ Readable7.prototype._destroy = function(err, cb) {
+ this.push(null);
+ cb(err);
+ };
+ Readable7.prototype.push = function(chunk, encoding) {
+ var state3 = this._readableState;
+ var skipChunkCheck;
+ if (!state3.objectMode) {
+ if (typeof chunk === "string") {
+ encoding = encoding || state3.defaultEncoding;
+ if (encoding !== state3.encoding) {
+ chunk = Buffer3.from(chunk, encoding);
+ encoding = "";
+ }
+ skipChunkCheck = true;
}
+ } else {
+ skipChunkCheck = true;
}
- const resolverFn = (...args) => {
- if (!isAborted) {
- process5.nextTick(() => callback.apply(stream4, args));
+ return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
+ };
+ Readable7.prototype.unshift = function(chunk) {
+ return readableAddChunk(this, chunk, null, true, false);
+ };
+ function readableAddChunk(stream4, chunk, encoding, addToFront, skipChunkCheck) {
+ var state3 = stream4._readableState;
+ if (chunk === null) {
+ state3.reading = false;
+ onEofChunk(stream4, state3);
+ } else {
+ var er;
+ if (!skipChunkCheck) er = chunkInvalid(state3, chunk);
+ if (er) {
+ stream4.emit("error", er);
+ } else if (state3.objectMode || chunk && chunk.length > 0) {
+ if (typeof chunk !== "string" && !state3.objectMode && Object.getPrototypeOf(chunk) !== Buffer3.prototype) {
+ chunk = _uint8ArrayToBuffer(chunk);
+ }
+ if (addToFront) {
+ if (state3.endEmitted) stream4.emit("error", new Error("stream.unshift() after end event"));
+ else addChunk(stream4, state3, chunk, true);
+ } else if (state3.ended) {
+ stream4.emit("error", new Error("stream.push() after EOF"));
+ } else {
+ state3.reading = false;
+ if (state3.decoder && !encoding) {
+ chunk = state3.decoder.write(chunk);
+ if (state3.objectMode || chunk.length !== 0) addChunk(stream4, state3, chunk, false);
+ else maybeReadMore(stream4, state3);
+ } else {
+ addChunk(stream4, state3, chunk, false);
+ }
+ }
+ } else if (!addToFront) {
+ state3.reading = false;
}
- };
- PromisePrototypeThen(stream4[kIsClosedPromise].promise, resolverFn, resolverFn);
- return nop;
+ }
+ return needMoreData(state3);
}
- function finished(stream4, opts) {
- var _opts;
- let autoCleanup = false;
- if (opts === null) {
- opts = kEmptyObject;
+ function addChunk(stream4, state3, chunk, addToFront) {
+ if (state3.flowing && state3.length === 0 && !state3.sync) {
+ stream4.emit("data", chunk);
+ stream4.read(0);
+ } else {
+ state3.length += state3.objectMode ? 1 : chunk.length;
+ if (addToFront) state3.buffer.unshift(chunk);
+ else state3.buffer.push(chunk);
+ if (state3.needReadable) emitReadable(stream4);
}
- if ((_opts = opts) !== null && _opts !== void 0 && _opts.cleanup) {
- validateBoolean(opts.cleanup, "cleanup");
- autoCleanup = opts.cleanup;
+ maybeReadMore(stream4, state3);
+ }
+ function chunkInvalid(state3, chunk) {
+ var er;
+ if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state3.objectMode) {
+ er = new TypeError("Invalid non-string/buffer chunk");
}
- return new Promise2((resolve7, reject) => {
- const cleanup = eos(stream4, opts, (err) => {
- if (autoCleanup) {
- cleanup();
- }
- if (err) {
- reject(err);
- } else {
- resolve7();
- }
- });
- });
+ return er;
+ }
+ function needMoreData(state3) {
+ return !state3.ended && (state3.needReadable || state3.length < state3.highWaterMark || state3.length === 0);
+ }
+ Readable7.prototype.isPaused = function() {
+ return this._readableState.flowing === false;
+ };
+ Readable7.prototype.setEncoding = function(enc) {
+ if (!StringDecoder2) StringDecoder2 = require_string_decoder().StringDecoder;
+ this._readableState.decoder = new StringDecoder2(enc);
+ this._readableState.encoding = enc;
+ return this;
+ };
+ var MAX_HWM = 8388608;
+ function computeNewHighWaterMark(n) {
+ if (n >= MAX_HWM) {
+ n = MAX_HWM;
+ } else {
+ n--;
+ n |= n >>> 1;
+ n |= n >>> 2;
+ n |= n >>> 4;
+ n |= n >>> 8;
+ n |= n >>> 16;
+ n++;
+ }
+ return n;
}
- module2.exports = eos;
- module2.exports.finished = finished;
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/destroy.js
-var require_destroy2 = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
- "use strict";
- var process5 = require_process();
- var {
- aggregateTwoErrors,
- codes: { ERR_MULTIPLE_CALLBACK },
- AbortError: AbortError3
- } = require_errors2();
- var { Symbol: Symbol2 } = require_primordials();
- var { kIsDestroyed, isDestroyed, isFinished, isServerRequest } = require_utils2();
- var kDestroy = Symbol2("kDestroy");
- var kConstruct = Symbol2("kConstruct");
- function checkError(err, w, r) {
- if (err) {
- err.stack;
- if (w && !w.errored) {
- w.errored = err;
- }
- if (r && !r.errored) {
- r.errored = err;
- }
+ function howMuchToRead(n, state3) {
+ if (n <= 0 || state3.length === 0 && state3.ended) return 0;
+ if (state3.objectMode) return 1;
+ if (n !== n) {
+ if (state3.flowing && state3.length) return state3.buffer.head.data.length;
+ else return state3.length;
+ }
+ if (n > state3.highWaterMark) state3.highWaterMark = computeNewHighWaterMark(n);
+ if (n <= state3.length) return n;
+ if (!state3.ended) {
+ state3.needReadable = true;
+ return 0;
}
+ return state3.length;
}
- function destroy2(err, cb) {
- const r = this._readableState;
- const w = this._writableState;
- const s = w || r;
- if (w !== null && w !== void 0 && w.destroyed || r !== null && r !== void 0 && r.destroyed) {
- if (typeof cb === "function") {
- cb();
- }
- return this;
+ Readable7.prototype.read = function(n) {
+ debug2("read", n);
+ n = parseInt(n, 10);
+ var state3 = this._readableState;
+ var nOrig = n;
+ if (n !== 0) state3.emittedReadable = false;
+ if (n === 0 && state3.needReadable && (state3.length >= state3.highWaterMark || state3.ended)) {
+ debug2("read: emitReadable", state3.length, state3.ended);
+ if (state3.length === 0 && state3.ended) endReadable(this);
+ else emitReadable(this);
+ return null;
}
- checkError(err, w, r);
- if (w) {
- w.destroyed = true;
+ n = howMuchToRead(n, state3);
+ if (n === 0 && state3.ended) {
+ if (state3.length === 0) endReadable(this);
+ return null;
}
- if (r) {
- r.destroyed = true;
+ var doRead = state3.needReadable;
+ debug2("need readable", doRead);
+ if (state3.length === 0 || state3.length - n < state3.highWaterMark) {
+ doRead = true;
+ debug2("length less than watermark", doRead);
}
- if (!s.constructed) {
- this.once(kDestroy, function(er) {
- _destroy(this, aggregateTwoErrors(er, err), cb);
- });
+ if (state3.ended || state3.reading) {
+ doRead = false;
+ debug2("reading or ended", doRead);
+ } else if (doRead) {
+ debug2("do read");
+ state3.reading = true;
+ state3.sync = true;
+ if (state3.length === 0) state3.needReadable = true;
+ this._read(state3.highWaterMark);
+ state3.sync = false;
+ if (!state3.reading) n = howMuchToRead(nOrig, state3);
+ }
+ var ret;
+ if (n > 0) ret = fromList(n, state3);
+ else ret = null;
+ if (ret === null) {
+ state3.needReadable = true;
+ n = 0;
} else {
- _destroy(this, err, cb);
+ state3.length -= n;
}
- return this;
- }
- function _destroy(self2, err, cb) {
- let called = false;
- function onDestroy(err2) {
- if (called) {
- return;
- }
- called = true;
- const r = self2._readableState;
- const w = self2._writableState;
- checkError(err2, w, r);
- if (w) {
- w.closed = true;
- }
- if (r) {
- r.closed = true;
- }
- if (typeof cb === "function") {
- cb(err2);
- }
- if (err2) {
- process5.nextTick(emitErrorCloseNT, self2, err2);
- } else {
- process5.nextTick(emitCloseNT, self2);
+ if (state3.length === 0) {
+ if (!state3.ended) state3.needReadable = true;
+ if (nOrig !== n && state3.ended) endReadable(this);
+ }
+ if (ret !== null) this.emit("data", ret);
+ return ret;
+ };
+ function onEofChunk(stream4, state3) {
+ if (state3.ended) return;
+ if (state3.decoder) {
+ var chunk = state3.decoder.end();
+ if (chunk && chunk.length) {
+ state3.buffer.push(chunk);
+ state3.length += state3.objectMode ? 1 : chunk.length;
}
}
- try {
- self2._destroy(err || null, onDestroy);
- } catch (err2) {
- onDestroy(err2);
+ state3.ended = true;
+ emitReadable(stream4);
+ }
+ function emitReadable(stream4) {
+ var state3 = stream4._readableState;
+ state3.needReadable = false;
+ if (!state3.emittedReadable) {
+ debug2("emitReadable", state3.flowing);
+ state3.emittedReadable = true;
+ if (state3.sync) pna.nextTick(emitReadable_, stream4);
+ else emitReadable_(stream4);
}
}
- function emitErrorCloseNT(self2, err) {
- emitErrorNT(self2, err);
- emitCloseNT(self2);
+ function emitReadable_(stream4) {
+ debug2("emit readable");
+ stream4.emit("readable");
+ flow(stream4);
}
- function emitCloseNT(self2) {
- const r = self2._readableState;
- const w = self2._writableState;
- if (w) {
- w.closeEmitted = true;
- }
- if (r) {
- r.closeEmitted = true;
+ function maybeReadMore(stream4, state3) {
+ if (!state3.readingMore) {
+ state3.readingMore = true;
+ pna.nextTick(maybeReadMore_, stream4, state3);
}
- if (w !== null && w !== void 0 && w.emitClose || r !== null && r !== void 0 && r.emitClose) {
- self2.emit("close");
+ }
+ function maybeReadMore_(stream4, state3) {
+ var len = state3.length;
+ while (!state3.reading && !state3.flowing && !state3.ended && state3.length < state3.highWaterMark) {
+ debug2("maybeReadMore read 0");
+ stream4.read(0);
+ if (len === state3.length)
+ break;
+ else len = state3.length;
}
+ state3.readingMore = false;
}
- function emitErrorNT(self2, err) {
- const r = self2._readableState;
- const w = self2._writableState;
- if (w !== null && w !== void 0 && w.errorEmitted || r !== null && r !== void 0 && r.errorEmitted) {
- return;
+ Readable7.prototype._read = function(n) {
+ this.emit("error", new Error("_read() is not implemented"));
+ };
+ Readable7.prototype.pipe = function(dest, pipeOpts) {
+ var src = this;
+ var state3 = this._readableState;
+ switch (state3.pipesCount) {
+ case 0:
+ state3.pipes = dest;
+ break;
+ case 1:
+ state3.pipes = [state3.pipes, dest];
+ break;
+ default:
+ state3.pipes.push(dest);
+ break;
+ }
+ state3.pipesCount += 1;
+ debug2("pipe count=%d opts=%j", state3.pipesCount, pipeOpts);
+ var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
+ var endFn = doEnd ? onend : unpipe;
+ if (state3.endEmitted) pna.nextTick(endFn);
+ else src.once("end", endFn);
+ dest.on("unpipe", onunpipe);
+ function onunpipe(readable, unpipeInfo) {
+ debug2("onunpipe");
+ if (readable === src) {
+ if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
+ unpipeInfo.hasUnpiped = true;
+ cleanup();
+ }
+ }
+ }
+ function onend() {
+ debug2("onend");
+ dest.end();
+ }
+ var ondrain = pipeOnDrain(src);
+ dest.on("drain", ondrain);
+ var cleanedUp = false;
+ function cleanup() {
+ debug2("cleanup");
+ dest.removeListener("close", onclose);
+ dest.removeListener("finish", onfinish);
+ dest.removeListener("drain", ondrain);
+ dest.removeListener("error", onerror);
+ dest.removeListener("unpipe", onunpipe);
+ src.removeListener("end", onend);
+ src.removeListener("end", unpipe);
+ src.removeListener("data", ondata);
+ cleanedUp = true;
+ if (state3.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
+ }
+ var increasedAwaitDrain = false;
+ src.on("data", ondata);
+ function ondata(chunk) {
+ debug2("ondata");
+ increasedAwaitDrain = false;
+ var ret = dest.write(chunk);
+ if (false === ret && !increasedAwaitDrain) {
+ if ((state3.pipesCount === 1 && state3.pipes === dest || state3.pipesCount > 1 && indexOf(state3.pipes, dest) !== -1) && !cleanedUp) {
+ debug2("false write response, pause", state3.awaitDrain);
+ state3.awaitDrain++;
+ increasedAwaitDrain = true;
+ }
+ src.pause();
+ }
}
- if (w) {
- w.errorEmitted = true;
+ function onerror(er) {
+ debug2("onerror", er);
+ unpipe();
+ dest.removeListener("error", onerror);
+ if (EElistenerCount(dest, "error") === 0) dest.emit("error", er);
}
- if (r) {
- r.errorEmitted = true;
+ prependListener(dest, "error", onerror);
+ function onclose() {
+ dest.removeListener("finish", onfinish);
+ unpipe();
}
- self2.emit("error", err);
- }
- function undestroy() {
- const r = this._readableState;
- const w = this._writableState;
- if (r) {
- r.constructed = true;
- r.closed = false;
- r.closeEmitted = false;
- r.destroyed = false;
- r.errored = null;
- r.errorEmitted = false;
- r.reading = false;
- r.ended = r.readable === false;
- r.endEmitted = r.readable === false;
+ dest.once("close", onclose);
+ function onfinish() {
+ debug2("onfinish");
+ dest.removeListener("close", onclose);
+ unpipe();
}
- if (w) {
- w.constructed = true;
- w.destroyed = false;
- w.closed = false;
- w.closeEmitted = false;
- w.errored = null;
- w.errorEmitted = false;
- w.finalCalled = false;
- w.prefinished = false;
- w.ended = w.writable === false;
- w.ending = w.writable === false;
- w.finished = w.writable === false;
+ dest.once("finish", onfinish);
+ function unpipe() {
+ debug2("unpipe");
+ src.unpipe(dest);
+ }
+ dest.emit("pipe", src);
+ if (!state3.flowing) {
+ debug2("pipe resume");
+ src.resume();
}
+ return dest;
+ };
+ function pipeOnDrain(src) {
+ return function() {
+ var state3 = src._readableState;
+ debug2("pipeOnDrain", state3.awaitDrain);
+ if (state3.awaitDrain) state3.awaitDrain--;
+ if (state3.awaitDrain === 0 && EElistenerCount(src, "data")) {
+ state3.flowing = true;
+ flow(src);
+ }
+ };
}
- function errorOrDestroy(stream4, err, sync) {
- const r = stream4._readableState;
- const w = stream4._writableState;
- if (w !== null && w !== void 0 && w.destroyed || r !== null && r !== void 0 && r.destroyed) {
+ Readable7.prototype.unpipe = function(dest) {
+ var state3 = this._readableState;
+ var unpipeInfo = { hasUnpiped: false };
+ if (state3.pipesCount === 0) return this;
+ if (state3.pipesCount === 1) {
+ if (dest && dest !== state3.pipes) return this;
+ if (!dest) dest = state3.pipes;
+ state3.pipes = null;
+ state3.pipesCount = 0;
+ state3.flowing = false;
+ if (dest) dest.emit("unpipe", this, unpipeInfo);
return this;
}
- if (r !== null && r !== void 0 && r.autoDestroy || w !== null && w !== void 0 && w.autoDestroy)
- stream4.destroy(err);
- else if (err) {
- err.stack;
- if (w && !w.errored) {
- w.errored = err;
- }
- if (r && !r.errored) {
- r.errored = err;
+ if (!dest) {
+ var dests = state3.pipes;
+ var len = state3.pipesCount;
+ state3.pipes = null;
+ state3.pipesCount = 0;
+ state3.flowing = false;
+ for (var i = 0; i < len; i++) {
+ dests[i].emit("unpipe", this, { hasUnpiped: false });
}
- if (sync) {
- process5.nextTick(emitErrorNT, stream4, err);
- } else {
- emitErrorNT(stream4, err);
+ return this;
+ }
+ var index = indexOf(state3.pipes, dest);
+ if (index === -1) return this;
+ state3.pipes.splice(index, 1);
+ state3.pipesCount -= 1;
+ if (state3.pipesCount === 1) state3.pipes = state3.pipes[0];
+ dest.emit("unpipe", this, unpipeInfo);
+ return this;
+ };
+ Readable7.prototype.on = function(ev, fn) {
+ var res = Stream2.prototype.on.call(this, ev, fn);
+ if (ev === "data") {
+ if (this._readableState.flowing !== false) this.resume();
+ } else if (ev === "readable") {
+ var state3 = this._readableState;
+ if (!state3.endEmitted && !state3.readableListening) {
+ state3.readableListening = state3.needReadable = true;
+ state3.emittedReadable = false;
+ if (!state3.reading) {
+ pna.nextTick(nReadingNextTick, this);
+ } else if (state3.length) {
+ emitReadable(this);
+ }
}
}
+ return res;
+ };
+ Readable7.prototype.addListener = Readable7.prototype.on;
+ function nReadingNextTick(self2) {
+ debug2("readable nexttick read 0");
+ self2.read(0);
}
- function construct(stream4, cb) {
- if (typeof stream4._construct !== "function") {
- return;
+ Readable7.prototype.resume = function() {
+ var state3 = this._readableState;
+ if (!state3.flowing) {
+ debug2("resume");
+ state3.flowing = true;
+ resume(this, state3);
}
- const r = stream4._readableState;
- const w = stream4._writableState;
- if (r) {
- r.constructed = false;
+ return this;
+ };
+ function resume(stream4, state3) {
+ if (!state3.resumeScheduled) {
+ state3.resumeScheduled = true;
+ pna.nextTick(resume_, stream4, state3);
}
- if (w) {
- w.constructed = false;
+ }
+ function resume_(stream4, state3) {
+ if (!state3.reading) {
+ debug2("resume read 0");
+ stream4.read(0);
}
- stream4.once(kConstruct, cb);
- if (stream4.listenerCount(kConstruct) > 1) {
- return;
+ state3.resumeScheduled = false;
+ state3.awaitDrain = 0;
+ stream4.emit("resume");
+ flow(stream4);
+ if (state3.flowing && !state3.reading) stream4.read(0);
+ }
+ Readable7.prototype.pause = function() {
+ debug2("call pause flowing=%j", this._readableState.flowing);
+ if (false !== this._readableState.flowing) {
+ debug2("pause");
+ this._readableState.flowing = false;
+ this.emit("pause");
+ }
+ return this;
+ };
+ function flow(stream4) {
+ var state3 = stream4._readableState;
+ debug2("flow", state3.flowing);
+ while (state3.flowing && stream4.read() !== null) {
}
- process5.nextTick(constructNT, stream4);
}
- function constructNT(stream4) {
- let called = false;
- function onConstruct(err) {
- if (called) {
- errorOrDestroy(stream4, err !== null && err !== void 0 ? err : new ERR_MULTIPLE_CALLBACK());
- return;
- }
- called = true;
- const r = stream4._readableState;
- const w = stream4._writableState;
- const s = w || r;
- if (r) {
- r.constructed = true;
+ Readable7.prototype.wrap = function(stream4) {
+ var _this = this;
+ var state3 = this._readableState;
+ var paused = false;
+ stream4.on("end", function() {
+ debug2("wrapped end");
+ if (state3.decoder && !state3.ended) {
+ var chunk = state3.decoder.end();
+ if (chunk && chunk.length) _this.push(chunk);
}
- if (w) {
- w.constructed = true;
+ _this.push(null);
+ });
+ stream4.on("data", function(chunk) {
+ debug2("wrapped data");
+ if (state3.decoder) chunk = state3.decoder.write(chunk);
+ if (state3.objectMode && (chunk === null || chunk === void 0)) return;
+ else if (!state3.objectMode && (!chunk || !chunk.length)) return;
+ var ret = _this.push(chunk);
+ if (!ret) {
+ paused = true;
+ stream4.pause();
}
- if (s.destroyed) {
- stream4.emit(kDestroy, err);
- } else if (err) {
- errorOrDestroy(stream4, err, true);
- } else {
- process5.nextTick(emitConstructNT, stream4);
+ });
+ for (var i in stream4) {
+ if (this[i] === void 0 && typeof stream4[i] === "function") {
+ this[i] = /* @__PURE__ */ (function(method) {
+ return function() {
+ return stream4[method].apply(stream4, arguments);
+ };
+ })(i);
}
}
- try {
- stream4._construct((err) => {
- process5.nextTick(onConstruct, err);
- });
- } catch (err) {
- process5.nextTick(onConstruct, err);
- }
- }
- function emitConstructNT(stream4) {
- stream4.emit(kConstruct);
- }
- function isRequest(stream4) {
- return (stream4 === null || stream4 === void 0 ? void 0 : stream4.setHeader) && typeof stream4.abort === "function";
- }
- function emitCloseLegacy(stream4) {
- stream4.emit("close");
- }
- function emitErrorCloseLegacy(stream4, err) {
- stream4.emit("error", err);
- process5.nextTick(emitCloseLegacy, stream4);
- }
- function destroyer(stream4, err) {
- if (!stream4 || isDestroyed(stream4)) {
- return;
+ for (var n = 0; n < kProxyEvents.length; n++) {
+ stream4.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}
- if (!err && !isFinished(stream4)) {
- err = new AbortError3();
+ this._read = function(n2) {
+ debug2("wrapped _read", n2);
+ if (paused) {
+ paused = false;
+ stream4.resume();
+ }
+ };
+ return this;
+ };
+ Object.defineProperty(Readable7.prototype, "readableHighWaterMark", {
+ // making it explicit this property is not enumerable
+ // because otherwise some prototype manipulation in
+ // userland will fail
+ enumerable: false,
+ get: function() {
+ return this._readableState.highWaterMark;
}
- if (isServerRequest(stream4)) {
- stream4.socket = null;
- stream4.destroy(err);
- } else if (isRequest(stream4)) {
- stream4.abort();
- } else if (isRequest(stream4.req)) {
- stream4.req.abort();
- } else if (typeof stream4.destroy === "function") {
- stream4.destroy(err);
- } else if (typeof stream4.close === "function") {
- stream4.close();
- } else if (err) {
- process5.nextTick(emitErrorCloseLegacy, stream4, err);
+ });
+ Readable7._fromList = fromList;
+ function fromList(n, state3) {
+ if (state3.length === 0) return null;
+ var ret;
+ if (state3.objectMode) ret = state3.buffer.shift();
+ else if (!n || n >= state3.length) {
+ if (state3.decoder) ret = state3.buffer.join("");
+ else if (state3.buffer.length === 1) ret = state3.buffer.head.data;
+ else ret = state3.buffer.concat(state3.length);
+ state3.buffer.clear();
} else {
- process5.nextTick(emitCloseLegacy, stream4);
- }
- if (!stream4.destroyed) {
- stream4[kIsDestroyed] = true;
+ ret = fromListPartial(n, state3.buffer, state3.decoder);
}
+ return ret;
}
- module2.exports = {
- construct,
- destroyer,
- destroy: destroy2,
- undestroy,
- errorOrDestroy
- };
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/legacy.js
-var require_legacy = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/legacy.js"(exports2, module2) {
- "use strict";
- var { ArrayIsArray, ObjectSetPrototypeOf } = require_primordials();
- var { EventEmitter: EE } = require("events");
- function Stream2(opts) {
- EE.call(this, opts);
+ function fromListPartial(n, list, hasStrings) {
+ var ret;
+ if (n < list.head.data.length) {
+ ret = list.head.data.slice(0, n);
+ list.head.data = list.head.data.slice(n);
+ } else if (n === list.head.data.length) {
+ ret = list.shift();
+ } else {
+ ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
+ }
+ return ret;
}
- ObjectSetPrototypeOf(Stream2.prototype, EE.prototype);
- ObjectSetPrototypeOf(Stream2, EE);
- Stream2.prototype.pipe = function(dest, options) {
- const source = this;
- function ondata(chunk) {
- if (dest.writable && dest.write(chunk) === false && source.pause) {
- source.pause();
+ function copyFromBufferString(n, list) {
+ var p = list.head;
+ var c = 1;
+ var ret = p.data;
+ n -= ret.length;
+ while (p = p.next) {
+ var str = p.data;
+ var nb = n > str.length ? str.length : n;
+ if (nb === str.length) ret += str;
+ else ret += str.slice(0, n);
+ n -= nb;
+ if (n === 0) {
+ if (nb === str.length) {
+ ++c;
+ if (p.next) list.head = p.next;
+ else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = str.slice(nb);
+ }
+ break;
}
+ ++c;
}
- source.on("data", ondata);
- function ondrain() {
- if (source.readable && source.resume) {
- source.resume();
+ list.length -= c;
+ return ret;
+ }
+ function copyFromBuffer(n, list) {
+ var ret = Buffer3.allocUnsafe(n);
+ var p = list.head;
+ var c = 1;
+ p.data.copy(ret);
+ n -= p.data.length;
+ while (p = p.next) {
+ var buf = p.data;
+ var nb = n > buf.length ? buf.length : n;
+ buf.copy(ret, ret.length - n, 0, nb);
+ n -= nb;
+ if (n === 0) {
+ if (nb === buf.length) {
+ ++c;
+ if (p.next) list.head = p.next;
+ else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = buf.slice(nb);
+ }
+ break;
}
+ ++c;
}
- dest.on("drain", ondrain);
- if (!dest._isStdio && (!options || options.end !== false)) {
- source.on("end", onend);
- source.on("close", onclose);
- }
- let didOnEnd = false;
- function onend() {
- if (didOnEnd) return;
- didOnEnd = true;
- dest.end();
- }
- function onclose() {
- if (didOnEnd) return;
- didOnEnd = true;
- if (typeof dest.destroy === "function") dest.destroy();
+ list.length -= c;
+ return ret;
+ }
+ function endReadable(stream4) {
+ var state3 = stream4._readableState;
+ if (state3.length > 0) throw new Error('"endReadable()" called on non-empty stream');
+ if (!state3.endEmitted) {
+ state3.ended = true;
+ pna.nextTick(endReadableNT, state3, stream4);
}
- function onerror(er) {
- cleanup();
- if (EE.listenerCount(this, "error") === 0) {
- this.emit("error", er);
- }
+ }
+ function endReadableNT(state3, stream4) {
+ if (!state3.endEmitted && state3.length === 0) {
+ state3.endEmitted = true;
+ stream4.readable = false;
+ stream4.emit("end");
}
- prependListener(source, "error", onerror);
- prependListener(dest, "error", onerror);
- function cleanup() {
- source.removeListener("data", ondata);
- dest.removeListener("drain", ondrain);
- source.removeListener("end", onend);
- source.removeListener("close", onclose);
- source.removeListener("error", onerror);
- dest.removeListener("error", onerror);
- source.removeListener("end", cleanup);
- source.removeListener("close", cleanup);
- dest.removeListener("close", cleanup);
+ }
+ function indexOf(xs, x) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ if (xs[i] === x) return i;
}
- source.on("end", cleanup);
- source.on("close", cleanup);
- dest.on("close", cleanup);
- dest.emit("pipe", source);
- return dest;
- };
- function prependListener(emitter, event, fn) {
- if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
- else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn);
- else emitter._events[event] = [fn, emitter._events[event]];
+ return -1;
}
- module2.exports = {
- Stream: Stream2,
- prependListener
- };
}
});
-// node_modules/readable-stream/lib/internal/streams/add-abort-signal.js
-var require_add_abort_signal = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/add-abort-signal.js"(exports2, module2) {
+// node_modules/lazystream/node_modules/readable-stream/lib/_stream_transform.js
+var require_stream_transform = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/_stream_transform.js"(exports2, module2) {
"use strict";
- var { SymbolDispose } = require_primordials();
- var { AbortError: AbortError3, codes } = require_errors2();
- var { isNodeStream, isWebStream, kControllerErrorFunction } = require_utils2();
- var eos = require_end_of_stream();
- var { ERR_INVALID_ARG_TYPE } = codes;
- var addAbortListener;
- var validateAbortSignal = (signal, name) => {
- if (typeof signal !== "object" || !("aborted" in signal)) {
- throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
+ module2.exports = Transform4;
+ var Duplex = require_stream_duplex();
+ var util3 = Object.create(require_util9());
+ util3.inherits = require_inherits();
+ util3.inherits(Transform4, Duplex);
+ function afterTransform(er, data) {
+ var ts = this._transformState;
+ ts.transforming = false;
+ var cb = ts.writecb;
+ if (!cb) {
+ return this.emit("error", new Error("write callback called multiple times"));
+ }
+ ts.writechunk = null;
+ ts.writecb = null;
+ if (data != null)
+ this.push(data);
+ cb(er);
+ var rs = this._readableState;
+ rs.reading = false;
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
+ this._read(rs.highWaterMark);
+ }
+ }
+ function Transform4(options) {
+ if (!(this instanceof Transform4)) return new Transform4(options);
+ Duplex.call(this, options);
+ this._transformState = {
+ afterTransform: afterTransform.bind(this),
+ needTransform: false,
+ transforming: false,
+ writecb: null,
+ writechunk: null,
+ writeencoding: null
+ };
+ this._readableState.needReadable = true;
+ this._readableState.sync = false;
+ if (options) {
+ if (typeof options.transform === "function") this._transform = options.transform;
+ if (typeof options.flush === "function") this._flush = options.flush;
}
- };
- module2.exports.addAbortSignal = function addAbortSignal(signal, stream4) {
- validateAbortSignal(signal, "signal");
- if (!isNodeStream(stream4) && !isWebStream(stream4)) {
- throw new ERR_INVALID_ARG_TYPE("stream", ["ReadableStream", "WritableStream", "Stream"], stream4);
+ this.on("prefinish", prefinish);
+ }
+ function prefinish() {
+ var _this = this;
+ if (typeof this._flush === "function") {
+ this._flush(function(er, data) {
+ done(_this, er, data);
+ });
+ } else {
+ done(this, null, null);
}
- return module2.exports.addAbortSignalNoValidate(signal, stream4);
+ }
+ Transform4.prototype.push = function(chunk, encoding) {
+ this._transformState.needTransform = false;
+ return Duplex.prototype.push.call(this, chunk, encoding);
};
- module2.exports.addAbortSignalNoValidate = function(signal, stream4) {
- if (typeof signal !== "object" || !("aborted" in signal)) {
- return stream4;
+ Transform4.prototype._transform = function(chunk, encoding, cb) {
+ throw new Error("_transform() is not implemented");
+ };
+ Transform4.prototype._write = function(chunk, encoding, cb) {
+ var ts = this._transformState;
+ ts.writecb = cb;
+ ts.writechunk = chunk;
+ ts.writeencoding = encoding;
+ if (!ts.transforming) {
+ var rs = this._readableState;
+ if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
}
- const onAbort = isNodeStream(stream4) ? () => {
- stream4.destroy(
- new AbortError3(void 0, {
- cause: signal.reason
- })
- );
- } : () => {
- stream4[kControllerErrorFunction](
- new AbortError3(void 0, {
- cause: signal.reason
- })
- );
- };
- if (signal.aborted) {
- onAbort();
+ };
+ Transform4.prototype._read = function(n) {
+ var ts = this._transformState;
+ if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
+ ts.transforming = true;
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
- addAbortListener = addAbortListener || require_util10().addAbortListener;
- const disposable = addAbortListener(signal, onAbort);
- eos(stream4, disposable[SymbolDispose]);
+ ts.needTransform = true;
}
- return stream4;
};
+ Transform4.prototype._destroy = function(err, cb) {
+ var _this2 = this;
+ Duplex.prototype._destroy.call(this, err, function(err2) {
+ cb(err2);
+ _this2.emit("close");
+ });
+ };
+ function done(stream4, er, data) {
+ if (er) return stream4.emit("error", er);
+ if (data != null)
+ stream4.push(data);
+ if (stream4._writableState.length) throw new Error("Calling transform done when ws.length != 0");
+ if (stream4._transformState.transforming) throw new Error("Calling transform done when still transforming");
+ return stream4.push(null);
+ }
}
});
-// node_modules/readable-stream/lib/internal/streams/buffer_list.js
-var require_buffer_list = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports2, module2) {
+// node_modules/lazystream/node_modules/readable-stream/lib/_stream_passthrough.js
+var require_stream_passthrough = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/lib/_stream_passthrough.js"(exports2, module2) {
"use strict";
- var { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array: Uint8Array2 } = require_primordials();
- var { Buffer: Buffer3 } = require("buffer");
- var { inspect: inspect2 } = require_util10();
- module2.exports = class BufferList {
- constructor() {
- this.head = null;
- this.tail = null;
- this.length = 0;
- }
- push(v) {
- const entry = {
- data: v,
- next: null
- };
- if (this.length > 0) this.tail.next = entry;
- else this.head = entry;
- this.tail = entry;
- ++this.length;
- }
- unshift(v) {
- const entry = {
- data: v,
- next: this.head
- };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
- }
- shift() {
- if (this.length === 0) return;
- const ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;
- else this.head = this.head.next;
- --this.length;
- return ret;
- }
- clear() {
- this.head = this.tail = null;
- this.length = 0;
- }
- join(s) {
- if (this.length === 0) return "";
- let p = this.head;
- let ret = "" + p.data;
- while ((p = p.next) !== null) ret += s + p.data;
- return ret;
- }
- concat(n) {
- if (this.length === 0) return Buffer3.alloc(0);
- const ret = Buffer3.allocUnsafe(n >>> 0);
- let p = this.head;
- let i = 0;
- while (p) {
- TypedArrayPrototypeSet(ret, p.data, i);
- i += p.data.length;
- p = p.next;
- }
- return ret;
- }
- // Consumes a specified amount of bytes or characters from the buffered data.
- consume(n, hasStrings) {
- const data = this.head.data;
- if (n < data.length) {
- const slice = data.slice(0, n);
- this.head.data = data.slice(n);
- return slice;
- }
- if (n === data.length) {
- return this.shift();
- }
- return hasStrings ? this._getString(n) : this._getBuffer(n);
- }
- first() {
- return this.head.data;
- }
- *[SymbolIterator]() {
- for (let p = this.head; p; p = p.next) {
- yield p.data;
- }
- }
- // Consumes a specified amount of characters from the buffered data.
- _getString(n) {
- let ret = "";
- let p = this.head;
- let c = 0;
- do {
- const str = p.data;
- if (n > str.length) {
- ret += str;
- n -= str.length;
- } else {
- if (n === str.length) {
- ret += str;
- ++c;
- if (p.next) this.head = p.next;
- else this.head = this.tail = null;
- } else {
- ret += StringPrototypeSlice(str, 0, n);
- this.head = p;
- p.data = StringPrototypeSlice(str, n);
- }
- break;
- }
- ++c;
- } while ((p = p.next) !== null);
- this.length -= c;
- return ret;
- }
- // Consumes a specified amount of bytes from the buffered data.
- _getBuffer(n) {
- const ret = Buffer3.allocUnsafe(n);
- const retLen = n;
- let p = this.head;
- let c = 0;
- do {
- const buf = p.data;
- if (n > buf.length) {
- TypedArrayPrototypeSet(ret, buf, retLen - n);
- n -= buf.length;
- } else {
- if (n === buf.length) {
- TypedArrayPrototypeSet(ret, buf, retLen - n);
- ++c;
- if (p.next) this.head = p.next;
- else this.head = this.tail = null;
- } else {
- TypedArrayPrototypeSet(ret, new Uint8Array2(buf.buffer, buf.byteOffset, n), retLen - n);
- this.head = p;
- p.data = buf.slice(n);
- }
- break;
- }
- ++c;
- } while ((p = p.next) !== null);
- this.length -= c;
- return ret;
- }
- // Make sure the linked list only shows the minimal necessary information.
- [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")](_2, options) {
- return inspect2(this, {
- ...options,
- // Only inspect one level.
- depth: 0,
- // It should not recurse.
- customInspect: false
- });
- }
+ module2.exports = PassThrough2;
+ var Transform4 = require_stream_transform();
+ var util3 = Object.create(require_util9());
+ util3.inherits = require_inherits();
+ util3.inherits(PassThrough2, Transform4);
+ function PassThrough2(options) {
+ if (!(this instanceof PassThrough2)) return new PassThrough2(options);
+ Transform4.call(this, options);
+ }
+ PassThrough2.prototype._transform = function(chunk, encoding, cb) {
+ cb(null, chunk);
};
}
});
-// node_modules/readable-stream/lib/internal/streams/state.js
-var require_state = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/state.js"(exports2, module2) {
- "use strict";
- var { MathFloor, NumberIsInteger } = require_primordials();
- var { validateInteger } = require_validators();
- var { ERR_INVALID_ARG_VALUE } = require_errors2().codes;
- var defaultHighWaterMarkBytes = 16 * 1024;
- var defaultHighWaterMarkObjectMode = 16;
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
+// node_modules/lazystream/node_modules/readable-stream/readable.js
+var require_readable2 = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/readable.js"(exports2, module2) {
+ var Stream2 = require("stream");
+ if (process.env.READABLE_STREAM === "disable" && Stream2) {
+ module2.exports = Stream2;
+ exports2 = module2.exports = Stream2.Readable;
+ exports2.Readable = Stream2.Readable;
+ exports2.Writable = Stream2.Writable;
+ exports2.Duplex = Stream2.Duplex;
+ exports2.Transform = Stream2.Transform;
+ exports2.PassThrough = Stream2.PassThrough;
+ exports2.Stream = Stream2;
+ } else {
+ exports2 = module2.exports = require_stream_readable();
+ exports2.Stream = Stream2 || exports2;
+ exports2.Readable = exports2;
+ exports2.Writable = require_stream_writable();
+ exports2.Duplex = require_stream_duplex();
+ exports2.Transform = require_stream_transform();
+ exports2.PassThrough = require_stream_passthrough();
+ }
+ }
+});
+
+// node_modules/lazystream/node_modules/readable-stream/passthrough.js
+var require_passthrough = __commonJS({
+ "node_modules/lazystream/node_modules/readable-stream/passthrough.js"(exports2, module2) {
+ module2.exports = require_readable2().PassThrough;
+ }
+});
+
+// node_modules/lazystream/lib/lazystream.js
+var require_lazystream = __commonJS({
+ "node_modules/lazystream/lib/lazystream.js"(exports2, module2) {
+ var util3 = require("util");
+ var PassThrough2 = require_passthrough();
+ module2.exports = {
+ Readable: Readable7,
+ Writable
+ };
+ util3.inherits(Readable7, PassThrough2);
+ util3.inherits(Writable, PassThrough2);
+ function beforeFirstCall(instance, method, callback) {
+ instance[method] = function() {
+ delete instance[method];
+ callback.apply(this, arguments);
+ return this[method].apply(this, arguments);
+ };
}
- function getDefaultHighWaterMark(objectMode) {
- return objectMode ? defaultHighWaterMarkObjectMode : defaultHighWaterMarkBytes;
+ function Readable7(fn, options) {
+ if (!(this instanceof Readable7))
+ return new Readable7(fn, options);
+ PassThrough2.call(this, options);
+ beforeFirstCall(this, "_read", function() {
+ var source = fn.call(this, options);
+ var emit = this.emit.bind(this, "error");
+ source.on("error", emit);
+ source.pipe(this);
+ });
+ this.emit("readable");
}
- function setDefaultHighWaterMark(objectMode, value) {
- validateInteger(value, "value", 0);
- if (objectMode) {
- defaultHighWaterMarkObjectMode = value;
- } else {
- defaultHighWaterMarkBytes = value;
- }
+ function Writable(fn, options) {
+ if (!(this instanceof Writable))
+ return new Writable(fn, options);
+ PassThrough2.call(this, options);
+ beforeFirstCall(this, "_write", function() {
+ var destination = fn.call(this, options);
+ var emit = this.emit.bind(this, "error");
+ destination.on("error", emit);
+ this.pipe(destination);
+ });
+ this.emit("writable");
}
- function getHighWaterMark(state3, options, duplexKey, isDuplex) {
- const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
- if (hwm != null) {
- if (!NumberIsInteger(hwm) || hwm < 0) {
- const name = isDuplex ? `options.${duplexKey}` : "options.highWaterMark";
- throw new ERR_INVALID_ARG_VALUE(name, hwm);
+ }
+});
+
+// node_modules/normalize-path/index.js
+var require_normalize_path = __commonJS({
+ "node_modules/normalize-path/index.js"(exports2, module2) {
+ module2.exports = function(path6, stripTrailing) {
+ if (typeof path6 !== "string") {
+ throw new TypeError("expected path to be a string");
+ }
+ if (path6 === "\\" || path6 === "/") return "/";
+ var len = path6.length;
+ if (len <= 1) return path6;
+ var prefix2 = "";
+ if (len > 4 && path6[3] === "\\") {
+ var ch = path6[2];
+ if ((ch === "?" || ch === ".") && path6.slice(0, 2) === "\\\\") {
+ path6 = path6.slice(2);
+ prefix2 = "//";
}
- return MathFloor(hwm);
}
- return getDefaultHighWaterMark(state3.objectMode);
- }
- module2.exports = {
- getHighWaterMark,
- getDefaultHighWaterMark,
- setDefaultHighWaterMark
+ var segs = path6.split(/[/\\]+/);
+ if (stripTrailing !== false && segs[segs.length - 1] === "") {
+ segs.pop();
+ }
+ return prefix2 + segs.join("/");
};
}
});
-// node_modules/safe-buffer/index.js
-var require_safe_buffer2 = __commonJS({
- "node_modules/safe-buffer/index.js"(exports2, module2) {
- var buffer2 = require("buffer");
- var Buffer3 = buffer2.Buffer;
- function copyProps(src, dst) {
- for (var key in src) {
- dst[key] = src[key];
+// node_modules/lodash/identity.js
+var require_identity = __commonJS({
+ "node_modules/lodash/identity.js"(exports2, module2) {
+ function identity(value) {
+ return value;
+ }
+ module2.exports = identity;
+ }
+});
+
+// node_modules/lodash/_apply.js
+var require_apply = __commonJS({
+ "node_modules/lodash/_apply.js"(exports2, module2) {
+ function apply(func, thisArg, args) {
+ switch (args.length) {
+ case 0:
+ return func.call(thisArg);
+ case 1:
+ return func.call(thisArg, args[0]);
+ case 2:
+ return func.call(thisArg, args[0], args[1]);
+ case 3:
+ return func.call(thisArg, args[0], args[1], args[2]);
}
+ return func.apply(thisArg, args);
}
- if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
- module2.exports = buffer2;
- } else {
- copyProps(buffer2, exports2);
- exports2.Buffer = SafeBuffer;
+ module2.exports = apply;
+ }
+});
+
+// node_modules/lodash/_overRest.js
+var require_overRest = __commonJS({
+ "node_modules/lodash/_overRest.js"(exports2, module2) {
+ var apply = require_apply();
+ var nativeMax = Math.max;
+ function overRest(func, start, transform) {
+ start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
+ return function() {
+ var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
+ while (++index < length) {
+ array[index] = args[start + index];
+ }
+ index = -1;
+ var otherArgs = Array(start + 1);
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = transform(array);
+ return apply(func, this, otherArgs);
+ };
}
- function SafeBuffer(arg, encodingOrOffset, length) {
- return Buffer3(arg, encodingOrOffset, length);
+ module2.exports = overRest;
+ }
+});
+
+// node_modules/lodash/constant.js
+var require_constant = __commonJS({
+ "node_modules/lodash/constant.js"(exports2, module2) {
+ function constant(value) {
+ return function() {
+ return value;
+ };
}
- SafeBuffer.prototype = Object.create(Buffer3.prototype);
- copyProps(Buffer3, SafeBuffer);
- SafeBuffer.from = function(arg, encodingOrOffset, length) {
- if (typeof arg === "number") {
- throw new TypeError("Argument must not be a number");
- }
- return Buffer3(arg, encodingOrOffset, length);
- };
- SafeBuffer.alloc = function(size, fill, encoding) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- var buf = Buffer3(size);
- if (fill !== void 0) {
- if (typeof encoding === "string") {
- buf.fill(fill, encoding);
- } else {
- buf.fill(fill);
- }
- } else {
- buf.fill(0);
- }
- return buf;
- };
- SafeBuffer.allocUnsafe = function(size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- return Buffer3(size);
- };
- SafeBuffer.allocUnsafeSlow = function(size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- return buffer2.SlowBuffer(size);
- };
+ module2.exports = constant;
}
});
-// node_modules/string_decoder/lib/string_decoder.js
-var require_string_decoder2 = __commonJS({
- "node_modules/string_decoder/lib/string_decoder.js"(exports2) {
- "use strict";
- var Buffer3 = require_safe_buffer2().Buffer;
- var isEncoding = Buffer3.isEncoding || function(encoding) {
- encoding = "" + encoding;
- switch (encoding && encoding.toLowerCase()) {
- case "hex":
- case "utf8":
- case "utf-8":
- case "ascii":
- case "binary":
- case "base64":
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- case "raw":
- return true;
- default:
- return false;
+// node_modules/lodash/_freeGlobal.js
+var require_freeGlobal = __commonJS({
+ "node_modules/lodash/_freeGlobal.js"(exports2, module2) {
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
+ module2.exports = freeGlobal;
+ }
+});
+
+// node_modules/lodash/_root.js
+var require_root = __commonJS({
+ "node_modules/lodash/_root.js"(exports2, module2) {
+ var freeGlobal = require_freeGlobal();
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
+ var root = freeGlobal || freeSelf || Function("return this")();
+ module2.exports = root;
+ }
+});
+
+// node_modules/lodash/_Symbol.js
+var require_Symbol = __commonJS({
+ "node_modules/lodash/_Symbol.js"(exports2, module2) {
+ var root = require_root();
+ var Symbol2 = root.Symbol;
+ module2.exports = Symbol2;
+ }
+});
+
+// node_modules/lodash/_getRawTag.js
+var require_getRawTag = __commonJS({
+ "node_modules/lodash/_getRawTag.js"(exports2, module2) {
+ var Symbol2 = require_Symbol();
+ var objectProto = Object.prototype;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ var nativeObjectToString = objectProto.toString;
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
+ function getRawTag(value) {
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
+ try {
+ value[symToStringTag] = void 0;
+ var unmasked = true;
+ } catch (e) {
}
- };
- function _normalizeEncoding(enc) {
- if (!enc) return "utf8";
- var retried;
- while (true) {
- switch (enc) {
- case "utf8":
- case "utf-8":
- return "utf8";
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return "utf16le";
- case "latin1":
- case "binary":
- return "latin1";
- case "base64":
- case "ascii":
- case "hex":
- return enc;
- default:
- if (retried) return;
- enc = ("" + enc).toLowerCase();
- retried = true;
+ var result = nativeObjectToString.call(value);
+ if (unmasked) {
+ if (isOwn) {
+ value[symToStringTag] = tag;
+ } else {
+ delete value[symToStringTag];
}
}
+ return result;
}
- function normalizeEncoding(enc) {
- var nenc = _normalizeEncoding(enc);
- if (typeof nenc !== "string" && (Buffer3.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
- return nenc || enc;
+ module2.exports = getRawTag;
+ }
+});
+
+// node_modules/lodash/_objectToString.js
+var require_objectToString = __commonJS({
+ "node_modules/lodash/_objectToString.js"(exports2, module2) {
+ var objectProto = Object.prototype;
+ var nativeObjectToString = objectProto.toString;
+ function objectToString(value) {
+ return nativeObjectToString.call(value);
}
- exports2.StringDecoder = StringDecoder2;
- function StringDecoder2(encoding) {
- this.encoding = normalizeEncoding(encoding);
- var nb;
- switch (this.encoding) {
- case "utf16le":
- this.text = utf16Text;
- this.end = utf16End;
- nb = 4;
- break;
- case "utf8":
- this.fillLast = utf8FillLast;
- nb = 4;
- break;
- case "base64":
- this.text = base64Text;
- this.end = base64End;
- nb = 3;
- break;
- default:
- this.write = simpleWrite;
- this.end = simpleEnd;
- return;
+ module2.exports = objectToString;
+ }
+});
+
+// node_modules/lodash/_baseGetTag.js
+var require_baseGetTag = __commonJS({
+ "node_modules/lodash/_baseGetTag.js"(exports2, module2) {
+ var Symbol2 = require_Symbol();
+ var getRawTag = require_getRawTag();
+ var objectToString = require_objectToString();
+ var nullTag = "[object Null]";
+ var undefinedTag = "[object Undefined]";
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
+ function baseGetTag(value) {
+ if (value == null) {
+ return value === void 0 ? undefinedTag : nullTag;
}
- this.lastNeed = 0;
- this.lastTotal = 0;
- this.lastChar = Buffer3.allocUnsafe(nb);
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
- StringDecoder2.prototype.write = function(buf) {
- if (buf.length === 0) return "";
- var r;
- var i;
- if (this.lastNeed) {
- r = this.fillLast(buf);
- if (r === void 0) return "";
- i = this.lastNeed;
- this.lastNeed = 0;
- } else {
- i = 0;
- }
- if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
- return r || "";
- };
- StringDecoder2.prototype.end = utf8End;
- StringDecoder2.prototype.text = utf8Text;
- StringDecoder2.prototype.fillLast = function(buf) {
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
- this.lastNeed -= buf.length;
- };
- function utf8CheckByte(byte) {
- if (byte <= 127) return 0;
- else if (byte >> 5 === 6) return 2;
- else if (byte >> 4 === 14) return 3;
- else if (byte >> 3 === 30) return 4;
- return byte >> 6 === 2 ? -1 : -2;
+ module2.exports = baseGetTag;
+ }
+});
+
+// node_modules/lodash/isObject.js
+var require_isObject = __commonJS({
+ "node_modules/lodash/isObject.js"(exports2, module2) {
+ function isObject2(value) {
+ var type = typeof value;
+ return value != null && (type == "object" || type == "function");
}
- function utf8CheckIncomplete(self2, buf, i) {
- var j = buf.length - 1;
- if (j < i) return 0;
- var nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self2.lastNeed = nb - 1;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self2.lastNeed = nb - 2;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) {
- if (nb === 2) nb = 0;
- else self2.lastNeed = nb - 3;
- }
- return nb;
+ module2.exports = isObject2;
+ }
+});
+
+// node_modules/lodash/isFunction.js
+var require_isFunction = __commonJS({
+ "node_modules/lodash/isFunction.js"(exports2, module2) {
+ var baseGetTag = require_baseGetTag();
+ var isObject2 = require_isObject();
+ var asyncTag = "[object AsyncFunction]";
+ var funcTag = "[object Function]";
+ var genTag = "[object GeneratorFunction]";
+ var proxyTag = "[object Proxy]";
+ function isFunction(value) {
+ if (!isObject2(value)) {
+ return false;
}
- return 0;
+ var tag = baseGetTag(value);
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
- function utf8CheckExtraBytes(self2, buf, p) {
- if ((buf[0] & 192) !== 128) {
- self2.lastNeed = 0;
- return "\uFFFD";
- }
- if (self2.lastNeed > 1 && buf.length > 1) {
- if ((buf[1] & 192) !== 128) {
- self2.lastNeed = 1;
- return "\uFFFD";
+ module2.exports = isFunction;
+ }
+});
+
+// node_modules/lodash/_coreJsData.js
+var require_coreJsData = __commonJS({
+ "node_modules/lodash/_coreJsData.js"(exports2, module2) {
+ var root = require_root();
+ var coreJsData = root["__core-js_shared__"];
+ module2.exports = coreJsData;
+ }
+});
+
+// node_modules/lodash/_isMasked.js
+var require_isMasked = __commonJS({
+ "node_modules/lodash/_isMasked.js"(exports2, module2) {
+ var coreJsData = require_coreJsData();
+ var maskSrcKey = (function() {
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
+ return uid ? "Symbol(src)_1." + uid : "";
+ })();
+ function isMasked(func) {
+ return !!maskSrcKey && maskSrcKey in func;
+ }
+ module2.exports = isMasked;
+ }
+});
+
+// node_modules/lodash/_toSource.js
+var require_toSource = __commonJS({
+ "node_modules/lodash/_toSource.js"(exports2, module2) {
+ var funcProto = Function.prototype;
+ var funcToString = funcProto.toString;
+ function toSource(func) {
+ if (func != null) {
+ try {
+ return funcToString.call(func);
+ } catch (e) {
}
- if (self2.lastNeed > 2 && buf.length > 2) {
- if ((buf[2] & 192) !== 128) {
- self2.lastNeed = 2;
- return "\uFFFD";
- }
+ try {
+ return func + "";
+ } catch (e) {
}
}
+ return "";
}
- function utf8FillLast(buf) {
- var p = this.lastTotal - this.lastNeed;
- var r = utf8CheckExtraBytes(this, buf, p);
- if (r !== void 0) return r;
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, p, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
+ module2.exports = toSource;
+ }
+});
+
+// node_modules/lodash/_baseIsNative.js
+var require_baseIsNative = __commonJS({
+ "node_modules/lodash/_baseIsNative.js"(exports2, module2) {
+ var isFunction = require_isFunction();
+ var isMasked = require_isMasked();
+ var isObject2 = require_isObject();
+ var toSource = require_toSource();
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
+ var funcProto = Function.prototype;
+ var objectProto = Object.prototype;
+ var funcToString = funcProto.toString;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ var reIsNative = RegExp(
+ "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
+ );
+ function baseIsNative(value) {
+ if (!isObject2(value) || isMasked(value)) {
+ return false;
}
- buf.copy(this.lastChar, p, 0, buf.length);
- this.lastNeed -= buf.length;
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
+ return pattern.test(toSource(value));
}
- function utf8Text(buf, i) {
- var total = utf8CheckIncomplete(this, buf, i);
- if (!this.lastNeed) return buf.toString("utf8", i);
- this.lastTotal = total;
- var end = buf.length - (total - this.lastNeed);
- buf.copy(this.lastChar, 0, end);
- return buf.toString("utf8", i, end);
+ module2.exports = baseIsNative;
+ }
+});
+
+// node_modules/lodash/_getValue.js
+var require_getValue = __commonJS({
+ "node_modules/lodash/_getValue.js"(exports2, module2) {
+ function getValue(object, key) {
+ return object == null ? void 0 : object[key];
}
- function utf8End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) return r + "\uFFFD";
- return r;
+ module2.exports = getValue;
+ }
+});
+
+// node_modules/lodash/_getNative.js
+var require_getNative = __commonJS({
+ "node_modules/lodash/_getNative.js"(exports2, module2) {
+ var baseIsNative = require_baseIsNative();
+ var getValue = require_getValue();
+ function getNative(object, key) {
+ var value = getValue(object, key);
+ return baseIsNative(value) ? value : void 0;
}
- function utf16Text(buf, i) {
- if ((buf.length - i) % 2 === 0) {
- var r = buf.toString("utf16le", i);
- if (r) {
- var c = r.charCodeAt(r.length - 1);
- if (c >= 55296 && c <= 56319) {
- this.lastNeed = 2;
- this.lastTotal = 4;
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- return r.slice(0, -1);
+ module2.exports = getNative;
+ }
+});
+
+// node_modules/lodash/_defineProperty.js
+var require_defineProperty = __commonJS({
+ "node_modules/lodash/_defineProperty.js"(exports2, module2) {
+ var getNative = require_getNative();
+ var defineProperty = (function() {
+ try {
+ var func = getNative(Object, "defineProperty");
+ func({}, "", {});
+ return func;
+ } catch (e) {
+ }
+ })();
+ module2.exports = defineProperty;
+ }
+});
+
+// node_modules/lodash/_baseSetToString.js
+var require_baseSetToString = __commonJS({
+ "node_modules/lodash/_baseSetToString.js"(exports2, module2) {
+ var constant = require_constant();
+ var defineProperty = require_defineProperty();
+ var identity = require_identity();
+ var baseSetToString = !defineProperty ? identity : function(func, string) {
+ return defineProperty(func, "toString", {
+ "configurable": true,
+ "enumerable": false,
+ "value": constant(string),
+ "writable": true
+ });
+ };
+ module2.exports = baseSetToString;
+ }
+});
+
+// node_modules/lodash/_shortOut.js
+var require_shortOut = __commonJS({
+ "node_modules/lodash/_shortOut.js"(exports2, module2) {
+ var HOT_COUNT = 800;
+ var HOT_SPAN = 16;
+ var nativeNow = Date.now;
+ function shortOut(func) {
+ var count = 0, lastCalled = 0;
+ return function() {
+ var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
+ lastCalled = stamp;
+ if (remaining > 0) {
+ if (++count >= HOT_COUNT) {
+ return arguments[0];
}
+ } else {
+ count = 0;
}
- return r;
- }
- this.lastNeed = 1;
- this.lastTotal = 2;
- this.lastChar[0] = buf[buf.length - 1];
- return buf.toString("utf16le", i, buf.length - 1);
+ return func.apply(void 0, arguments);
+ };
}
- function utf16End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) {
- var end = this.lastTotal - this.lastNeed;
- return r + this.lastChar.toString("utf16le", 0, end);
+ module2.exports = shortOut;
+ }
+});
+
+// node_modules/lodash/_setToString.js
+var require_setToString = __commonJS({
+ "node_modules/lodash/_setToString.js"(exports2, module2) {
+ var baseSetToString = require_baseSetToString();
+ var shortOut = require_shortOut();
+ var setToString = shortOut(baseSetToString);
+ module2.exports = setToString;
+ }
+});
+
+// node_modules/lodash/_baseRest.js
+var require_baseRest = __commonJS({
+ "node_modules/lodash/_baseRest.js"(exports2, module2) {
+ var identity = require_identity();
+ var overRest = require_overRest();
+ var setToString = require_setToString();
+ function baseRest(func, start) {
+ return setToString(overRest(func, start, identity), func + "");
+ }
+ module2.exports = baseRest;
+ }
+});
+
+// node_modules/lodash/eq.js
+var require_eq = __commonJS({
+ "node_modules/lodash/eq.js"(exports2, module2) {
+ function eq(value, other) {
+ return value === other || value !== value && other !== other;
+ }
+ module2.exports = eq;
+ }
+});
+
+// node_modules/lodash/isLength.js
+var require_isLength = __commonJS({
+ "node_modules/lodash/isLength.js"(exports2, module2) {
+ var MAX_SAFE_INTEGER = 9007199254740991;
+ function isLength(value) {
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+ }
+ module2.exports = isLength;
+ }
+});
+
+// node_modules/lodash/isArrayLike.js
+var require_isArrayLike = __commonJS({
+ "node_modules/lodash/isArrayLike.js"(exports2, module2) {
+ var isFunction = require_isFunction();
+ var isLength = require_isLength();
+ function isArrayLike(value) {
+ return value != null && isLength(value.length) && !isFunction(value);
+ }
+ module2.exports = isArrayLike;
+ }
+});
+
+// node_modules/lodash/_isIndex.js
+var require_isIndex = __commonJS({
+ "node_modules/lodash/_isIndex.js"(exports2, module2) {
+ var MAX_SAFE_INTEGER = 9007199254740991;
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
+ function isIndex(value, length) {
+ var type = typeof value;
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
+ }
+ module2.exports = isIndex;
+ }
+});
+
+// node_modules/lodash/_isIterateeCall.js
+var require_isIterateeCall = __commonJS({
+ "node_modules/lodash/_isIterateeCall.js"(exports2, module2) {
+ var eq = require_eq();
+ var isArrayLike = require_isArrayLike();
+ var isIndex = require_isIndex();
+ var isObject2 = require_isObject();
+ function isIterateeCall(value, index, object) {
+ if (!isObject2(object)) {
+ return false;
}
- return r;
+ var type = typeof index;
+ if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
+ return eq(object[index], value);
+ }
+ return false;
}
- function base64Text(buf, i) {
- var n = (buf.length - i) % 3;
- if (n === 0) return buf.toString("base64", i);
- this.lastNeed = 3 - n;
- this.lastTotal = 3;
- if (n === 1) {
- this.lastChar[0] = buf[buf.length - 1];
- } else {
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
+ module2.exports = isIterateeCall;
+ }
+});
+
+// node_modules/lodash/_baseTimes.js
+var require_baseTimes = __commonJS({
+ "node_modules/lodash/_baseTimes.js"(exports2, module2) {
+ function baseTimes(n, iteratee) {
+ var index = -1, result = Array(n);
+ while (++index < n) {
+ result[index] = iteratee(index);
}
- return buf.toString("base64", i, buf.length - n);
+ return result;
}
- function base64End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
- return r;
+ module2.exports = baseTimes;
+ }
+});
+
+// node_modules/lodash/isObjectLike.js
+var require_isObjectLike = __commonJS({
+ "node_modules/lodash/isObjectLike.js"(exports2, module2) {
+ function isObjectLike(value) {
+ return value != null && typeof value == "object";
}
- function simpleWrite(buf) {
- return buf.toString(this.encoding);
+ module2.exports = isObjectLike;
+ }
+});
+
+// node_modules/lodash/_baseIsArguments.js
+var require_baseIsArguments = __commonJS({
+ "node_modules/lodash/_baseIsArguments.js"(exports2, module2) {
+ var baseGetTag = require_baseGetTag();
+ var isObjectLike = require_isObjectLike();
+ var argsTag = "[object Arguments]";
+ function baseIsArguments(value) {
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
}
- function simpleEnd(buf) {
- return buf && buf.length ? this.write(buf) : "";
+ module2.exports = baseIsArguments;
+ }
+});
+
+// node_modules/lodash/isArguments.js
+var require_isArguments = __commonJS({
+ "node_modules/lodash/isArguments.js"(exports2, module2) {
+ var baseIsArguments = require_baseIsArguments();
+ var isObjectLike = require_isObjectLike();
+ var objectProto = Object.prototype;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
+ var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
+ return arguments;
+ })()) ? baseIsArguments : function(value) {
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
+ };
+ module2.exports = isArguments;
+ }
+});
+
+// node_modules/lodash/isArray.js
+var require_isArray = __commonJS({
+ "node_modules/lodash/isArray.js"(exports2, module2) {
+ var isArray = Array.isArray;
+ module2.exports = isArray;
+ }
+});
+
+// node_modules/lodash/stubFalse.js
+var require_stubFalse = __commonJS({
+ "node_modules/lodash/stubFalse.js"(exports2, module2) {
+ function stubFalse() {
+ return false;
}
+ module2.exports = stubFalse;
}
});
-// node_modules/readable-stream/lib/internal/streams/from.js
-var require_from = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
- "use strict";
- var process5 = require_process();
- var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
- var { Buffer: Buffer3 } = require("buffer");
- var { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require_errors2().codes;
- function from(Readable7, iterable, opts) {
- let iterator2;
- if (typeof iterable === "string" || iterable instanceof Buffer3) {
- return new Readable7({
- objectMode: true,
- ...opts,
- read() {
- this.push(iterable);
- this.push(null);
- }
- });
- }
- let isAsync;
- if (iterable && iterable[SymbolAsyncIterator]) {
- isAsync = true;
- iterator2 = iterable[SymbolAsyncIterator]();
- } else if (iterable && iterable[SymbolIterator]) {
- isAsync = false;
- iterator2 = iterable[SymbolIterator]();
- } else {
- throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
- }
- const readable = new Readable7({
- objectMode: true,
- highWaterMark: 1,
- // TODO(ronag): What options should be allowed?
- ...opts
- });
- let reading = false;
- readable._read = function() {
- if (!reading) {
- reading = true;
- next();
- }
- };
- readable._destroy = function(error2, cb) {
- PromisePrototypeThen(
- close(error2),
- () => process5.nextTick(cb, error2),
- // nextTick is here in case cb throws
- (e) => process5.nextTick(cb, e || error2)
- );
+// node_modules/lodash/isBuffer.js
+var require_isBuffer = __commonJS({
+ "node_modules/lodash/isBuffer.js"(exports2, module2) {
+ var root = require_root();
+ var stubFalse = require_stubFalse();
+ var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
+ var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
+ var moduleExports = freeModule && freeModule.exports === freeExports;
+ var Buffer3 = moduleExports ? root.Buffer : void 0;
+ var nativeIsBuffer = Buffer3 ? Buffer3.isBuffer : void 0;
+ var isBuffer = nativeIsBuffer || stubFalse;
+ module2.exports = isBuffer;
+ }
+});
+
+// node_modules/lodash/_baseIsTypedArray.js
+var require_baseIsTypedArray = __commonJS({
+ "node_modules/lodash/_baseIsTypedArray.js"(exports2, module2) {
+ var baseGetTag = require_baseGetTag();
+ var isLength = require_isLength();
+ var isObjectLike = require_isObjectLike();
+ var argsTag = "[object Arguments]";
+ var arrayTag = "[object Array]";
+ var boolTag = "[object Boolean]";
+ var dateTag = "[object Date]";
+ var errorTag = "[object Error]";
+ var funcTag = "[object Function]";
+ var mapTag = "[object Map]";
+ var numberTag = "[object Number]";
+ var objectTag = "[object Object]";
+ var regexpTag = "[object RegExp]";
+ var setTag = "[object Set]";
+ var stringTag = "[object String]";
+ var weakMapTag = "[object WeakMap]";
+ var arrayBufferTag = "[object ArrayBuffer]";
+ var dataViewTag = "[object DataView]";
+ var float32Tag = "[object Float32Array]";
+ var float64Tag = "[object Float64Array]";
+ var int8Tag = "[object Int8Array]";
+ var int16Tag = "[object Int16Array]";
+ var int32Tag = "[object Int32Array]";
+ var uint8Tag = "[object Uint8Array]";
+ var uint8ClampedTag = "[object Uint8ClampedArray]";
+ var uint16Tag = "[object Uint16Array]";
+ var uint32Tag = "[object Uint32Array]";
+ var typedArrayTags = {};
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
+ function baseIsTypedArray(value) {
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
+ }
+ module2.exports = baseIsTypedArray;
+ }
+});
+
+// node_modules/lodash/_baseUnary.js
+var require_baseUnary = __commonJS({
+ "node_modules/lodash/_baseUnary.js"(exports2, module2) {
+ function baseUnary(func) {
+ return function(value) {
+ return func(value);
};
- async function close(error2) {
- const hadError = error2 !== void 0 && error2 !== null;
- const hasThrow = typeof iterator2.throw === "function";
- if (hadError && hasThrow) {
- const { value, done } = await iterator2.throw(error2);
- await value;
- if (done) {
- return;
- }
- }
- if (typeof iterator2.return === "function") {
- const { value } = await iterator2.return();
- await value;
+ }
+ module2.exports = baseUnary;
+ }
+});
+
+// node_modules/lodash/_nodeUtil.js
+var require_nodeUtil = __commonJS({
+ "node_modules/lodash/_nodeUtil.js"(exports2, module2) {
+ var freeGlobal = require_freeGlobal();
+ var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
+ var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
+ var moduleExports = freeModule && freeModule.exports === freeExports;
+ var freeProcess = moduleExports && freeGlobal.process;
+ var nodeUtil = (function() {
+ try {
+ var types = freeModule && freeModule.require && freeModule.require("util").types;
+ if (types) {
+ return types;
}
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
+ } catch (e) {
}
- async function next() {
- for (; ; ) {
- try {
- const { value, done } = isAsync ? await iterator2.next() : iterator2.next();
- if (done) {
- readable.push(null);
- } else {
- const res = value && typeof value.then === "function" ? await value : value;
- if (res === null) {
- reading = false;
- throw new ERR_STREAM_NULL_VALUES();
- } else if (readable.push(res)) {
- continue;
- } else {
- reading = false;
- }
- }
- } catch (err) {
- readable.destroy(err);
- }
- break;
+ })();
+ module2.exports = nodeUtil;
+ }
+});
+
+// node_modules/lodash/isTypedArray.js
+var require_isTypedArray = __commonJS({
+ "node_modules/lodash/isTypedArray.js"(exports2, module2) {
+ var baseIsTypedArray = require_baseIsTypedArray();
+ var baseUnary = require_baseUnary();
+ var nodeUtil = require_nodeUtil();
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
+ module2.exports = isTypedArray;
+ }
+});
+
+// node_modules/lodash/_arrayLikeKeys.js
+var require_arrayLikeKeys = __commonJS({
+ "node_modules/lodash/_arrayLikeKeys.js"(exports2, module2) {
+ var baseTimes = require_baseTimes();
+ var isArguments = require_isArguments();
+ var isArray = require_isArray();
+ var isBuffer = require_isBuffer();
+ var isIndex = require_isIndex();
+ var isTypedArray = require_isTypedArray();
+ var objectProto = Object.prototype;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ function arrayLikeKeys(value, inherited) {
+ var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
+ for (var key in value) {
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
+ isIndex(key, length)))) {
+ result.push(key);
}
}
- return readable;
+ return result;
}
- module2.exports = from;
+ module2.exports = arrayLikeKeys;
}
});
-// node_modules/readable-stream/lib/internal/streams/readable.js
-var require_readable3 = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/readable.js"(exports2, module2) {
- "use strict";
- var process5 = require_process();
- var {
- ArrayPrototypeIndexOf,
- NumberIsInteger,
- NumberIsNaN,
- NumberParseInt,
- ObjectDefineProperties,
- ObjectKeys,
- ObjectSetPrototypeOf,
- Promise: Promise2,
- SafeSet,
- SymbolAsyncDispose,
- SymbolAsyncIterator,
- Symbol: Symbol2
- } = require_primordials();
- module2.exports = Readable7;
- Readable7.ReadableState = ReadableState;
- var { EventEmitter: EE } = require("events");
- var { Stream: Stream2, prependListener } = require_legacy();
- var { Buffer: Buffer3 } = require("buffer");
- var { addAbortSignal } = require_add_abort_signal();
- var eos = require_end_of_stream();
- var debug2 = require_util10().debuglog("stream", (fn) => {
- debug2 = fn;
- });
- var BufferList = require_buffer_list();
- var destroyImpl = require_destroy2();
- var { getHighWaterMark, getDefaultHighWaterMark } = require_state();
- var {
- aggregateTwoErrors,
- codes: {
- ERR_INVALID_ARG_TYPE,
- ERR_METHOD_NOT_IMPLEMENTED,
- ERR_OUT_OF_RANGE,
- ERR_STREAM_PUSH_AFTER_EOF,
- ERR_STREAM_UNSHIFT_AFTER_END_EVENT
- },
- AbortError: AbortError3
- } = require_errors2();
- var { validateObject } = require_validators();
- var kPaused = Symbol2("kPaused");
- var { StringDecoder: StringDecoder2 } = require_string_decoder2();
- var from = require_from();
- ObjectSetPrototypeOf(Readable7.prototype, Stream2.prototype);
- ObjectSetPrototypeOf(Readable7, Stream2);
- var nop = () => {
- };
- var { errorOrDestroy } = destroyImpl;
- var kObjectMode = 1 << 0;
- var kEnded = 1 << 1;
- var kEndEmitted = 1 << 2;
- var kReading = 1 << 3;
- var kConstructed = 1 << 4;
- var kSync = 1 << 5;
- var kNeedReadable = 1 << 6;
- var kEmittedReadable = 1 << 7;
- var kReadableListening = 1 << 8;
- var kResumeScheduled = 1 << 9;
- var kErrorEmitted = 1 << 10;
- var kEmitClose = 1 << 11;
- var kAutoDestroy = 1 << 12;
- var kDestroyed = 1 << 13;
- var kClosed = 1 << 14;
- var kCloseEmitted = 1 << 15;
- var kMultiAwaitDrain = 1 << 16;
- var kReadingMore = 1 << 17;
- var kDataEmitted = 1 << 18;
- function makeBitMapDescriptor(bit) {
- return {
- enumerable: false,
- get() {
- return (this.state & bit) !== 0;
- },
- set(value) {
- if (value) this.state |= bit;
- else this.state &= ~bit;
+// node_modules/lodash/_isPrototype.js
+var require_isPrototype = __commonJS({
+ "node_modules/lodash/_isPrototype.js"(exports2, module2) {
+ var objectProto = Object.prototype;
+ function isPrototype(value) {
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
+ return value === proto;
+ }
+ module2.exports = isPrototype;
+ }
+});
+
+// node_modules/lodash/_nativeKeysIn.js
+var require_nativeKeysIn = __commonJS({
+ "node_modules/lodash/_nativeKeysIn.js"(exports2, module2) {
+ function nativeKeysIn(object) {
+ var result = [];
+ if (object != null) {
+ for (var key in Object(object)) {
+ result.push(key);
}
- };
+ }
+ return result;
}
- ObjectDefineProperties(ReadableState.prototype, {
- objectMode: makeBitMapDescriptor(kObjectMode),
- ended: makeBitMapDescriptor(kEnded),
- endEmitted: makeBitMapDescriptor(kEndEmitted),
- reading: makeBitMapDescriptor(kReading),
- // Stream is still being constructed and cannot be
- // destroyed until construction finished or failed.
- // Async construction is opt in, therefore we start as
- // constructed.
- constructed: makeBitMapDescriptor(kConstructed),
- // A flag to be able to tell if the event 'readable'/'data' is emitted
- // immediately, or on a later tick. We set this to true at first, because
- // any actions that shouldn't happen until "later" should generally also
- // not happen before the first read call.
- sync: makeBitMapDescriptor(kSync),
- // Whenever we return null, then we set a flag to say
- // that we're awaiting a 'readable' event emission.
- needReadable: makeBitMapDescriptor(kNeedReadable),
- emittedReadable: makeBitMapDescriptor(kEmittedReadable),
- readableListening: makeBitMapDescriptor(kReadableListening),
- resumeScheduled: makeBitMapDescriptor(kResumeScheduled),
- // True if the error was already emitted and should not be thrown again.
- errorEmitted: makeBitMapDescriptor(kErrorEmitted),
- emitClose: makeBitMapDescriptor(kEmitClose),
- autoDestroy: makeBitMapDescriptor(kAutoDestroy),
- // Has it been destroyed.
- destroyed: makeBitMapDescriptor(kDestroyed),
- // Indicates whether the stream has finished destroying.
- closed: makeBitMapDescriptor(kClosed),
- // True if close has been emitted or would have been emitted
- // depending on emitClose.
- closeEmitted: makeBitMapDescriptor(kCloseEmitted),
- multiAwaitDrain: makeBitMapDescriptor(kMultiAwaitDrain),
- // If true, a maybeReadMore has been scheduled.
- readingMore: makeBitMapDescriptor(kReadingMore),
- dataEmitted: makeBitMapDescriptor(kDataEmitted)
- });
- function ReadableState(options, stream4, isDuplex) {
- if (typeof isDuplex !== "boolean") isDuplex = stream4 instanceof require_duplex();
- this.state = kEmitClose | kAutoDestroy | kConstructed | kSync;
- if (options && options.objectMode) this.state |= kObjectMode;
- if (isDuplex && options && options.readableObjectMode) this.state |= kObjectMode;
- this.highWaterMark = options ? getHighWaterMark(this, options, "readableHighWaterMark", isDuplex) : getDefaultHighWaterMark(false);
- this.buffer = new BufferList();
- this.length = 0;
- this.pipes = [];
- this.flowing = null;
- this[kPaused] = null;
- if (options && options.emitClose === false) this.state &= ~kEmitClose;
- if (options && options.autoDestroy === false) this.state &= ~kAutoDestroy;
- this.errored = null;
- this.defaultEncoding = options && options.defaultEncoding || "utf8";
- this.awaitDrainWriters = null;
- this.decoder = null;
- this.encoding = null;
- if (options && options.encoding) {
- this.decoder = new StringDecoder2(options.encoding);
- this.encoding = options.encoding;
+ module2.exports = nativeKeysIn;
+ }
+});
+
+// node_modules/lodash/_baseKeysIn.js
+var require_baseKeysIn = __commonJS({
+ "node_modules/lodash/_baseKeysIn.js"(exports2, module2) {
+ var isObject2 = require_isObject();
+ var isPrototype = require_isPrototype();
+ var nativeKeysIn = require_nativeKeysIn();
+ var objectProto = Object.prototype;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ function baseKeysIn(object) {
+ if (!isObject2(object)) {
+ return nativeKeysIn(object);
+ }
+ var isProto = isPrototype(object), result = [];
+ for (var key in object) {
+ if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
+ result.push(key);
+ }
}
+ return result;
}
- function Readable7(options) {
- if (!(this instanceof Readable7)) return new Readable7(options);
- const isDuplex = this instanceof require_duplex();
- this._readableState = new ReadableState(options, this, isDuplex);
- if (options) {
- if (typeof options.read === "function") this._read = options.read;
- if (typeof options.destroy === "function") this._destroy = options.destroy;
- if (typeof options.construct === "function") this._construct = options.construct;
- if (options.signal && !isDuplex) addAbortSignal(options.signal, this);
+ module2.exports = baseKeysIn;
+ }
+});
+
+// node_modules/lodash/keysIn.js
+var require_keysIn = __commonJS({
+ "node_modules/lodash/keysIn.js"(exports2, module2) {
+ var arrayLikeKeys = require_arrayLikeKeys();
+ var baseKeysIn = require_baseKeysIn();
+ var isArrayLike = require_isArrayLike();
+ function keysIn(object) {
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
+ }
+ module2.exports = keysIn;
+ }
+});
+
+// node_modules/lodash/defaults.js
+var require_defaults = __commonJS({
+ "node_modules/lodash/defaults.js"(exports2, module2) {
+ var baseRest = require_baseRest();
+ var eq = require_eq();
+ var isIterateeCall = require_isIterateeCall();
+ var keysIn = require_keysIn();
+ var objectProto = Object.prototype;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ var defaults2 = baseRest(function(object, sources) {
+ object = Object(object);
+ var index = -1;
+ var length = sources.length;
+ var guard = length > 2 ? sources[2] : void 0;
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+ length = 1;
+ }
+ while (++index < length) {
+ var source = sources[index];
+ var props = keysIn(source);
+ var propsIndex = -1;
+ var propsLength = props.length;
+ while (++propsIndex < propsLength) {
+ var key = props[propsIndex];
+ var value = object[key];
+ if (value === void 0 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) {
+ object[key] = source[key];
+ }
+ }
}
- Stream2.call(this, options);
- destroyImpl.construct(this, () => {
- if (this._readableState.needReadable) {
- maybeReadMore(this, this._readableState);
+ return object;
+ });
+ module2.exports = defaults2;
+ }
+});
+
+// node_modules/readable-stream/lib/ours/primordials.js
+var require_primordials = __commonJS({
+ "node_modules/readable-stream/lib/ours/primordials.js"(exports2, module2) {
+ "use strict";
+ var AggregateError = class extends Error {
+ constructor(errors) {
+ if (!Array.isArray(errors)) {
+ throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
}
- });
- }
- Readable7.prototype.destroy = destroyImpl.destroy;
- Readable7.prototype._undestroy = destroyImpl.undestroy;
- Readable7.prototype._destroy = function(err, cb) {
- cb(err);
- };
- Readable7.prototype[EE.captureRejectionSymbol] = function(err) {
- this.destroy(err);
- };
- Readable7.prototype[SymbolAsyncDispose] = function() {
- let error2;
- if (!this.destroyed) {
- error2 = this.readableEnded ? null : new AbortError3();
- this.destroy(error2);
+ let message = "";
+ for (let i = 0; i < errors.length; i++) {
+ message += ` ${errors[i].stack}
+`;
+ }
+ super(message);
+ this.name = "AggregateError";
+ this.errors = errors;
}
- return new Promise2((resolve7, reject) => eos(this, (err) => err && err !== error2 ? reject(err) : resolve7(null)));
- };
- Readable7.prototype.push = function(chunk, encoding) {
- return readableAddChunk(this, chunk, encoding, false);
};
- Readable7.prototype.unshift = function(chunk, encoding) {
- return readableAddChunk(this, chunk, encoding, true);
+ module2.exports = {
+ AggregateError,
+ ArrayIsArray(self2) {
+ return Array.isArray(self2);
+ },
+ ArrayPrototypeIncludes(self2, el) {
+ return self2.includes(el);
+ },
+ ArrayPrototypeIndexOf(self2, el) {
+ return self2.indexOf(el);
+ },
+ ArrayPrototypeJoin(self2, sep7) {
+ return self2.join(sep7);
+ },
+ ArrayPrototypeMap(self2, fn) {
+ return self2.map(fn);
+ },
+ ArrayPrototypePop(self2, el) {
+ return self2.pop(el);
+ },
+ ArrayPrototypePush(self2, el) {
+ return self2.push(el);
+ },
+ ArrayPrototypeSlice(self2, start, end) {
+ return self2.slice(start, end);
+ },
+ Error,
+ FunctionPrototypeCall(fn, thisArgs, ...args) {
+ return fn.call(thisArgs, ...args);
+ },
+ FunctionPrototypeSymbolHasInstance(self2, instance) {
+ return Function.prototype[Symbol.hasInstance].call(self2, instance);
+ },
+ MathFloor: Math.floor,
+ Number,
+ NumberIsInteger: Number.isInteger,
+ NumberIsNaN: Number.isNaN,
+ NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,
+ NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,
+ NumberParseInt: Number.parseInt,
+ ObjectDefineProperties(self2, props) {
+ return Object.defineProperties(self2, props);
+ },
+ ObjectDefineProperty(self2, name, prop) {
+ return Object.defineProperty(self2, name, prop);
+ },
+ ObjectGetOwnPropertyDescriptor(self2, name) {
+ return Object.getOwnPropertyDescriptor(self2, name);
+ },
+ ObjectKeys(obj) {
+ return Object.keys(obj);
+ },
+ ObjectSetPrototypeOf(target, proto) {
+ return Object.setPrototypeOf(target, proto);
+ },
+ Promise,
+ PromisePrototypeCatch(self2, fn) {
+ return self2.catch(fn);
+ },
+ PromisePrototypeThen(self2, thenFn, catchFn) {
+ return self2.then(thenFn, catchFn);
+ },
+ PromiseReject(err) {
+ return Promise.reject(err);
+ },
+ PromiseResolve(val) {
+ return Promise.resolve(val);
+ },
+ ReflectApply: Reflect.apply,
+ RegExpPrototypeTest(self2, value) {
+ return self2.test(value);
+ },
+ SafeSet: Set,
+ String,
+ StringPrototypeSlice(self2, start, end) {
+ return self2.slice(start, end);
+ },
+ StringPrototypeToLowerCase(self2) {
+ return self2.toLowerCase();
+ },
+ StringPrototypeToUpperCase(self2) {
+ return self2.toUpperCase();
+ },
+ StringPrototypeTrim(self2) {
+ return self2.trim();
+ },
+ Symbol,
+ SymbolFor: Symbol.for,
+ SymbolAsyncIterator: Symbol.asyncIterator,
+ SymbolHasInstance: Symbol.hasInstance,
+ SymbolIterator: Symbol.iterator,
+ SymbolDispose: Symbol.dispose || /* @__PURE__ */ Symbol("Symbol.dispose"),
+ SymbolAsyncDispose: Symbol.asyncDispose || /* @__PURE__ */ Symbol("Symbol.asyncDispose"),
+ TypedArrayPrototypeSet(self2, buf, len) {
+ return self2.set(buf, len);
+ },
+ Boolean,
+ Uint8Array
};
- function readableAddChunk(stream4, chunk, encoding, addToFront) {
- debug2("readableAddChunk", chunk);
- const state3 = stream4._readableState;
- let err;
- if ((state3.state & kObjectMode) === 0) {
- if (typeof chunk === "string") {
- encoding = encoding || state3.defaultEncoding;
- if (state3.encoding !== encoding) {
- if (addToFront && state3.encoding) {
- chunk = Buffer3.from(chunk, encoding).toString(state3.encoding);
- } else {
- chunk = Buffer3.from(chunk, encoding);
- encoding = "";
- }
- }
- } else if (chunk instanceof Buffer3) {
- encoding = "";
- } else if (Stream2._isUint8Array(chunk)) {
- chunk = Stream2._uint8ArrayToBuffer(chunk);
- encoding = "";
- } else if (chunk != null) {
- err = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
- }
- }
- if (err) {
- errorOrDestroy(stream4, err);
- } else if (chunk === null) {
- state3.state &= ~kReading;
- onEofChunk(stream4, state3);
- } else if ((state3.state & kObjectMode) !== 0 || chunk && chunk.length > 0) {
- if (addToFront) {
- if ((state3.state & kEndEmitted) !== 0) errorOrDestroy(stream4, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
- else if (state3.destroyed || state3.errored) return false;
- else addChunk(stream4, state3, chunk, true);
- } else if (state3.ended) {
- errorOrDestroy(stream4, new ERR_STREAM_PUSH_AFTER_EOF());
- } else if (state3.destroyed || state3.errored) {
- return false;
- } else {
- state3.state &= ~kReading;
- if (state3.decoder && !encoding) {
- chunk = state3.decoder.write(chunk);
- if (state3.objectMode || chunk.length !== 0) addChunk(stream4, state3, chunk, false);
- else maybeReadMore(stream4, state3);
+ }
+});
+
+// node_modules/readable-stream/lib/ours/util/inspect.js
+var require_inspect = __commonJS({
+ "node_modules/readable-stream/lib/ours/util/inspect.js"(exports2, module2) {
+ "use strict";
+ module2.exports = {
+ format(format, ...args) {
+ return format.replace(/%([sdifj])/g, function(...[_unused, type]) {
+ const replacement = args.shift();
+ if (type === "f") {
+ return replacement.toFixed(6);
+ } else if (type === "j") {
+ return JSON.stringify(replacement);
+ } else if (type === "s" && typeof replacement === "object") {
+ const ctor = replacement.constructor !== Object ? replacement.constructor.name : "";
+ return `${ctor} {}`.trim();
} else {
- addChunk(stream4, state3, chunk, false);
+ return replacement.toString();
}
- }
- } else if (!addToFront) {
- state3.state &= ~kReading;
- maybeReadMore(stream4, state3);
- }
- return !state3.ended && (state3.length < state3.highWaterMark || state3.length === 0);
- }
- function addChunk(stream4, state3, chunk, addToFront) {
- if (state3.flowing && state3.length === 0 && !state3.sync && stream4.listenerCount("data") > 0) {
- if ((state3.state & kMultiAwaitDrain) !== 0) {
- state3.awaitDrainWriters.clear();
- } else {
- state3.awaitDrainWriters = null;
- }
- state3.dataEmitted = true;
- stream4.emit("data", chunk);
- } else {
- state3.length += state3.objectMode ? 1 : chunk.length;
- if (addToFront) state3.buffer.unshift(chunk);
- else state3.buffer.push(chunk);
- if ((state3.state & kNeedReadable) !== 0) emitReadable(stream4);
+ });
+ },
+ inspect(value) {
+ switch (typeof value) {
+ case "string":
+ if (value.includes("'")) {
+ if (!value.includes('"')) {
+ return `"${value}"`;
+ } else if (!value.includes("`") && !value.includes("${")) {
+ return `\`${value}\``;
+ }
+ }
+ return `'${value}'`;
+ case "number":
+ if (isNaN(value)) {
+ return "NaN";
+ } else if (Object.is(value, -0)) {
+ return String(value);
+ }
+ return value;
+ case "bigint":
+ return `${String(value)}n`;
+ case "boolean":
+ case "undefined":
+ return String(value);
+ case "object":
+ return "{}";
+ }
}
- maybeReadMore(stream4, state3);
- }
- Readable7.prototype.isPaused = function() {
- const state3 = this._readableState;
- return state3[kPaused] === true || state3.flowing === false;
};
- Readable7.prototype.setEncoding = function(enc) {
- const decoder = new StringDecoder2(enc);
- this._readableState.decoder = decoder;
- this._readableState.encoding = this._readableState.decoder.encoding;
- const buffer2 = this._readableState.buffer;
- let content = "";
- for (const data of buffer2) {
- content += decoder.write(data);
+ }
+});
+
+// node_modules/readable-stream/lib/ours/errors.js
+var require_errors2 = __commonJS({
+ "node_modules/readable-stream/lib/ours/errors.js"(exports2, module2) {
+ "use strict";
+ var { format, inspect: inspect2 } = require_inspect();
+ var { AggregateError: CustomAggregateError } = require_primordials();
+ var AggregateError = globalThis.AggregateError || CustomAggregateError;
+ var kIsNodeError = /* @__PURE__ */ Symbol("kIsNodeError");
+ var kTypes = [
+ "string",
+ "function",
+ "number",
+ "object",
+ // Accept 'Function' and 'Object' as alternative to the lower cased version.
+ "Function",
+ "Object",
+ "boolean",
+ "bigint",
+ "symbol"
+ ];
+ var classRegExp = /^([A-Z][a-z0-9]*)+$/;
+ var nodeInternalPrefix = "__node_internal_";
+ var codes = {};
+ function assert(value, message) {
+ if (!value) {
+ throw new codes.ERR_INTERNAL_ASSERTION(message);
}
- buffer2.clear();
- if (content !== "") buffer2.push(content);
- this._readableState.length = content.length;
- return this;
- };
- var MAX_HWM = 1073741824;
- function computeNewHighWaterMark(n) {
- if (n > MAX_HWM) {
- throw new ERR_OUT_OF_RANGE("size", "<= 1GiB", n);
- } else {
- n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- n++;
+ }
+ function addNumericalSeparator(val) {
+ let res = "";
+ let i = val.length;
+ const start = val[0] === "-" ? 1 : 0;
+ for (; i >= start + 4; i -= 3) {
+ res = `_${val.slice(i - 3, i)}${res}`;
}
- return n;
+ return `${val.slice(0, i)}${res}`;
}
- function howMuchToRead(n, state3) {
- if (n <= 0 || state3.length === 0 && state3.ended) return 0;
- if ((state3.state & kObjectMode) !== 0) return 1;
- if (NumberIsNaN(n)) {
- if (state3.flowing && state3.length) return state3.buffer.first().length;
- return state3.length;
+ function getMessage(key, msg, args) {
+ if (typeof msg === "function") {
+ assert(
+ msg.length <= args.length,
+ // Default options do not count.
+ `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`
+ );
+ return msg(...args);
}
- if (n <= state3.length) return n;
- return state3.ended ? state3.length : 0;
+ const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length;
+ assert(
+ expectedLength === args.length,
+ `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
+ );
+ if (args.length === 0) {
+ return msg;
+ }
+ return format(msg, ...args);
}
- Readable7.prototype.read = function(n) {
- debug2("read", n);
- if (n === void 0) {
- n = NaN;
- } else if (!NumberIsInteger(n)) {
- n = NumberParseInt(n, 10);
+ function E(code, message, Base) {
+ if (!Base) {
+ Base = Error;
}
- const state3 = this._readableState;
- const nOrig = n;
- if (n > state3.highWaterMark) state3.highWaterMark = computeNewHighWaterMark(n);
- if (n !== 0) state3.state &= ~kEmittedReadable;
- if (n === 0 && state3.needReadable && ((state3.highWaterMark !== 0 ? state3.length >= state3.highWaterMark : state3.length > 0) || state3.ended)) {
- debug2("read: emitReadable", state3.length, state3.ended);
- if (state3.length === 0 && state3.ended) endReadable(this);
- else emitReadable(this);
- return null;
+ class NodeError extends Base {
+ constructor(...args) {
+ super(getMessage(code, message, args));
+ }
+ toString() {
+ return `${this.name} [${code}]: ${this.message}`;
+ }
}
- n = howMuchToRead(n, state3);
- if (n === 0 && state3.ended) {
- if (state3.length === 0) endReadable(this);
- return null;
+ Object.defineProperties(NodeError.prototype, {
+ name: {
+ value: Base.name,
+ writable: true,
+ enumerable: false,
+ configurable: true
+ },
+ toString: {
+ value() {
+ return `${this.name} [${code}]: ${this.message}`;
+ },
+ writable: true,
+ enumerable: false,
+ configurable: true
+ }
+ });
+ NodeError.prototype.code = code;
+ NodeError.prototype[kIsNodeError] = true;
+ codes[code] = NodeError;
+ }
+ function hideStackFrames(fn) {
+ const hidden = nodeInternalPrefix + fn.name;
+ Object.defineProperty(fn, "name", {
+ value: hidden
+ });
+ return fn;
+ }
+ function aggregateTwoErrors(innerError, outerError) {
+ if (innerError && outerError && innerError !== outerError) {
+ if (Array.isArray(outerError.errors)) {
+ outerError.errors.push(innerError);
+ return outerError;
+ }
+ const err = new AggregateError([outerError, innerError], outerError.message);
+ err.code = outerError.code;
+ return err;
}
- let doRead = (state3.state & kNeedReadable) !== 0;
- debug2("need readable", doRead);
- if (state3.length === 0 || state3.length - n < state3.highWaterMark) {
- doRead = true;
- debug2("length less than watermark", doRead);
+ return innerError || outerError;
+ }
+ var AbortError3 = class extends Error {
+ constructor(message = "The operation was aborted", options = void 0) {
+ if (options !== void 0 && typeof options !== "object") {
+ throw new codes.ERR_INVALID_ARG_TYPE("options", "Object", options);
+ }
+ super(message, options);
+ this.code = "ABORT_ERR";
+ this.name = "AbortError";
}
- if (state3.ended || state3.reading || state3.destroyed || state3.errored || !state3.constructed) {
- doRead = false;
- debug2("reading, ended or constructing", doRead);
- } else if (doRead) {
- debug2("do read");
- state3.state |= kReading | kSync;
- if (state3.length === 0) state3.state |= kNeedReadable;
- try {
- this._read(state3.highWaterMark);
- } catch (err) {
- errorOrDestroy(this, err);
+ };
+ E("ERR_ASSERTION", "%s", Error);
+ E(
+ "ERR_INVALID_ARG_TYPE",
+ (name, expected, actual) => {
+ assert(typeof name === "string", "'name' must be a string");
+ if (!Array.isArray(expected)) {
+ expected = [expected];
+ }
+ let msg = "The ";
+ if (name.endsWith(" argument")) {
+ msg += `${name} `;
+ } else {
+ msg += `"${name}" ${name.includes(".") ? "property" : "argument"} `;
+ }
+ msg += "must be ";
+ const types = [];
+ const instances = [];
+ const other = [];
+ for (const value of expected) {
+ assert(typeof value === "string", "All expected entries have to be of type string");
+ if (kTypes.includes(value)) {
+ types.push(value.toLowerCase());
+ } else if (classRegExp.test(value)) {
+ instances.push(value);
+ } else {
+ assert(value !== "object", 'The value "object" should be written as "Object"');
+ other.push(value);
+ }
+ }
+ if (instances.length > 0) {
+ const pos = types.indexOf("object");
+ if (pos !== -1) {
+ types.splice(types, pos, 1);
+ instances.push("Object");
+ }
+ }
+ if (types.length > 0) {
+ switch (types.length) {
+ case 1:
+ msg += `of type ${types[0]}`;
+ break;
+ case 2:
+ msg += `one of type ${types[0]} or ${types[1]}`;
+ break;
+ default: {
+ const last = types.pop();
+ msg += `one of type ${types.join(", ")}, or ${last}`;
+ }
+ }
+ if (instances.length > 0 || other.length > 0) {
+ msg += " or ";
+ }
+ }
+ if (instances.length > 0) {
+ switch (instances.length) {
+ case 1:
+ msg += `an instance of ${instances[0]}`;
+ break;
+ case 2:
+ msg += `an instance of ${instances[0]} or ${instances[1]}`;
+ break;
+ default: {
+ const last = instances.pop();
+ msg += `an instance of ${instances.join(", ")}, or ${last}`;
+ }
+ }
+ if (other.length > 0) {
+ msg += " or ";
+ }
}
- state3.state &= ~kSync;
- if (!state3.reading) n = howMuchToRead(nOrig, state3);
- }
- let ret;
- if (n > 0) ret = fromList(n, state3);
- else ret = null;
- if (ret === null) {
- state3.needReadable = state3.length <= state3.highWaterMark;
- n = 0;
- } else {
- state3.length -= n;
- if (state3.multiAwaitDrain) {
- state3.awaitDrainWriters.clear();
+ switch (other.length) {
+ case 0:
+ break;
+ case 1:
+ if (other[0].toLowerCase() !== other[0]) {
+ msg += "an ";
+ }
+ msg += `${other[0]}`;
+ break;
+ case 2:
+ msg += `one of ${other[0]} or ${other[1]}`;
+ break;
+ default: {
+ const last = other.pop();
+ msg += `one of ${other.join(", ")}, or ${last}`;
+ }
+ }
+ if (actual == null) {
+ msg += `. Received ${actual}`;
+ } else if (typeof actual === "function" && actual.name) {
+ msg += `. Received function ${actual.name}`;
+ } else if (typeof actual === "object") {
+ var _actual$constructor;
+ if ((_actual$constructor = actual.constructor) !== null && _actual$constructor !== void 0 && _actual$constructor.name) {
+ msg += `. Received an instance of ${actual.constructor.name}`;
+ } else {
+ const inspected = inspect2(actual, {
+ depth: -1
+ });
+ msg += `. Received ${inspected}`;
+ }
} else {
- state3.awaitDrainWriters = null;
+ let inspected = inspect2(actual, {
+ colors: false
+ });
+ if (inspected.length > 25) {
+ inspected = `${inspected.slice(0, 25)}...`;
+ }
+ msg += `. Received type ${typeof actual} (${inspected})`;
}
- }
- if (state3.length === 0) {
- if (!state3.ended) state3.needReadable = true;
- if (nOrig !== n && state3.ended) endReadable(this);
- }
- if (ret !== null && !state3.errorEmitted && !state3.closeEmitted) {
- state3.dataEmitted = true;
- this.emit("data", ret);
- }
- return ret;
- };
- function onEofChunk(stream4, state3) {
- debug2("onEofChunk");
- if (state3.ended) return;
- if (state3.decoder) {
- const chunk = state3.decoder.end();
- if (chunk && chunk.length) {
- state3.buffer.push(chunk);
- state3.length += state3.objectMode ? 1 : chunk.length;
+ return msg;
+ },
+ TypeError
+ );
+ E(
+ "ERR_INVALID_ARG_VALUE",
+ (name, value, reason = "is invalid") => {
+ let inspected = inspect2(value);
+ if (inspected.length > 128) {
+ inspected = inspected.slice(0, 128) + "...";
}
- }
- state3.ended = true;
- if (state3.sync) {
- emitReadable(stream4);
- } else {
- state3.needReadable = false;
- state3.emittedReadable = true;
- emitReadable_(stream4);
- }
- }
- function emitReadable(stream4) {
- const state3 = stream4._readableState;
- debug2("emitReadable", state3.needReadable, state3.emittedReadable);
- state3.needReadable = false;
- if (!state3.emittedReadable) {
- debug2("emitReadable", state3.flowing);
- state3.emittedReadable = true;
- process5.nextTick(emitReadable_, stream4);
- }
- }
- function emitReadable_(stream4) {
- const state3 = stream4._readableState;
- debug2("emitReadable_", state3.destroyed, state3.length, state3.ended);
- if (!state3.destroyed && !state3.errored && (state3.length || state3.ended)) {
- stream4.emit("readable");
- state3.emittedReadable = false;
- }
- state3.needReadable = !state3.flowing && !state3.ended && state3.length <= state3.highWaterMark;
- flow(stream4);
- }
- function maybeReadMore(stream4, state3) {
- if (!state3.readingMore && state3.constructed) {
- state3.readingMore = true;
- process5.nextTick(maybeReadMore_, stream4, state3);
- }
- }
- function maybeReadMore_(stream4, state3) {
- while (!state3.reading && !state3.ended && (state3.length < state3.highWaterMark || state3.flowing && state3.length === 0)) {
- const len = state3.length;
- debug2("maybeReadMore read 0");
- stream4.read(0);
- if (len === state3.length)
- break;
- }
- state3.readingMore = false;
- }
- Readable7.prototype._read = function(n) {
- throw new ERR_METHOD_NOT_IMPLEMENTED("_read()");
- };
- Readable7.prototype.pipe = function(dest, pipeOpts) {
- const src = this;
- const state3 = this._readableState;
- if (state3.pipes.length === 1) {
- if (!state3.multiAwaitDrain) {
- state3.multiAwaitDrain = true;
- state3.awaitDrainWriters = new SafeSet(state3.awaitDrainWriters ? [state3.awaitDrainWriters] : []);
+ const type = name.includes(".") ? "property" : "argument";
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`;
+ },
+ TypeError
+ );
+ E(
+ "ERR_INVALID_RETURN_VALUE",
+ (input, name, value) => {
+ var _value$constructor;
+ const type = value !== null && value !== void 0 && (_value$constructor = value.constructor) !== null && _value$constructor !== void 0 && _value$constructor.name ? `instance of ${value.constructor.name}` : `type ${typeof value}`;
+ return `Expected ${input} to be returned from the "${name}" function but got ${type}.`;
+ },
+ TypeError
+ );
+ E(
+ "ERR_MISSING_ARGS",
+ (...args) => {
+ assert(args.length > 0, "At least one arg needs to be specified");
+ let msg = "";
+ const len = args.length;
+ args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`);
+ switch (len) {
+ case 1:
+ msg += `The ${args[0]} argument`;
+ break;
+ case 2:
+ msg += `The ${args[0]} and ${args[1]} arguments`;
+ break;
+ default:
+ {
+ const last = args.pop();
+ msg += `The ${args.join(", ")}, and ${last} arguments`;
+ }
+ break;
}
- }
- state3.pipes.push(dest);
- debug2("pipe count=%d opts=%j", state3.pipes.length, pipeOpts);
- const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process5.stdout && dest !== process5.stderr;
- const endFn = doEnd ? onend : unpipe;
- if (state3.endEmitted) process5.nextTick(endFn);
- else src.once("end", endFn);
- dest.on("unpipe", onunpipe);
- function onunpipe(readable, unpipeInfo) {
- debug2("onunpipe");
- if (readable === src) {
- if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
- unpipeInfo.hasUnpiped = true;
- cleanup();
+ return `${msg} must be specified`;
+ },
+ TypeError
+ );
+ E(
+ "ERR_OUT_OF_RANGE",
+ (str, range2, input) => {
+ assert(range2, 'Missing "range" argument');
+ let received;
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
+ received = addNumericalSeparator(String(input));
+ } else if (typeof input === "bigint") {
+ received = String(input);
+ const limit = BigInt(2) ** BigInt(32);
+ if (input > limit || input < -limit) {
+ received = addNumericalSeparator(received);
}
+ received += "n";
+ } else {
+ received = inspect2(input);
+ }
+ return `The value of "${str}" is out of range. It must be ${range2}. Received ${received}`;
+ },
+ RangeError
+ );
+ E("ERR_MULTIPLE_CALLBACK", "Callback called multiple times", Error);
+ E("ERR_METHOD_NOT_IMPLEMENTED", "The %s method is not implemented", Error);
+ E("ERR_STREAM_ALREADY_FINISHED", "Cannot call %s after a stream was finished", Error);
+ E("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable", Error);
+ E("ERR_STREAM_DESTROYED", "Cannot call %s after a stream was destroyed", Error);
+ E("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
+ E("ERR_STREAM_PREMATURE_CLOSE", "Premature close", Error);
+ E("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF", Error);
+ E("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event", Error);
+ E("ERR_STREAM_WRITE_AFTER_END", "write after end", Error);
+ E("ERR_UNKNOWN_ENCODING", "Unknown encoding: %s", TypeError);
+ module2.exports = {
+ AbortError: AbortError3,
+ aggregateTwoErrors: hideStackFrames(aggregateTwoErrors),
+ hideStackFrames,
+ codes
+ };
+ }
+});
+
+// node_modules/event-target-shim/dist/event-target-shim.js
+var require_event_target_shim = __commonJS({
+ "node_modules/event-target-shim/dist/event-target-shim.js"(exports2, module2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ var privateData = /* @__PURE__ */ new WeakMap();
+ var wrappers = /* @__PURE__ */ new WeakMap();
+ function pd(event) {
+ const retv = privateData.get(event);
+ console.assert(
+ retv != null,
+ "'this' is expected an Event object, but got",
+ event
+ );
+ return retv;
+ }
+ function setCancelFlag(data) {
+ if (data.passiveListener != null) {
+ if (typeof console !== "undefined" && typeof console.error === "function") {
+ console.error(
+ "Unable to preventDefault inside passive event listener invocation.",
+ data.passiveListener
+ );
}
+ return;
+ }
+ if (!data.event.cancelable) {
+ return;
}
- function onend() {
- debug2("onend");
- dest.end();
+ data.canceled = true;
+ if (typeof data.event.preventDefault === "function") {
+ data.event.preventDefault();
}
- let ondrain;
- let cleanedUp = false;
- function cleanup() {
- debug2("cleanup");
- dest.removeListener("close", onclose);
- dest.removeListener("finish", onfinish);
- if (ondrain) {
- dest.removeListener("drain", ondrain);
+ }
+ function Event2(eventTarget, event) {
+ privateData.set(this, {
+ eventTarget,
+ event,
+ eventPhase: 2,
+ currentTarget: eventTarget,
+ canceled: false,
+ stopped: false,
+ immediateStopped: false,
+ passiveListener: null,
+ timeStamp: event.timeStamp || Date.now()
+ });
+ Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
+ const keys = Object.keys(event);
+ for (let i = 0; i < keys.length; ++i) {
+ const key = keys[i];
+ if (!(key in this)) {
+ Object.defineProperty(this, key, defineRedirectDescriptor(key));
}
- dest.removeListener("error", onerror);
- dest.removeListener("unpipe", onunpipe);
- src.removeListener("end", onend);
- src.removeListener("end", unpipe);
- src.removeListener("data", ondata);
- cleanedUp = true;
- if (ondrain && state3.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
- function pause() {
- if (!cleanedUp) {
- if (state3.pipes.length === 1 && state3.pipes[0] === dest) {
- debug2("false write response, pause", 0);
- state3.awaitDrainWriters = dest;
- state3.multiAwaitDrain = false;
- } else if (state3.pipes.length > 1 && state3.pipes.includes(dest)) {
- debug2("false write response, pause", state3.awaitDrainWriters.size);
- state3.awaitDrainWriters.add(dest);
- }
- src.pause();
- }
- if (!ondrain) {
- ondrain = pipeOnDrain(src, dest);
- dest.on("drain", ondrain);
+ }
+ Event2.prototype = {
+ /**
+ * The type of this event.
+ * @type {string}
+ */
+ get type() {
+ return pd(this).event.type;
+ },
+ /**
+ * The target of this event.
+ * @type {EventTarget}
+ */
+ get target() {
+ return pd(this).eventTarget;
+ },
+ /**
+ * The target of this event.
+ * @type {EventTarget}
+ */
+ get currentTarget() {
+ return pd(this).currentTarget;
+ },
+ /**
+ * @returns {EventTarget[]} The composed path of this event.
+ */
+ composedPath() {
+ const currentTarget = pd(this).currentTarget;
+ if (currentTarget == null) {
+ return [];
}
- }
- src.on("data", ondata);
- function ondata(chunk) {
- debug2("ondata");
- const ret = dest.write(chunk);
- debug2("dest.write", ret);
- if (ret === false) {
- pause();
+ return [currentTarget];
+ },
+ /**
+ * Constant of NONE.
+ * @type {number}
+ */
+ get NONE() {
+ return 0;
+ },
+ /**
+ * Constant of CAPTURING_PHASE.
+ * @type {number}
+ */
+ get CAPTURING_PHASE() {
+ return 1;
+ },
+ /**
+ * Constant of AT_TARGET.
+ * @type {number}
+ */
+ get AT_TARGET() {
+ return 2;
+ },
+ /**
+ * Constant of BUBBLING_PHASE.
+ * @type {number}
+ */
+ get BUBBLING_PHASE() {
+ return 3;
+ },
+ /**
+ * The target of this event.
+ * @type {number}
+ */
+ get eventPhase() {
+ return pd(this).eventPhase;
+ },
+ /**
+ * Stop event bubbling.
+ * @returns {void}
+ */
+ stopPropagation() {
+ const data = pd(this);
+ data.stopped = true;
+ if (typeof data.event.stopPropagation === "function") {
+ data.event.stopPropagation();
}
- }
- function onerror(er) {
- debug2("onerror", er);
- unpipe();
- dest.removeListener("error", onerror);
- if (dest.listenerCount("error") === 0) {
- const s = dest._writableState || dest._readableState;
- if (s && !s.errorEmitted) {
- errorOrDestroy(dest, er);
- } else {
- dest.emit("error", er);
- }
+ },
+ /**
+ * Stop event bubbling.
+ * @returns {void}
+ */
+ stopImmediatePropagation() {
+ const data = pd(this);
+ data.stopped = true;
+ data.immediateStopped = true;
+ if (typeof data.event.stopImmediatePropagation === "function") {
+ data.event.stopImmediatePropagation();
}
- }
- prependListener(dest, "error", onerror);
- function onclose() {
- dest.removeListener("finish", onfinish);
- unpipe();
- }
- dest.once("close", onclose);
- function onfinish() {
- debug2("onfinish");
- dest.removeListener("close", onclose);
- unpipe();
- }
- dest.once("finish", onfinish);
- function unpipe() {
- debug2("unpipe");
- src.unpipe(dest);
- }
- dest.emit("pipe", src);
- if (dest.writableNeedDrain === true) {
- pause();
- } else if (!state3.flowing) {
- debug2("pipe resume");
- src.resume();
- }
- return dest;
- };
- function pipeOnDrain(src, dest) {
- return function pipeOnDrainFunctionResult() {
- const state3 = src._readableState;
- if (state3.awaitDrainWriters === dest) {
- debug2("pipeOnDrain", 1);
- state3.awaitDrainWriters = null;
- } else if (state3.multiAwaitDrain) {
- debug2("pipeOnDrain", state3.awaitDrainWriters.size);
- state3.awaitDrainWriters.delete(dest);
+ },
+ /**
+ * The flag to be bubbling.
+ * @type {boolean}
+ */
+ get bubbles() {
+ return Boolean(pd(this).event.bubbles);
+ },
+ /**
+ * The flag to be cancelable.
+ * @type {boolean}
+ */
+ get cancelable() {
+ return Boolean(pd(this).event.cancelable);
+ },
+ /**
+ * Cancel this event.
+ * @returns {void}
+ */
+ preventDefault() {
+ setCancelFlag(pd(this));
+ },
+ /**
+ * The flag to indicate cancellation state.
+ * @type {boolean}
+ */
+ get defaultPrevented() {
+ return pd(this).canceled;
+ },
+ /**
+ * The flag to be composed.
+ * @type {boolean}
+ */
+ get composed() {
+ return Boolean(pd(this).event.composed);
+ },
+ /**
+ * The unix time of this event.
+ * @type {number}
+ */
+ get timeStamp() {
+ return pd(this).timeStamp;
+ },
+ /**
+ * The target of this event.
+ * @type {EventTarget}
+ * @deprecated
+ */
+ get srcElement() {
+ return pd(this).eventTarget;
+ },
+ /**
+ * The flag to stop event bubbling.
+ * @type {boolean}
+ * @deprecated
+ */
+ get cancelBubble() {
+ return pd(this).stopped;
+ },
+ set cancelBubble(value) {
+ if (!value) {
+ return;
}
- if ((!state3.awaitDrainWriters || state3.awaitDrainWriters.size === 0) && src.listenerCount("data")) {
- src.resume();
+ const data = pd(this);
+ data.stopped = true;
+ if (typeof data.event.cancelBubble === "boolean") {
+ data.event.cancelBubble = true;
+ }
+ },
+ /**
+ * The flag to indicate cancellation state.
+ * @type {boolean}
+ * @deprecated
+ */
+ get returnValue() {
+ return !pd(this).canceled;
+ },
+ set returnValue(value) {
+ if (!value) {
+ setCancelFlag(pd(this));
}
+ },
+ /**
+ * Initialize this event object. But do nothing under event dispatching.
+ * @param {string} type The event type.
+ * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
+ * @param {boolean} [cancelable=false] The flag to be possible to cancel.
+ * @deprecated
+ */
+ initEvent() {
+ }
+ };
+ Object.defineProperty(Event2.prototype, "constructor", {
+ value: Event2,
+ configurable: true,
+ writable: true
+ });
+ if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
+ Object.setPrototypeOf(Event2.prototype, window.Event.prototype);
+ wrappers.set(window.Event.prototype, Event2);
+ }
+ function defineRedirectDescriptor(key) {
+ return {
+ get() {
+ return pd(this).event[key];
+ },
+ set(value) {
+ pd(this).event[key] = value;
+ },
+ configurable: true,
+ enumerable: true
};
}
- Readable7.prototype.unpipe = function(dest) {
- const state3 = this._readableState;
- const unpipeInfo = {
- hasUnpiped: false
+ function defineCallDescriptor(key) {
+ return {
+ value() {
+ const event = pd(this).event;
+ return event[key].apply(event, arguments);
+ },
+ configurable: true,
+ enumerable: true
};
- if (state3.pipes.length === 0) return this;
- if (!dest) {
- const dests = state3.pipes;
- state3.pipes = [];
- this.pause();
- for (let i = 0; i < dests.length; i++)
- dests[i].emit("unpipe", this, {
- hasUnpiped: false
- });
- return this;
+ }
+ function defineWrapper(BaseEvent, proto) {
+ const keys = Object.keys(proto);
+ if (keys.length === 0) {
+ return BaseEvent;
}
- const index = ArrayPrototypeIndexOf(state3.pipes, dest);
- if (index === -1) return this;
- state3.pipes.splice(index, 1);
- if (state3.pipes.length === 0) this.pause();
- dest.emit("unpipe", this, unpipeInfo);
- return this;
- };
- Readable7.prototype.on = function(ev, fn) {
- const res = Stream2.prototype.on.call(this, ev, fn);
- const state3 = this._readableState;
- if (ev === "data") {
- state3.readableListening = this.listenerCount("readable") > 0;
- if (state3.flowing !== false) this.resume();
- } else if (ev === "readable") {
- if (!state3.endEmitted && !state3.readableListening) {
- state3.readableListening = state3.needReadable = true;
- state3.flowing = false;
- state3.emittedReadable = false;
- debug2("on readable", state3.length, state3.reading);
- if (state3.length) {
- emitReadable(this);
- } else if (!state3.reading) {
- process5.nextTick(nReadingNextTick, this);
- }
- }
+ function CustomEvent(eventTarget, event) {
+ BaseEvent.call(this, eventTarget, event);
}
- return res;
- };
- Readable7.prototype.addListener = Readable7.prototype.on;
- Readable7.prototype.removeListener = function(ev, fn) {
- const res = Stream2.prototype.removeListener.call(this, ev, fn);
- if (ev === "readable") {
- process5.nextTick(updateReadableListening, this);
+ CustomEvent.prototype = Object.create(BaseEvent.prototype, {
+ constructor: { value: CustomEvent, configurable: true, writable: true }
+ });
+ for (let i = 0; i < keys.length; ++i) {
+ const key = keys[i];
+ if (!(key in BaseEvent.prototype)) {
+ const descriptor = Object.getOwnPropertyDescriptor(proto, key);
+ const isFunc = typeof descriptor.value === "function";
+ Object.defineProperty(
+ CustomEvent.prototype,
+ key,
+ isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key)
+ );
+ }
}
- return res;
- };
- Readable7.prototype.off = Readable7.prototype.removeListener;
- Readable7.prototype.removeAllListeners = function(ev) {
- const res = Stream2.prototype.removeAllListeners.apply(this, arguments);
- if (ev === "readable" || ev === void 0) {
- process5.nextTick(updateReadableListening, this);
+ return CustomEvent;
+ }
+ function getWrapper(proto) {
+ if (proto == null || proto === Object.prototype) {
+ return Event2;
}
- return res;
- };
- function updateReadableListening(self2) {
- const state3 = self2._readableState;
- state3.readableListening = self2.listenerCount("readable") > 0;
- if (state3.resumeScheduled && state3[kPaused] === false) {
- state3.flowing = true;
- } else if (self2.listenerCount("data") > 0) {
- self2.resume();
- } else if (!state3.readableListening) {
- state3.flowing = null;
+ let wrapper = wrappers.get(proto);
+ if (wrapper == null) {
+ wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
+ wrappers.set(proto, wrapper);
}
+ return wrapper;
}
- function nReadingNextTick(self2) {
- debug2("readable nexttick read 0");
- self2.read(0);
+ function wrapEvent(eventTarget, event) {
+ const Wrapper = getWrapper(Object.getPrototypeOf(event));
+ return new Wrapper(eventTarget, event);
}
- Readable7.prototype.resume = function() {
- const state3 = this._readableState;
- if (!state3.flowing) {
- debug2("resume");
- state3.flowing = !state3.readableListening;
- resume(this, state3);
- }
- state3[kPaused] = false;
- return this;
- };
- function resume(stream4, state3) {
- if (!state3.resumeScheduled) {
- state3.resumeScheduled = true;
- process5.nextTick(resume_, stream4, state3);
- }
+ function isStopped(event) {
+ return pd(event).immediateStopped;
}
- function resume_(stream4, state3) {
- debug2("resume", state3.reading);
- if (!state3.reading) {
- stream4.read(0);
+ function setEventPhase(event, eventPhase) {
+ pd(event).eventPhase = eventPhase;
+ }
+ function setCurrentTarget(event, currentTarget) {
+ pd(event).currentTarget = currentTarget;
+ }
+ function setPassiveListener(event, passiveListener) {
+ pd(event).passiveListener = passiveListener;
+ }
+ var listenersMap = /* @__PURE__ */ new WeakMap();
+ var CAPTURE = 1;
+ var BUBBLE = 2;
+ var ATTRIBUTE = 3;
+ function isObject2(x) {
+ return x !== null && typeof x === "object";
+ }
+ function getListeners(eventTarget) {
+ const listeners = listenersMap.get(eventTarget);
+ if (listeners == null) {
+ throw new TypeError(
+ "'this' is expected an EventTarget object, but got another value."
+ );
}
- state3.resumeScheduled = false;
- stream4.emit("resume");
- flow(stream4);
- if (state3.flowing && !state3.reading) stream4.read(0);
+ return listeners;
+ }
+ function defineEventAttributeDescriptor(eventName) {
+ return {
+ get() {
+ const listeners = getListeners(this);
+ let node = listeners.get(eventName);
+ while (node != null) {
+ if (node.listenerType === ATTRIBUTE) {
+ return node.listener;
+ }
+ node = node.next;
+ }
+ return null;
+ },
+ set(listener) {
+ if (typeof listener !== "function" && !isObject2(listener)) {
+ listener = null;
+ }
+ const listeners = getListeners(this);
+ let prev = null;
+ let node = listeners.get(eventName);
+ while (node != null) {
+ if (node.listenerType === ATTRIBUTE) {
+ if (prev !== null) {
+ prev.next = node.next;
+ } else if (node.next !== null) {
+ listeners.set(eventName, node.next);
+ } else {
+ listeners.delete(eventName);
+ }
+ } else {
+ prev = node;
+ }
+ node = node.next;
+ }
+ if (listener !== null) {
+ const newNode = {
+ listener,
+ listenerType: ATTRIBUTE,
+ passive: false,
+ once: false,
+ next: null
+ };
+ if (prev === null) {
+ listeners.set(eventName, newNode);
+ } else {
+ prev.next = newNode;
+ }
+ }
+ },
+ configurable: true,
+ enumerable: true
+ };
}
- Readable7.prototype.pause = function() {
- debug2("call pause flowing=%j", this._readableState.flowing);
- if (this._readableState.flowing !== false) {
- debug2("pause");
- this._readableState.flowing = false;
- this.emit("pause");
- }
- this._readableState[kPaused] = true;
- return this;
- };
- function flow(stream4) {
- const state3 = stream4._readableState;
- debug2("flow", state3.flowing);
- while (state3.flowing && stream4.read() !== null) ;
+ function defineEventAttribute(eventTargetPrototype, eventName) {
+ Object.defineProperty(
+ eventTargetPrototype,
+ `on${eventName}`,
+ defineEventAttributeDescriptor(eventName)
+ );
}
- Readable7.prototype.wrap = function(stream4) {
- let paused = false;
- stream4.on("data", (chunk) => {
- if (!this.push(chunk) && stream4.pause) {
- paused = true;
- stream4.pause();
+ function defineCustomEventTarget(eventNames) {
+ function CustomEventTarget() {
+ EventTarget2.call(this);
+ }
+ CustomEventTarget.prototype = Object.create(EventTarget2.prototype, {
+ constructor: {
+ value: CustomEventTarget,
+ configurable: true,
+ writable: true
}
});
- stream4.on("end", () => {
- this.push(null);
- });
- stream4.on("error", (err) => {
- errorOrDestroy(this, err);
- });
- stream4.on("close", () => {
- this.destroy();
- });
- stream4.on("destroy", () => {
- this.destroy();
- });
- this._read = () => {
- if (paused && stream4.resume) {
- paused = false;
- stream4.resume();
- }
- };
- const streamKeys = ObjectKeys(stream4);
- for (let j = 1; j < streamKeys.length; j++) {
- const i = streamKeys[j];
- if (this[i] === void 0 && typeof stream4[i] === "function") {
- this[i] = stream4[i].bind(stream4);
- }
- }
- return this;
- };
- Readable7.prototype[SymbolAsyncIterator] = function() {
- return streamToAsyncIterator(this);
- };
- Readable7.prototype.iterator = function(options) {
- if (options !== void 0) {
- validateObject(options, "options");
- }
- return streamToAsyncIterator(this, options);
- };
- function streamToAsyncIterator(stream4, options) {
- if (typeof stream4.read !== "function") {
- stream4 = Readable7.wrap(stream4, {
- objectMode: true
- });
+ for (let i = 0; i < eventNames.length; ++i) {
+ defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
}
- const iter = createAsyncIterator(stream4, options);
- iter.stream = stream4;
- return iter;
+ return CustomEventTarget;
}
- async function* createAsyncIterator(stream4, options) {
- let callback = nop;
- function next(resolve7) {
- if (this === stream4) {
- callback();
- callback = nop;
- } else {
- callback = resolve7;
- }
+ function EventTarget2() {
+ if (this instanceof EventTarget2) {
+ listenersMap.set(this, /* @__PURE__ */ new Map());
+ return;
}
- stream4.on("readable", next);
- let error2;
- const cleanup = eos(
- stream4,
- {
- writable: false
- },
- (err) => {
- error2 = err ? aggregateTwoErrors(error2, err) : null;
- callback();
- callback = nop;
- }
- );
- try {
- while (true) {
- const chunk = stream4.destroyed ? null : stream4.read();
- if (chunk !== null) {
- yield chunk;
- } else if (error2) {
- throw error2;
- } else if (error2 === null) {
- return;
- } else {
- await new Promise2(next);
- }
- }
- } catch (err) {
- error2 = aggregateTwoErrors(error2, err);
- throw error2;
- } finally {
- if ((error2 || (options === null || options === void 0 ? void 0 : options.destroyOnReturn) !== false) && (error2 === void 0 || stream4._readableState.autoDestroy)) {
- destroyImpl.destroyer(stream4, null);
- } else {
- stream4.off("readable", next);
- cleanup();
+ if (arguments.length === 1 && Array.isArray(arguments[0])) {
+ return defineCustomEventTarget(arguments[0]);
+ }
+ if (arguments.length > 0) {
+ const types = new Array(arguments.length);
+ for (let i = 0; i < arguments.length; ++i) {
+ types[i] = arguments[i];
}
+ return defineCustomEventTarget(types);
}
+ throw new TypeError("Cannot call a class as a function");
}
- ObjectDefineProperties(Readable7.prototype, {
- readable: {
- __proto__: null,
- get() {
- const r = this._readableState;
- return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted;
- },
- set(val) {
- if (this._readableState) {
- this._readableState.readable = !!val;
- }
- }
- },
- readableDidRead: {
- __proto__: null,
- enumerable: false,
- get: function() {
- return this._readableState.dataEmitted;
- }
- },
- readableAborted: {
- __proto__: null,
- enumerable: false,
- get: function() {
- return !!(this._readableState.readable !== false && (this._readableState.destroyed || this._readableState.errored) && !this._readableState.endEmitted);
- }
- },
- readableHighWaterMark: {
- __proto__: null,
- enumerable: false,
- get: function() {
- return this._readableState.highWaterMark;
- }
- },
- readableBuffer: {
- __proto__: null,
- enumerable: false,
- get: function() {
- return this._readableState && this._readableState.buffer;
- }
- },
- readableFlowing: {
- __proto__: null,
- enumerable: false,
- get: function() {
- return this._readableState.flowing;
- },
- set: function(state3) {
- if (this._readableState) {
- this._readableState.flowing = state3;
- }
- }
- },
- readableLength: {
- __proto__: null,
- enumerable: false,
- get() {
- return this._readableState.length;
- }
- },
- readableObjectMode: {
- __proto__: null,
- enumerable: false,
- get() {
- return this._readableState ? this._readableState.objectMode : false;
- }
- },
- readableEncoding: {
- __proto__: null,
- enumerable: false,
- get() {
- return this._readableState ? this._readableState.encoding : null;
+ EventTarget2.prototype = {
+ /**
+ * Add a given listener to this event target.
+ * @param {string} eventName The event name to add.
+ * @param {Function} listener The listener to add.
+ * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
+ * @returns {void}
+ */
+ addEventListener(eventName, listener, options) {
+ if (listener == null) {
+ return;
}
- },
- errored: {
- __proto__: null,
- enumerable: false,
- get() {
- return this._readableState ? this._readableState.errored : null;
+ if (typeof listener !== "function" && !isObject2(listener)) {
+ throw new TypeError("'listener' should be a function or an object.");
}
- },
- closed: {
- __proto__: null,
- get() {
- return this._readableState ? this._readableState.closed : false;
+ const listeners = getListeners(this);
+ const optionsIsObj = isObject2(options);
+ const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
+ const listenerType = capture ? CAPTURE : BUBBLE;
+ const newNode = {
+ listener,
+ listenerType,
+ passive: optionsIsObj && Boolean(options.passive),
+ once: optionsIsObj && Boolean(options.once),
+ next: null
+ };
+ let node = listeners.get(eventName);
+ if (node === void 0) {
+ listeners.set(eventName, newNode);
+ return;
}
- },
- destroyed: {
- __proto__: null,
- enumerable: false,
- get() {
- return this._readableState ? this._readableState.destroyed : false;
- },
- set(value) {
- if (!this._readableState) {
+ let prev = null;
+ while (node != null) {
+ if (node.listener === listener && node.listenerType === listenerType) {
return;
}
- this._readableState.destroyed = value;
+ prev = node;
+ node = node.next;
}
+ prev.next = newNode;
},
- readableEnded: {
- __proto__: null,
- enumerable: false,
- get() {
- return this._readableState ? this._readableState.endEmitted : false;
+ /**
+ * Remove a given listener from this event target.
+ * @param {string} eventName The event name to remove.
+ * @param {Function} listener The listener to remove.
+ * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
+ * @returns {void}
+ */
+ removeEventListener(eventName, listener, options) {
+ if (listener == null) {
+ return;
}
- }
- });
- ObjectDefineProperties(ReadableState.prototype, {
- // Legacy getter for `pipesCount`.
- pipesCount: {
- __proto__: null,
- get() {
- return this.pipes.length;
+ const listeners = getListeners(this);
+ const capture = isObject2(options) ? Boolean(options.capture) : Boolean(options);
+ const listenerType = capture ? CAPTURE : BUBBLE;
+ let prev = null;
+ let node = listeners.get(eventName);
+ while (node != null) {
+ if (node.listener === listener && node.listenerType === listenerType) {
+ if (prev !== null) {
+ prev.next = node.next;
+ } else if (node.next !== null) {
+ listeners.set(eventName, node.next);
+ } else {
+ listeners.delete(eventName);
+ }
+ return;
+ }
+ prev = node;
+ node = node.next;
}
},
- // Legacy property for `paused`.
- paused: {
- __proto__: null,
- get() {
- return this[kPaused] !== false;
- },
- set(value) {
- this[kPaused] = !!value;
- }
- }
- });
- Readable7._fromList = fromList;
- function fromList(n, state3) {
- if (state3.length === 0) return null;
- let ret;
- if (state3.objectMode) ret = state3.buffer.shift();
- else if (!n || n >= state3.length) {
- if (state3.decoder) ret = state3.buffer.join("");
- else if (state3.buffer.length === 1) ret = state3.buffer.first();
- else ret = state3.buffer.concat(state3.length);
- state3.buffer.clear();
- } else {
- ret = state3.buffer.consume(n, state3.decoder);
- }
- return ret;
- }
- function endReadable(stream4) {
- const state3 = stream4._readableState;
- debug2("endReadable", state3.endEmitted);
- if (!state3.endEmitted) {
- state3.ended = true;
- process5.nextTick(endReadableNT, state3, stream4);
- }
- }
- function endReadableNT(state3, stream4) {
- debug2("endReadableNT", state3.endEmitted, state3.length);
- if (!state3.errored && !state3.closeEmitted && !state3.endEmitted && state3.length === 0) {
- state3.endEmitted = true;
- stream4.emit("end");
- if (stream4.writable && stream4.allowHalfOpen === false) {
- process5.nextTick(endWritableNT, stream4);
- } else if (state3.autoDestroy) {
- const wState = stream4._writableState;
- const autoDestroy = !wState || wState.autoDestroy && // We don't expect the writable to ever 'finish'
- // if writable is explicitly set to false.
- (wState.finished || wState.writable === false);
- if (autoDestroy) {
- stream4.destroy();
- }
+ /**
+ * Dispatch a given event.
+ * @param {Event|{type:string}} event The event to dispatch.
+ * @returns {boolean} `false` if canceled.
+ */
+ dispatchEvent(event) {
+ if (event == null || typeof event.type !== "string") {
+ throw new TypeError('"event.type" should be a string.');
}
- }
- }
- function endWritableNT(stream4) {
- const writable = stream4.writable && !stream4.writableEnded && !stream4.destroyed;
- if (writable) {
- stream4.end();
- }
- }
- Readable7.from = function(iterable, opts) {
- return from(Readable7, iterable, opts);
- };
- var webStreamsAdapters;
- function lazyWebStreams() {
- if (webStreamsAdapters === void 0) webStreamsAdapters = {};
- return webStreamsAdapters;
- }
- Readable7.fromWeb = function(readableStream, options) {
- return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options);
- };
- Readable7.toWeb = function(streamReadable, options) {
- return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options);
- };
- Readable7.wrap = function(src, options) {
- var _ref, _src$readableObjectMo;
- return new Readable7({
- objectMode: (_ref = (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== void 0 ? _src$readableObjectMo : src.objectMode) !== null && _ref !== void 0 ? _ref : true,
- ...options,
- destroy(err, callback) {
- destroyImpl.destroyer(src, err);
- callback(err);
+ const listeners = getListeners(this);
+ const eventName = event.type;
+ let node = listeners.get(eventName);
+ if (node == null) {
+ return true;
}
- }).wrap(src);
- };
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/writable.js
-var require_writable = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/writable.js"(exports2, module2) {
- "use strict";
- var process5 = require_process();
- var {
- ArrayPrototypeSlice,
- Error: Error2,
- FunctionPrototypeSymbolHasInstance,
- ObjectDefineProperty,
- ObjectDefineProperties,
- ObjectSetPrototypeOf,
- StringPrototypeToLowerCase,
- Symbol: Symbol2,
- SymbolHasInstance
- } = require_primordials();
- module2.exports = Writable;
- Writable.WritableState = WritableState;
- var { EventEmitter: EE } = require("events");
- var Stream2 = require_legacy().Stream;
- var { Buffer: Buffer3 } = require("buffer");
- var destroyImpl = require_destroy2();
- var { addAbortSignal } = require_add_abort_signal();
- var { getHighWaterMark, getDefaultHighWaterMark } = require_state();
- var {
- ERR_INVALID_ARG_TYPE,
- ERR_METHOD_NOT_IMPLEMENTED,
- ERR_MULTIPLE_CALLBACK,
- ERR_STREAM_CANNOT_PIPE,
- ERR_STREAM_DESTROYED,
- ERR_STREAM_ALREADY_FINISHED,
- ERR_STREAM_NULL_VALUES,
- ERR_STREAM_WRITE_AFTER_END,
- ERR_UNKNOWN_ENCODING
- } = require_errors2().codes;
- var { errorOrDestroy } = destroyImpl;
- ObjectSetPrototypeOf(Writable.prototype, Stream2.prototype);
- ObjectSetPrototypeOf(Writable, Stream2);
- function nop() {
- }
- var kOnFinished = Symbol2("kOnFinished");
- function WritableState(options, stream4, isDuplex) {
- if (typeof isDuplex !== "boolean") isDuplex = stream4 instanceof require_duplex();
- this.objectMode = !!(options && options.objectMode);
- if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode);
- this.highWaterMark = options ? getHighWaterMark(this, options, "writableHighWaterMark", isDuplex) : getDefaultHighWaterMark(false);
- this.finalCalled = false;
- this.needDrain = false;
- this.ending = false;
- this.ended = false;
- this.finished = false;
- this.destroyed = false;
- const noDecode = !!(options && options.decodeStrings === false);
- this.decodeStrings = !noDecode;
- this.defaultEncoding = options && options.defaultEncoding || "utf8";
- this.length = 0;
- this.writing = false;
- this.corked = 0;
- this.sync = true;
- this.bufferProcessing = false;
- this.onwrite = onwrite.bind(void 0, stream4);
- this.writecb = null;
- this.writelen = 0;
- this.afterWriteTickInfo = null;
- resetBuffer(this);
- this.pendingcb = 0;
- this.constructed = true;
- this.prefinished = false;
- this.errorEmitted = false;
- this.emitClose = !options || options.emitClose !== false;
- this.autoDestroy = !options || options.autoDestroy !== false;
- this.errored = null;
- this.closed = false;
- this.closeEmitted = false;
- this[kOnFinished] = [];
- }
- function resetBuffer(state3) {
- state3.buffered = [];
- state3.bufferedIndex = 0;
- state3.allBuffers = true;
- state3.allNoop = true;
- }
- WritableState.prototype.getBuffer = function getBuffer() {
- return ArrayPrototypeSlice(this.buffered, this.bufferedIndex);
- };
- ObjectDefineProperty(WritableState.prototype, "bufferedRequestCount", {
- __proto__: null,
- get() {
- return this.buffered.length - this.bufferedIndex;
+ const wrappedEvent = wrapEvent(this, event);
+ let prev = null;
+ while (node != null) {
+ if (node.once) {
+ if (prev !== null) {
+ prev.next = node.next;
+ } else if (node.next !== null) {
+ listeners.set(eventName, node.next);
+ } else {
+ listeners.delete(eventName);
+ }
+ } else {
+ prev = node;
+ }
+ setPassiveListener(
+ wrappedEvent,
+ node.passive ? node.listener : null
+ );
+ if (typeof node.listener === "function") {
+ try {
+ node.listener.call(this, wrappedEvent);
+ } catch (err) {
+ if (typeof console !== "undefined" && typeof console.error === "function") {
+ console.error(err);
+ }
+ }
+ } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
+ node.listener.handleEvent(wrappedEvent);
+ }
+ if (isStopped(wrappedEvent)) {
+ break;
+ }
+ node = node.next;
+ }
+ setPassiveListener(wrappedEvent, null);
+ setEventPhase(wrappedEvent, 0);
+ setCurrentTarget(wrappedEvent, null);
+ return !wrappedEvent.defaultPrevented;
}
+ };
+ Object.defineProperty(EventTarget2.prototype, "constructor", {
+ value: EventTarget2,
+ configurable: true,
+ writable: true
});
- function Writable(options) {
- const isDuplex = this instanceof require_duplex();
- if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options);
- this._writableState = new WritableState(options, this, isDuplex);
- if (options) {
- if (typeof options.write === "function") this._write = options.write;
- if (typeof options.writev === "function") this._writev = options.writev;
- if (typeof options.destroy === "function") this._destroy = options.destroy;
- if (typeof options.final === "function") this._final = options.final;
- if (typeof options.construct === "function") this._construct = options.construct;
- if (options.signal) addAbortSignal(options.signal, this);
+ if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
+ Object.setPrototypeOf(EventTarget2.prototype, window.EventTarget.prototype);
+ }
+ exports2.defineEventAttribute = defineEventAttribute;
+ exports2.EventTarget = EventTarget2;
+ exports2.default = EventTarget2;
+ module2.exports = EventTarget2;
+ module2.exports.EventTarget = module2.exports["default"] = EventTarget2;
+ module2.exports.defineEventAttribute = defineEventAttribute;
+ }
+});
+
+// node_modules/abort-controller/dist/abort-controller.js
+var require_abort_controller = __commonJS({
+ "node_modules/abort-controller/dist/abort-controller.js"(exports2, module2) {
+ "use strict";
+ Object.defineProperty(exports2, "__esModule", { value: true });
+ var eventTargetShim = require_event_target_shim();
+ var AbortSignal2 = class extends eventTargetShim.EventTarget {
+ /**
+ * AbortSignal cannot be constructed directly.
+ */
+ constructor() {
+ super();
+ throw new TypeError("AbortSignal cannot be constructed directly");
}
- Stream2.call(this, options);
- destroyImpl.construct(this, () => {
- const state3 = this._writableState;
- if (!state3.writing) {
- clearBuffer(this, state3);
+ /**
+ * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
+ */
+ get aborted() {
+ const aborted = abortedFlags.get(this);
+ if (typeof aborted !== "boolean") {
+ throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
}
- finishMaybe(this, state3);
- });
- }
- ObjectDefineProperty(Writable, SymbolHasInstance, {
- __proto__: null,
- value: function(object) {
- if (FunctionPrototypeSymbolHasInstance(this, object)) return true;
- if (this !== Writable) return false;
- return object && object._writableState instanceof WritableState;
+ return aborted;
}
- });
- Writable.prototype.pipe = function() {
- errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
};
- function _write(stream4, chunk, encoding, cb) {
- const state3 = stream4._writableState;
- if (typeof encoding === "function") {
- cb = encoding;
- encoding = state3.defaultEncoding;
- } else {
- if (!encoding) encoding = state3.defaultEncoding;
- else if (encoding !== "buffer" && !Buffer3.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding);
- if (typeof cb !== "function") cb = nop;
- }
- if (chunk === null) {
- throw new ERR_STREAM_NULL_VALUES();
- } else if (!state3.objectMode) {
- if (typeof chunk === "string") {
- if (state3.decodeStrings !== false) {
- chunk = Buffer3.from(chunk, encoding);
- encoding = "buffer";
- }
- } else if (chunk instanceof Buffer3) {
- encoding = "buffer";
- } else if (Stream2._isUint8Array(chunk)) {
- chunk = Stream2._uint8ArrayToBuffer(chunk);
- encoding = "buffer";
- } else {
- throw new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
- }
+ eventTargetShim.defineEventAttribute(AbortSignal2.prototype, "abort");
+ function createAbortSignal() {
+ const signal = Object.create(AbortSignal2.prototype);
+ eventTargetShim.EventTarget.call(signal);
+ abortedFlags.set(signal, false);
+ return signal;
+ }
+ function abortSignal(signal) {
+ if (abortedFlags.get(signal) !== false) {
+ return;
}
- let err;
- if (state3.ending) {
- err = new ERR_STREAM_WRITE_AFTER_END();
- } else if (state3.destroyed) {
- err = new ERR_STREAM_DESTROYED("write");
+ abortedFlags.set(signal, true);
+ signal.dispatchEvent({ type: "abort" });
+ }
+ var abortedFlags = /* @__PURE__ */ new WeakMap();
+ Object.defineProperties(AbortSignal2.prototype, {
+ aborted: { enumerable: true }
+ });
+ if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
+ Object.defineProperty(AbortSignal2.prototype, Symbol.toStringTag, {
+ configurable: true,
+ value: "AbortSignal"
+ });
+ }
+ var AbortController2 = class {
+ /**
+ * Initialize this controller.
+ */
+ constructor() {
+ signals.set(this, createAbortSignal());
}
- if (err) {
- process5.nextTick(cb, err);
- errorOrDestroy(stream4, err, true);
- return err;
+ /**
+ * Returns the `AbortSignal` object associated with this object.
+ */
+ get signal() {
+ return getSignal(this);
}
- state3.pendingcb++;
- return writeOrBuffer(stream4, state3, chunk, encoding, cb);
- }
- Writable.prototype.write = function(chunk, encoding, cb) {
- return _write(this, chunk, encoding, cb) === true;
- };
- Writable.prototype.cork = function() {
- this._writableState.corked++;
- };
- Writable.prototype.uncork = function() {
- const state3 = this._writableState;
- if (state3.corked) {
- state3.corked--;
- if (!state3.writing) clearBuffer(this, state3);
+ /**
+ * Abort and signal to any observers that the associated activity is to be aborted.
+ */
+ abort() {
+ abortSignal(getSignal(this));
}
};
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- if (typeof encoding === "string") encoding = StringPrototypeToLowerCase(encoding);
- if (!Buffer3.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding);
- this._writableState.defaultEncoding = encoding;
- return this;
- };
- function writeOrBuffer(stream4, state3, chunk, encoding, callback) {
- const len = state3.objectMode ? 1 : chunk.length;
- state3.length += len;
- const ret = state3.length < state3.highWaterMark;
- if (!ret) state3.needDrain = true;
- if (state3.writing || state3.corked || state3.errored || !state3.constructed) {
- state3.buffered.push({
- chunk,
- encoding,
- callback
- });
- if (state3.allBuffers && encoding !== "buffer") {
- state3.allBuffers = false;
- }
- if (state3.allNoop && callback !== nop) {
- state3.allNoop = false;
- }
- } else {
- state3.writelen = len;
- state3.writecb = callback;
- state3.writing = true;
- state3.sync = true;
- stream4._write(chunk, encoding, state3.onwrite);
- state3.sync = false;
+ var signals = /* @__PURE__ */ new WeakMap();
+ function getSignal(controller) {
+ const signal = signals.get(controller);
+ if (signal == null) {
+ throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
}
- return ret && !state3.errored && !state3.destroyed;
- }
- function doWrite(stream4, state3, writev, len, chunk, encoding, cb) {
- state3.writelen = len;
- state3.writecb = cb;
- state3.writing = true;
- state3.sync = true;
- if (state3.destroyed) state3.onwrite(new ERR_STREAM_DESTROYED("write"));
- else if (writev) stream4._writev(chunk, state3.onwrite);
- else stream4._write(chunk, encoding, state3.onwrite);
- state3.sync = false;
+ return signal;
}
- function onwriteError(stream4, state3, er, cb) {
- --state3.pendingcb;
- cb(er);
- errorBuffer(state3);
- errorOrDestroy(stream4, er);
+ Object.defineProperties(AbortController2.prototype, {
+ signal: { enumerable: true },
+ abort: { enumerable: true }
+ });
+ if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
+ Object.defineProperty(AbortController2.prototype, Symbol.toStringTag, {
+ configurable: true,
+ value: "AbortController"
+ });
}
- function onwrite(stream4, er) {
- const state3 = stream4._writableState;
- const sync = state3.sync;
- const cb = state3.writecb;
- if (typeof cb !== "function") {
- errorOrDestroy(stream4, new ERR_MULTIPLE_CALLBACK());
- return;
+ exports2.AbortController = AbortController2;
+ exports2.AbortSignal = AbortSignal2;
+ exports2.default = AbortController2;
+ module2.exports = AbortController2;
+ module2.exports.AbortController = module2.exports["default"] = AbortController2;
+ module2.exports.AbortSignal = AbortSignal2;
+ }
+});
+
+// node_modules/readable-stream/lib/ours/util.js
+var require_util10 = __commonJS({
+ "node_modules/readable-stream/lib/ours/util.js"(exports2, module2) {
+ "use strict";
+ var bufferModule = require("buffer");
+ var { format, inspect: inspect2 } = require_inspect();
+ var {
+ codes: { ERR_INVALID_ARG_TYPE }
+ } = require_errors2();
+ var { kResistStopPropagation, AggregateError, SymbolDispose } = require_primordials();
+ var AbortSignal2 = globalThis.AbortSignal || require_abort_controller().AbortSignal;
+ var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
+ var AsyncFunction = Object.getPrototypeOf(async function() {
+ }).constructor;
+ var Blob2 = globalThis.Blob || bufferModule.Blob;
+ var isBlob2 = typeof Blob2 !== "undefined" ? function isBlob3(b) {
+ return b instanceof Blob2;
+ } : function isBlob3(b) {
+ return false;
+ };
+ var validateAbortSignal = (signal, name) => {
+ if (signal !== void 0 && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
+ throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
}
- state3.writing = false;
- state3.writecb = null;
- state3.length -= state3.writelen;
- state3.writelen = 0;
- if (er) {
- er.stack;
- if (!state3.errored) {
- state3.errored = er;
+ };
+ var validateFunction = (value, name) => {
+ if (typeof value !== "function") {
+ throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
+ }
+ };
+ module2.exports = {
+ AggregateError,
+ kEmptyObject: Object.freeze({}),
+ once(callback) {
+ let called = false;
+ return function(...args) {
+ if (called) {
+ return;
+ }
+ called = true;
+ callback.apply(this, args);
+ };
+ },
+ createDeferredPromise: function() {
+ let resolve7;
+ let reject;
+ const promise = new Promise((res, rej) => {
+ resolve7 = res;
+ reject = rej;
+ });
+ return {
+ promise,
+ resolve: resolve7,
+ reject
+ };
+ },
+ promisify(fn) {
+ return new Promise((resolve7, reject) => {
+ fn((err, ...args) => {
+ if (err) {
+ return reject(err);
+ }
+ return resolve7(...args);
+ });
+ });
+ },
+ debuglog() {
+ return function() {
+ };
+ },
+ format,
+ inspect: inspect2,
+ types: {
+ isAsyncFunction(fn) {
+ return fn instanceof AsyncFunction;
+ },
+ isArrayBufferView(arr) {
+ return ArrayBuffer.isView(arr);
}
- if (stream4._readableState && !stream4._readableState.errored) {
- stream4._readableState.errored = er;
+ },
+ isBlob: isBlob2,
+ deprecate(fn, message) {
+ return fn;
+ },
+ addAbortListener: require("events").addAbortListener || function addAbortListener(signal, listener) {
+ if (signal === void 0) {
+ throw new ERR_INVALID_ARG_TYPE("signal", "AbortSignal", signal);
}
- if (sync) {
- process5.nextTick(onwriteError, stream4, state3, er, cb);
+ validateAbortSignal(signal, "signal");
+ validateFunction(listener, "listener");
+ let removeEventListener;
+ if (signal.aborted) {
+ queueMicrotask(() => listener());
} else {
- onwriteError(stream4, state3, er, cb);
- }
- } else {
- if (state3.buffered.length > state3.bufferedIndex) {
- clearBuffer(stream4, state3);
+ signal.addEventListener("abort", listener, {
+ __proto__: null,
+ once: true,
+ [kResistStopPropagation]: true
+ });
+ removeEventListener = () => {
+ signal.removeEventListener("abort", listener);
+ };
}
- if (sync) {
- if (state3.afterWriteTickInfo !== null && state3.afterWriteTickInfo.cb === cb) {
- state3.afterWriteTickInfo.count++;
- } else {
- state3.afterWriteTickInfo = {
- count: 1,
- cb,
- stream: stream4,
- state: state3
- };
- process5.nextTick(afterWriteTick, state3.afterWriteTickInfo);
+ return {
+ __proto__: null,
+ [SymbolDispose]() {
+ var _removeEventListener;
+ (_removeEventListener = removeEventListener) === null || _removeEventListener === void 0 ? void 0 : _removeEventListener();
}
- } else {
- afterWrite(stream4, state3, 1, cb);
+ };
+ },
+ AbortSignalAny: AbortSignal2.any || function AbortSignalAny(signals) {
+ if (signals.length === 1) {
+ return signals[0];
}
+ const ac = new AbortController2();
+ const abort = () => ac.abort();
+ signals.forEach((signal) => {
+ validateAbortSignal(signal, "signals");
+ signal.addEventListener("abort", abort, {
+ once: true
+ });
+ });
+ ac.signal.addEventListener(
+ "abort",
+ () => {
+ signals.forEach((signal) => signal.removeEventListener("abort", abort));
+ },
+ {
+ once: true
+ }
+ );
+ return ac.signal;
}
+ };
+ module2.exports.promisify.custom = /* @__PURE__ */ Symbol.for("nodejs.util.promisify.custom");
+ }
+});
+
+// node_modules/readable-stream/lib/internal/validators.js
+var require_validators = __commonJS({
+ "node_modules/readable-stream/lib/internal/validators.js"(exports2, module2) {
+ "use strict";
+ var {
+ ArrayIsArray,
+ ArrayPrototypeIncludes,
+ ArrayPrototypeJoin,
+ ArrayPrototypeMap,
+ NumberIsInteger,
+ NumberIsNaN,
+ NumberMAX_SAFE_INTEGER,
+ NumberMIN_SAFE_INTEGER,
+ NumberParseInt,
+ ObjectPrototypeHasOwnProperty,
+ RegExpPrototypeExec,
+ String: String2,
+ StringPrototypeToUpperCase,
+ StringPrototypeTrim
+ } = require_primordials();
+ var {
+ hideStackFrames,
+ codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL }
+ } = require_errors2();
+ var { normalizeEncoding } = require_util10();
+ var { isAsyncFunction, isArrayBufferView } = require_util10().types;
+ var signals = {};
+ function isInt32(value) {
+ return value === (value | 0);
}
- function afterWriteTick({ stream: stream4, state: state3, count, cb }) {
- state3.afterWriteTickInfo = null;
- return afterWrite(stream4, state3, count, cb);
+ function isUint32(value) {
+ return value === value >>> 0;
}
- function afterWrite(stream4, state3, count, cb) {
- const needDrain = !state3.ending && !stream4.destroyed && state3.length === 0 && state3.needDrain;
- if (needDrain) {
- state3.needDrain = false;
- stream4.emit("drain");
- }
- while (count-- > 0) {
- state3.pendingcb--;
- cb();
+ var octalReg = /^[0-7]+$/;
+ var modeDesc = "must be a 32-bit unsigned integer or an octal string";
+ function parseFileMode(value, name, def) {
+ if (typeof value === "undefined") {
+ value = def;
}
- if (state3.destroyed) {
- errorBuffer(state3);
+ if (typeof value === "string") {
+ if (RegExpPrototypeExec(octalReg, value) === null) {
+ throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);
+ }
+ value = NumberParseInt(value, 8);
}
- finishMaybe(stream4, state3);
+ validateUint32(value, name);
+ return value;
}
- function errorBuffer(state3) {
- if (state3.writing) {
- return;
+ var validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {
+ if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+ });
+ var validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {
+ if (typeof value !== "number") {
+ throw new ERR_INVALID_ARG_TYPE(name, "number", value);
}
- for (let n = state3.bufferedIndex; n < state3.buffered.length; ++n) {
- var _state$errored;
- const { chunk, callback } = state3.buffered[n];
- const len = state3.objectMode ? 1 : chunk.length;
- state3.length -= len;
- callback(
- (_state$errored = state3.errored) !== null && _state$errored !== void 0 ? _state$errored : new ERR_STREAM_DESTROYED("write")
- );
+ if (!NumberIsInteger(value)) {
+ throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ }
+ if (value < min || value > max) {
+ throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+ }
+ });
+ var validateUint32 = hideStackFrames((value, name, positive = false) => {
+ if (typeof value !== "number") {
+ throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ }
+ if (!NumberIsInteger(value)) {
+ throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ }
+ const min = positive ? 1 : 0;
+ const max = 4294967295;
+ if (value < min || value > max) {
+ throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
}
- const onfinishCallbacks = state3[kOnFinished].splice(0);
- for (let i = 0; i < onfinishCallbacks.length; i++) {
- var _state$errored2;
- onfinishCallbacks[i](
- (_state$errored2 = state3.errored) !== null && _state$errored2 !== void 0 ? _state$errored2 : new ERR_STREAM_DESTROYED("end")
+ });
+ function validateString(value, name) {
+ if (typeof value !== "string") throw new ERR_INVALID_ARG_TYPE(name, "string", value);
+ }
+ function validateNumber(value, name, min = void 0, max) {
+ if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ if (min != null && value < min || max != null && value > max || (min != null || max != null) && NumberIsNaN(value)) {
+ throw new ERR_OUT_OF_RANGE(
+ name,
+ `${min != null ? `>= ${min}` : ""}${min != null && max != null ? " && " : ""}${max != null ? `<= ${max}` : ""}`,
+ value
);
}
- resetBuffer(state3);
}
- function clearBuffer(stream4, state3) {
- if (state3.corked || state3.bufferProcessing || state3.destroyed || !state3.constructed) {
- return;
- }
- const { buffered, bufferedIndex, objectMode } = state3;
- const bufferedLength = buffered.length - bufferedIndex;
- if (!bufferedLength) {
- return;
- }
- let i = bufferedIndex;
- state3.bufferProcessing = true;
- if (bufferedLength > 1 && stream4._writev) {
- state3.pendingcb -= bufferedLength - 1;
- const callback = state3.allNoop ? nop : (err) => {
- for (let n = i; n < buffered.length; ++n) {
- buffered[n].callback(err);
- }
- };
- const chunks = state3.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i);
- chunks.allBuffers = state3.allBuffers;
- doWrite(stream4, state3, true, state3.length, chunks, "", callback);
- resetBuffer(state3);
- } else {
- do {
- const { chunk, encoding, callback } = buffered[i];
- buffered[i++] = null;
- const len = objectMode ? 1 : chunk.length;
- doWrite(stream4, state3, false, len, chunk, encoding, callback);
- } while (i < buffered.length && !state3.writing);
- if (i === buffered.length) {
- resetBuffer(state3);
- } else if (i > 256) {
- buffered.splice(0, i);
- state3.bufferedIndex = 0;
- } else {
- state3.bufferedIndex = i;
- }
+ var validateOneOf = hideStackFrames((value, name, oneOf) => {
+ if (!ArrayPrototypeIncludes(oneOf, value)) {
+ const allowed = ArrayPrototypeJoin(
+ ArrayPrototypeMap(oneOf, (v) => typeof v === "string" ? `'${v}'` : String2(v)),
+ ", "
+ );
+ const reason = "must be one of: " + allowed;
+ throw new ERR_INVALID_ARG_VALUE(name, value, reason);
}
- state3.bufferProcessing = false;
+ });
+ function validateBoolean(value, name) {
+ if (typeof value !== "boolean") throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
}
- Writable.prototype._write = function(chunk, encoding, cb) {
- if (this._writev) {
- this._writev(
- [
- {
- chunk,
- encoding
- }
- ],
- cb
- );
- } else {
- throw new ERR_METHOD_NOT_IMPLEMENTED("_write()");
+ function getOwnPropertyValueOrDefault(options, key, defaultValue) {
+ return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key];
+ }
+ var validateObject = hideStackFrames((value, name, options = null) => {
+ const allowArray = getOwnPropertyValueOrDefault(options, "allowArray", false);
+ const allowFunction = getOwnPropertyValueOrDefault(options, "allowFunction", false);
+ const nullable = getOwnPropertyValueOrDefault(options, "nullable", false);
+ if (!nullable && value === null || !allowArray && ArrayIsArray(value) || typeof value !== "object" && (!allowFunction || typeof value !== "function")) {
+ throw new ERR_INVALID_ARG_TYPE(name, "Object", value);
}
- };
- Writable.prototype._writev = null;
- Writable.prototype.end = function(chunk, encoding, cb) {
- const state3 = this._writableState;
- if (typeof chunk === "function") {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === "function") {
- cb = encoding;
- encoding = null;
+ });
+ var validateDictionary = hideStackFrames((value, name) => {
+ if (value != null && typeof value !== "object" && typeof value !== "function") {
+ throw new ERR_INVALID_ARG_TYPE(name, "a dictionary", value);
}
- let err;
- if (chunk !== null && chunk !== void 0) {
- const ret = _write(this, chunk, encoding);
- if (ret instanceof Error2) {
- err = ret;
- }
+ });
+ var validateArray = hideStackFrames((value, name, minLength = 0) => {
+ if (!ArrayIsArray(value)) {
+ throw new ERR_INVALID_ARG_TYPE(name, "Array", value);
}
- if (state3.corked) {
- state3.corked = 1;
- this.uncork();
+ if (value.length < minLength) {
+ const reason = `must be longer than ${minLength}`;
+ throw new ERR_INVALID_ARG_VALUE(name, value, reason);
}
- if (err) {
- } else if (!state3.errored && !state3.ending) {
- state3.ending = true;
- finishMaybe(this, state3, true);
- state3.ended = true;
- } else if (state3.finished) {
- err = new ERR_STREAM_ALREADY_FINISHED("end");
- } else if (state3.destroyed) {
- err = new ERR_STREAM_DESTROYED("end");
+ });
+ function validateStringArray(value, name) {
+ validateArray(value, name);
+ for (let i = 0; i < value.length; i++) {
+ validateString(value[i], `${name}[${i}]`);
}
- if (typeof cb === "function") {
- if (err || state3.finished) {
- process5.nextTick(cb, err);
- } else {
- state3[kOnFinished].push(cb);
- }
+ }
+ function validateBooleanArray(value, name) {
+ validateArray(value, name);
+ for (let i = 0; i < value.length; i++) {
+ validateBoolean(value[i], `${name}[${i}]`);
}
- return this;
- };
- function needFinish(state3) {
- return state3.ending && !state3.destroyed && state3.constructed && state3.length === 0 && !state3.errored && state3.buffered.length === 0 && !state3.finished && !state3.writing && !state3.errorEmitted && !state3.closeEmitted;
}
- function callFinal(stream4, state3) {
- let called = false;
- function onFinish(err) {
- if (called) {
- errorOrDestroy(stream4, err !== null && err !== void 0 ? err : ERR_MULTIPLE_CALLBACK());
- return;
- }
- called = true;
- state3.pendingcb--;
- if (err) {
- const onfinishCallbacks = state3[kOnFinished].splice(0);
- for (let i = 0; i < onfinishCallbacks.length; i++) {
- onfinishCallbacks[i](err);
- }
- errorOrDestroy(stream4, err, state3.sync);
- } else if (needFinish(state3)) {
- state3.prefinished = true;
- stream4.emit("prefinish");
- state3.pendingcb++;
- process5.nextTick(finish, stream4, state3);
+ function validateAbortSignalArray(value, name) {
+ validateArray(value, name);
+ for (let i = 0; i < value.length; i++) {
+ const signal = value[i];
+ const indexedName = `${name}[${i}]`;
+ if (signal == null) {
+ throw new ERR_INVALID_ARG_TYPE(indexedName, "AbortSignal", signal);
}
+ validateAbortSignal(signal, indexedName);
}
- state3.sync = true;
- state3.pendingcb++;
- try {
- stream4._final(onFinish);
- } catch (err) {
- onFinish(err);
- }
- state3.sync = false;
}
- function prefinish(stream4, state3) {
- if (!state3.prefinished && !state3.finalCalled) {
- if (typeof stream4._final === "function" && !state3.destroyed) {
- state3.finalCalled = true;
- callFinal(stream4, state3);
- } else {
- state3.prefinished = true;
- stream4.emit("prefinish");
+ function validateSignalName(signal, name = "signal") {
+ validateString(signal, name);
+ if (signals[signal] === void 0) {
+ if (signals[StringPrototypeToUpperCase(signal)] !== void 0) {
+ throw new ERR_UNKNOWN_SIGNAL(signal + " (signals must use all capital letters)");
}
+ throw new ERR_UNKNOWN_SIGNAL(signal);
}
}
- function finishMaybe(stream4, state3, sync) {
- if (needFinish(state3)) {
- prefinish(stream4, state3);
- if (state3.pendingcb === 0) {
- if (sync) {
- state3.pendingcb++;
- process5.nextTick(
- (stream5, state4) => {
- if (needFinish(state4)) {
- finish(stream5, state4);
- } else {
- state4.pendingcb--;
- }
- },
- stream4,
- state3
- );
- } else if (needFinish(state3)) {
- state3.pendingcb++;
- finish(stream4, state3);
- }
- }
+ var validateBuffer = hideStackFrames((buffer2, name = "buffer") => {
+ if (!isArrayBufferView(buffer2)) {
+ throw new ERR_INVALID_ARG_TYPE(name, ["Buffer", "TypedArray", "DataView"], buffer2);
+ }
+ });
+ function validateEncoding(data, encoding) {
+ const normalizedEncoding = normalizeEncoding(encoding);
+ const length = data.length;
+ if (normalizedEncoding === "hex" && length % 2 !== 0) {
+ throw new ERR_INVALID_ARG_VALUE("encoding", encoding, `is invalid for data of length ${length}`);
}
}
- function finish(stream4, state3) {
- state3.pendingcb--;
- state3.finished = true;
- const onfinishCallbacks = state3[kOnFinished].splice(0);
- for (let i = 0; i < onfinishCallbacks.length; i++) {
- onfinishCallbacks[i]();
+ function validatePort(port, name = "Port", allowZero = true) {
+ if (typeof port !== "number" && typeof port !== "string" || typeof port === "string" && StringPrototypeTrim(port).length === 0 || +port !== +port >>> 0 || port > 65535 || port === 0 && !allowZero) {
+ throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);
+ }
+ return port | 0;
+ }
+ var validateAbortSignal = hideStackFrames((signal, name) => {
+ if (signal !== void 0 && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
+ throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
+ }
+ });
+ var validateFunction = hideStackFrames((value, name) => {
+ if (typeof value !== "function") throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
+ });
+ var validatePlainFunction = hideStackFrames((value, name) => {
+ if (typeof value !== "function" || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
+ });
+ var validateUndefined = hideStackFrames((value, name) => {
+ if (value !== void 0) throw new ERR_INVALID_ARG_TYPE(name, "undefined", value);
+ });
+ function validateUnion(value, name, union) {
+ if (!ArrayPrototypeIncludes(union, value)) {
+ throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, "|")}')`, value);
}
- stream4.emit("finish");
- if (state3.autoDestroy) {
- const rState = stream4._readableState;
- const autoDestroy = !rState || rState.autoDestroy && // We don't expect the readable to ever 'end'
- // if readable is explicitly set to false.
- (rState.endEmitted || rState.readable === false);
- if (autoDestroy) {
- stream4.destroy();
- }
+ }
+ var linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;
+ function validateLinkHeaderFormat(value, name) {
+ if (typeof value === "undefined" || !RegExpPrototypeExec(linkValueRegExp, value)) {
+ throw new ERR_INVALID_ARG_VALUE(
+ name,
+ value,
+ 'must be an array or string of format "</styles.css>; rel=preload; as=style"'
+ );
}
}
- ObjectDefineProperties(Writable.prototype, {
- closed: {
- __proto__: null,
- get() {
- return this._writableState ? this._writableState.closed : false;
- }
- },
- destroyed: {
- __proto__: null,
- get() {
- return this._writableState ? this._writableState.destroyed : false;
- },
- set(value) {
- if (this._writableState) {
- this._writableState.destroyed = value;
- }
+ function validateLinkHeaderValue(hints) {
+ if (typeof hints === "string") {
+ validateLinkHeaderFormat(hints, "hints");
+ return hints;
+ } else if (ArrayIsArray(hints)) {
+ const hintsLength = hints.length;
+ let result = "";
+ if (hintsLength === 0) {
+ return result;
}
- },
- writable: {
- __proto__: null,
- get() {
- const w = this._writableState;
- return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended;
- },
- set(val) {
- if (this._writableState) {
- this._writableState.writable = !!val;
+ for (let i = 0; i < hintsLength; i++) {
+ const link = hints[i];
+ validateLinkHeaderFormat(link, "hints");
+ result += link;
+ if (i !== hintsLength - 1) {
+ result += ", ";
}
}
- },
- writableFinished: {
- __proto__: null,
- get() {
- return this._writableState ? this._writableState.finished : false;
- }
- },
- writableObjectMode: {
- __proto__: null,
- get() {
- return this._writableState ? this._writableState.objectMode : false;
- }
- },
- writableBuffer: {
- __proto__: null,
- get() {
- return this._writableState && this._writableState.getBuffer();
- }
- },
- writableEnded: {
- __proto__: null,
- get() {
- return this._writableState ? this._writableState.ending : false;
- }
- },
- writableNeedDrain: {
- __proto__: null,
- get() {
- const wState = this._writableState;
- if (!wState) return false;
- return !wState.destroyed && !wState.ending && wState.needDrain;
- }
- },
- writableHighWaterMark: {
- __proto__: null,
- get() {
- return this._writableState && this._writableState.highWaterMark;
- }
- },
- writableCorked: {
- __proto__: null,
- get() {
- return this._writableState ? this._writableState.corked : 0;
- }
- },
- writableLength: {
- __proto__: null,
- get() {
- return this._writableState && this._writableState.length;
- }
- },
- errored: {
- __proto__: null,
- enumerable: false,
- get() {
- return this._writableState ? this._writableState.errored : null;
- }
- },
- writableAborted: {
- __proto__: null,
- enumerable: false,
- get: function() {
- return !!(this._writableState.writable !== false && (this._writableState.destroyed || this._writableState.errored) && !this._writableState.finished);
- }
+ return result;
+ }
+ throw new ERR_INVALID_ARG_VALUE(
+ "hints",
+ hints,
+ 'must be an array or string of format "</styles.css>; rel=preload; as=style"'
+ );
+ }
+ module2.exports = {
+ isInt32,
+ isUint32,
+ parseFileMode,
+ validateArray,
+ validateStringArray,
+ validateBooleanArray,
+ validateAbortSignalArray,
+ validateBoolean,
+ validateBuffer,
+ validateDictionary,
+ validateEncoding,
+ validateFunction,
+ validateInt32,
+ validateInteger,
+ validateNumber,
+ validateObject,
+ validateOneOf,
+ validatePlainFunction,
+ validatePort,
+ validateSignalName,
+ validateString,
+ validateUint32,
+ validateUndefined,
+ validateUnion,
+ validateAbortSignal,
+ validateLinkHeaderValue
+ };
+ }
+});
+
+// node_modules/process/index.js
+var require_process = __commonJS({
+ "node_modules/process/index.js"(exports2, module2) {
+ module2.exports = global.process;
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/utils.js
+var require_utils2 = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/utils.js"(exports2, module2) {
+ "use strict";
+ var { SymbolAsyncIterator, SymbolIterator, SymbolFor } = require_primordials();
+ var kIsDestroyed = SymbolFor("nodejs.stream.destroyed");
+ var kIsErrored = SymbolFor("nodejs.stream.errored");
+ var kIsReadable = SymbolFor("nodejs.stream.readable");
+ var kIsWritable = SymbolFor("nodejs.stream.writable");
+ var kIsDisturbed = SymbolFor("nodejs.stream.disturbed");
+ var kIsClosedPromise = SymbolFor("nodejs.webstream.isClosedPromise");
+ var kControllerErrorFunction = SymbolFor("nodejs.webstream.controllerErrorFunction");
+ function isReadableNodeStream(obj, strict = false) {
+ var _obj$_readableState;
+ return !!(obj && typeof obj.pipe === "function" && typeof obj.on === "function" && (!strict || typeof obj.pause === "function" && typeof obj.resume === "function") && (!obj._writableState || ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === void 0 ? void 0 : _obj$_readableState.readable) !== false) && // Duplex
+ (!obj._writableState || obj._readableState));
+ }
+ function isWritableNodeStream(obj) {
+ var _obj$_writableState;
+ return !!(obj && typeof obj.write === "function" && typeof obj.on === "function" && (!obj._readableState || ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === void 0 ? void 0 : _obj$_writableState.writable) !== false));
+ }
+ function isDuplexNodeStream(obj) {
+ return !!(obj && typeof obj.pipe === "function" && obj._readableState && typeof obj.on === "function" && typeof obj.write === "function");
+ }
+ function isNodeStream(obj) {
+ return obj && (obj._readableState || obj._writableState || typeof obj.write === "function" && typeof obj.on === "function" || typeof obj.pipe === "function" && typeof obj.on === "function");
+ }
+ function isReadableStream3(obj) {
+ return !!(obj && !isNodeStream(obj) && typeof obj.pipeThrough === "function" && typeof obj.getReader === "function" && typeof obj.cancel === "function");
+ }
+ function isWritableStream(obj) {
+ return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === "function" && typeof obj.abort === "function");
+ }
+ function isTransformStream(obj) {
+ return !!(obj && !isNodeStream(obj) && typeof obj.readable === "object" && typeof obj.writable === "object");
+ }
+ function isWebStream(obj) {
+ return isReadableStream3(obj) || isWritableStream(obj) || isTransformStream(obj);
+ }
+ function isIterable(obj, isAsync) {
+ if (obj == null) return false;
+ if (isAsync === true) return typeof obj[SymbolAsyncIterator] === "function";
+ if (isAsync === false) return typeof obj[SymbolIterator] === "function";
+ return typeof obj[SymbolAsyncIterator] === "function" || typeof obj[SymbolIterator] === "function";
+ }
+ function isDestroyed(stream4) {
+ if (!isNodeStream(stream4)) return null;
+ const wState = stream4._writableState;
+ const rState = stream4._readableState;
+ const state3 = wState || rState;
+ return !!(stream4.destroyed || stream4[kIsDestroyed] || state3 !== null && state3 !== void 0 && state3.destroyed);
+ }
+ function isWritableEnded(stream4) {
+ if (!isWritableNodeStream(stream4)) return null;
+ if (stream4.writableEnded === true) return true;
+ const wState = stream4._writableState;
+ if (wState !== null && wState !== void 0 && wState.errored) return false;
+ if (typeof (wState === null || wState === void 0 ? void 0 : wState.ended) !== "boolean") return null;
+ return wState.ended;
+ }
+ function isWritableFinished(stream4, strict) {
+ if (!isWritableNodeStream(stream4)) return null;
+ if (stream4.writableFinished === true) return true;
+ const wState = stream4._writableState;
+ if (wState !== null && wState !== void 0 && wState.errored) return false;
+ if (typeof (wState === null || wState === void 0 ? void 0 : wState.finished) !== "boolean") return null;
+ return !!(wState.finished || strict === false && wState.ended === true && wState.length === 0);
+ }
+ function isReadableEnded(stream4) {
+ if (!isReadableNodeStream(stream4)) return null;
+ if (stream4.readableEnded === true) return true;
+ const rState = stream4._readableState;
+ if (!rState || rState.errored) return false;
+ if (typeof (rState === null || rState === void 0 ? void 0 : rState.ended) !== "boolean") return null;
+ return rState.ended;
+ }
+ function isReadableFinished(stream4, strict) {
+ if (!isReadableNodeStream(stream4)) return null;
+ const rState = stream4._readableState;
+ if (rState !== null && rState !== void 0 && rState.errored) return false;
+ if (typeof (rState === null || rState === void 0 ? void 0 : rState.endEmitted) !== "boolean") return null;
+ return !!(rState.endEmitted || strict === false && rState.ended === true && rState.length === 0);
+ }
+ function isReadable(stream4) {
+ if (stream4 && stream4[kIsReadable] != null) return stream4[kIsReadable];
+ if (typeof (stream4 === null || stream4 === void 0 ? void 0 : stream4.readable) !== "boolean") return null;
+ if (isDestroyed(stream4)) return false;
+ return isReadableNodeStream(stream4) && stream4.readable && !isReadableFinished(stream4);
+ }
+ function isWritable(stream4) {
+ if (stream4 && stream4[kIsWritable] != null) return stream4[kIsWritable];
+ if (typeof (stream4 === null || stream4 === void 0 ? void 0 : stream4.writable) !== "boolean") return null;
+ if (isDestroyed(stream4)) return false;
+ return isWritableNodeStream(stream4) && stream4.writable && !isWritableEnded(stream4);
+ }
+ function isFinished(stream4, opts) {
+ if (!isNodeStream(stream4)) {
+ return null;
}
- });
- var destroy2 = destroyImpl.destroy;
- Writable.prototype.destroy = function(err, cb) {
- const state3 = this._writableState;
- if (!state3.destroyed && (state3.bufferedIndex < state3.buffered.length || state3[kOnFinished].length)) {
- process5.nextTick(errorBuffer, state3);
+ if (isDestroyed(stream4)) {
+ return true;
}
- destroy2.call(this, err, cb);
- return this;
- };
- Writable.prototype._undestroy = destroyImpl.undestroy;
- Writable.prototype._destroy = function(err, cb) {
- cb(err);
- };
- Writable.prototype[EE.captureRejectionSymbol] = function(err) {
- this.destroy(err);
- };
- var webStreamsAdapters;
- function lazyWebStreams() {
- if (webStreamsAdapters === void 0) webStreamsAdapters = {};
- return webStreamsAdapters;
+ if ((opts === null || opts === void 0 ? void 0 : opts.readable) !== false && isReadable(stream4)) {
+ return false;
+ }
+ if ((opts === null || opts === void 0 ? void 0 : opts.writable) !== false && isWritable(stream4)) {
+ return false;
+ }
+ return true;
}
- Writable.fromWeb = function(writableStream, options) {
- return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options);
- };
- Writable.toWeb = function(streamWritable) {
- return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);
+ function isWritableErrored(stream4) {
+ var _stream$_writableStat, _stream$_writableStat2;
+ if (!isNodeStream(stream4)) {
+ return null;
+ }
+ if (stream4.writableErrored) {
+ return stream4.writableErrored;
+ }
+ return (_stream$_writableStat = (_stream$_writableStat2 = stream4._writableState) === null || _stream$_writableStat2 === void 0 ? void 0 : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== void 0 ? _stream$_writableStat : null;
+ }
+ function isReadableErrored(stream4) {
+ var _stream$_readableStat, _stream$_readableStat2;
+ if (!isNodeStream(stream4)) {
+ return null;
+ }
+ if (stream4.readableErrored) {
+ return stream4.readableErrored;
+ }
+ return (_stream$_readableStat = (_stream$_readableStat2 = stream4._readableState) === null || _stream$_readableStat2 === void 0 ? void 0 : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== void 0 ? _stream$_readableStat : null;
+ }
+ function isClosed(stream4) {
+ if (!isNodeStream(stream4)) {
+ return null;
+ }
+ if (typeof stream4.closed === "boolean") {
+ return stream4.closed;
+ }
+ const wState = stream4._writableState;
+ const rState = stream4._readableState;
+ if (typeof (wState === null || wState === void 0 ? void 0 : wState.closed) === "boolean" || typeof (rState === null || rState === void 0 ? void 0 : rState.closed) === "boolean") {
+ return (wState === null || wState === void 0 ? void 0 : wState.closed) || (rState === null || rState === void 0 ? void 0 : rState.closed);
+ }
+ if (typeof stream4._closed === "boolean" && isOutgoingMessage(stream4)) {
+ return stream4._closed;
+ }
+ return null;
+ }
+ function isOutgoingMessage(stream4) {
+ return typeof stream4._closed === "boolean" && typeof stream4._defaultKeepAlive === "boolean" && typeof stream4._removedConnection === "boolean" && typeof stream4._removedContLen === "boolean";
+ }
+ function isServerResponse(stream4) {
+ return typeof stream4._sent100 === "boolean" && isOutgoingMessage(stream4);
+ }
+ function isServerRequest(stream4) {
+ var _stream$req;
+ return typeof stream4._consuming === "boolean" && typeof stream4._dumped === "boolean" && ((_stream$req = stream4.req) === null || _stream$req === void 0 ? void 0 : _stream$req.upgradeOrConnect) === void 0;
+ }
+ function willEmitClose(stream4) {
+ if (!isNodeStream(stream4)) return null;
+ const wState = stream4._writableState;
+ const rState = stream4._readableState;
+ const state3 = wState || rState;
+ return !state3 && isServerResponse(stream4) || !!(state3 && state3.autoDestroy && state3.emitClose && state3.closed === false);
+ }
+ function isDisturbed(stream4) {
+ var _stream$kIsDisturbed;
+ return !!(stream4 && ((_stream$kIsDisturbed = stream4[kIsDisturbed]) !== null && _stream$kIsDisturbed !== void 0 ? _stream$kIsDisturbed : stream4.readableDidRead || stream4.readableAborted));
+ }
+ function isErrored(stream4) {
+ var _ref, _ref2, _ref3, _ref4, _ref5, _stream$kIsErrored, _stream$_readableStat3, _stream$_writableStat3, _stream$_readableStat4, _stream$_writableStat4;
+ return !!(stream4 && ((_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_stream$kIsErrored = stream4[kIsErrored]) !== null && _stream$kIsErrored !== void 0 ? _stream$kIsErrored : stream4.readableErrored) !== null && _ref5 !== void 0 ? _ref5 : stream4.writableErrored) !== null && _ref4 !== void 0 ? _ref4 : (_stream$_readableStat3 = stream4._readableState) === null || _stream$_readableStat3 === void 0 ? void 0 : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== void 0 ? _ref3 : (_stream$_writableStat3 = stream4._writableState) === null || _stream$_writableStat3 === void 0 ? void 0 : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== void 0 ? _ref2 : (_stream$_readableStat4 = stream4._readableState) === null || _stream$_readableStat4 === void 0 ? void 0 : _stream$_readableStat4.errored) !== null && _ref !== void 0 ? _ref : (_stream$_writableStat4 = stream4._writableState) === null || _stream$_writableStat4 === void 0 ? void 0 : _stream$_writableStat4.errored));
+ }
+ module2.exports = {
+ isDestroyed,
+ kIsDestroyed,
+ isDisturbed,
+ kIsDisturbed,
+ isErrored,
+ kIsErrored,
+ isReadable,
+ kIsReadable,
+ kIsClosedPromise,
+ kControllerErrorFunction,
+ kIsWritable,
+ isClosed,
+ isDuplexNodeStream,
+ isFinished,
+ isIterable,
+ isReadableNodeStream,
+ isReadableStream: isReadableStream3,
+ isReadableEnded,
+ isReadableFinished,
+ isReadableErrored,
+ isNodeStream,
+ isWebStream,
+ isWritable,
+ isWritableNodeStream,
+ isWritableStream,
+ isWritableEnded,
+ isWritableFinished,
+ isWritableErrored,
+ isServerRequest,
+ isServerResponse,
+ willEmitClose,
+ isTransformStream
};
}
});
-// node_modules/readable-stream/lib/internal/streams/duplexify.js
-var require_duplexify = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/duplexify.js"(exports2, module2) {
+// node_modules/readable-stream/lib/internal/streams/end-of-stream.js
+var require_end_of_stream = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2, module2) {
+ "use strict";
var process5 = require_process();
- var bufferModule = require("buffer");
+ var { AbortError: AbortError3, codes } = require_errors2();
+ var { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes;
+ var { kEmptyObject, once } = require_util10();
+ var { validateAbortSignal, validateFunction, validateObject, validateBoolean } = require_validators();
+ var { Promise: Promise2, PromisePrototypeThen, SymbolDispose } = require_primordials();
var {
+ isClosed,
isReadable,
- isWritable,
- isIterable,
- isNodeStream,
isReadableNodeStream,
- isWritableNodeStream,
- isDuplexNodeStream,
isReadableStream: isReadableStream3,
- isWritableStream
+ isReadableFinished,
+ isReadableErrored,
+ isWritable,
+ isWritableNodeStream,
+ isWritableStream,
+ isWritableFinished,
+ isWritableErrored,
+ isNodeStream,
+ willEmitClose: _willEmitClose,
+ kIsClosedPromise
} = require_utils2();
- var eos = require_end_of_stream();
- var {
- AbortError: AbortError3,
- codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE }
- } = require_errors2();
- var { destroyer } = require_destroy2();
- var Duplex = require_duplex();
- var Readable7 = require_readable3();
- var Writable = require_writable();
- var { createDeferredPromise } = require_util10();
- var from = require_from();
- var Blob2 = globalThis.Blob || bufferModule.Blob;
- var isBlob2 = typeof Blob2 !== "undefined" ? function isBlob3(b) {
- return b instanceof Blob2;
- } : function isBlob3(b) {
- return false;
+ var addAbortListener;
+ function isRequest(stream4) {
+ return stream4.setHeader && typeof stream4.abort === "function";
+ }
+ var nop = () => {
};
- var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
- var { FunctionPrototypeCall } = require_primordials();
- var Duplexify = class extends Duplex {
- constructor(options) {
- super(options);
- if ((options === null || options === void 0 ? void 0 : options.readable) === false) {
- this._readableState.readable = false;
- this._readableState.ended = true;
- this._readableState.endEmitted = true;
+ function eos(stream4, options, callback) {
+ var _options$readable, _options$writable;
+ if (arguments.length === 2) {
+ callback = options;
+ options = kEmptyObject;
+ } else if (options == null) {
+ options = kEmptyObject;
+ } else {
+ validateObject(options, "options");
+ }
+ validateFunction(callback, "callback");
+ validateAbortSignal(options.signal, "options.signal");
+ callback = once(callback);
+ if (isReadableStream3(stream4) || isWritableStream(stream4)) {
+ return eosWeb(stream4, options, callback);
+ }
+ if (!isNodeStream(stream4)) {
+ throw new ERR_INVALID_ARG_TYPE("stream", ["ReadableStream", "WritableStream", "Stream"], stream4);
+ }
+ const readable = (_options$readable = options.readable) !== null && _options$readable !== void 0 ? _options$readable : isReadableNodeStream(stream4);
+ const writable = (_options$writable = options.writable) !== null && _options$writable !== void 0 ? _options$writable : isWritableNodeStream(stream4);
+ const wState = stream4._writableState;
+ const rState = stream4._readableState;
+ const onlegacyfinish = () => {
+ if (!stream4.writable) {
+ onfinish();
+ }
+ };
+ let willEmitClose = _willEmitClose(stream4) && isReadableNodeStream(stream4) === readable && isWritableNodeStream(stream4) === writable;
+ let writableFinished = isWritableFinished(stream4, false);
+ const onfinish = () => {
+ writableFinished = true;
+ if (stream4.destroyed) {
+ willEmitClose = false;
+ }
+ if (willEmitClose && (!stream4.readable || readable)) {
+ return;
+ }
+ if (!readable || readableFinished) {
+ callback.call(stream4);
+ }
+ };
+ let readableFinished = isReadableFinished(stream4, false);
+ const onend = () => {
+ readableFinished = true;
+ if (stream4.destroyed) {
+ willEmitClose = false;
+ }
+ if (willEmitClose && (!stream4.writable || writable)) {
+ return;
+ }
+ if (!writable || writableFinished) {
+ callback.call(stream4);
}
- if ((options === null || options === void 0 ? void 0 : options.writable) === false) {
- this._writableState.writable = false;
- this._writableState.ending = true;
- this._writableState.ended = true;
- this._writableState.finished = true;
+ };
+ const onerror = (err) => {
+ callback.call(stream4, err);
+ };
+ let closed = isClosed(stream4);
+ const onclose = () => {
+ closed = true;
+ const errored = isWritableErrored(stream4) || isReadableErrored(stream4);
+ if (errored && typeof errored !== "boolean") {
+ return callback.call(stream4, errored);
}
- }
- };
- module2.exports = function duplexify(body2, name) {
- if (isDuplexNodeStream(body2)) {
- return body2;
- }
- if (isReadableNodeStream(body2)) {
- return _duplexify({
- readable: body2
- });
- }
- if (isWritableNodeStream(body2)) {
- return _duplexify({
- writable: body2
- });
- }
- if (isNodeStream(body2)) {
- return _duplexify({
- writable: false,
- readable: false
- });
- }
- if (isReadableStream3(body2)) {
- return _duplexify({
- readable: Readable7.fromWeb(body2)
- });
- }
- if (isWritableStream(body2)) {
- return _duplexify({
- writable: Writable.fromWeb(body2)
- });
- }
- if (typeof body2 === "function") {
- const { value, write, final, destroy: destroy2 } = fromAsyncGen(body2);
- if (isIterable(value)) {
- return from(Duplexify, value, {
- // TODO (ronag): highWaterMark?
- objectMode: true,
- write,
- final,
- destroy: destroy2
- });
+ if (readable && !readableFinished && isReadableNodeStream(stream4, true)) {
+ if (!isReadableFinished(stream4, false)) return callback.call(stream4, new ERR_STREAM_PREMATURE_CLOSE());
}
- const then2 = value === null || value === void 0 ? void 0 : value.then;
- if (typeof then2 === "function") {
- let d;
- const promise = FunctionPrototypeCall(
- then2,
- value,
- (val) => {
- if (val != null) {
- throw new ERR_INVALID_RETURN_VALUE("nully", "body", val);
- }
- },
- (err) => {
- destroyer(d, err);
- }
- );
- return d = new Duplexify({
- // TODO (ronag): highWaterMark?
- objectMode: true,
- readable: false,
- write,
- final(cb) {
- final(async () => {
- try {
- await promise;
- process5.nextTick(cb, null);
- } catch (err) {
- process5.nextTick(cb, err);
- }
- });
- },
- destroy: destroy2
- });
+ if (writable && !writableFinished) {
+ if (!isWritableFinished(stream4, false)) return callback.call(stream4, new ERR_STREAM_PREMATURE_CLOSE());
}
- throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or AsyncFunction", name, value);
- }
- if (isBlob2(body2)) {
- return duplexify(body2.arrayBuffer());
- }
- if (isIterable(body2)) {
- return from(Duplexify, body2, {
- // TODO (ronag): highWaterMark?
- objectMode: true,
- writable: false
- });
- }
- if (isReadableStream3(body2 === null || body2 === void 0 ? void 0 : body2.readable) && isWritableStream(body2 === null || body2 === void 0 ? void 0 : body2.writable)) {
- return Duplexify.fromWeb(body2);
+ callback.call(stream4);
+ };
+ const onclosed = () => {
+ closed = true;
+ const errored = isWritableErrored(stream4) || isReadableErrored(stream4);
+ if (errored && typeof errored !== "boolean") {
+ return callback.call(stream4, errored);
+ }
+ callback.call(stream4);
+ };
+ const onrequest = () => {
+ stream4.req.on("finish", onfinish);
+ };
+ if (isRequest(stream4)) {
+ stream4.on("complete", onfinish);
+ if (!willEmitClose) {
+ stream4.on("abort", onclose);
+ }
+ if (stream4.req) {
+ onrequest();
+ } else {
+ stream4.on("request", onrequest);
+ }
+ } else if (writable && !wState) {
+ stream4.on("end", onlegacyfinish);
+ stream4.on("close", onlegacyfinish);
}
- if (typeof (body2 === null || body2 === void 0 ? void 0 : body2.writable) === "object" || typeof (body2 === null || body2 === void 0 ? void 0 : body2.readable) === "object") {
- const readable = body2 !== null && body2 !== void 0 && body2.readable ? isReadableNodeStream(body2 === null || body2 === void 0 ? void 0 : body2.readable) ? body2 === null || body2 === void 0 ? void 0 : body2.readable : duplexify(body2.readable) : void 0;
- const writable = body2 !== null && body2 !== void 0 && body2.writable ? isWritableNodeStream(body2 === null || body2 === void 0 ? void 0 : body2.writable) ? body2 === null || body2 === void 0 ? void 0 : body2.writable : duplexify(body2.writable) : void 0;
- return _duplexify({
- readable,
- writable
- });
+ if (!willEmitClose && typeof stream4.aborted === "boolean") {
+ stream4.on("aborted", onclose);
}
- const then = body2 === null || body2 === void 0 ? void 0 : body2.then;
- if (typeof then === "function") {
- let d;
- FunctionPrototypeCall(
- then,
- body2,
- (val) => {
- if (val != null) {
- d.push(val);
- }
- d.push(null);
- },
- (err) => {
- destroyer(d, err);
- }
- );
- return d = new Duplexify({
- objectMode: true,
- writable: false,
- read() {
- }
- });
+ stream4.on("end", onend);
+ stream4.on("finish", onfinish);
+ if (options.error !== false) {
+ stream4.on("error", onerror);
}
- throw new ERR_INVALID_ARG_TYPE(
- name,
- [
- "Blob",
- "ReadableStream",
- "WritableStream",
- "Stream",
- "Iterable",
- "AsyncIterable",
- "Function",
- "{ readable, writable } pair",
- "Promise"
- ],
- body2
- );
- };
- function fromAsyncGen(fn) {
- let { promise, resolve: resolve7 } = createDeferredPromise();
- const ac = new AbortController2();
- const signal = ac.signal;
- const value = fn(
- (async function* () {
- while (true) {
- const _promise = promise;
- promise = null;
- const { chunk, done, cb } = await _promise;
- process5.nextTick(cb);
- if (done) return;
- if (signal.aborted)
- throw new AbortError3(void 0, {
- cause: signal.reason
- });
- ({ promise, resolve: resolve7 } = createDeferredPromise());
- yield chunk;
- }
- })(),
- {
- signal
+ stream4.on("close", onclose);
+ if (closed) {
+ process5.nextTick(onclose);
+ } else if (wState !== null && wState !== void 0 && wState.errorEmitted || rState !== null && rState !== void 0 && rState.errorEmitted) {
+ if (!willEmitClose) {
+ process5.nextTick(onclosed);
}
- );
- return {
- value,
- write(chunk, encoding, cb) {
- const _resolve = resolve7;
- resolve7 = null;
- _resolve({
- chunk,
- done: false,
- cb
+ } else if (!readable && (!willEmitClose || isReadable(stream4)) && (writableFinished || isWritable(stream4) === false)) {
+ process5.nextTick(onclosed);
+ } else if (!writable && (!willEmitClose || isWritable(stream4)) && (readableFinished || isReadable(stream4) === false)) {
+ process5.nextTick(onclosed);
+ } else if (rState && stream4.req && stream4.aborted) {
+ process5.nextTick(onclosed);
+ }
+ const cleanup = () => {
+ callback = nop;
+ stream4.removeListener("aborted", onclose);
+ stream4.removeListener("complete", onfinish);
+ stream4.removeListener("abort", onclose);
+ stream4.removeListener("request", onrequest);
+ if (stream4.req) stream4.req.removeListener("finish", onfinish);
+ stream4.removeListener("end", onlegacyfinish);
+ stream4.removeListener("close", onlegacyfinish);
+ stream4.removeListener("finish", onfinish);
+ stream4.removeListener("end", onend);
+ stream4.removeListener("error", onerror);
+ stream4.removeListener("close", onclose);
+ };
+ if (options.signal && !closed) {
+ const abort = () => {
+ const endCallback = callback;
+ cleanup();
+ endCallback.call(
+ stream4,
+ new AbortError3(void 0, {
+ cause: options.signal.reason
+ })
+ );
+ };
+ if (options.signal.aborted) {
+ process5.nextTick(abort);
+ } else {
+ addAbortListener = addAbortListener || require_util10().addAbortListener;
+ const disposable = addAbortListener(options.signal, abort);
+ const originalCallback = callback;
+ callback = once((...args) => {
+ disposable[SymbolDispose]();
+ originalCallback.apply(stream4, args);
});
- },
- final(cb) {
- const _resolve = resolve7;
- resolve7 = null;
- _resolve({
- done: true,
- cb
+ }
+ }
+ return cleanup;
+ }
+ function eosWeb(stream4, options, callback) {
+ let isAborted = false;
+ let abort = nop;
+ if (options.signal) {
+ abort = () => {
+ isAborted = true;
+ callback.call(
+ stream4,
+ new AbortError3(void 0, {
+ cause: options.signal.reason
+ })
+ );
+ };
+ if (options.signal.aborted) {
+ process5.nextTick(abort);
+ } else {
+ addAbortListener = addAbortListener || require_util10().addAbortListener;
+ const disposable = addAbortListener(options.signal, abort);
+ const originalCallback = callback;
+ callback = once((...args) => {
+ disposable[SymbolDispose]();
+ originalCallback.apply(stream4, args);
});
- },
- destroy(err, cb) {
- ac.abort();
- cb(err);
+ }
+ }
+ const resolverFn = (...args) => {
+ if (!isAborted) {
+ process5.nextTick(() => callback.apply(stream4, args));
}
};
+ PromisePrototypeThen(stream4[kIsClosedPromise].promise, resolverFn, resolverFn);
+ return nop;
}
- function _duplexify(pair) {
- const r = pair.readable && typeof pair.readable.read !== "function" ? Readable7.wrap(pair.readable) : pair.readable;
- const w = pair.writable;
- let readable = !!isReadable(r);
- let writable = !!isWritable(w);
- let ondrain;
- let onfinish;
- let onreadable;
- let onclose;
- let d;
- function onfinished(err) {
- const cb = onclose;
- onclose = null;
- if (cb) {
- cb(err);
- } else if (err) {
- d.destroy(err);
- }
+ function finished(stream4, opts) {
+ var _opts;
+ let autoCleanup = false;
+ if (opts === null) {
+ opts = kEmptyObject;
}
- d = new Duplexify({
- // TODO (ronag): highWaterMark?
- readableObjectMode: !!(r !== null && r !== void 0 && r.readableObjectMode),
- writableObjectMode: !!(w !== null && w !== void 0 && w.writableObjectMode),
- readable,
- writable
- });
- if (writable) {
- eos(w, (err) => {
- writable = false;
- if (err) {
- destroyer(r, err);
+ if ((_opts = opts) !== null && _opts !== void 0 && _opts.cleanup) {
+ validateBoolean(opts.cleanup, "cleanup");
+ autoCleanup = opts.cleanup;
+ }
+ return new Promise2((resolve7, reject) => {
+ const cleanup = eos(stream4, opts, (err) => {
+ if (autoCleanup) {
+ cleanup();
}
- onfinished(err);
- });
- d._write = function(chunk, encoding, callback) {
- if (w.write(chunk, encoding)) {
- callback();
+ if (err) {
+ reject(err);
} else {
- ondrain = callback;
- }
- };
- d._final = function(callback) {
- w.end();
- onfinish = callback;
- };
- w.on("drain", function() {
- if (ondrain) {
- const cb = ondrain;
- ondrain = null;
- cb();
+ resolve7();
}
});
- w.on("finish", function() {
- if (onfinish) {
- const cb = onfinish;
- onfinish = null;
- cb();
- }
+ });
+ }
+ module2.exports = eos;
+ module2.exports.finished = finished;
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/destroy.js
+var require_destroy2 = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
+ "use strict";
+ var process5 = require_process();
+ var {
+ aggregateTwoErrors,
+ codes: { ERR_MULTIPLE_CALLBACK },
+ AbortError: AbortError3
+ } = require_errors2();
+ var { Symbol: Symbol2 } = require_primordials();
+ var { kIsDestroyed, isDestroyed, isFinished, isServerRequest } = require_utils2();
+ var kDestroy = Symbol2("kDestroy");
+ var kConstruct = Symbol2("kConstruct");
+ function checkError(err, w, r) {
+ if (err) {
+ err.stack;
+ if (w && !w.errored) {
+ w.errored = err;
+ }
+ if (r && !r.errored) {
+ r.errored = err;
+ }
+ }
+ }
+ function destroy2(err, cb) {
+ const r = this._readableState;
+ const w = this._writableState;
+ const s = w || r;
+ if (w !== null && w !== void 0 && w.destroyed || r !== null && r !== void 0 && r.destroyed) {
+ if (typeof cb === "function") {
+ cb();
+ }
+ return this;
+ }
+ checkError(err, w, r);
+ if (w) {
+ w.destroyed = true;
+ }
+ if (r) {
+ r.destroyed = true;
+ }
+ if (!s.constructed) {
+ this.once(kDestroy, function(er) {
+ _destroy(this, aggregateTwoErrors(er, err), cb);
});
+ } else {
+ _destroy(this, err, cb);
+ }
+ return this;
+ }
+ function _destroy(self2, err, cb) {
+ let called = false;
+ function onDestroy(err2) {
+ if (called) {
+ return;
+ }
+ called = true;
+ const r = self2._readableState;
+ const w = self2._writableState;
+ checkError(err2, w, r);
+ if (w) {
+ w.closed = true;
+ }
+ if (r) {
+ r.closed = true;
+ }
+ if (typeof cb === "function") {
+ cb(err2);
+ }
+ if (err2) {
+ process5.nextTick(emitErrorCloseNT, self2, err2);
+ } else {
+ process5.nextTick(emitCloseNT, self2);
+ }
+ }
+ try {
+ self2._destroy(err || null, onDestroy);
+ } catch (err2) {
+ onDestroy(err2);
+ }
+ }
+ function emitErrorCloseNT(self2, err) {
+ emitErrorNT(self2, err);
+ emitCloseNT(self2);
+ }
+ function emitCloseNT(self2) {
+ const r = self2._readableState;
+ const w = self2._writableState;
+ if (w) {
+ w.closeEmitted = true;
+ }
+ if (r) {
+ r.closeEmitted = true;
+ }
+ if (w !== null && w !== void 0 && w.emitClose || r !== null && r !== void 0 && r.emitClose) {
+ self2.emit("close");
+ }
+ }
+ function emitErrorNT(self2, err) {
+ const r = self2._readableState;
+ const w = self2._writableState;
+ if (w !== null && w !== void 0 && w.errorEmitted || r !== null && r !== void 0 && r.errorEmitted) {
+ return;
+ }
+ if (w) {
+ w.errorEmitted = true;
+ }
+ if (r) {
+ r.errorEmitted = true;
+ }
+ self2.emit("error", err);
+ }
+ function undestroy() {
+ const r = this._readableState;
+ const w = this._writableState;
+ if (r) {
+ r.constructed = true;
+ r.closed = false;
+ r.closeEmitted = false;
+ r.destroyed = false;
+ r.errored = null;
+ r.errorEmitted = false;
+ r.reading = false;
+ r.ended = r.readable === false;
+ r.endEmitted = r.readable === false;
+ }
+ if (w) {
+ w.constructed = true;
+ w.destroyed = false;
+ w.closed = false;
+ w.closeEmitted = false;
+ w.errored = null;
+ w.errorEmitted = false;
+ w.finalCalled = false;
+ w.prefinished = false;
+ w.ended = w.writable === false;
+ w.ending = w.writable === false;
+ w.finished = w.writable === false;
}
- if (readable) {
- eos(r, (err) => {
- readable = false;
- if (err) {
- destroyer(r, err);
- }
- onfinished(err);
- });
- r.on("readable", function() {
- if (onreadable) {
- const cb = onreadable;
- onreadable = null;
- cb();
- }
- });
- r.on("end", function() {
- d.push(null);
- });
- d._read = function() {
- while (true) {
- const buf = r.read();
- if (buf === null) {
- onreadable = d._read;
- return;
- }
- if (!d.push(buf)) {
- return;
- }
- }
- };
+ }
+ function errorOrDestroy(stream4, err, sync) {
+ const r = stream4._readableState;
+ const w = stream4._writableState;
+ if (w !== null && w !== void 0 && w.destroyed || r !== null && r !== void 0 && r.destroyed) {
+ return this;
}
- d._destroy = function(err, callback) {
- if (!err && onclose !== null) {
- err = new AbortError3();
+ if (r !== null && r !== void 0 && r.autoDestroy || w !== null && w !== void 0 && w.autoDestroy)
+ stream4.destroy(err);
+ else if (err) {
+ err.stack;
+ if (w && !w.errored) {
+ w.errored = err;
}
- onreadable = null;
- ondrain = null;
- onfinish = null;
- if (onclose === null) {
- callback(err);
+ if (r && !r.errored) {
+ r.errored = err;
+ }
+ if (sync) {
+ process5.nextTick(emitErrorNT, stream4, err);
} else {
- onclose = callback;
- destroyer(w, err);
- destroyer(r, err);
+ emitErrorNT(stream4, err);
}
- };
- return d;
+ }
}
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/duplex.js
-var require_duplex = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/duplex.js"(exports2, module2) {
- "use strict";
- var {
- ObjectDefineProperties,
- ObjectGetOwnPropertyDescriptor,
- ObjectKeys,
- ObjectSetPrototypeOf
- } = require_primordials();
- module2.exports = Duplex;
- var Readable7 = require_readable3();
- var Writable = require_writable();
- ObjectSetPrototypeOf(Duplex.prototype, Readable7.prototype);
- ObjectSetPrototypeOf(Duplex, Readable7);
- {
- const keys = ObjectKeys(Writable.prototype);
- for (let i = 0; i < keys.length; i++) {
- const method = keys[i];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
+ function construct(stream4, cb) {
+ if (typeof stream4._construct !== "function") {
+ return;
+ }
+ const r = stream4._readableState;
+ const w = stream4._writableState;
+ if (r) {
+ r.constructed = false;
+ }
+ if (w) {
+ w.constructed = false;
+ }
+ stream4.once(kConstruct, cb);
+ if (stream4.listenerCount(kConstruct) > 1) {
+ return;
}
+ process5.nextTick(constructNT, stream4);
}
- function Duplex(options) {
- if (!(this instanceof Duplex)) return new Duplex(options);
- Readable7.call(this, options);
- Writable.call(this, options);
- if (options) {
- this.allowHalfOpen = options.allowHalfOpen !== false;
- if (options.readable === false) {
- this._readableState.readable = false;
- this._readableState.ended = true;
- this._readableState.endEmitted = true;
+ function constructNT(stream4) {
+ let called = false;
+ function onConstruct(err) {
+ if (called) {
+ errorOrDestroy(stream4, err !== null && err !== void 0 ? err : new ERR_MULTIPLE_CALLBACK());
+ return;
}
- if (options.writable === false) {
- this._writableState.writable = false;
- this._writableState.ending = true;
- this._writableState.ended = true;
- this._writableState.finished = true;
+ called = true;
+ const r = stream4._readableState;
+ const w = stream4._writableState;
+ const s = w || r;
+ if (r) {
+ r.constructed = true;
+ }
+ if (w) {
+ w.constructed = true;
+ }
+ if (s.destroyed) {
+ stream4.emit(kDestroy, err);
+ } else if (err) {
+ errorOrDestroy(stream4, err, true);
+ } else {
+ process5.nextTick(emitConstructNT, stream4);
}
+ }
+ try {
+ stream4._construct((err) => {
+ process5.nextTick(onConstruct, err);
+ });
+ } catch (err) {
+ process5.nextTick(onConstruct, err);
+ }
+ }
+ function emitConstructNT(stream4) {
+ stream4.emit(kConstruct);
+ }
+ function isRequest(stream4) {
+ return (stream4 === null || stream4 === void 0 ? void 0 : stream4.setHeader) && typeof stream4.abort === "function";
+ }
+ function emitCloseLegacy(stream4) {
+ stream4.emit("close");
+ }
+ function emitErrorCloseLegacy(stream4, err) {
+ stream4.emit("error", err);
+ process5.nextTick(emitCloseLegacy, stream4);
+ }
+ function destroyer(stream4, err) {
+ if (!stream4 || isDestroyed(stream4)) {
+ return;
+ }
+ if (!err && !isFinished(stream4)) {
+ err = new AbortError3();
+ }
+ if (isServerRequest(stream4)) {
+ stream4.socket = null;
+ stream4.destroy(err);
+ } else if (isRequest(stream4)) {
+ stream4.abort();
+ } else if (isRequest(stream4.req)) {
+ stream4.req.abort();
+ } else if (typeof stream4.destroy === "function") {
+ stream4.destroy(err);
+ } else if (typeof stream4.close === "function") {
+ stream4.close();
+ } else if (err) {
+ process5.nextTick(emitErrorCloseLegacy, stream4, err);
} else {
- this.allowHalfOpen = true;
+ process5.nextTick(emitCloseLegacy, stream4);
+ }
+ if (!stream4.destroyed) {
+ stream4[kIsDestroyed] = true;
}
}
- ObjectDefineProperties(Duplex.prototype, {
- writable: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writable")
- },
- writableHighWaterMark: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableHighWaterMark")
- },
- writableObjectMode: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableObjectMode")
- },
- writableBuffer: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableBuffer")
- },
- writableLength: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableLength")
- },
- writableFinished: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableFinished")
- },
- writableCorked: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableCorked")
- },
- writableEnded: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableEnded")
- },
- writableNeedDrain: {
- __proto__: null,
- ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableNeedDrain")
- },
- destroyed: {
- __proto__: null,
- get() {
- if (this._readableState === void 0 || this._writableState === void 0) {
- return false;
- }
- return this._readableState.destroyed && this._writableState.destroyed;
- },
- set(value) {
- if (this._readableState && this._writableState) {
- this._readableState.destroyed = value;
- this._writableState.destroyed = value;
- }
+ module2.exports = {
+ construct,
+ destroyer,
+ destroy: destroy2,
+ undestroy,
+ errorOrDestroy
+ };
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/legacy.js
+var require_legacy = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/legacy.js"(exports2, module2) {
+ "use strict";
+ var { ArrayIsArray, ObjectSetPrototypeOf } = require_primordials();
+ var { EventEmitter: EE } = require("events");
+ function Stream2(opts) {
+ EE.call(this, opts);
+ }
+ ObjectSetPrototypeOf(Stream2.prototype, EE.prototype);
+ ObjectSetPrototypeOf(Stream2, EE);
+ Stream2.prototype.pipe = function(dest, options) {
+ const source = this;
+ function ondata(chunk) {
+ if (dest.writable && dest.write(chunk) === false && source.pause) {
+ source.pause();
}
}
- });
- var webStreamsAdapters;
- function lazyWebStreams() {
- if (webStreamsAdapters === void 0) webStreamsAdapters = {};
- return webStreamsAdapters;
+ source.on("data", ondata);
+ function ondrain() {
+ if (source.readable && source.resume) {
+ source.resume();
+ }
+ }
+ dest.on("drain", ondrain);
+ if (!dest._isStdio && (!options || options.end !== false)) {
+ source.on("end", onend);
+ source.on("close", onclose);
+ }
+ let didOnEnd = false;
+ function onend() {
+ if (didOnEnd) return;
+ didOnEnd = true;
+ dest.end();
+ }
+ function onclose() {
+ if (didOnEnd) return;
+ didOnEnd = true;
+ if (typeof dest.destroy === "function") dest.destroy();
+ }
+ function onerror(er) {
+ cleanup();
+ if (EE.listenerCount(this, "error") === 0) {
+ this.emit("error", er);
+ }
+ }
+ prependListener(source, "error", onerror);
+ prependListener(dest, "error", onerror);
+ function cleanup() {
+ source.removeListener("data", ondata);
+ dest.removeListener("drain", ondrain);
+ source.removeListener("end", onend);
+ source.removeListener("close", onclose);
+ source.removeListener("error", onerror);
+ dest.removeListener("error", onerror);
+ source.removeListener("end", cleanup);
+ source.removeListener("close", cleanup);
+ dest.removeListener("close", cleanup);
+ }
+ source.on("end", cleanup);
+ source.on("close", cleanup);
+ dest.on("close", cleanup);
+ dest.emit("pipe", source);
+ return dest;
+ };
+ function prependListener(emitter, event, fn) {
+ if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
+ else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn);
+ else emitter._events[event] = [fn, emitter._events[event]];
}
- Duplex.fromWeb = function(pair, options) {
- return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options);
+ module2.exports = {
+ Stream: Stream2,
+ prependListener
};
- Duplex.toWeb = function(duplex) {
- return lazyWebStreams().newReadableWritablePairFromDuplex(duplex);
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/add-abort-signal.js
+var require_add_abort_signal = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/add-abort-signal.js"(exports2, module2) {
+ "use strict";
+ var { SymbolDispose } = require_primordials();
+ var { AbortError: AbortError3, codes } = require_errors2();
+ var { isNodeStream, isWebStream, kControllerErrorFunction } = require_utils2();
+ var eos = require_end_of_stream();
+ var { ERR_INVALID_ARG_TYPE } = codes;
+ var addAbortListener;
+ var validateAbortSignal = (signal, name) => {
+ if (typeof signal !== "object" || !("aborted" in signal)) {
+ throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
+ }
};
- var duplexify;
- Duplex.from = function(body2) {
- if (!duplexify) {
- duplexify = require_duplexify();
+ module2.exports.addAbortSignal = function addAbortSignal(signal, stream4) {
+ validateAbortSignal(signal, "signal");
+ if (!isNodeStream(stream4) && !isWebStream(stream4)) {
+ throw new ERR_INVALID_ARG_TYPE("stream", ["ReadableStream", "WritableStream", "Stream"], stream4);
}
- return duplexify(body2, "body");
+ return module2.exports.addAbortSignalNoValidate(signal, stream4);
+ };
+ module2.exports.addAbortSignalNoValidate = function(signal, stream4) {
+ if (typeof signal !== "object" || !("aborted" in signal)) {
+ return stream4;
+ }
+ const onAbort = isNodeStream(stream4) ? () => {
+ stream4.destroy(
+ new AbortError3(void 0, {
+ cause: signal.reason
+ })
+ );
+ } : () => {
+ stream4[kControllerErrorFunction](
+ new AbortError3(void 0, {
+ cause: signal.reason
+ })
+ );
+ };
+ if (signal.aborted) {
+ onAbort();
+ } else {
+ addAbortListener = addAbortListener || require_util10().addAbortListener;
+ const disposable = addAbortListener(signal, onAbort);
+ eos(stream4, disposable[SymbolDispose]);
+ }
+ return stream4;
};
}
});
-// node_modules/readable-stream/lib/internal/streams/transform.js
-var require_transform = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/transform.js"(exports2, module2) {
+// node_modules/readable-stream/lib/internal/streams/buffer_list.js
+var require_buffer_list = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports2, module2) {
"use strict";
- var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials();
- module2.exports = Transform4;
- var { ERR_METHOD_NOT_IMPLEMENTED } = require_errors2().codes;
- var Duplex = require_duplex();
- var { getHighWaterMark } = require_state();
- ObjectSetPrototypeOf(Transform4.prototype, Duplex.prototype);
- ObjectSetPrototypeOf(Transform4, Duplex);
- var kCallback = Symbol2("kCallback");
- function Transform4(options) {
- if (!(this instanceof Transform4)) return new Transform4(options);
- const readableHighWaterMark = options ? getHighWaterMark(this, options, "readableHighWaterMark", true) : null;
- if (readableHighWaterMark === 0) {
- options = {
- ...options,
- highWaterMark: null,
- readableHighWaterMark,
- // TODO (ronag): 0 is not optimal since we have
- // a "bug" where we check needDrain before calling _write and not after.
- // Refs: https://github.com/nodejs/node/pull/32887
- // Refs: https://github.com/nodejs/node/pull/35941
- writableHighWaterMark: options.writableHighWaterMark || 0
+ var { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array: Uint8Array2 } = require_primordials();
+ var { Buffer: Buffer3 } = require("buffer");
+ var { inspect: inspect2 } = require_util10();
+ module2.exports = class BufferList {
+ constructor() {
+ this.head = null;
+ this.tail = null;
+ this.length = 0;
+ }
+ push(v) {
+ const entry = {
+ data: v,
+ next: null
};
+ if (this.length > 0) this.tail.next = entry;
+ else this.head = entry;
+ this.tail = entry;
+ ++this.length;
}
- Duplex.call(this, options);
- this._readableState.sync = false;
- this[kCallback] = null;
- if (options) {
- if (typeof options.transform === "function") this._transform = options.transform;
- if (typeof options.flush === "function") this._flush = options.flush;
+ unshift(v) {
+ const entry = {
+ data: v,
+ next: this.head
+ };
+ if (this.length === 0) this.tail = entry;
+ this.head = entry;
+ ++this.length;
}
- this.on("prefinish", prefinish);
- }
- function final(cb) {
- if (typeof this._flush === "function" && !this.destroyed) {
- this._flush((er, data) => {
- if (er) {
- if (cb) {
- cb(er);
+ shift() {
+ if (this.length === 0) return;
+ const ret = this.head.data;
+ if (this.length === 1) this.head = this.tail = null;
+ else this.head = this.head.next;
+ --this.length;
+ return ret;
+ }
+ clear() {
+ this.head = this.tail = null;
+ this.length = 0;
+ }
+ join(s) {
+ if (this.length === 0) return "";
+ let p = this.head;
+ let ret = "" + p.data;
+ while ((p = p.next) !== null) ret += s + p.data;
+ return ret;
+ }
+ concat(n) {
+ if (this.length === 0) return Buffer3.alloc(0);
+ const ret = Buffer3.allocUnsafe(n >>> 0);
+ let p = this.head;
+ let i = 0;
+ while (p) {
+ TypedArrayPrototypeSet(ret, p.data, i);
+ i += p.data.length;
+ p = p.next;
+ }
+ return ret;
+ }
+ // Consumes a specified amount of bytes or characters from the buffered data.
+ consume(n, hasStrings) {
+ const data = this.head.data;
+ if (n < data.length) {
+ const slice = data.slice(0, n);
+ this.head.data = data.slice(n);
+ return slice;
+ }
+ if (n === data.length) {
+ return this.shift();
+ }
+ return hasStrings ? this._getString(n) : this._getBuffer(n);
+ }
+ first() {
+ return this.head.data;
+ }
+ *[SymbolIterator]() {
+ for (let p = this.head; p; p = p.next) {
+ yield p.data;
+ }
+ }
+ // Consumes a specified amount of characters from the buffered data.
+ _getString(n) {
+ let ret = "";
+ let p = this.head;
+ let c = 0;
+ do {
+ const str = p.data;
+ if (n > str.length) {
+ ret += str;
+ n -= str.length;
+ } else {
+ if (n === str.length) {
+ ret += str;
+ ++c;
+ if (p.next) this.head = p.next;
+ else this.head = this.tail = null;
} else {
- this.destroy(er);
+ ret += StringPrototypeSlice(str, 0, n);
+ this.head = p;
+ p.data = StringPrototypeSlice(str, n);
}
- return;
- }
- if (data != null) {
- this.push(data);
- }
- this.push(null);
- if (cb) {
- cb();
+ break;
}
- });
- } else {
- this.push(null);
- if (cb) {
- cb();
- }
+ ++c;
+ } while ((p = p.next) !== null);
+ this.length -= c;
+ return ret;
}
- }
- function prefinish() {
- if (this._final !== final) {
- final.call(this);
+ // Consumes a specified amount of bytes from the buffered data.
+ _getBuffer(n) {
+ const ret = Buffer3.allocUnsafe(n);
+ const retLen = n;
+ let p = this.head;
+ let c = 0;
+ do {
+ const buf = p.data;
+ if (n > buf.length) {
+ TypedArrayPrototypeSet(ret, buf, retLen - n);
+ n -= buf.length;
+ } else {
+ if (n === buf.length) {
+ TypedArrayPrototypeSet(ret, buf, retLen - n);
+ ++c;
+ if (p.next) this.head = p.next;
+ else this.head = this.tail = null;
+ } else {
+ TypedArrayPrototypeSet(ret, new Uint8Array2(buf.buffer, buf.byteOffset, n), retLen - n);
+ this.head = p;
+ p.data = buf.slice(n);
+ }
+ break;
+ }
+ ++c;
+ } while ((p = p.next) !== null);
+ this.length -= c;
+ return ret;
}
- }
- Transform4.prototype._final = final;
- Transform4.prototype._transform = function(chunk, encoding, callback) {
- throw new ERR_METHOD_NOT_IMPLEMENTED("_transform()");
- };
- Transform4.prototype._write = function(chunk, encoding, callback) {
- const rState = this._readableState;
- const wState = this._writableState;
- const length = rState.length;
- this._transform(chunk, encoding, (err, val) => {
- if (err) {
- callback(err);
- return;
- }
- if (val != null) {
- this.push(val);
- }
- if (wState.ended || // Backwards compat.
- length === rState.length || // Backwards compat.
- rState.length < rState.highWaterMark) {
- callback();
- } else {
- this[kCallback] = callback;
- }
- });
- };
- Transform4.prototype._read = function() {
- if (this[kCallback]) {
- const callback = this[kCallback];
- this[kCallback] = null;
- callback();
+ // Make sure the linked list only shows the minimal necessary information.
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")](_2, options) {
+ return inspect2(this, {
+ ...options,
+ // Only inspect one level.
+ depth: 0,
+ // It should not recurse.
+ customInspect: false
+ });
}
};
}
});
-// node_modules/readable-stream/lib/internal/streams/passthrough.js
-var require_passthrough2 = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/passthrough.js"(exports2, module2) {
+// node_modules/readable-stream/lib/internal/streams/state.js
+var require_state = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/state.js"(exports2, module2) {
"use strict";
- var { ObjectSetPrototypeOf } = require_primordials();
- module2.exports = PassThrough2;
- var Transform4 = require_transform();
- ObjectSetPrototypeOf(PassThrough2.prototype, Transform4.prototype);
- ObjectSetPrototypeOf(PassThrough2, Transform4);
- function PassThrough2(options) {
- if (!(this instanceof PassThrough2)) return new PassThrough2(options);
- Transform4.call(this, options);
- }
- PassThrough2.prototype._transform = function(chunk, encoding, cb) {
- cb(null, chunk);
- };
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/pipeline.js
-var require_pipeline = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports2, module2) {
- var process5 = require_process();
- var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator, SymbolDispose } = require_primordials();
- var eos = require_end_of_stream();
- var { once } = require_util10();
- var destroyImpl = require_destroy2();
- var Duplex = require_duplex();
- var {
- aggregateTwoErrors,
- codes: {
- ERR_INVALID_ARG_TYPE,
- ERR_INVALID_RETURN_VALUE,
- ERR_MISSING_ARGS,
- ERR_STREAM_DESTROYED,
- ERR_STREAM_PREMATURE_CLOSE
- },
- AbortError: AbortError3
- } = require_errors2();
- var { validateFunction, validateAbortSignal } = require_validators();
- var {
- isIterable,
- isReadable,
- isReadableNodeStream,
- isNodeStream,
- isTransformStream,
- isWebStream,
- isReadableStream: isReadableStream3,
- isReadableFinished
- } = require_utils2();
- var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
- var PassThrough2;
- var Readable7;
- var addAbortListener;
- function destroyer(stream4, reading, writing) {
- let finished = false;
- stream4.on("close", () => {
- finished = true;
- });
- const cleanup = eos(
- stream4,
- {
- readable: reading,
- writable: writing
- },
- (err) => {
- finished = !err;
- }
- );
- return {
- destroy: (err) => {
- if (finished) return;
- finished = true;
- destroyImpl.destroyer(stream4, err || new ERR_STREAM_DESTROYED("pipe"));
- },
- cleanup
- };
- }
- function popCallback(streams) {
- validateFunction(streams[streams.length - 1], "streams[stream.length - 1]");
- return streams.pop();
- }
- function makeAsyncIterable2(val) {
- if (isIterable(val)) {
- return val;
- } else if (isReadableNodeStream(val)) {
- return fromReadable(val);
- }
- throw new ERR_INVALID_ARG_TYPE("val", ["Readable", "Iterable", "AsyncIterable"], val);
- }
- async function* fromReadable(val) {
- if (!Readable7) {
- Readable7 = require_readable3();
- }
- yield* Readable7.prototype[SymbolAsyncIterator].call(val);
+ var { MathFloor, NumberIsInteger } = require_primordials();
+ var { validateInteger } = require_validators();
+ var { ERR_INVALID_ARG_VALUE } = require_errors2().codes;
+ var defaultHighWaterMarkBytes = 16 * 1024;
+ var defaultHighWaterMarkObjectMode = 16;
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
}
- async function pumpToNode(iterable, writable, finish, { end }) {
- let error2;
- let onresolve = null;
- const resume = (err) => {
- if (err) {
- error2 = err;
- }
- if (onresolve) {
- const callback = onresolve;
- onresolve = null;
- callback();
- }
- };
- const wait = () => new Promise2((resolve7, reject) => {
- if (error2) {
- reject(error2);
- } else {
- onresolve = () => {
- if (error2) {
- reject(error2);
- } else {
- resolve7();
- }
- };
- }
- });
- writable.on("drain", resume);
- const cleanup = eos(
- writable,
- {
- readable: false
- },
- resume
- );
- try {
- if (writable.writableNeedDrain) {
- await wait();
- }
- for await (const chunk of iterable) {
- if (!writable.write(chunk)) {
- await wait();
- }
- }
- if (end) {
- writable.end();
- await wait();
+ function getDefaultHighWaterMark(objectMode) {
+ return objectMode ? defaultHighWaterMarkObjectMode : defaultHighWaterMarkBytes;
+ }
+ function setDefaultHighWaterMark(objectMode, value) {
+ validateInteger(value, "value", 0);
+ if (objectMode) {
+ defaultHighWaterMarkObjectMode = value;
+ } else {
+ defaultHighWaterMarkBytes = value;
+ }
+ }
+ function getHighWaterMark(state3, options, duplexKey, isDuplex) {
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
+ if (hwm != null) {
+ if (!NumberIsInteger(hwm) || hwm < 0) {
+ const name = isDuplex ? `options.${duplexKey}` : "options.highWaterMark";
+ throw new ERR_INVALID_ARG_VALUE(name, hwm);
}
- finish();
- } catch (err) {
- finish(error2 !== err ? aggregateTwoErrors(error2, err) : err);
- } finally {
- cleanup();
- writable.off("drain", resume);
+ return MathFloor(hwm);
}
+ return getDefaultHighWaterMark(state3.objectMode);
}
- async function pumpToWeb(readable, writable, finish, { end }) {
- if (isTransformStream(writable)) {
- writable = writable.writable;
+ module2.exports = {
+ getHighWaterMark,
+ getDefaultHighWaterMark,
+ setDefaultHighWaterMark
+ };
+ }
+});
+
+// node_modules/safe-buffer/index.js
+var require_safe_buffer2 = __commonJS({
+ "node_modules/safe-buffer/index.js"(exports2, module2) {
+ var buffer2 = require("buffer");
+ var Buffer3 = buffer2.Buffer;
+ function copyProps(src, dst) {
+ for (var key in src) {
+ dst[key] = src[key];
}
- const writer = writable.getWriter();
- try {
- for await (const chunk of readable) {
- await writer.ready;
- writer.write(chunk).catch(() => {
- });
- }
- await writer.ready;
- if (end) {
- await writer.close();
+ }
+ if (Buffer3.from && Buffer3.alloc && Buffer3.allocUnsafe && Buffer3.allocUnsafeSlow) {
+ module2.exports = buffer2;
+ } else {
+ copyProps(buffer2, exports2);
+ exports2.Buffer = SafeBuffer;
+ }
+ function SafeBuffer(arg, encodingOrOffset, length) {
+ return Buffer3(arg, encodingOrOffset, length);
+ }
+ SafeBuffer.prototype = Object.create(Buffer3.prototype);
+ copyProps(Buffer3, SafeBuffer);
+ SafeBuffer.from = function(arg, encodingOrOffset, length) {
+ if (typeof arg === "number") {
+ throw new TypeError("Argument must not be a number");
+ }
+ return Buffer3(arg, encodingOrOffset, length);
+ };
+ SafeBuffer.alloc = function(size, fill, encoding) {
+ if (typeof size !== "number") {
+ throw new TypeError("Argument must be a number");
+ }
+ var buf = Buffer3(size);
+ if (fill !== void 0) {
+ if (typeof encoding === "string") {
+ buf.fill(fill, encoding);
+ } else {
+ buf.fill(fill);
}
- finish();
- } catch (err) {
- try {
- await writer.abort(err);
- finish(err);
- } catch (err2) {
- finish(err2);
+ } else {
+ buf.fill(0);
+ }
+ return buf;
+ };
+ SafeBuffer.allocUnsafe = function(size) {
+ if (typeof size !== "number") {
+ throw new TypeError("Argument must be a number");
+ }
+ return Buffer3(size);
+ };
+ SafeBuffer.allocUnsafeSlow = function(size) {
+ if (typeof size !== "number") {
+ throw new TypeError("Argument must be a number");
+ }
+ return buffer2.SlowBuffer(size);
+ };
+ }
+});
+
+// node_modules/string_decoder/lib/string_decoder.js
+var require_string_decoder2 = __commonJS({
+ "node_modules/string_decoder/lib/string_decoder.js"(exports2) {
+ "use strict";
+ var Buffer3 = require_safe_buffer2().Buffer;
+ var isEncoding = Buffer3.isEncoding || function(encoding) {
+ encoding = "" + encoding;
+ switch (encoding && encoding.toLowerCase()) {
+ case "hex":
+ case "utf8":
+ case "utf-8":
+ case "ascii":
+ case "binary":
+ case "base64":
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ case "raw":
+ return true;
+ default:
+ return false;
+ }
+ };
+ function _normalizeEncoding(enc) {
+ if (!enc) return "utf8";
+ var retried;
+ while (true) {
+ switch (enc) {
+ case "utf8":
+ case "utf-8":
+ return "utf8";
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ return "utf16le";
+ case "latin1":
+ case "binary":
+ return "latin1";
+ case "base64":
+ case "ascii":
+ case "hex":
+ return enc;
+ default:
+ if (retried) return;
+ enc = ("" + enc).toLowerCase();
+ retried = true;
}
}
}
- function pipeline3(...streams) {
- return pipelineImpl(streams, once(popCallback(streams)));
+ function normalizeEncoding(enc) {
+ var nenc = _normalizeEncoding(enc);
+ if (typeof nenc !== "string" && (Buffer3.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
+ return nenc || enc;
}
- function pipelineImpl(streams, callback, opts) {
- if (streams.length === 1 && ArrayIsArray(streams[0])) {
- streams = streams[0];
+ exports2.StringDecoder = StringDecoder2;
+ function StringDecoder2(encoding) {
+ this.encoding = normalizeEncoding(encoding);
+ var nb;
+ switch (this.encoding) {
+ case "utf16le":
+ this.text = utf16Text;
+ this.end = utf16End;
+ nb = 4;
+ break;
+ case "utf8":
+ this.fillLast = utf8FillLast;
+ nb = 4;
+ break;
+ case "base64":
+ this.text = base64Text;
+ this.end = base64End;
+ nb = 3;
+ break;
+ default:
+ this.write = simpleWrite;
+ this.end = simpleEnd;
+ return;
}
- if (streams.length < 2) {
- throw new ERR_MISSING_ARGS("streams");
+ this.lastNeed = 0;
+ this.lastTotal = 0;
+ this.lastChar = Buffer3.allocUnsafe(nb);
+ }
+ StringDecoder2.prototype.write = function(buf) {
+ if (buf.length === 0) return "";
+ var r;
+ var i;
+ if (this.lastNeed) {
+ r = this.fillLast(buf);
+ if (r === void 0) return "";
+ i = this.lastNeed;
+ this.lastNeed = 0;
+ } else {
+ i = 0;
}
- const ac = new AbortController2();
- const signal = ac.signal;
- const outerSignal = opts === null || opts === void 0 ? void 0 : opts.signal;
- const lastStreamCleanup = [];
- validateAbortSignal(outerSignal, "options.signal");
- function abort() {
- finishImpl(new AbortError3());
+ if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
+ return r || "";
+ };
+ StringDecoder2.prototype.end = utf8End;
+ StringDecoder2.prototype.text = utf8Text;
+ StringDecoder2.prototype.fillLast = function(buf) {
+ if (this.lastNeed <= buf.length) {
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
- addAbortListener = addAbortListener || require_util10().addAbortListener;
- let disposable;
- if (outerSignal) {
- disposable = addAbortListener(outerSignal, abort);
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
+ this.lastNeed -= buf.length;
+ };
+ function utf8CheckByte(byte) {
+ if (byte <= 127) return 0;
+ else if (byte >> 5 === 6) return 2;
+ else if (byte >> 4 === 14) return 3;
+ else if (byte >> 3 === 30) return 4;
+ return byte >> 6 === 2 ? -1 : -2;
+ }
+ function utf8CheckIncomplete(self2, buf, i) {
+ var j = buf.length - 1;
+ if (j < i) return 0;
+ var nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) self2.lastNeed = nb - 1;
+ return nb;
+ }
+ if (--j < i || nb === -2) return 0;
+ nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) self2.lastNeed = nb - 2;
+ return nb;
+ }
+ if (--j < i || nb === -2) return 0;
+ nb = utf8CheckByte(buf[j]);
+ if (nb >= 0) {
+ if (nb > 0) {
+ if (nb === 2) nb = 0;
+ else self2.lastNeed = nb - 3;
+ }
+ return nb;
}
- let error2;
- let value;
- const destroys = [];
- let finishCount = 0;
- function finish(err) {
- finishImpl(err, --finishCount === 0);
+ return 0;
+ }
+ function utf8CheckExtraBytes(self2, buf, p) {
+ if ((buf[0] & 192) !== 128) {
+ self2.lastNeed = 0;
+ return "\uFFFD";
}
- function finishImpl(err, final) {
- var _disposable;
- if (err && (!error2 || error2.code === "ERR_STREAM_PREMATURE_CLOSE")) {
- error2 = err;
- }
- if (!error2 && !final) {
- return;
- }
- while (destroys.length) {
- destroys.shift()(error2);
+ if (self2.lastNeed > 1 && buf.length > 1) {
+ if ((buf[1] & 192) !== 128) {
+ self2.lastNeed = 1;
+ return "\uFFFD";
}
- ;
- (_disposable = disposable) === null || _disposable === void 0 ? void 0 : _disposable[SymbolDispose]();
- ac.abort();
- if (final) {
- if (!error2) {
- lastStreamCleanup.forEach((fn) => fn());
+ if (self2.lastNeed > 2 && buf.length > 2) {
+ if ((buf[2] & 192) !== 128) {
+ self2.lastNeed = 2;
+ return "\uFFFD";
}
- process5.nextTick(callback, error2, value);
}
}
- let ret;
- for (let i = 0; i < streams.length; i++) {
- const stream4 = streams[i];
- const reading = i < streams.length - 1;
- const writing = i > 0;
- const end = reading || (opts === null || opts === void 0 ? void 0 : opts.end) !== false;
- const isLastStream = i === streams.length - 1;
- if (isNodeStream(stream4)) {
- let onError2 = function(err) {
- if (err && err.name !== "AbortError" && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
- finish(err);
- }
- };
- var onError = onError2;
- if (end) {
- const { destroy: destroy2, cleanup } = destroyer(stream4, reading, writing);
- destroys.push(destroy2);
- if (isReadable(stream4) && isLastStream) {
- lastStreamCleanup.push(cleanup);
- }
- }
- stream4.on("error", onError2);
- if (isReadable(stream4) && isLastStream) {
- lastStreamCleanup.push(() => {
- stream4.removeListener("error", onError2);
- });
+ }
+ function utf8FillLast(buf) {
+ var p = this.lastTotal - this.lastNeed;
+ var r = utf8CheckExtraBytes(this, buf, p);
+ if (r !== void 0) return r;
+ if (this.lastNeed <= buf.length) {
+ buf.copy(this.lastChar, p, 0, this.lastNeed);
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
+ }
+ buf.copy(this.lastChar, p, 0, buf.length);
+ this.lastNeed -= buf.length;
+ }
+ function utf8Text(buf, i) {
+ var total = utf8CheckIncomplete(this, buf, i);
+ if (!this.lastNeed) return buf.toString("utf8", i);
+ this.lastTotal = total;
+ var end = buf.length - (total - this.lastNeed);
+ buf.copy(this.lastChar, 0, end);
+ return buf.toString("utf8", i, end);
+ }
+ function utf8End(buf) {
+ var r = buf && buf.length ? this.write(buf) : "";
+ if (this.lastNeed) return r + "\uFFFD";
+ return r;
+ }
+ function utf16Text(buf, i) {
+ if ((buf.length - i) % 2 === 0) {
+ var r = buf.toString("utf16le", i);
+ if (r) {
+ var c = r.charCodeAt(r.length - 1);
+ if (c >= 55296 && c <= 56319) {
+ this.lastNeed = 2;
+ this.lastTotal = 4;
+ this.lastChar[0] = buf[buf.length - 2];
+ this.lastChar[1] = buf[buf.length - 1];
+ return r.slice(0, -1);
}
}
- if (i === 0) {
- if (typeof stream4 === "function") {
- ret = stream4({
- signal
- });
- if (!isIterable(ret)) {
- throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or Stream", "source", ret);
- }
- } else if (isIterable(stream4) || isReadableNodeStream(stream4) || isTransformStream(stream4)) {
- ret = stream4;
- } else {
- ret = Duplex.from(stream4);
- }
- } else if (typeof stream4 === "function") {
- if (isTransformStream(ret)) {
- var _ret;
- ret = makeAsyncIterable2((_ret = ret) === null || _ret === void 0 ? void 0 : _ret.readable);
- } else {
- ret = makeAsyncIterable2(ret);
- }
- ret = stream4(ret, {
- signal
- });
- if (reading) {
- if (!isIterable(ret, true)) {
- throw new ERR_INVALID_RETURN_VALUE("AsyncIterable", `transform[${i - 1}]`, ret);
- }
- } else {
- var _ret2;
- if (!PassThrough2) {
- PassThrough2 = require_passthrough2();
- }
- const pt = new PassThrough2({
- objectMode: true
- });
- const then = (_ret2 = ret) === null || _ret2 === void 0 ? void 0 : _ret2.then;
- if (typeof then === "function") {
- finishCount++;
- then.call(
- ret,
- (val) => {
- value = val;
- if (val != null) {
- pt.write(val);
- }
- if (end) {
- pt.end();
- }
- process5.nextTick(finish);
- },
- (err) => {
- pt.destroy(err);
- process5.nextTick(finish, err);
- }
- );
- } else if (isIterable(ret, true)) {
- finishCount++;
- pumpToNode(ret, pt, finish, {
- end
- });
- } else if (isReadableStream3(ret) || isTransformStream(ret)) {
- const toRead = ret.readable || ret;
- finishCount++;
- pumpToNode(toRead, pt, finish, {
- end
- });
- } else {
- throw new ERR_INVALID_RETURN_VALUE("AsyncIterable or Promise", "destination", ret);
- }
- ret = pt;
- const { destroy: destroy2, cleanup } = destroyer(ret, false, true);
- destroys.push(destroy2);
- if (isLastStream) {
- lastStreamCleanup.push(cleanup);
- }
- }
- } else if (isNodeStream(stream4)) {
- if (isReadableNodeStream(ret)) {
- finishCount += 2;
- const cleanup = pipe(ret, stream4, finish, {
- end
- });
- if (isReadable(stream4) && isLastStream) {
- lastStreamCleanup.push(cleanup);
- }
- } else if (isTransformStream(ret) || isReadableStream3(ret)) {
- const toRead = ret.readable || ret;
- finishCount++;
- pumpToNode(toRead, stream4, finish, {
- end
- });
- } else if (isIterable(ret)) {
- finishCount++;
- pumpToNode(ret, stream4, finish, {
- end
- });
- } else {
- throw new ERR_INVALID_ARG_TYPE(
- "val",
- ["Readable", "Iterable", "AsyncIterable", "ReadableStream", "TransformStream"],
- ret
- );
+ return r;
+ }
+ this.lastNeed = 1;
+ this.lastTotal = 2;
+ this.lastChar[0] = buf[buf.length - 1];
+ return buf.toString("utf16le", i, buf.length - 1);
+ }
+ function utf16End(buf) {
+ var r = buf && buf.length ? this.write(buf) : "";
+ if (this.lastNeed) {
+ var end = this.lastTotal - this.lastNeed;
+ return r + this.lastChar.toString("utf16le", 0, end);
+ }
+ return r;
+ }
+ function base64Text(buf, i) {
+ var n = (buf.length - i) % 3;
+ if (n === 0) return buf.toString("base64", i);
+ this.lastNeed = 3 - n;
+ this.lastTotal = 3;
+ if (n === 1) {
+ this.lastChar[0] = buf[buf.length - 1];
+ } else {
+ this.lastChar[0] = buf[buf.length - 2];
+ this.lastChar[1] = buf[buf.length - 1];
+ }
+ return buf.toString("base64", i, buf.length - n);
+ }
+ function base64End(buf) {
+ var r = buf && buf.length ? this.write(buf) : "";
+ if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
+ return r;
+ }
+ function simpleWrite(buf) {
+ return buf.toString(this.encoding);
+ }
+ function simpleEnd(buf) {
+ return buf && buf.length ? this.write(buf) : "";
+ }
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/from.js
+var require_from = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
+ "use strict";
+ var process5 = require_process();
+ var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
+ var { Buffer: Buffer3 } = require("buffer");
+ var { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require_errors2().codes;
+ function from(Readable7, iterable, opts) {
+ let iterator2;
+ if (typeof iterable === "string" || iterable instanceof Buffer3) {
+ return new Readable7({
+ objectMode: true,
+ ...opts,
+ read() {
+ this.push(iterable);
+ this.push(null);
}
- ret = stream4;
- } else if (isWebStream(stream4)) {
- if (isReadableNodeStream(ret)) {
- finishCount++;
- pumpToWeb(makeAsyncIterable2(ret), stream4, finish, {
- end
- });
- } else if (isReadableStream3(ret) || isIterable(ret)) {
- finishCount++;
- pumpToWeb(ret, stream4, finish, {
- end
- });
- } else if (isTransformStream(ret)) {
- finishCount++;
- pumpToWeb(ret.readable, stream4, finish, {
- end
- });
- } else {
- throw new ERR_INVALID_ARG_TYPE(
- "val",
- ["Readable", "Iterable", "AsyncIterable", "ReadableStream", "TransformStream"],
- ret
- );
+ });
+ }
+ let isAsync;
+ if (iterable && iterable[SymbolAsyncIterator]) {
+ isAsync = true;
+ iterator2 = iterable[SymbolAsyncIterator]();
+ } else if (iterable && iterable[SymbolIterator]) {
+ isAsync = false;
+ iterator2 = iterable[SymbolIterator]();
+ } else {
+ throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
+ }
+ const readable = new Readable7({
+ objectMode: true,
+ highWaterMark: 1,
+ // TODO(ronag): What options should be allowed?
+ ...opts
+ });
+ let reading = false;
+ readable._read = function() {
+ if (!reading) {
+ reading = true;
+ next();
+ }
+ };
+ readable._destroy = function(error2, cb) {
+ PromisePrototypeThen(
+ close(error2),
+ () => process5.nextTick(cb, error2),
+ // nextTick is here in case cb throws
+ (e) => process5.nextTick(cb, e || error2)
+ );
+ };
+ async function close(error2) {
+ const hadError = error2 !== void 0 && error2 !== null;
+ const hasThrow = typeof iterator2.throw === "function";
+ if (hadError && hasThrow) {
+ const { value, done } = await iterator2.throw(error2);
+ await value;
+ if (done) {
+ return;
}
- ret = stream4;
- } else {
- ret = Duplex.from(stream4);
+ }
+ if (typeof iterator2.return === "function") {
+ const { value } = await iterator2.return();
+ await value;
}
}
- if (signal !== null && signal !== void 0 && signal.aborted || outerSignal !== null && outerSignal !== void 0 && outerSignal.aborted) {
- process5.nextTick(abort);
+ async function next() {
+ for (; ; ) {
+ try {
+ const { value, done } = isAsync ? await iterator2.next() : iterator2.next();
+ if (done) {
+ readable.push(null);
+ } else {
+ const res = value && typeof value.then === "function" ? await value : value;
+ if (res === null) {
+ reading = false;
+ throw new ERR_STREAM_NULL_VALUES();
+ } else if (readable.push(res)) {
+ continue;
+ } else {
+ reading = false;
+ }
+ }
+ } catch (err) {
+ readable.destroy(err);
+ }
+ break;
+ }
}
- return ret;
+ return readable;
}
- function pipe(src, dst, finish, { end }) {
- let ended = false;
- dst.on("close", () => {
- if (!ended) {
- finish(new ERR_STREAM_PREMATURE_CLOSE());
- }
- });
- src.pipe(dst, {
- end: false
- });
- if (end) {
- let endFn2 = function() {
- ended = true;
- dst.end();
- };
- var endFn = endFn2;
- if (isReadableFinished(src)) {
- process5.nextTick(endFn2);
- } else {
- src.once("end", endFn2);
+ module2.exports = from;
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/readable.js
+var require_readable3 = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/readable.js"(exports2, module2) {
+ "use strict";
+ var process5 = require_process();
+ var {
+ ArrayPrototypeIndexOf,
+ NumberIsInteger,
+ NumberIsNaN,
+ NumberParseInt,
+ ObjectDefineProperties,
+ ObjectKeys,
+ ObjectSetPrototypeOf,
+ Promise: Promise2,
+ SafeSet,
+ SymbolAsyncDispose,
+ SymbolAsyncIterator,
+ Symbol: Symbol2
+ } = require_primordials();
+ module2.exports = Readable7;
+ Readable7.ReadableState = ReadableState;
+ var { EventEmitter: EE } = require("events");
+ var { Stream: Stream2, prependListener } = require_legacy();
+ var { Buffer: Buffer3 } = require("buffer");
+ var { addAbortSignal } = require_add_abort_signal();
+ var eos = require_end_of_stream();
+ var debug2 = require_util10().debuglog("stream", (fn) => {
+ debug2 = fn;
+ });
+ var BufferList = require_buffer_list();
+ var destroyImpl = require_destroy2();
+ var { getHighWaterMark, getDefaultHighWaterMark } = require_state();
+ var {
+ aggregateTwoErrors,
+ codes: {
+ ERR_INVALID_ARG_TYPE,
+ ERR_METHOD_NOT_IMPLEMENTED,
+ ERR_OUT_OF_RANGE,
+ ERR_STREAM_PUSH_AFTER_EOF,
+ ERR_STREAM_UNSHIFT_AFTER_END_EVENT
+ },
+ AbortError: AbortError3
+ } = require_errors2();
+ var { validateObject } = require_validators();
+ var kPaused = Symbol2("kPaused");
+ var { StringDecoder: StringDecoder2 } = require_string_decoder2();
+ var from = require_from();
+ ObjectSetPrototypeOf(Readable7.prototype, Stream2.prototype);
+ ObjectSetPrototypeOf(Readable7, Stream2);
+ var nop = () => {
+ };
+ var { errorOrDestroy } = destroyImpl;
+ var kObjectMode = 1 << 0;
+ var kEnded = 1 << 1;
+ var kEndEmitted = 1 << 2;
+ var kReading = 1 << 3;
+ var kConstructed = 1 << 4;
+ var kSync = 1 << 5;
+ var kNeedReadable = 1 << 6;
+ var kEmittedReadable = 1 << 7;
+ var kReadableListening = 1 << 8;
+ var kResumeScheduled = 1 << 9;
+ var kErrorEmitted = 1 << 10;
+ var kEmitClose = 1 << 11;
+ var kAutoDestroy = 1 << 12;
+ var kDestroyed = 1 << 13;
+ var kClosed = 1 << 14;
+ var kCloseEmitted = 1 << 15;
+ var kMultiAwaitDrain = 1 << 16;
+ var kReadingMore = 1 << 17;
+ var kDataEmitted = 1 << 18;
+ function makeBitMapDescriptor(bit) {
+ return {
+ enumerable: false,
+ get() {
+ return (this.state & bit) !== 0;
+ },
+ set(value) {
+ if (value) this.state |= bit;
+ else this.state &= ~bit;
}
- } else {
- finish();
+ };
+ }
+ ObjectDefineProperties(ReadableState.prototype, {
+ objectMode: makeBitMapDescriptor(kObjectMode),
+ ended: makeBitMapDescriptor(kEnded),
+ endEmitted: makeBitMapDescriptor(kEndEmitted),
+ reading: makeBitMapDescriptor(kReading),
+ // Stream is still being constructed and cannot be
+ // destroyed until construction finished or failed.
+ // Async construction is opt in, therefore we start as
+ // constructed.
+ constructed: makeBitMapDescriptor(kConstructed),
+ // A flag to be able to tell if the event 'readable'/'data' is emitted
+ // immediately, or on a later tick. We set this to true at first, because
+ // any actions that shouldn't happen until "later" should generally also
+ // not happen before the first read call.
+ sync: makeBitMapDescriptor(kSync),
+ // Whenever we return null, then we set a flag to say
+ // that we're awaiting a 'readable' event emission.
+ needReadable: makeBitMapDescriptor(kNeedReadable),
+ emittedReadable: makeBitMapDescriptor(kEmittedReadable),
+ readableListening: makeBitMapDescriptor(kReadableListening),
+ resumeScheduled: makeBitMapDescriptor(kResumeScheduled),
+ // True if the error was already emitted and should not be thrown again.
+ errorEmitted: makeBitMapDescriptor(kErrorEmitted),
+ emitClose: makeBitMapDescriptor(kEmitClose),
+ autoDestroy: makeBitMapDescriptor(kAutoDestroy),
+ // Has it been destroyed.
+ destroyed: makeBitMapDescriptor(kDestroyed),
+ // Indicates whether the stream has finished destroying.
+ closed: makeBitMapDescriptor(kClosed),
+ // True if close has been emitted or would have been emitted
+ // depending on emitClose.
+ closeEmitted: makeBitMapDescriptor(kCloseEmitted),
+ multiAwaitDrain: makeBitMapDescriptor(kMultiAwaitDrain),
+ // If true, a maybeReadMore has been scheduled.
+ readingMore: makeBitMapDescriptor(kReadingMore),
+ dataEmitted: makeBitMapDescriptor(kDataEmitted)
+ });
+ function ReadableState(options, stream4, isDuplex) {
+ if (typeof isDuplex !== "boolean") isDuplex = stream4 instanceof require_duplex();
+ this.state = kEmitClose | kAutoDestroy | kConstructed | kSync;
+ if (options && options.objectMode) this.state |= kObjectMode;
+ if (isDuplex && options && options.readableObjectMode) this.state |= kObjectMode;
+ this.highWaterMark = options ? getHighWaterMark(this, options, "readableHighWaterMark", isDuplex) : getDefaultHighWaterMark(false);
+ this.buffer = new BufferList();
+ this.length = 0;
+ this.pipes = [];
+ this.flowing = null;
+ this[kPaused] = null;
+ if (options && options.emitClose === false) this.state &= ~kEmitClose;
+ if (options && options.autoDestroy === false) this.state &= ~kAutoDestroy;
+ this.errored = null;
+ this.defaultEncoding = options && options.defaultEncoding || "utf8";
+ this.awaitDrainWriters = null;
+ this.decoder = null;
+ this.encoding = null;
+ if (options && options.encoding) {
+ this.decoder = new StringDecoder2(options.encoding);
+ this.encoding = options.encoding;
}
- eos(
- src,
- {
- readable: true,
- writable: false
- },
- (err) => {
- const rState = src._readableState;
- if (err && err.code === "ERR_STREAM_PREMATURE_CLOSE" && rState && rState.ended && !rState.errored && !rState.errorEmitted) {
- src.once("end", finish).once("error", finish);
- } else {
- finish(err);
- }
- }
- );
- return eos(
- dst,
- {
- readable: false,
- writable: true
- },
- finish
- );
}
- module2.exports = {
- pipelineImpl,
- pipeline: pipeline3
- };
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/compose.js
-var require_compose = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
- "use strict";
- var { pipeline: pipeline3 } = require_pipeline();
- var Duplex = require_duplex();
- var { destroyer } = require_destroy2();
- var {
- isNodeStream,
- isReadable,
- isWritable,
- isWebStream,
- isTransformStream,
- isWritableStream,
- isReadableStream: isReadableStream3
- } = require_utils2();
- var {
- AbortError: AbortError3,
- codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS }
- } = require_errors2();
- var eos = require_end_of_stream();
- module2.exports = function compose(...streams) {
- if (streams.length === 0) {
- throw new ERR_MISSING_ARGS("streams");
- }
- if (streams.length === 1) {
- return Duplex.from(streams[0]);
- }
- const orgStreams = [...streams];
- if (typeof streams[0] === "function") {
- streams[0] = Duplex.from(streams[0]);
- }
- if (typeof streams[streams.length - 1] === "function") {
- const idx = streams.length - 1;
- streams[idx] = Duplex.from(streams[idx]);
- }
- for (let n = 0; n < streams.length; ++n) {
- if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) {
- continue;
- }
- if (n < streams.length - 1 && !(isReadable(streams[n]) || isReadableStream3(streams[n]) || isTransformStream(streams[n]))) {
- throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be readable");
- }
- if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) {
- throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be writable");
- }
+ function Readable7(options) {
+ if (!(this instanceof Readable7)) return new Readable7(options);
+ const isDuplex = this instanceof require_duplex();
+ this._readableState = new ReadableState(options, this, isDuplex);
+ if (options) {
+ if (typeof options.read === "function") this._read = options.read;
+ if (typeof options.destroy === "function") this._destroy = options.destroy;
+ if (typeof options.construct === "function") this._construct = options.construct;
+ if (options.signal && !isDuplex) addAbortSignal(options.signal, this);
}
- let ondrain;
- let onfinish;
- let onreadable;
- let onclose;
- let d;
- function onfinished(err) {
- const cb = onclose;
- onclose = null;
- if (cb) {
- cb(err);
- } else if (err) {
- d.destroy(err);
- } else if (!readable && !writable) {
- d.destroy();
+ Stream2.call(this, options);
+ destroyImpl.construct(this, () => {
+ if (this._readableState.needReadable) {
+ maybeReadMore(this, this._readableState);
}
- }
- const head = streams[0];
- const tail = pipeline3(streams, onfinished);
- const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
- const readable = !!(isReadable(tail) || isReadableStream3(tail) || isTransformStream(tail));
- d = new Duplex({
- // TODO (ronag): highWaterMark?
- writableObjectMode: !!(head !== null && head !== void 0 && head.writableObjectMode),
- readableObjectMode: !!(tail !== null && tail !== void 0 && tail.readableObjectMode),
- writable,
- readable
});
- if (writable) {
- if (isNodeStream(head)) {
- d._write = function(chunk, encoding, callback) {
- if (head.write(chunk, encoding)) {
- callback();
+ }
+ Readable7.prototype.destroy = destroyImpl.destroy;
+ Readable7.prototype._undestroy = destroyImpl.undestroy;
+ Readable7.prototype._destroy = function(err, cb) {
+ cb(err);
+ };
+ Readable7.prototype[EE.captureRejectionSymbol] = function(err) {
+ this.destroy(err);
+ };
+ Readable7.prototype[SymbolAsyncDispose] = function() {
+ let error2;
+ if (!this.destroyed) {
+ error2 = this.readableEnded ? null : new AbortError3();
+ this.destroy(error2);
+ }
+ return new Promise2((resolve7, reject) => eos(this, (err) => err && err !== error2 ? reject(err) : resolve7(null)));
+ };
+ Readable7.prototype.push = function(chunk, encoding) {
+ return readableAddChunk(this, chunk, encoding, false);
+ };
+ Readable7.prototype.unshift = function(chunk, encoding) {
+ return readableAddChunk(this, chunk, encoding, true);
+ };
+ function readableAddChunk(stream4, chunk, encoding, addToFront) {
+ debug2("readableAddChunk", chunk);
+ const state3 = stream4._readableState;
+ let err;
+ if ((state3.state & kObjectMode) === 0) {
+ if (typeof chunk === "string") {
+ encoding = encoding || state3.defaultEncoding;
+ if (state3.encoding !== encoding) {
+ if (addToFront && state3.encoding) {
+ chunk = Buffer3.from(chunk, encoding).toString(state3.encoding);
} else {
- ondrain = callback;
- }
- };
- d._final = function(callback) {
- head.end();
- onfinish = callback;
- };
- head.on("drain", function() {
- if (ondrain) {
- const cb = ondrain;
- ondrain = null;
- cb();
- }
- });
- } else if (isWebStream(head)) {
- const writable2 = isTransformStream(head) ? head.writable : head;
- const writer = writable2.getWriter();
- d._write = async function(chunk, encoding, callback) {
- try {
- await writer.ready;
- writer.write(chunk).catch(() => {
- });
- callback();
- } catch (err) {
- callback(err);
- }
- };
- d._final = async function(callback) {
- try {
- await writer.ready;
- writer.close().catch(() => {
- });
- onfinish = callback;
- } catch (err) {
- callback(err);
+ chunk = Buffer3.from(chunk, encoding);
+ encoding = "";
}
- };
- }
- const toRead = isTransformStream(tail) ? tail.readable : tail;
- eos(toRead, () => {
- if (onfinish) {
- const cb = onfinish;
- onfinish = null;
- cb();
}
- });
- }
- if (readable) {
- if (isNodeStream(tail)) {
- tail.on("readable", function() {
- if (onreadable) {
- const cb = onreadable;
- onreadable = null;
- cb();
- }
- });
- tail.on("end", function() {
- d.push(null);
- });
- d._read = function() {
- while (true) {
- const buf = tail.read();
- if (buf === null) {
- onreadable = d._read;
- return;
- }
- if (!d.push(buf)) {
- return;
- }
- }
- };
- } else if (isWebStream(tail)) {
- const readable2 = isTransformStream(tail) ? tail.readable : tail;
- const reader = readable2.getReader();
- d._read = async function() {
- while (true) {
- try {
- const { value, done } = await reader.read();
- if (!d.push(value)) {
- return;
- }
- if (done) {
- d.push(null);
- return;
- }
- } catch {
- return;
- }
- }
- };
+ } else if (chunk instanceof Buffer3) {
+ encoding = "";
+ } else if (Stream2._isUint8Array(chunk)) {
+ chunk = Stream2._uint8ArrayToBuffer(chunk);
+ encoding = "";
+ } else if (chunk != null) {
+ err = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
}
}
- d._destroy = function(err, callback) {
- if (!err && onclose !== null) {
- err = new AbortError3();
- }
- onreadable = null;
- ondrain = null;
- onfinish = null;
- if (onclose === null) {
- callback(err);
+ if (err) {
+ errorOrDestroy(stream4, err);
+ } else if (chunk === null) {
+ state3.state &= ~kReading;
+ onEofChunk(stream4, state3);
+ } else if ((state3.state & kObjectMode) !== 0 || chunk && chunk.length > 0) {
+ if (addToFront) {
+ if ((state3.state & kEndEmitted) !== 0) errorOrDestroy(stream4, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
+ else if (state3.destroyed || state3.errored) return false;
+ else addChunk(stream4, state3, chunk, true);
+ } else if (state3.ended) {
+ errorOrDestroy(stream4, new ERR_STREAM_PUSH_AFTER_EOF());
+ } else if (state3.destroyed || state3.errored) {
+ return false;
} else {
- onclose = callback;
- if (isNodeStream(tail)) {
- destroyer(tail, err);
+ state3.state &= ~kReading;
+ if (state3.decoder && !encoding) {
+ chunk = state3.decoder.write(chunk);
+ if (state3.objectMode || chunk.length !== 0) addChunk(stream4, state3, chunk, false);
+ else maybeReadMore(stream4, state3);
+ } else {
+ addChunk(stream4, state3, chunk, false);
}
}
- };
- return d;
- };
- }
-});
-
-// node_modules/readable-stream/lib/internal/streams/operators.js
-var require_operators = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/operators.js"(exports2, module2) {
- "use strict";
- var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
- var {
- codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },
- AbortError: AbortError3
- } = require_errors2();
- var { validateAbortSignal, validateInteger, validateObject } = require_validators();
- var kWeakHandler = require_primordials().Symbol("kWeak");
- var kResistStopPropagation = require_primordials().Symbol("kResistStopPropagation");
- var { finished } = require_end_of_stream();
- var staticCompose = require_compose();
- var { addAbortSignalNoValidate } = require_add_abort_signal();
- var { isWritable, isNodeStream } = require_utils2();
- var { deprecate } = require_util10();
- var {
- ArrayPrototypePush,
- Boolean: Boolean2,
- MathFloor,
- Number: Number2,
- NumberIsNaN,
- Promise: Promise2,
- PromiseReject,
- PromiseResolve,
- PromisePrototypeThen,
- Symbol: Symbol2
- } = require_primordials();
- var kEmpty = Symbol2("kEmpty");
- var kEof = Symbol2("kEof");
- function compose(stream4, options) {
- if (options != null) {
- validateObject(options, "options");
+ } else if (!addToFront) {
+ state3.state &= ~kReading;
+ maybeReadMore(stream4, state3);
}
- if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
- validateAbortSignal(options.signal, "options.signal");
+ return !state3.ended && (state3.length < state3.highWaterMark || state3.length === 0);
+ }
+ function addChunk(stream4, state3, chunk, addToFront) {
+ if (state3.flowing && state3.length === 0 && !state3.sync && stream4.listenerCount("data") > 0) {
+ if ((state3.state & kMultiAwaitDrain) !== 0) {
+ state3.awaitDrainWriters.clear();
+ } else {
+ state3.awaitDrainWriters = null;
+ }
+ state3.dataEmitted = true;
+ stream4.emit("data", chunk);
+ } else {
+ state3.length += state3.objectMode ? 1 : chunk.length;
+ if (addToFront) state3.buffer.unshift(chunk);
+ else state3.buffer.push(chunk);
+ if ((state3.state & kNeedReadable) !== 0) emitReadable(stream4);
}
- if (isNodeStream(stream4) && !isWritable(stream4)) {
- throw new ERR_INVALID_ARG_VALUE("stream", stream4, "must be writable");
+ maybeReadMore(stream4, state3);
+ }
+ Readable7.prototype.isPaused = function() {
+ const state3 = this._readableState;
+ return state3[kPaused] === true || state3.flowing === false;
+ };
+ Readable7.prototype.setEncoding = function(enc) {
+ const decoder = new StringDecoder2(enc);
+ this._readableState.decoder = decoder;
+ this._readableState.encoding = this._readableState.decoder.encoding;
+ const buffer2 = this._readableState.buffer;
+ let content = "";
+ for (const data of buffer2) {
+ content += decoder.write(data);
}
- const composedStream = staticCompose(this, stream4);
- if (options !== null && options !== void 0 && options.signal) {
- addAbortSignalNoValidate(options.signal, composedStream);
+ buffer2.clear();
+ if (content !== "") buffer2.push(content);
+ this._readableState.length = content.length;
+ return this;
+ };
+ var MAX_HWM = 1073741824;
+ function computeNewHighWaterMark(n) {
+ if (n > MAX_HWM) {
+ throw new ERR_OUT_OF_RANGE("size", "<= 1GiB", n);
+ } else {
+ n--;
+ n |= n >>> 1;
+ n |= n >>> 2;
+ n |= n >>> 4;
+ n |= n >>> 8;
+ n |= n >>> 16;
+ n++;
}
- return composedStream;
+ return n;
}
- function map(fn, options) {
- if (typeof fn !== "function") {
- throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
- }
- if (options != null) {
- validateObject(options, "options");
+ function howMuchToRead(n, state3) {
+ if (n <= 0 || state3.length === 0 && state3.ended) return 0;
+ if ((state3.state & kObjectMode) !== 0) return 1;
+ if (NumberIsNaN(n)) {
+ if (state3.flowing && state3.length) return state3.buffer.first().length;
+ return state3.length;
}
- if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
- validateAbortSignal(options.signal, "options.signal");
+ if (n <= state3.length) return n;
+ return state3.ended ? state3.length : 0;
+ }
+ Readable7.prototype.read = function(n) {
+ debug2("read", n);
+ if (n === void 0) {
+ n = NaN;
+ } else if (!NumberIsInteger(n)) {
+ n = NumberParseInt(n, 10);
}
- let concurrency = 1;
- if ((options === null || options === void 0 ? void 0 : options.concurrency) != null) {
- concurrency = MathFloor(options.concurrency);
+ const state3 = this._readableState;
+ const nOrig = n;
+ if (n > state3.highWaterMark) state3.highWaterMark = computeNewHighWaterMark(n);
+ if (n !== 0) state3.state &= ~kEmittedReadable;
+ if (n === 0 && state3.needReadable && ((state3.highWaterMark !== 0 ? state3.length >= state3.highWaterMark : state3.length > 0) || state3.ended)) {
+ debug2("read: emitReadable", state3.length, state3.ended);
+ if (state3.length === 0 && state3.ended) endReadable(this);
+ else emitReadable(this);
+ return null;
}
- let highWaterMark = concurrency - 1;
- if ((options === null || options === void 0 ? void 0 : options.highWaterMark) != null) {
- highWaterMark = MathFloor(options.highWaterMark);
+ n = howMuchToRead(n, state3);
+ if (n === 0 && state3.ended) {
+ if (state3.length === 0) endReadable(this);
+ return null;
}
- validateInteger(concurrency, "options.concurrency", 1);
- validateInteger(highWaterMark, "options.highWaterMark", 0);
- highWaterMark += concurrency;
- return async function* map2() {
- const signal = require_util10().AbortSignalAny(
- [options === null || options === void 0 ? void 0 : options.signal].filter(Boolean2)
- );
- const stream4 = this;
- const queue = [];
- const signalOpt = {
- signal
- };
- let next;
- let resume;
- let done = false;
- let cnt = 0;
- function onCatch() {
- done = true;
- afterItemProcessed();
- }
- function afterItemProcessed() {
- cnt -= 1;
- maybeResume();
- }
- function maybeResume() {
- if (resume && !done && cnt < concurrency && queue.length < highWaterMark) {
- resume();
- resume = null;
- }
- }
- async function pump2() {
- try {
- for await (let val of stream4) {
- if (done) {
- return;
- }
- if (signal.aborted) {
- throw new AbortError3();
- }
- try {
- val = fn(val, signalOpt);
- if (val === kEmpty) {
- continue;
- }
- val = PromiseResolve(val);
- } catch (err) {
- val = PromiseReject(err);
- }
- cnt += 1;
- PromisePrototypeThen(val, afterItemProcessed, onCatch);
- queue.push(val);
- if (next) {
- next();
- next = null;
- }
- if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) {
- await new Promise2((resolve7) => {
- resume = resolve7;
- });
- }
- }
- queue.push(kEof);
- } catch (err) {
- const val = PromiseReject(err);
- PromisePrototypeThen(val, afterItemProcessed, onCatch);
- queue.push(val);
- } finally {
- done = true;
- if (next) {
- next();
- next = null;
- }
- }
- }
- pump2();
+ let doRead = (state3.state & kNeedReadable) !== 0;
+ debug2("need readable", doRead);
+ if (state3.length === 0 || state3.length - n < state3.highWaterMark) {
+ doRead = true;
+ debug2("length less than watermark", doRead);
+ }
+ if (state3.ended || state3.reading || state3.destroyed || state3.errored || !state3.constructed) {
+ doRead = false;
+ debug2("reading, ended or constructing", doRead);
+ } else if (doRead) {
+ debug2("do read");
+ state3.state |= kReading | kSync;
+ if (state3.length === 0) state3.state |= kNeedReadable;
try {
- while (true) {
- while (queue.length > 0) {
- const val = await queue[0];
- if (val === kEof) {
- return;
- }
- if (signal.aborted) {
- throw new AbortError3();
- }
- if (val !== kEmpty) {
- yield val;
- }
- queue.shift();
- maybeResume();
- }
- await new Promise2((resolve7) => {
- next = resolve7;
- });
- }
- } finally {
- done = true;
- if (resume) {
- resume();
- resume = null;
- }
+ this._read(state3.highWaterMark);
+ } catch (err) {
+ errorOrDestroy(this, err);
}
- }.call(this);
- }
- function asIndexedPairs(options = void 0) {
- if (options != null) {
- validateObject(options, "options");
+ state3.state &= ~kSync;
+ if (!state3.reading) n = howMuchToRead(nOrig, state3);
}
- if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
- validateAbortSignal(options.signal, "options.signal");
+ let ret;
+ if (n > 0) ret = fromList(n, state3);
+ else ret = null;
+ if (ret === null) {
+ state3.needReadable = state3.length <= state3.highWaterMark;
+ n = 0;
+ } else {
+ state3.length -= n;
+ if (state3.multiAwaitDrain) {
+ state3.awaitDrainWriters.clear();
+ } else {
+ state3.awaitDrainWriters = null;
+ }
}
- return async function* asIndexedPairs2() {
- let index = 0;
- for await (const val of this) {
- var _options$signal;
- if (options !== null && options !== void 0 && (_options$signal = options.signal) !== null && _options$signal !== void 0 && _options$signal.aborted) {
- throw new AbortError3({
- cause: options.signal.reason
- });
- }
- yield [index++, val];
+ if (state3.length === 0) {
+ if (!state3.ended) state3.needReadable = true;
+ if (nOrig !== n && state3.ended) endReadable(this);
+ }
+ if (ret !== null && !state3.errorEmitted && !state3.closeEmitted) {
+ state3.dataEmitted = true;
+ this.emit("data", ret);
+ }
+ return ret;
+ };
+ function onEofChunk(stream4, state3) {
+ debug2("onEofChunk");
+ if (state3.ended) return;
+ if (state3.decoder) {
+ const chunk = state3.decoder.end();
+ if (chunk && chunk.length) {
+ state3.buffer.push(chunk);
+ state3.length += state3.objectMode ? 1 : chunk.length;
}
- }.call(this);
- }
- async function some(fn, options = void 0) {
- for await (const unused of filter.call(this, fn, options)) {
- return true;
}
- return false;
+ state3.ended = true;
+ if (state3.sync) {
+ emitReadable(stream4);
+ } else {
+ state3.needReadable = false;
+ state3.emittedReadable = true;
+ emitReadable_(stream4);
+ }
}
- async function every(fn, options = void 0) {
- if (typeof fn !== "function") {
- throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
+ function emitReadable(stream4) {
+ const state3 = stream4._readableState;
+ debug2("emitReadable", state3.needReadable, state3.emittedReadable);
+ state3.needReadable = false;
+ if (!state3.emittedReadable) {
+ debug2("emitReadable", state3.flowing);
+ state3.emittedReadable = true;
+ process5.nextTick(emitReadable_, stream4);
}
- return !await some.call(
- this,
- async (...args) => {
- return !await fn(...args);
- },
- options
- );
}
- async function find(fn, options) {
- for await (const result of filter.call(this, fn, options)) {
- return result;
+ function emitReadable_(stream4) {
+ const state3 = stream4._readableState;
+ debug2("emitReadable_", state3.destroyed, state3.length, state3.ended);
+ if (!state3.destroyed && !state3.errored && (state3.length || state3.ended)) {
+ stream4.emit("readable");
+ state3.emittedReadable = false;
}
- return void 0;
+ state3.needReadable = !state3.flowing && !state3.ended && state3.length <= state3.highWaterMark;
+ flow(stream4);
}
- async function forEach(fn, options) {
- if (typeof fn !== "function") {
- throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
+ function maybeReadMore(stream4, state3) {
+ if (!state3.readingMore && state3.constructed) {
+ state3.readingMore = true;
+ process5.nextTick(maybeReadMore_, stream4, state3);
}
- async function forEachFn(value, options2) {
- await fn(value, options2);
- return kEmpty;
+ }
+ function maybeReadMore_(stream4, state3) {
+ while (!state3.reading && !state3.ended && (state3.length < state3.highWaterMark || state3.flowing && state3.length === 0)) {
+ const len = state3.length;
+ debug2("maybeReadMore read 0");
+ stream4.read(0);
+ if (len === state3.length)
+ break;
}
- for await (const unused of map.call(this, forEachFn, options)) ;
+ state3.readingMore = false;
}
- function filter(fn, options) {
- if (typeof fn !== "function") {
- throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
+ Readable7.prototype._read = function(n) {
+ throw new ERR_METHOD_NOT_IMPLEMENTED("_read()");
+ };
+ Readable7.prototype.pipe = function(dest, pipeOpts) {
+ const src = this;
+ const state3 = this._readableState;
+ if (state3.pipes.length === 1) {
+ if (!state3.multiAwaitDrain) {
+ state3.multiAwaitDrain = true;
+ state3.awaitDrainWriters = new SafeSet(state3.awaitDrainWriters ? [state3.awaitDrainWriters] : []);
+ }
}
- async function filterFn(value, options2) {
- if (await fn(value, options2)) {
- return value;
+ state3.pipes.push(dest);
+ debug2("pipe count=%d opts=%j", state3.pipes.length, pipeOpts);
+ const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process5.stdout && dest !== process5.stderr;
+ const endFn = doEnd ? onend : unpipe;
+ if (state3.endEmitted) process5.nextTick(endFn);
+ else src.once("end", endFn);
+ dest.on("unpipe", onunpipe);
+ function onunpipe(readable, unpipeInfo) {
+ debug2("onunpipe");
+ if (readable === src) {
+ if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
+ unpipeInfo.hasUnpiped = true;
+ cleanup();
+ }
}
- return kEmpty;
}
- return map.call(this, filterFn, options);
- }
- var ReduceAwareErrMissingArgs = class extends ERR_MISSING_ARGS {
- constructor() {
- super("reduce");
- this.message = "Reduce of an empty stream requires an initial value";
+ function onend() {
+ debug2("onend");
+ dest.end();
}
- };
- async function reduce(reducer, initialValue, options) {
- var _options$signal2;
- if (typeof reducer !== "function") {
- throw new ERR_INVALID_ARG_TYPE("reducer", ["Function", "AsyncFunction"], reducer);
+ let ondrain;
+ let cleanedUp = false;
+ function cleanup() {
+ debug2("cleanup");
+ dest.removeListener("close", onclose);
+ dest.removeListener("finish", onfinish);
+ if (ondrain) {
+ dest.removeListener("drain", ondrain);
+ }
+ dest.removeListener("error", onerror);
+ dest.removeListener("unpipe", onunpipe);
+ src.removeListener("end", onend);
+ src.removeListener("end", unpipe);
+ src.removeListener("data", ondata);
+ cleanedUp = true;
+ if (ondrain && state3.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain();
+ }
+ function pause() {
+ if (!cleanedUp) {
+ if (state3.pipes.length === 1 && state3.pipes[0] === dest) {
+ debug2("false write response, pause", 0);
+ state3.awaitDrainWriters = dest;
+ state3.multiAwaitDrain = false;
+ } else if (state3.pipes.length > 1 && state3.pipes.includes(dest)) {
+ debug2("false write response, pause", state3.awaitDrainWriters.size);
+ state3.awaitDrainWriters.add(dest);
+ }
+ src.pause();
+ }
+ if (!ondrain) {
+ ondrain = pipeOnDrain(src, dest);
+ dest.on("drain", ondrain);
+ }
+ }
+ src.on("data", ondata);
+ function ondata(chunk) {
+ debug2("ondata");
+ const ret = dest.write(chunk);
+ debug2("dest.write", ret);
+ if (ret === false) {
+ pause();
+ }
+ }
+ function onerror(er) {
+ debug2("onerror", er);
+ unpipe();
+ dest.removeListener("error", onerror);
+ if (dest.listenerCount("error") === 0) {
+ const s = dest._writableState || dest._readableState;
+ if (s && !s.errorEmitted) {
+ errorOrDestroy(dest, er);
+ } else {
+ dest.emit("error", er);
+ }
+ }
+ }
+ prependListener(dest, "error", onerror);
+ function onclose() {
+ dest.removeListener("finish", onfinish);
+ unpipe();
}
- if (options != null) {
- validateObject(options, "options");
+ dest.once("close", onclose);
+ function onfinish() {
+ debug2("onfinish");
+ dest.removeListener("close", onclose);
+ unpipe();
}
- if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
- validateAbortSignal(options.signal, "options.signal");
+ dest.once("finish", onfinish);
+ function unpipe() {
+ debug2("unpipe");
+ src.unpipe(dest);
}
- let hasInitialValue = arguments.length > 1;
- if (options !== null && options !== void 0 && (_options$signal2 = options.signal) !== null && _options$signal2 !== void 0 && _options$signal2.aborted) {
- const err = new AbortError3(void 0, {
- cause: options.signal.reason
- });
- this.once("error", () => {
- });
- await finished(this.destroy(err));
- throw err;
+ dest.emit("pipe", src);
+ if (dest.writableNeedDrain === true) {
+ pause();
+ } else if (!state3.flowing) {
+ debug2("pipe resume");
+ src.resume();
}
- const ac = new AbortController2();
- const signal = ac.signal;
- if (options !== null && options !== void 0 && options.signal) {
- const opts = {
- once: true,
- [kWeakHandler]: this,
- [kResistStopPropagation]: true
- };
- options.signal.addEventListener("abort", () => ac.abort(), opts);
+ return dest;
+ };
+ function pipeOnDrain(src, dest) {
+ return function pipeOnDrainFunctionResult() {
+ const state3 = src._readableState;
+ if (state3.awaitDrainWriters === dest) {
+ debug2("pipeOnDrain", 1);
+ state3.awaitDrainWriters = null;
+ } else if (state3.multiAwaitDrain) {
+ debug2("pipeOnDrain", state3.awaitDrainWriters.size);
+ state3.awaitDrainWriters.delete(dest);
+ }
+ if ((!state3.awaitDrainWriters || state3.awaitDrainWriters.size === 0) && src.listenerCount("data")) {
+ src.resume();
+ }
+ };
+ }
+ Readable7.prototype.unpipe = function(dest) {
+ const state3 = this._readableState;
+ const unpipeInfo = {
+ hasUnpiped: false
+ };
+ if (state3.pipes.length === 0) return this;
+ if (!dest) {
+ const dests = state3.pipes;
+ state3.pipes = [];
+ this.pause();
+ for (let i = 0; i < dests.length; i++)
+ dests[i].emit("unpipe", this, {
+ hasUnpiped: false
+ });
+ return this;
}
- let gotAnyItemFromStream = false;
- try {
- for await (const value of this) {
- var _options$signal3;
- gotAnyItemFromStream = true;
- if (options !== null && options !== void 0 && (_options$signal3 = options.signal) !== null && _options$signal3 !== void 0 && _options$signal3.aborted) {
- throw new AbortError3();
- }
- if (!hasInitialValue) {
- initialValue = value;
- hasInitialValue = true;
- } else {
- initialValue = await reducer(initialValue, value, {
- signal
- });
+ const index = ArrayPrototypeIndexOf(state3.pipes, dest);
+ if (index === -1) return this;
+ state3.pipes.splice(index, 1);
+ if (state3.pipes.length === 0) this.pause();
+ dest.emit("unpipe", this, unpipeInfo);
+ return this;
+ };
+ Readable7.prototype.on = function(ev, fn) {
+ const res = Stream2.prototype.on.call(this, ev, fn);
+ const state3 = this._readableState;
+ if (ev === "data") {
+ state3.readableListening = this.listenerCount("readable") > 0;
+ if (state3.flowing !== false) this.resume();
+ } else if (ev === "readable") {
+ if (!state3.endEmitted && !state3.readableListening) {
+ state3.readableListening = state3.needReadable = true;
+ state3.flowing = false;
+ state3.emittedReadable = false;
+ debug2("on readable", state3.length, state3.reading);
+ if (state3.length) {
+ emitReadable(this);
+ } else if (!state3.reading) {
+ process5.nextTick(nReadingNextTick, this);
}
}
- if (!gotAnyItemFromStream && !hasInitialValue) {
- throw new ReduceAwareErrMissingArgs();
- }
- } finally {
- ac.abort();
}
- return initialValue;
- }
- async function toArray(options) {
- if (options != null) {
- validateObject(options, "options");
+ return res;
+ };
+ Readable7.prototype.addListener = Readable7.prototype.on;
+ Readable7.prototype.removeListener = function(ev, fn) {
+ const res = Stream2.prototype.removeListener.call(this, ev, fn);
+ if (ev === "readable") {
+ process5.nextTick(updateReadableListening, this);
}
- if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
- validateAbortSignal(options.signal, "options.signal");
+ return res;
+ };
+ Readable7.prototype.off = Readable7.prototype.removeListener;
+ Readable7.prototype.removeAllListeners = function(ev) {
+ const res = Stream2.prototype.removeAllListeners.apply(this, arguments);
+ if (ev === "readable" || ev === void 0) {
+ process5.nextTick(updateReadableListening, this);
}
- const result = [];
- for await (const val of this) {
- var _options$signal4;
- if (options !== null && options !== void 0 && (_options$signal4 = options.signal) !== null && _options$signal4 !== void 0 && _options$signal4.aborted) {
- throw new AbortError3(void 0, {
- cause: options.signal.reason
- });
- }
- ArrayPrototypePush(result, val);
+ return res;
+ };
+ function updateReadableListening(self2) {
+ const state3 = self2._readableState;
+ state3.readableListening = self2.listenerCount("readable") > 0;
+ if (state3.resumeScheduled && state3[kPaused] === false) {
+ state3.flowing = true;
+ } else if (self2.listenerCount("data") > 0) {
+ self2.resume();
+ } else if (!state3.readableListening) {
+ state3.flowing = null;
}
- return result;
}
- function flatMap(fn, options) {
- const values = map.call(this, fn, options);
- return async function* flatMap2() {
- for await (const val of values) {
- yield* val;
- }
- }.call(this);
+ function nReadingNextTick(self2) {
+ debug2("readable nexttick read 0");
+ self2.read(0);
}
- function toIntegerOrInfinity(number) {
- number = Number2(number);
- if (NumberIsNaN(number)) {
- return 0;
+ Readable7.prototype.resume = function() {
+ const state3 = this._readableState;
+ if (!state3.flowing) {
+ debug2("resume");
+ state3.flowing = !state3.readableListening;
+ resume(this, state3);
}
- if (number < 0) {
- throw new ERR_OUT_OF_RANGE("number", ">= 0", number);
+ state3[kPaused] = false;
+ return this;
+ };
+ function resume(stream4, state3) {
+ if (!state3.resumeScheduled) {
+ state3.resumeScheduled = true;
+ process5.nextTick(resume_, stream4, state3);
}
- return number;
}
- function drop(number, options = void 0) {
- if (options != null) {
- validateObject(options, "options");
+ function resume_(stream4, state3) {
+ debug2("resume", state3.reading);
+ if (!state3.reading) {
+ stream4.read(0);
}
- if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
- validateAbortSignal(options.signal, "options.signal");
+ state3.resumeScheduled = false;
+ stream4.emit("resume");
+ flow(stream4);
+ if (state3.flowing && !state3.reading) stream4.read(0);
+ }
+ Readable7.prototype.pause = function() {
+ debug2("call pause flowing=%j", this._readableState.flowing);
+ if (this._readableState.flowing !== false) {
+ debug2("pause");
+ this._readableState.flowing = false;
+ this.emit("pause");
}
- number = toIntegerOrInfinity(number);
- return async function* drop2() {
- var _options$signal5;
- if (options !== null && options !== void 0 && (_options$signal5 = options.signal) !== null && _options$signal5 !== void 0 && _options$signal5.aborted) {
- throw new AbortError3();
+ this._readableState[kPaused] = true;
+ return this;
+ };
+ function flow(stream4) {
+ const state3 = stream4._readableState;
+ debug2("flow", state3.flowing);
+ while (state3.flowing && stream4.read() !== null) ;
+ }
+ Readable7.prototype.wrap = function(stream4) {
+ let paused = false;
+ stream4.on("data", (chunk) => {
+ if (!this.push(chunk) && stream4.pause) {
+ paused = true;
+ stream4.pause();
}
- for await (const val of this) {
- var _options$signal6;
- if (options !== null && options !== void 0 && (_options$signal6 = options.signal) !== null && _options$signal6 !== void 0 && _options$signal6.aborted) {
- throw new AbortError3();
- }
- if (number-- <= 0) {
- yield val;
- }
+ });
+ stream4.on("end", () => {
+ this.push(null);
+ });
+ stream4.on("error", (err) => {
+ errorOrDestroy(this, err);
+ });
+ stream4.on("close", () => {
+ this.destroy();
+ });
+ stream4.on("destroy", () => {
+ this.destroy();
+ });
+ this._read = () => {
+ if (paused && stream4.resume) {
+ paused = false;
+ stream4.resume();
+ }
+ };
+ const streamKeys = ObjectKeys(stream4);
+ for (let j = 1; j < streamKeys.length; j++) {
+ const i = streamKeys[j];
+ if (this[i] === void 0 && typeof stream4[i] === "function") {
+ this[i] = stream4[i].bind(stream4);
}
- }.call(this);
- }
- function take(number, options = void 0) {
- if (options != null) {
+ }
+ return this;
+ };
+ Readable7.prototype[SymbolAsyncIterator] = function() {
+ return streamToAsyncIterator(this);
+ };
+ Readable7.prototype.iterator = function(options) {
+ if (options !== void 0) {
validateObject(options, "options");
}
- if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
- validateAbortSignal(options.signal, "options.signal");
+ return streamToAsyncIterator(this, options);
+ };
+ function streamToAsyncIterator(stream4, options) {
+ if (typeof stream4.read !== "function") {
+ stream4 = Readable7.wrap(stream4, {
+ objectMode: true
+ });
}
- number = toIntegerOrInfinity(number);
- return async function* take2() {
- var _options$signal7;
- if (options !== null && options !== void 0 && (_options$signal7 = options.signal) !== null && _options$signal7 !== void 0 && _options$signal7.aborted) {
- throw new AbortError3();
+ const iter = createAsyncIterator(stream4, options);
+ iter.stream = stream4;
+ return iter;
+ }
+ async function* createAsyncIterator(stream4, options) {
+ let callback = nop;
+ function next(resolve7) {
+ if (this === stream4) {
+ callback();
+ callback = nop;
+ } else {
+ callback = resolve7;
}
- for await (const val of this) {
- var _options$signal8;
- if (options !== null && options !== void 0 && (_options$signal8 = options.signal) !== null && _options$signal8 !== void 0 && _options$signal8.aborted) {
- throw new AbortError3();
- }
- if (number-- > 0) {
- yield val;
- }
- if (number <= 0) {
+ }
+ stream4.on("readable", next);
+ let error2;
+ const cleanup = eos(
+ stream4,
+ {
+ writable: false
+ },
+ (err) => {
+ error2 = err ? aggregateTwoErrors(error2, err) : null;
+ callback();
+ callback = nop;
+ }
+ );
+ try {
+ while (true) {
+ const chunk = stream4.destroyed ? null : stream4.read();
+ if (chunk !== null) {
+ yield chunk;
+ } else if (error2) {
+ throw error2;
+ } else if (error2 === null) {
return;
+ } else {
+ await new Promise2(next);
}
}
- }.call(this);
+ } catch (err) {
+ error2 = aggregateTwoErrors(error2, err);
+ throw error2;
+ } finally {
+ if ((error2 || (options === null || options === void 0 ? void 0 : options.destroyOnReturn) !== false) && (error2 === void 0 || stream4._readableState.autoDestroy)) {
+ destroyImpl.destroyer(stream4, null);
+ } else {
+ stream4.off("readable", next);
+ cleanup();
+ }
+ }
}
- module2.exports.streamReturningOperators = {
- asIndexedPairs: deprecate(asIndexedPairs, "readable.asIndexedPairs will be removed in a future version."),
- drop,
- filter,
- flatMap,
- map,
- take,
- compose
- };
- module2.exports.promiseReturningOperators = {
- every,
- forEach,
- reduce,
- toArray,
- some,
- find
- };
- }
-});
-
-// node_modules/readable-stream/lib/stream/promises.js
-var require_promises = __commonJS({
- "node_modules/readable-stream/lib/stream/promises.js"(exports2, module2) {
- "use strict";
- var { ArrayPrototypePop, Promise: Promise2 } = require_primordials();
- var { isIterable, isNodeStream, isWebStream } = require_utils2();
- var { pipelineImpl: pl } = require_pipeline();
- var { finished } = require_end_of_stream();
- require_stream2();
- function pipeline3(...streams) {
- return new Promise2((resolve7, reject) => {
- let signal;
- let end;
- const lastArg = streams[streams.length - 1];
- if (lastArg && typeof lastArg === "object" && !isNodeStream(lastArg) && !isIterable(lastArg) && !isWebStream(lastArg)) {
- const options = ArrayPrototypePop(streams);
- signal = options.signal;
- end = options.end;
+ ObjectDefineProperties(Readable7.prototype, {
+ readable: {
+ __proto__: null,
+ get() {
+ const r = this._readableState;
+ return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted;
+ },
+ set(val) {
+ if (this._readableState) {
+ this._readableState.readable = !!val;
+ }
}
- pl(
- streams,
- (err, value) => {
- if (err) {
- reject(err);
- } else {
- resolve7(value);
- }
- },
- {
- signal,
- end
+ },
+ readableDidRead: {
+ __proto__: null,
+ enumerable: false,
+ get: function() {
+ return this._readableState.dataEmitted;
+ }
+ },
+ readableAborted: {
+ __proto__: null,
+ enumerable: false,
+ get: function() {
+ return !!(this._readableState.readable !== false && (this._readableState.destroyed || this._readableState.errored) && !this._readableState.endEmitted);
+ }
+ },
+ readableHighWaterMark: {
+ __proto__: null,
+ enumerable: false,
+ get: function() {
+ return this._readableState.highWaterMark;
+ }
+ },
+ readableBuffer: {
+ __proto__: null,
+ enumerable: false,
+ get: function() {
+ return this._readableState && this._readableState.buffer;
+ }
+ },
+ readableFlowing: {
+ __proto__: null,
+ enumerable: false,
+ get: function() {
+ return this._readableState.flowing;
+ },
+ set: function(state3) {
+ if (this._readableState) {
+ this._readableState.flowing = state3;
}
- );
- });
- }
- module2.exports = {
- finished,
- pipeline: pipeline3
- };
- }
-});
-
-// node_modules/readable-stream/lib/stream.js
-var require_stream2 = __commonJS({
- "node_modules/readable-stream/lib/stream.js"(exports2, module2) {
- "use strict";
- var { Buffer: Buffer3 } = require("buffer");
- var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials();
- var {
- promisify: { custom: customPromisify }
- } = require_util10();
- var { streamReturningOperators, promiseReturningOperators } = require_operators();
- var {
- codes: { ERR_ILLEGAL_CONSTRUCTOR }
- } = require_errors2();
- var compose = require_compose();
- var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state();
- var { pipeline: pipeline3 } = require_pipeline();
- var { destroyer } = require_destroy2();
- var eos = require_end_of_stream();
- var promises4 = require_promises();
- var utils = require_utils2();
- var Stream2 = module2.exports = require_legacy().Stream;
- Stream2.isDestroyed = utils.isDestroyed;
- Stream2.isDisturbed = utils.isDisturbed;
- Stream2.isErrored = utils.isErrored;
- Stream2.isReadable = utils.isReadable;
- Stream2.isWritable = utils.isWritable;
- Stream2.Readable = require_readable3();
- for (const key of ObjectKeys(streamReturningOperators)) {
- let fn = function(...args) {
- if (new.target) {
- throw ERR_ILLEGAL_CONSTRUCTOR();
}
- return Stream2.Readable.from(ReflectApply(op, this, args));
- };
- const op = streamReturningOperators[key];
- ObjectDefineProperty(fn, "name", {
+ },
+ readableLength: {
__proto__: null,
- value: op.name
- });
- ObjectDefineProperty(fn, "length", {
+ enumerable: false,
+ get() {
+ return this._readableState.length;
+ }
+ },
+ readableObjectMode: {
__proto__: null,
- value: op.length
- });
- ObjectDefineProperty(Stream2.Readable.prototype, key, {
+ enumerable: false,
+ get() {
+ return this._readableState ? this._readableState.objectMode : false;
+ }
+ },
+ readableEncoding: {
+ __proto__: null,
+ enumerable: false,
+ get() {
+ return this._readableState ? this._readableState.encoding : null;
+ }
+ },
+ errored: {
__proto__: null,
- value: fn,
enumerable: false,
- configurable: true,
- writable: true
- });
- }
- for (const key of ObjectKeys(promiseReturningOperators)) {
- let fn = function(...args) {
- if (new.target) {
- throw ERR_ILLEGAL_CONSTRUCTOR();
+ get() {
+ return this._readableState ? this._readableState.errored : null;
}
- return ReflectApply(op, this, args);
- };
- const op = promiseReturningOperators[key];
- ObjectDefineProperty(fn, "name", {
+ },
+ closed: {
__proto__: null,
- value: op.name
- });
- ObjectDefineProperty(fn, "length", {
+ get() {
+ return this._readableState ? this._readableState.closed : false;
+ }
+ },
+ destroyed: {
__proto__: null,
- value: op.length
- });
- ObjectDefineProperty(Stream2.Readable.prototype, key, {
+ enumerable: false,
+ get() {
+ return this._readableState ? this._readableState.destroyed : false;
+ },
+ set(value) {
+ if (!this._readableState) {
+ return;
+ }
+ this._readableState.destroyed = value;
+ }
+ },
+ readableEnded: {
__proto__: null,
- value: fn,
enumerable: false,
- configurable: true,
- writable: true
- });
- }
- Stream2.Writable = require_writable();
- Stream2.Duplex = require_duplex();
- Stream2.Transform = require_transform();
- Stream2.PassThrough = require_passthrough2();
- Stream2.pipeline = pipeline3;
- var { addAbortSignal } = require_add_abort_signal();
- Stream2.addAbortSignal = addAbortSignal;
- Stream2.finished = eos;
- Stream2.destroy = destroyer;
- Stream2.compose = compose;
- Stream2.setDefaultHighWaterMark = setDefaultHighWaterMark;
- Stream2.getDefaultHighWaterMark = getDefaultHighWaterMark;
- ObjectDefineProperty(Stream2, "promises", {
- __proto__: null,
- configurable: true,
- enumerable: true,
- get() {
- return promises4;
- }
- });
- ObjectDefineProperty(pipeline3, customPromisify, {
- __proto__: null,
- enumerable: true,
- get() {
- return promises4.pipeline;
- }
- });
- ObjectDefineProperty(eos, customPromisify, {
- __proto__: null,
- enumerable: true,
- get() {
- return promises4.finished;
+ get() {
+ return this._readableState ? this._readableState.endEmitted : false;
+ }
}
});
- Stream2.Stream = Stream2;
- Stream2._isUint8Array = function isUint8Array(value) {
- return value instanceof Uint8Array;
- };
- Stream2._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
- return Buffer3.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
- };
- }
-});
-
-// node_modules/readable-stream/lib/ours/index.js
-var require_ours = __commonJS({
- "node_modules/readable-stream/lib/ours/index.js"(exports2, module2) {
- "use strict";
- var Stream2 = require("stream");
- if (Stream2 && process.env.READABLE_STREAM === "disable") {
- const promises4 = Stream2.promises;
- module2.exports._uint8ArrayToBuffer = Stream2._uint8ArrayToBuffer;
- module2.exports._isUint8Array = Stream2._isUint8Array;
- module2.exports.isDisturbed = Stream2.isDisturbed;
- module2.exports.isErrored = Stream2.isErrored;
- module2.exports.isReadable = Stream2.isReadable;
- module2.exports.Readable = Stream2.Readable;
- module2.exports.Writable = Stream2.Writable;
- module2.exports.Duplex = Stream2.Duplex;
- module2.exports.Transform = Stream2.Transform;
- module2.exports.PassThrough = Stream2.PassThrough;
- module2.exports.addAbortSignal = Stream2.addAbortSignal;
- module2.exports.finished = Stream2.finished;
- module2.exports.destroy = Stream2.destroy;
- module2.exports.pipeline = Stream2.pipeline;
- module2.exports.compose = Stream2.compose;
- Object.defineProperty(Stream2, "promises", {
- configurable: true,
- enumerable: true,
+ ObjectDefineProperties(ReadableState.prototype, {
+ // Legacy getter for `pipesCount`.
+ pipesCount: {
+ __proto__: null,
get() {
- return promises4;
+ return this.pipes.length;
}
- });
- module2.exports.Stream = Stream2.Stream;
- } else {
- const CustomStream = require_stream2();
- const promises4 = require_promises();
- const originalDestroy = CustomStream.Readable.destroy;
- module2.exports = CustomStream.Readable;
- module2.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
- module2.exports._isUint8Array = CustomStream._isUint8Array;
- module2.exports.isDisturbed = CustomStream.isDisturbed;
- module2.exports.isErrored = CustomStream.isErrored;
- module2.exports.isReadable = CustomStream.isReadable;
- module2.exports.Readable = CustomStream.Readable;
- module2.exports.Writable = CustomStream.Writable;
- module2.exports.Duplex = CustomStream.Duplex;
- module2.exports.Transform = CustomStream.Transform;
- module2.exports.PassThrough = CustomStream.PassThrough;
- module2.exports.addAbortSignal = CustomStream.addAbortSignal;
- module2.exports.finished = CustomStream.finished;
- module2.exports.destroy = CustomStream.destroy;
- module2.exports.destroy = originalDestroy;
- module2.exports.pipeline = CustomStream.pipeline;
- module2.exports.compose = CustomStream.compose;
- Object.defineProperty(CustomStream, "promises", {
- configurable: true,
- enumerable: true,
+ },
+ // Legacy property for `paused`.
+ paused: {
+ __proto__: null,
get() {
- return promises4;
- }
- });
- module2.exports.Stream = CustomStream.Stream;
- }
- module2.exports.default = module2.exports;
- }
-});
-
-// node_modules/lodash/_arrayPush.js
-var require_arrayPush = __commonJS({
- "node_modules/lodash/_arrayPush.js"(exports2, module2) {
- function arrayPush(array, values) {
- var index = -1, length = values.length, offset = array.length;
- while (++index < length) {
- array[offset + index] = values[index];
- }
- return array;
- }
- module2.exports = arrayPush;
- }
-});
-
-// node_modules/lodash/_isFlattenable.js
-var require_isFlattenable = __commonJS({
- "node_modules/lodash/_isFlattenable.js"(exports2, module2) {
- var Symbol2 = require_Symbol();
- var isArguments = require_isArguments();
- var isArray = require_isArray();
- var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
- function isFlattenable(value) {
- return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
- }
- module2.exports = isFlattenable;
- }
-});
-
-// node_modules/lodash/_baseFlatten.js
-var require_baseFlatten = __commonJS({
- "node_modules/lodash/_baseFlatten.js"(exports2, module2) {
- var arrayPush = require_arrayPush();
- var isFlattenable = require_isFlattenable();
- function baseFlatten(array, depth, predicate, isStrict, result) {
- var index = -1, length = array.length;
- predicate || (predicate = isFlattenable);
- result || (result = []);
- while (++index < length) {
- var value = array[index];
- if (depth > 0 && predicate(value)) {
- if (depth > 1) {
- baseFlatten(value, depth - 1, predicate, isStrict, result);
- } else {
- arrayPush(result, value);
- }
- } else if (!isStrict) {
- result[result.length] = value;
+ return this[kPaused] !== false;
+ },
+ set(value) {
+ this[kPaused] = !!value;
}
}
- return result;
- }
- module2.exports = baseFlatten;
- }
-});
-
-// node_modules/lodash/flatten.js
-var require_flatten = __commonJS({
- "node_modules/lodash/flatten.js"(exports2, module2) {
- var baseFlatten = require_baseFlatten();
- function flatten(array) {
- var length = array == null ? 0 : array.length;
- return length ? baseFlatten(array, 1) : [];
- }
- module2.exports = flatten;
- }
-});
-
-// node_modules/lodash/_nativeCreate.js
-var require_nativeCreate = __commonJS({
- "node_modules/lodash/_nativeCreate.js"(exports2, module2) {
- var getNative = require_getNative();
- var nativeCreate = getNative(Object, "create");
- module2.exports = nativeCreate;
- }
-});
-
-// node_modules/lodash/_hashClear.js
-var require_hashClear = __commonJS({
- "node_modules/lodash/_hashClear.js"(exports2, module2) {
- var nativeCreate = require_nativeCreate();
- function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
- this.size = 0;
+ });
+ Readable7._fromList = fromList;
+ function fromList(n, state3) {
+ if (state3.length === 0) return null;
+ let ret;
+ if (state3.objectMode) ret = state3.buffer.shift();
+ else if (!n || n >= state3.length) {
+ if (state3.decoder) ret = state3.buffer.join("");
+ else if (state3.buffer.length === 1) ret = state3.buffer.first();
+ else ret = state3.buffer.concat(state3.length);
+ state3.buffer.clear();
+ } else {
+ ret = state3.buffer.consume(n, state3.decoder);
+ }
+ return ret;
}
- module2.exports = hashClear;
- }
-});
-
-// node_modules/lodash/_hashDelete.js
-var require_hashDelete = __commonJS({
- "node_modules/lodash/_hashDelete.js"(exports2, module2) {
- function hashDelete(key) {
- var result = this.has(key) && delete this.__data__[key];
- this.size -= result ? 1 : 0;
- return result;
+ function endReadable(stream4) {
+ const state3 = stream4._readableState;
+ debug2("endReadable", state3.endEmitted);
+ if (!state3.endEmitted) {
+ state3.ended = true;
+ process5.nextTick(endReadableNT, state3, stream4);
+ }
}
- module2.exports = hashDelete;
- }
-});
-
-// node_modules/lodash/_hashGet.js
-var require_hashGet = __commonJS({
- "node_modules/lodash/_hashGet.js"(exports2, module2) {
- var nativeCreate = require_nativeCreate();
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? void 0 : result;
+ function endReadableNT(state3, stream4) {
+ debug2("endReadableNT", state3.endEmitted, state3.length);
+ if (!state3.errored && !state3.closeEmitted && !state3.endEmitted && state3.length === 0) {
+ state3.endEmitted = true;
+ stream4.emit("end");
+ if (stream4.writable && stream4.allowHalfOpen === false) {
+ process5.nextTick(endWritableNT, stream4);
+ } else if (state3.autoDestroy) {
+ const wState = stream4._writableState;
+ const autoDestroy = !wState || wState.autoDestroy && // We don't expect the writable to ever 'finish'
+ // if writable is explicitly set to false.
+ (wState.finished || wState.writable === false);
+ if (autoDestroy) {
+ stream4.destroy();
+ }
+ }
}
- return hasOwnProperty.call(data, key) ? data[key] : void 0;
}
- module2.exports = hashGet;
- }
-});
-
-// node_modules/lodash/_hashHas.js
-var require_hashHas = __commonJS({
- "node_modules/lodash/_hashHas.js"(exports2, module2) {
- var nativeCreate = require_nativeCreate();
- var objectProto = Object.prototype;
- var hasOwnProperty = objectProto.hasOwnProperty;
- function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
+ function endWritableNT(stream4) {
+ const writable = stream4.writable && !stream4.writableEnded && !stream4.destroyed;
+ if (writable) {
+ stream4.end();
+ }
}
- module2.exports = hashHas;
- }
-});
-
-// node_modules/lodash/_hashSet.js
-var require_hashSet = __commonJS({
- "node_modules/lodash/_hashSet.js"(exports2, module2) {
- var nativeCreate = require_nativeCreate();
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
- function hashSet(key, value) {
- var data = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
- return this;
+ Readable7.from = function(iterable, opts) {
+ return from(Readable7, iterable, opts);
+ };
+ var webStreamsAdapters;
+ function lazyWebStreams() {
+ if (webStreamsAdapters === void 0) webStreamsAdapters = {};
+ return webStreamsAdapters;
}
- module2.exports = hashSet;
+ Readable7.fromWeb = function(readableStream, options) {
+ return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options);
+ };
+ Readable7.toWeb = function(streamReadable, options) {
+ return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options);
+ };
+ Readable7.wrap = function(src, options) {
+ var _ref, _src$readableObjectMo;
+ return new Readable7({
+ objectMode: (_ref = (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== void 0 ? _src$readableObjectMo : src.objectMode) !== null && _ref !== void 0 ? _ref : true,
+ ...options,
+ destroy(err, callback) {
+ destroyImpl.destroyer(src, err);
+ callback(err);
+ }
+ }).wrap(src);
+ };
}
});
-// node_modules/lodash/_Hash.js
-var require_Hash = __commonJS({
- "node_modules/lodash/_Hash.js"(exports2, module2) {
- var hashClear = require_hashClear();
- var hashDelete = require_hashDelete();
- var hashGet = require_hashGet();
- var hashHas = require_hashHas();
- var hashSet = require_hashSet();
- function Hash(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
+// node_modules/readable-stream/lib/internal/streams/writable.js
+var require_writable = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/writable.js"(exports2, module2) {
+ "use strict";
+ var process5 = require_process();
+ var {
+ ArrayPrototypeSlice,
+ Error: Error2,
+ FunctionPrototypeSymbolHasInstance,
+ ObjectDefineProperty,
+ ObjectDefineProperties,
+ ObjectSetPrototypeOf,
+ StringPrototypeToLowerCase,
+ Symbol: Symbol2,
+ SymbolHasInstance
+ } = require_primordials();
+ module2.exports = Writable;
+ Writable.WritableState = WritableState;
+ var { EventEmitter: EE } = require("events");
+ var Stream2 = require_legacy().Stream;
+ var { Buffer: Buffer3 } = require("buffer");
+ var destroyImpl = require_destroy2();
+ var { addAbortSignal } = require_add_abort_signal();
+ var { getHighWaterMark, getDefaultHighWaterMark } = require_state();
+ var {
+ ERR_INVALID_ARG_TYPE,
+ ERR_METHOD_NOT_IMPLEMENTED,
+ ERR_MULTIPLE_CALLBACK,
+ ERR_STREAM_CANNOT_PIPE,
+ ERR_STREAM_DESTROYED,
+ ERR_STREAM_ALREADY_FINISHED,
+ ERR_STREAM_NULL_VALUES,
+ ERR_STREAM_WRITE_AFTER_END,
+ ERR_UNKNOWN_ENCODING
+ } = require_errors2().codes;
+ var { errorOrDestroy } = destroyImpl;
+ ObjectSetPrototypeOf(Writable.prototype, Stream2.prototype);
+ ObjectSetPrototypeOf(Writable, Stream2);
+ function nop() {
}
- Hash.prototype.clear = hashClear;
- Hash.prototype["delete"] = hashDelete;
- Hash.prototype.get = hashGet;
- Hash.prototype.has = hashHas;
- Hash.prototype.set = hashSet;
- module2.exports = Hash;
- }
-});
-
-// node_modules/lodash/_listCacheClear.js
-var require_listCacheClear = __commonJS({
- "node_modules/lodash/_listCacheClear.js"(exports2, module2) {
- function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
+ var kOnFinished = Symbol2("kOnFinished");
+ function WritableState(options, stream4, isDuplex) {
+ if (typeof isDuplex !== "boolean") isDuplex = stream4 instanceof require_duplex();
+ this.objectMode = !!(options && options.objectMode);
+ if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode);
+ this.highWaterMark = options ? getHighWaterMark(this, options, "writableHighWaterMark", isDuplex) : getDefaultHighWaterMark(false);
+ this.finalCalled = false;
+ this.needDrain = false;
+ this.ending = false;
+ this.ended = false;
+ this.finished = false;
+ this.destroyed = false;
+ const noDecode = !!(options && options.decodeStrings === false);
+ this.decodeStrings = !noDecode;
+ this.defaultEncoding = options && options.defaultEncoding || "utf8";
+ this.length = 0;
+ this.writing = false;
+ this.corked = 0;
+ this.sync = true;
+ this.bufferProcessing = false;
+ this.onwrite = onwrite.bind(void 0, stream4);
+ this.writecb = null;
+ this.writelen = 0;
+ this.afterWriteTickInfo = null;
+ resetBuffer(this);
+ this.pendingcb = 0;
+ this.constructed = true;
+ this.prefinished = false;
+ this.errorEmitted = false;
+ this.emitClose = !options || options.emitClose !== false;
+ this.autoDestroy = !options || options.autoDestroy !== false;
+ this.errored = null;
+ this.closed = false;
+ this.closeEmitted = false;
+ this[kOnFinished] = [];
}
- module2.exports = listCacheClear;
- }
-});
-
-// node_modules/lodash/_assocIndexOf.js
-var require_assocIndexOf = __commonJS({
- "node_modules/lodash/_assocIndexOf.js"(exports2, module2) {
- var eq = require_eq();
- function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq(array[length][0], key)) {
- return length;
+ function resetBuffer(state3) {
+ state3.buffered = [];
+ state3.bufferedIndex = 0;
+ state3.allBuffers = true;
+ state3.allNoop = true;
+ }
+ WritableState.prototype.getBuffer = function getBuffer() {
+ return ArrayPrototypeSlice(this.buffered, this.bufferedIndex);
+ };
+ ObjectDefineProperty(WritableState.prototype, "bufferedRequestCount", {
+ __proto__: null,
+ get() {
+ return this.buffered.length - this.bufferedIndex;
+ }
+ });
+ function Writable(options) {
+ const isDuplex = this instanceof require_duplex();
+ if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options);
+ this._writableState = new WritableState(options, this, isDuplex);
+ if (options) {
+ if (typeof options.write === "function") this._write = options.write;
+ if (typeof options.writev === "function") this._writev = options.writev;
+ if (typeof options.destroy === "function") this._destroy = options.destroy;
+ if (typeof options.final === "function") this._final = options.final;
+ if (typeof options.construct === "function") this._construct = options.construct;
+ if (options.signal) addAbortSignal(options.signal, this);
+ }
+ Stream2.call(this, options);
+ destroyImpl.construct(this, () => {
+ const state3 = this._writableState;
+ if (!state3.writing) {
+ clearBuffer(this, state3);
}
- }
- return -1;
+ finishMaybe(this, state3);
+ });
}
- module2.exports = assocIndexOf;
- }
-});
-
-// node_modules/lodash/_listCacheDelete.js
-var require_listCacheDelete = __commonJS({
- "node_modules/lodash/_listCacheDelete.js"(exports2, module2) {
- var assocIndexOf = require_assocIndexOf();
- var arrayProto = Array.prototype;
- var splice = arrayProto.splice;
- function listCacheDelete(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) {
- return false;
+ ObjectDefineProperty(Writable, SymbolHasInstance, {
+ __proto__: null,
+ value: function(object) {
+ if (FunctionPrototypeSymbolHasInstance(this, object)) return true;
+ if (this !== Writable) return false;
+ return object && object._writableState instanceof WritableState;
}
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
+ });
+ Writable.prototype.pipe = function() {
+ errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
+ };
+ function _write(stream4, chunk, encoding, cb) {
+ const state3 = stream4._writableState;
+ if (typeof encoding === "function") {
+ cb = encoding;
+ encoding = state3.defaultEncoding;
} else {
- splice.call(data, index, 1);
+ if (!encoding) encoding = state3.defaultEncoding;
+ else if (encoding !== "buffer" && !Buffer3.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding);
+ if (typeof cb !== "function") cb = nop;
}
- --this.size;
- return true;
- }
- module2.exports = listCacheDelete;
- }
-});
-
-// node_modules/lodash/_listCacheGet.js
-var require_listCacheGet = __commonJS({
- "node_modules/lodash/_listCacheGet.js"(exports2, module2) {
- var assocIndexOf = require_assocIndexOf();
- function listCacheGet(key) {
- var data = this.__data__, index = assocIndexOf(data, key);
- return index < 0 ? void 0 : data[index][1];
- }
- module2.exports = listCacheGet;
- }
-});
-
-// node_modules/lodash/_listCacheHas.js
-var require_listCacheHas = __commonJS({
- "node_modules/lodash/_listCacheHas.js"(exports2, module2) {
- var assocIndexOf = require_assocIndexOf();
- function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
+ if (chunk === null) {
+ throw new ERR_STREAM_NULL_VALUES();
+ } else if (!state3.objectMode) {
+ if (typeof chunk === "string") {
+ if (state3.decodeStrings !== false) {
+ chunk = Buffer3.from(chunk, encoding);
+ encoding = "buffer";
+ }
+ } else if (chunk instanceof Buffer3) {
+ encoding = "buffer";
+ } else if (Stream2._isUint8Array(chunk)) {
+ chunk = Stream2._uint8ArrayToBuffer(chunk);
+ encoding = "buffer";
+ } else {
+ throw new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
+ }
+ }
+ let err;
+ if (state3.ending) {
+ err = new ERR_STREAM_WRITE_AFTER_END();
+ } else if (state3.destroyed) {
+ err = new ERR_STREAM_DESTROYED("write");
+ }
+ if (err) {
+ process5.nextTick(cb, err);
+ errorOrDestroy(stream4, err, true);
+ return err;
+ }
+ state3.pendingcb++;
+ return writeOrBuffer(stream4, state3, chunk, encoding, cb);
}
- module2.exports = listCacheHas;
- }
-});
-
-// node_modules/lodash/_listCacheSet.js
-var require_listCacheSet = __commonJS({
- "node_modules/lodash/_listCacheSet.js"(exports2, module2) {
- var assocIndexOf = require_assocIndexOf();
- function listCacheSet(key, value) {
- var data = this.__data__, index = assocIndexOf(data, key);
- if (index < 0) {
- ++this.size;
- data.push([key, value]);
- } else {
- data[index][1] = value;
+ Writable.prototype.write = function(chunk, encoding, cb) {
+ return _write(this, chunk, encoding, cb) === true;
+ };
+ Writable.prototype.cork = function() {
+ this._writableState.corked++;
+ };
+ Writable.prototype.uncork = function() {
+ const state3 = this._writableState;
+ if (state3.corked) {
+ state3.corked--;
+ if (!state3.writing) clearBuffer(this, state3);
}
+ };
+ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
+ if (typeof encoding === "string") encoding = StringPrototypeToLowerCase(encoding);
+ if (!Buffer3.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding);
+ this._writableState.defaultEncoding = encoding;
return this;
- }
- module2.exports = listCacheSet;
- }
-});
-
-// node_modules/lodash/_ListCache.js
-var require_ListCache = __commonJS({
- "node_modules/lodash/_ListCache.js"(exports2, module2) {
- var listCacheClear = require_listCacheClear();
- var listCacheDelete = require_listCacheDelete();
- var listCacheGet = require_listCacheGet();
- var listCacheHas = require_listCacheHas();
- var listCacheSet = require_listCacheSet();
- function ListCache(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
+ };
+ function writeOrBuffer(stream4, state3, chunk, encoding, callback) {
+ const len = state3.objectMode ? 1 : chunk.length;
+ state3.length += len;
+ const ret = state3.length < state3.highWaterMark;
+ if (!ret) state3.needDrain = true;
+ if (state3.writing || state3.corked || state3.errored || !state3.constructed) {
+ state3.buffered.push({
+ chunk,
+ encoding,
+ callback
+ });
+ if (state3.allBuffers && encoding !== "buffer") {
+ state3.allBuffers = false;
+ }
+ if (state3.allNoop && callback !== nop) {
+ state3.allNoop = false;
+ }
+ } else {
+ state3.writelen = len;
+ state3.writecb = callback;
+ state3.writing = true;
+ state3.sync = true;
+ stream4._write(chunk, encoding, state3.onwrite);
+ state3.sync = false;
}
+ return ret && !state3.errored && !state3.destroyed;
}
- ListCache.prototype.clear = listCacheClear;
- ListCache.prototype["delete"] = listCacheDelete;
- ListCache.prototype.get = listCacheGet;
- ListCache.prototype.has = listCacheHas;
- ListCache.prototype.set = listCacheSet;
- module2.exports = ListCache;
- }
-});
-
-// node_modules/lodash/_Map.js
-var require_Map = __commonJS({
- "node_modules/lodash/_Map.js"(exports2, module2) {
- var getNative = require_getNative();
- var root = require_root();
- var Map2 = getNative(root, "Map");
- module2.exports = Map2;
- }
-});
-
-// node_modules/lodash/_mapCacheClear.js
-var require_mapCacheClear = __commonJS({
- "node_modules/lodash/_mapCacheClear.js"(exports2, module2) {
- var Hash = require_Hash();
- var ListCache = require_ListCache();
- var Map2 = require_Map();
- function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- "hash": new Hash(),
- "map": new (Map2 || ListCache)(),
- "string": new Hash()
- };
- }
- module2.exports = mapCacheClear;
- }
-});
-
-// node_modules/lodash/_isKeyable.js
-var require_isKeyable = __commonJS({
- "node_modules/lodash/_isKeyable.js"(exports2, module2) {
- function isKeyable(value) {
- var type = typeof value;
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
- }
- module2.exports = isKeyable;
- }
-});
-
-// node_modules/lodash/_getMapData.js
-var require_getMapData = __commonJS({
- "node_modules/lodash/_getMapData.js"(exports2, module2) {
- var isKeyable = require_isKeyable();
- function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
- }
- module2.exports = getMapData;
- }
-});
-
-// node_modules/lodash/_mapCacheDelete.js
-var require_mapCacheDelete = __commonJS({
- "node_modules/lodash/_mapCacheDelete.js"(exports2, module2) {
- var getMapData = require_getMapData();
- function mapCacheDelete(key) {
- var result = getMapData(this, key)["delete"](key);
- this.size -= result ? 1 : 0;
- return result;
- }
- module2.exports = mapCacheDelete;
- }
-});
-
-// node_modules/lodash/_mapCacheGet.js
-var require_mapCacheGet = __commonJS({
- "node_modules/lodash/_mapCacheGet.js"(exports2, module2) {
- var getMapData = require_getMapData();
- function mapCacheGet(key) {
- return getMapData(this, key).get(key);
+ function doWrite(stream4, state3, writev, len, chunk, encoding, cb) {
+ state3.writelen = len;
+ state3.writecb = cb;
+ state3.writing = true;
+ state3.sync = true;
+ if (state3.destroyed) state3.onwrite(new ERR_STREAM_DESTROYED("write"));
+ else if (writev) stream4._writev(chunk, state3.onwrite);
+ else stream4._write(chunk, encoding, state3.onwrite);
+ state3.sync = false;
}
- module2.exports = mapCacheGet;
- }
-});
-
-// node_modules/lodash/_mapCacheHas.js
-var require_mapCacheHas = __commonJS({
- "node_modules/lodash/_mapCacheHas.js"(exports2, module2) {
- var getMapData = require_getMapData();
- function mapCacheHas(key) {
- return getMapData(this, key).has(key);
+ function onwriteError(stream4, state3, er, cb) {
+ --state3.pendingcb;
+ cb(er);
+ errorBuffer(state3);
+ errorOrDestroy(stream4, er);
}
- module2.exports = mapCacheHas;
- }
-});
-
-// node_modules/lodash/_mapCacheSet.js
-var require_mapCacheSet = __commonJS({
- "node_modules/lodash/_mapCacheSet.js"(exports2, module2) {
- var getMapData = require_getMapData();
- function mapCacheSet(key, value) {
- var data = getMapData(this, key), size = data.size;
- data.set(key, value);
- this.size += data.size == size ? 0 : 1;
- return this;
+ function onwrite(stream4, er) {
+ const state3 = stream4._writableState;
+ const sync = state3.sync;
+ const cb = state3.writecb;
+ if (typeof cb !== "function") {
+ errorOrDestroy(stream4, new ERR_MULTIPLE_CALLBACK());
+ return;
+ }
+ state3.writing = false;
+ state3.writecb = null;
+ state3.length -= state3.writelen;
+ state3.writelen = 0;
+ if (er) {
+ er.stack;
+ if (!state3.errored) {
+ state3.errored = er;
+ }
+ if (stream4._readableState && !stream4._readableState.errored) {
+ stream4._readableState.errored = er;
+ }
+ if (sync) {
+ process5.nextTick(onwriteError, stream4, state3, er, cb);
+ } else {
+ onwriteError(stream4, state3, er, cb);
+ }
+ } else {
+ if (state3.buffered.length > state3.bufferedIndex) {
+ clearBuffer(stream4, state3);
+ }
+ if (sync) {
+ if (state3.afterWriteTickInfo !== null && state3.afterWriteTickInfo.cb === cb) {
+ state3.afterWriteTickInfo.count++;
+ } else {
+ state3.afterWriteTickInfo = {
+ count: 1,
+ cb,
+ stream: stream4,
+ state: state3
+ };
+ process5.nextTick(afterWriteTick, state3.afterWriteTickInfo);
+ }
+ } else {
+ afterWrite(stream4, state3, 1, cb);
+ }
+ }
}
- module2.exports = mapCacheSet;
- }
-});
-
-// node_modules/lodash/_MapCache.js
-var require_MapCache = __commonJS({
- "node_modules/lodash/_MapCache.js"(exports2, module2) {
- var mapCacheClear = require_mapCacheClear();
- var mapCacheDelete = require_mapCacheDelete();
- var mapCacheGet = require_mapCacheGet();
- var mapCacheHas = require_mapCacheHas();
- var mapCacheSet = require_mapCacheSet();
- function MapCache(entries) {
- var index = -1, length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
+ function afterWriteTick({ stream: stream4, state: state3, count, cb }) {
+ state3.afterWriteTickInfo = null;
+ return afterWrite(stream4, state3, count, cb);
+ }
+ function afterWrite(stream4, state3, count, cb) {
+ const needDrain = !state3.ending && !stream4.destroyed && state3.length === 0 && state3.needDrain;
+ if (needDrain) {
+ state3.needDrain = false;
+ stream4.emit("drain");
+ }
+ while (count-- > 0) {
+ state3.pendingcb--;
+ cb();
+ }
+ if (state3.destroyed) {
+ errorBuffer(state3);
}
+ finishMaybe(stream4, state3);
}
- MapCache.prototype.clear = mapCacheClear;
- MapCache.prototype["delete"] = mapCacheDelete;
- MapCache.prototype.get = mapCacheGet;
- MapCache.prototype.has = mapCacheHas;
- MapCache.prototype.set = mapCacheSet;
- module2.exports = MapCache;
- }
-});
-
-// node_modules/lodash/_setCacheAdd.js
-var require_setCacheAdd = __commonJS({
- "node_modules/lodash/_setCacheAdd.js"(exports2, module2) {
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
- function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
+ function errorBuffer(state3) {
+ if (state3.writing) {
+ return;
+ }
+ for (let n = state3.bufferedIndex; n < state3.buffered.length; ++n) {
+ var _state$errored;
+ const { chunk, callback } = state3.buffered[n];
+ const len = state3.objectMode ? 1 : chunk.length;
+ state3.length -= len;
+ callback(
+ (_state$errored = state3.errored) !== null && _state$errored !== void 0 ? _state$errored : new ERR_STREAM_DESTROYED("write")
+ );
+ }
+ const onfinishCallbacks = state3[kOnFinished].splice(0);
+ for (let i = 0; i < onfinishCallbacks.length; i++) {
+ var _state$errored2;
+ onfinishCallbacks[i](
+ (_state$errored2 = state3.errored) !== null && _state$errored2 !== void 0 ? _state$errored2 : new ERR_STREAM_DESTROYED("end")
+ );
+ }
+ resetBuffer(state3);
}
- module2.exports = setCacheAdd;
- }
-});
-
-// node_modules/lodash/_setCacheHas.js
-var require_setCacheHas = __commonJS({
- "node_modules/lodash/_setCacheHas.js"(exports2, module2) {
- function setCacheHas(value) {
- return this.__data__.has(value);
+ function clearBuffer(stream4, state3) {
+ if (state3.corked || state3.bufferProcessing || state3.destroyed || !state3.constructed) {
+ return;
+ }
+ const { buffered, bufferedIndex, objectMode } = state3;
+ const bufferedLength = buffered.length - bufferedIndex;
+ if (!bufferedLength) {
+ return;
+ }
+ let i = bufferedIndex;
+ state3.bufferProcessing = true;
+ if (bufferedLength > 1 && stream4._writev) {
+ state3.pendingcb -= bufferedLength - 1;
+ const callback = state3.allNoop ? nop : (err) => {
+ for (let n = i; n < buffered.length; ++n) {
+ buffered[n].callback(err);
+ }
+ };
+ const chunks = state3.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i);
+ chunks.allBuffers = state3.allBuffers;
+ doWrite(stream4, state3, true, state3.length, chunks, "", callback);
+ resetBuffer(state3);
+ } else {
+ do {
+ const { chunk, encoding, callback } = buffered[i];
+ buffered[i++] = null;
+ const len = objectMode ? 1 : chunk.length;
+ doWrite(stream4, state3, false, len, chunk, encoding, callback);
+ } while (i < buffered.length && !state3.writing);
+ if (i === buffered.length) {
+ resetBuffer(state3);
+ } else if (i > 256) {
+ buffered.splice(0, i);
+ state3.bufferedIndex = 0;
+ } else {
+ state3.bufferedIndex = i;
+ }
+ }
+ state3.bufferProcessing = false;
}
- module2.exports = setCacheHas;
- }
-});
-
-// node_modules/lodash/_SetCache.js
-var require_SetCache = __commonJS({
- "node_modules/lodash/_SetCache.js"(exports2, module2) {
- var MapCache = require_MapCache();
- var setCacheAdd = require_setCacheAdd();
- var setCacheHas = require_setCacheHas();
- function SetCache(values) {
- var index = -1, length = values == null ? 0 : values.length;
- this.__data__ = new MapCache();
- while (++index < length) {
- this.add(values[index]);
+ Writable.prototype._write = function(chunk, encoding, cb) {
+ if (this._writev) {
+ this._writev(
+ [
+ {
+ chunk,
+ encoding
+ }
+ ],
+ cb
+ );
+ } else {
+ throw new ERR_METHOD_NOT_IMPLEMENTED("_write()");
+ }
+ };
+ Writable.prototype._writev = null;
+ Writable.prototype.end = function(chunk, encoding, cb) {
+ const state3 = this._writableState;
+ if (typeof chunk === "function") {
+ cb = chunk;
+ chunk = null;
+ encoding = null;
+ } else if (typeof encoding === "function") {
+ cb = encoding;
+ encoding = null;
+ }
+ let err;
+ if (chunk !== null && chunk !== void 0) {
+ const ret = _write(this, chunk, encoding);
+ if (ret instanceof Error2) {
+ err = ret;
+ }
+ }
+ if (state3.corked) {
+ state3.corked = 1;
+ this.uncork();
+ }
+ if (err) {
+ } else if (!state3.errored && !state3.ending) {
+ state3.ending = true;
+ finishMaybe(this, state3, true);
+ state3.ended = true;
+ } else if (state3.finished) {
+ err = new ERR_STREAM_ALREADY_FINISHED("end");
+ } else if (state3.destroyed) {
+ err = new ERR_STREAM_DESTROYED("end");
}
- }
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
- SetCache.prototype.has = setCacheHas;
- module2.exports = SetCache;
- }
-});
-
-// node_modules/lodash/_baseFindIndex.js
-var require_baseFindIndex = __commonJS({
- "node_modules/lodash/_baseFindIndex.js"(exports2, module2) {
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
- while (fromRight ? index-- : ++index < length) {
- if (predicate(array[index], index, array)) {
- return index;
+ if (typeof cb === "function") {
+ if (err || state3.finished) {
+ process5.nextTick(cb, err);
+ } else {
+ state3[kOnFinished].push(cb);
}
}
- return -1;
+ return this;
+ };
+ function needFinish(state3) {
+ return state3.ending && !state3.destroyed && state3.constructed && state3.length === 0 && !state3.errored && state3.buffered.length === 0 && !state3.finished && !state3.writing && !state3.errorEmitted && !state3.closeEmitted;
}
- module2.exports = baseFindIndex;
- }
-});
-
-// node_modules/lodash/_baseIsNaN.js
-var require_baseIsNaN = __commonJS({
- "node_modules/lodash/_baseIsNaN.js"(exports2, module2) {
- function baseIsNaN(value) {
- return value !== value;
+ function callFinal(stream4, state3) {
+ let called = false;
+ function onFinish(err) {
+ if (called) {
+ errorOrDestroy(stream4, err !== null && err !== void 0 ? err : ERR_MULTIPLE_CALLBACK());
+ return;
+ }
+ called = true;
+ state3.pendingcb--;
+ if (err) {
+ const onfinishCallbacks = state3[kOnFinished].splice(0);
+ for (let i = 0; i < onfinishCallbacks.length; i++) {
+ onfinishCallbacks[i](err);
+ }
+ errorOrDestroy(stream4, err, state3.sync);
+ } else if (needFinish(state3)) {
+ state3.prefinished = true;
+ stream4.emit("prefinish");
+ state3.pendingcb++;
+ process5.nextTick(finish, stream4, state3);
+ }
+ }
+ state3.sync = true;
+ state3.pendingcb++;
+ try {
+ stream4._final(onFinish);
+ } catch (err) {
+ onFinish(err);
+ }
+ state3.sync = false;
}
- module2.exports = baseIsNaN;
- }
-});
-
-// node_modules/lodash/_strictIndexOf.js
-var require_strictIndexOf = __commonJS({
- "node_modules/lodash/_strictIndexOf.js"(exports2, module2) {
- function strictIndexOf(array, value, fromIndex) {
- var index = fromIndex - 1, length = array.length;
- while (++index < length) {
- if (array[index] === value) {
- return index;
+ function prefinish(stream4, state3) {
+ if (!state3.prefinished && !state3.finalCalled) {
+ if (typeof stream4._final === "function" && !state3.destroyed) {
+ state3.finalCalled = true;
+ callFinal(stream4, state3);
+ } else {
+ state3.prefinished = true;
+ stream4.emit("prefinish");
}
}
- return -1;
}
- module2.exports = strictIndexOf;
- }
-});
-
-// node_modules/lodash/_baseIndexOf.js
-var require_baseIndexOf = __commonJS({
- "node_modules/lodash/_baseIndexOf.js"(exports2, module2) {
- var baseFindIndex = require_baseFindIndex();
- var baseIsNaN = require_baseIsNaN();
- var strictIndexOf = require_strictIndexOf();
- function baseIndexOf(array, value, fromIndex) {
- return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
+ function finishMaybe(stream4, state3, sync) {
+ if (needFinish(state3)) {
+ prefinish(stream4, state3);
+ if (state3.pendingcb === 0) {
+ if (sync) {
+ state3.pendingcb++;
+ process5.nextTick(
+ (stream5, state4) => {
+ if (needFinish(state4)) {
+ finish(stream5, state4);
+ } else {
+ state4.pendingcb--;
+ }
+ },
+ stream4,
+ state3
+ );
+ } else if (needFinish(state3)) {
+ state3.pendingcb++;
+ finish(stream4, state3);
+ }
+ }
+ }
}
- module2.exports = baseIndexOf;
- }
-});
-
-// node_modules/lodash/_arrayIncludes.js
-var require_arrayIncludes = __commonJS({
- "node_modules/lodash/_arrayIncludes.js"(exports2, module2) {
- var baseIndexOf = require_baseIndexOf();
- function arrayIncludes(array, value) {
- var length = array == null ? 0 : array.length;
- return !!length && baseIndexOf(array, value, 0) > -1;
+ function finish(stream4, state3) {
+ state3.pendingcb--;
+ state3.finished = true;
+ const onfinishCallbacks = state3[kOnFinished].splice(0);
+ for (let i = 0; i < onfinishCallbacks.length; i++) {
+ onfinishCallbacks[i]();
+ }
+ stream4.emit("finish");
+ if (state3.autoDestroy) {
+ const rState = stream4._readableState;
+ const autoDestroy = !rState || rState.autoDestroy && // We don't expect the readable to ever 'end'
+ // if readable is explicitly set to false.
+ (rState.endEmitted || rState.readable === false);
+ if (autoDestroy) {
+ stream4.destroy();
+ }
+ }
}
- module2.exports = arrayIncludes;
- }
-});
-
-// node_modules/lodash/_arrayIncludesWith.js
-var require_arrayIncludesWith = __commonJS({
- "node_modules/lodash/_arrayIncludesWith.js"(exports2, module2) {
- function arrayIncludesWith(array, value, comparator) {
- var index = -1, length = array == null ? 0 : array.length;
- while (++index < length) {
- if (comparator(value, array[index])) {
- return true;
+ ObjectDefineProperties(Writable.prototype, {
+ closed: {
+ __proto__: null,
+ get() {
+ return this._writableState ? this._writableState.closed : false;
+ }
+ },
+ destroyed: {
+ __proto__: null,
+ get() {
+ return this._writableState ? this._writableState.destroyed : false;
+ },
+ set(value) {
+ if (this._writableState) {
+ this._writableState.destroyed = value;
+ }
+ }
+ },
+ writable: {
+ __proto__: null,
+ get() {
+ const w = this._writableState;
+ return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended;
+ },
+ set(val) {
+ if (this._writableState) {
+ this._writableState.writable = !!val;
+ }
+ }
+ },
+ writableFinished: {
+ __proto__: null,
+ get() {
+ return this._writableState ? this._writableState.finished : false;
+ }
+ },
+ writableObjectMode: {
+ __proto__: null,
+ get() {
+ return this._writableState ? this._writableState.objectMode : false;
+ }
+ },
+ writableBuffer: {
+ __proto__: null,
+ get() {
+ return this._writableState && this._writableState.getBuffer();
+ }
+ },
+ writableEnded: {
+ __proto__: null,
+ get() {
+ return this._writableState ? this._writableState.ending : false;
+ }
+ },
+ writableNeedDrain: {
+ __proto__: null,
+ get() {
+ const wState = this._writableState;
+ if (!wState) return false;
+ return !wState.destroyed && !wState.ending && wState.needDrain;
+ }
+ },
+ writableHighWaterMark: {
+ __proto__: null,
+ get() {
+ return this._writableState && this._writableState.highWaterMark;
+ }
+ },
+ writableCorked: {
+ __proto__: null,
+ get() {
+ return this._writableState ? this._writableState.corked : 0;
+ }
+ },
+ writableLength: {
+ __proto__: null,
+ get() {
+ return this._writableState && this._writableState.length;
+ }
+ },
+ errored: {
+ __proto__: null,
+ enumerable: false,
+ get() {
+ return this._writableState ? this._writableState.errored : null;
+ }
+ },
+ writableAborted: {
+ __proto__: null,
+ enumerable: false,
+ get: function() {
+ return !!(this._writableState.writable !== false && (this._writableState.destroyed || this._writableState.errored) && !this._writableState.finished);
}
}
- return false;
- }
- module2.exports = arrayIncludesWith;
- }
-});
-
-// node_modules/lodash/_arrayMap.js
-var require_arrayMap = __commonJS({
- "node_modules/lodash/_arrayMap.js"(exports2, module2) {
- function arrayMap(array, iteratee) {
- var index = -1, length = array == null ? 0 : array.length, result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
+ });
+ var destroy2 = destroyImpl.destroy;
+ Writable.prototype.destroy = function(err, cb) {
+ const state3 = this._writableState;
+ if (!state3.destroyed && (state3.bufferedIndex < state3.buffered.length || state3[kOnFinished].length)) {
+ process5.nextTick(errorBuffer, state3);
}
- return result;
- }
- module2.exports = arrayMap;
- }
-});
-
-// node_modules/lodash/_cacheHas.js
-var require_cacheHas = __commonJS({
- "node_modules/lodash/_cacheHas.js"(exports2, module2) {
- function cacheHas(cache, key) {
- return cache.has(key);
+ destroy2.call(this, err, cb);
+ return this;
+ };
+ Writable.prototype._undestroy = destroyImpl.undestroy;
+ Writable.prototype._destroy = function(err, cb) {
+ cb(err);
+ };
+ Writable.prototype[EE.captureRejectionSymbol] = function(err) {
+ this.destroy(err);
+ };
+ var webStreamsAdapters;
+ function lazyWebStreams() {
+ if (webStreamsAdapters === void 0) webStreamsAdapters = {};
+ return webStreamsAdapters;
}
- module2.exports = cacheHas;
+ Writable.fromWeb = function(writableStream, options) {
+ return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options);
+ };
+ Writable.toWeb = function(streamWritable) {
+ return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);
+ };
}
});
-// node_modules/lodash/_baseDifference.js
-var require_baseDifference = __commonJS({
- "node_modules/lodash/_baseDifference.js"(exports2, module2) {
- var SetCache = require_SetCache();
- var arrayIncludes = require_arrayIncludes();
- var arrayIncludesWith = require_arrayIncludesWith();
- var arrayMap = require_arrayMap();
- var baseUnary = require_baseUnary();
- var cacheHas = require_cacheHas();
- var LARGE_ARRAY_SIZE = 200;
- function baseDifference(array, values, iteratee, comparator) {
- var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
- if (!length) {
- return result;
+// node_modules/readable-stream/lib/internal/streams/duplexify.js
+var require_duplexify = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/duplexify.js"(exports2, module2) {
+ var process5 = require_process();
+ var bufferModule = require("buffer");
+ var {
+ isReadable,
+ isWritable,
+ isIterable,
+ isNodeStream,
+ isReadableNodeStream,
+ isWritableNodeStream,
+ isDuplexNodeStream,
+ isReadableStream: isReadableStream3,
+ isWritableStream
+ } = require_utils2();
+ var eos = require_end_of_stream();
+ var {
+ AbortError: AbortError3,
+ codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE }
+ } = require_errors2();
+ var { destroyer } = require_destroy2();
+ var Duplex = require_duplex();
+ var Readable7 = require_readable3();
+ var Writable = require_writable();
+ var { createDeferredPromise } = require_util10();
+ var from = require_from();
+ var Blob2 = globalThis.Blob || bufferModule.Blob;
+ var isBlob2 = typeof Blob2 !== "undefined" ? function isBlob3(b) {
+ return b instanceof Blob2;
+ } : function isBlob3(b) {
+ return false;
+ };
+ var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
+ var { FunctionPrototypeCall } = require_primordials();
+ var Duplexify = class extends Duplex {
+ constructor(options) {
+ super(options);
+ if ((options === null || options === void 0 ? void 0 : options.readable) === false) {
+ this._readableState.readable = false;
+ this._readableState.ended = true;
+ this._readableState.endEmitted = true;
+ }
+ if ((options === null || options === void 0 ? void 0 : options.writable) === false) {
+ this._writableState.writable = false;
+ this._writableState.ending = true;
+ this._writableState.ended = true;
+ this._writableState.finished = true;
+ }
}
- if (iteratee) {
- values = arrayMap(values, baseUnary(iteratee));
+ };
+ module2.exports = function duplexify(body2, name) {
+ if (isDuplexNodeStream(body2)) {
+ return body2;
}
- if (comparator) {
- includes = arrayIncludesWith;
- isCommon = false;
- } else if (values.length >= LARGE_ARRAY_SIZE) {
- includes = cacheHas;
- isCommon = false;
- values = new SetCache(values);
+ if (isReadableNodeStream(body2)) {
+ return _duplexify({
+ readable: body2
+ });
}
- outer:
- while (++index < length) {
- var value = array[index], computed = iteratee == null ? value : iteratee(value);
- value = comparator || value !== 0 ? value : 0;
- if (isCommon && computed === computed) {
- var valuesIndex = valuesLength;
- while (valuesIndex--) {
- if (values[valuesIndex] === computed) {
- continue outer;
+ if (isWritableNodeStream(body2)) {
+ return _duplexify({
+ writable: body2
+ });
+ }
+ if (isNodeStream(body2)) {
+ return _duplexify({
+ writable: false,
+ readable: false
+ });
+ }
+ if (isReadableStream3(body2)) {
+ return _duplexify({
+ readable: Readable7.fromWeb(body2)
+ });
+ }
+ if (isWritableStream(body2)) {
+ return _duplexify({
+ writable: Writable.fromWeb(body2)
+ });
+ }
+ if (typeof body2 === "function") {
+ const { value, write, final, destroy: destroy2 } = fromAsyncGen(body2);
+ if (isIterable(value)) {
+ return from(Duplexify, value, {
+ // TODO (ronag): highWaterMark?
+ objectMode: true,
+ write,
+ final,
+ destroy: destroy2
+ });
+ }
+ const then2 = value === null || value === void 0 ? void 0 : value.then;
+ if (typeof then2 === "function") {
+ let d;
+ const promise = FunctionPrototypeCall(
+ then2,
+ value,
+ (val) => {
+ if (val != null) {
+ throw new ERR_INVALID_RETURN_VALUE("nully", "body", val);
}
+ },
+ (err) => {
+ destroyer(d, err);
}
- result.push(value);
- } else if (!includes(values, computed, comparator)) {
- result.push(value);
+ );
+ return d = new Duplexify({
+ // TODO (ronag): highWaterMark?
+ objectMode: true,
+ readable: false,
+ write,
+ final(cb) {
+ final(async () => {
+ try {
+ await promise;
+ process5.nextTick(cb, null);
+ } catch (err) {
+ process5.nextTick(cb, err);
+ }
+ });
+ },
+ destroy: destroy2
+ });
+ }
+ throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or AsyncFunction", name, value);
+ }
+ if (isBlob2(body2)) {
+ return duplexify(body2.arrayBuffer());
+ }
+ if (isIterable(body2)) {
+ return from(Duplexify, body2, {
+ // TODO (ronag): highWaterMark?
+ objectMode: true,
+ writable: false
+ });
+ }
+ if (isReadableStream3(body2 === null || body2 === void 0 ? void 0 : body2.readable) && isWritableStream(body2 === null || body2 === void 0 ? void 0 : body2.writable)) {
+ return Duplexify.fromWeb(body2);
+ }
+ if (typeof (body2 === null || body2 === void 0 ? void 0 : body2.writable) === "object" || typeof (body2 === null || body2 === void 0 ? void 0 : body2.readable) === "object") {
+ const readable = body2 !== null && body2 !== void 0 && body2.readable ? isReadableNodeStream(body2 === null || body2 === void 0 ? void 0 : body2.readable) ? body2 === null || body2 === void 0 ? void 0 : body2.readable : duplexify(body2.readable) : void 0;
+ const writable = body2 !== null && body2 !== void 0 && body2.writable ? isWritableNodeStream(body2 === null || body2 === void 0 ? void 0 : body2.writable) ? body2 === null || body2 === void 0 ? void 0 : body2.writable : duplexify(body2.writable) : void 0;
+ return _duplexify({
+ readable,
+ writable
+ });
+ }
+ const then = body2 === null || body2 === void 0 ? void 0 : body2.then;
+ if (typeof then === "function") {
+ let d;
+ FunctionPrototypeCall(
+ then,
+ body2,
+ (val) => {
+ if (val != null) {
+ d.push(val);
+ }
+ d.push(null);
+ },
+ (err) => {
+ destroyer(d, err);
+ }
+ );
+ return d = new Duplexify({
+ objectMode: true,
+ writable: false,
+ read() {
+ }
+ });
+ }
+ throw new ERR_INVALID_ARG_TYPE(
+ name,
+ [
+ "Blob",
+ "ReadableStream",
+ "WritableStream",
+ "Stream",
+ "Iterable",
+ "AsyncIterable",
+ "Function",
+ "{ readable, writable } pair",
+ "Promise"
+ ],
+ body2
+ );
+ };
+ function fromAsyncGen(fn) {
+ let { promise, resolve: resolve7 } = createDeferredPromise();
+ const ac = new AbortController2();
+ const signal = ac.signal;
+ const value = fn(
+ (async function* () {
+ while (true) {
+ const _promise = promise;
+ promise = null;
+ const { chunk, done, cb } = await _promise;
+ process5.nextTick(cb);
+ if (done) return;
+ if (signal.aborted)
+ throw new AbortError3(void 0, {
+ cause: signal.reason
+ });
+ ({ promise, resolve: resolve7 } = createDeferredPromise());
+ yield chunk;
}
+ })(),
+ {
+ signal
}
- return result;
- }
- module2.exports = baseDifference;
- }
-});
-
-// node_modules/lodash/isArrayLikeObject.js
-var require_isArrayLikeObject = __commonJS({
- "node_modules/lodash/isArrayLikeObject.js"(exports2, module2) {
- var isArrayLike = require_isArrayLike();
- var isObjectLike = require_isObjectLike();
- function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
- }
- module2.exports = isArrayLikeObject;
- }
-});
-
-// node_modules/lodash/difference.js
-var require_difference = __commonJS({
- "node_modules/lodash/difference.js"(exports2, module2) {
- var baseDifference = require_baseDifference();
- var baseFlatten = require_baseFlatten();
- var baseRest = require_baseRest();
- var isArrayLikeObject = require_isArrayLikeObject();
- var difference = baseRest(function(array, values) {
- return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
- });
- module2.exports = difference;
- }
-});
-
-// node_modules/lodash/_Set.js
-var require_Set = __commonJS({
- "node_modules/lodash/_Set.js"(exports2, module2) {
- var getNative = require_getNative();
- var root = require_root();
- var Set2 = getNative(root, "Set");
- module2.exports = Set2;
- }
-});
-
-// node_modules/lodash/noop.js
-var require_noop = __commonJS({
- "node_modules/lodash/noop.js"(exports2, module2) {
- function noop3() {
- }
- module2.exports = noop3;
- }
-});
-
-// node_modules/lodash/_setToArray.js
-var require_setToArray = __commonJS({
- "node_modules/lodash/_setToArray.js"(exports2, module2) {
- function setToArray(set) {
- var index = -1, result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
+ );
+ return {
+ value,
+ write(chunk, encoding, cb) {
+ const _resolve = resolve7;
+ resolve7 = null;
+ _resolve({
+ chunk,
+ done: false,
+ cb
+ });
+ },
+ final(cb) {
+ const _resolve = resolve7;
+ resolve7 = null;
+ _resolve({
+ done: true,
+ cb
+ });
+ },
+ destroy(err, cb) {
+ ac.abort();
+ cb(err);
+ }
+ };
}
- module2.exports = setToArray;
- }
-});
-
-// node_modules/lodash/_createSet.js
-var require_createSet = __commonJS({
- "node_modules/lodash/_createSet.js"(exports2, module2) {
- var Set2 = require_Set();
- var noop3 = require_noop();
- var setToArray = require_setToArray();
- var INFINITY = 1 / 0;
- var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop3 : function(values) {
- return new Set2(values);
- };
- module2.exports = createSet;
- }
-});
-
-// node_modules/lodash/_baseUniq.js
-var require_baseUniq = __commonJS({
- "node_modules/lodash/_baseUniq.js"(exports2, module2) {
- var SetCache = require_SetCache();
- var arrayIncludes = require_arrayIncludes();
- var arrayIncludesWith = require_arrayIncludesWith();
- var cacheHas = require_cacheHas();
- var createSet = require_createSet();
- var setToArray = require_setToArray();
- var LARGE_ARRAY_SIZE = 200;
- function baseUniq(array, iteratee, comparator) {
- var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
- if (comparator) {
- isCommon = false;
- includes = arrayIncludesWith;
- } else if (length >= LARGE_ARRAY_SIZE) {
- var set = iteratee ? null : createSet(array);
- if (set) {
- return setToArray(set);
+ function _duplexify(pair) {
+ const r = pair.readable && typeof pair.readable.read !== "function" ? Readable7.wrap(pair.readable) : pair.readable;
+ const w = pair.writable;
+ let readable = !!isReadable(r);
+ let writable = !!isWritable(w);
+ let ondrain;
+ let onfinish;
+ let onreadable;
+ let onclose;
+ let d;
+ function onfinished(err) {
+ const cb = onclose;
+ onclose = null;
+ if (cb) {
+ cb(err);
+ } else if (err) {
+ d.destroy(err);
}
- isCommon = false;
- includes = cacheHas;
- seen = new SetCache();
- } else {
- seen = iteratee ? [] : result;
}
- outer:
- while (++index < length) {
- var value = array[index], computed = iteratee ? iteratee(value) : value;
- value = comparator || value !== 0 ? value : 0;
- if (isCommon && computed === computed) {
- var seenIndex = seen.length;
- while (seenIndex--) {
- if (seen[seenIndex] === computed) {
- continue outer;
- }
- }
- if (iteratee) {
- seen.push(computed);
+ d = new Duplexify({
+ // TODO (ronag): highWaterMark?
+ readableObjectMode: !!(r !== null && r !== void 0 && r.readableObjectMode),
+ writableObjectMode: !!(w !== null && w !== void 0 && w.writableObjectMode),
+ readable,
+ writable
+ });
+ if (writable) {
+ eos(w, (err) => {
+ writable = false;
+ if (err) {
+ destroyer(r, err);
+ }
+ onfinished(err);
+ });
+ d._write = function(chunk, encoding, callback) {
+ if (w.write(chunk, encoding)) {
+ callback();
+ } else {
+ ondrain = callback;
+ }
+ };
+ d._final = function(callback) {
+ w.end();
+ onfinish = callback;
+ };
+ w.on("drain", function() {
+ if (ondrain) {
+ const cb = ondrain;
+ ondrain = null;
+ cb();
+ }
+ });
+ w.on("finish", function() {
+ if (onfinish) {
+ const cb = onfinish;
+ onfinish = null;
+ cb();
+ }
+ });
+ }
+ if (readable) {
+ eos(r, (err) => {
+ readable = false;
+ if (err) {
+ destroyer(r, err);
+ }
+ onfinished(err);
+ });
+ r.on("readable", function() {
+ if (onreadable) {
+ const cb = onreadable;
+ onreadable = null;
+ cb();
+ }
+ });
+ r.on("end", function() {
+ d.push(null);
+ });
+ d._read = function() {
+ while (true) {
+ const buf = r.read();
+ if (buf === null) {
+ onreadable = d._read;
+ return;
}
- result.push(value);
- } else if (!includes(seen, computed, comparator)) {
- if (seen !== result) {
- seen.push(computed);
+ if (!d.push(buf)) {
+ return;
}
- result.push(value);
}
+ };
+ }
+ d._destroy = function(err, callback) {
+ if (!err && onclose !== null) {
+ err = new AbortError3();
+ }
+ onreadable = null;
+ ondrain = null;
+ onfinish = null;
+ if (onclose === null) {
+ callback(err);
+ } else {
+ onclose = callback;
+ destroyer(w, err);
+ destroyer(r, err);
}
- return result;
- }
- module2.exports = baseUniq;
- }
-});
-
-// node_modules/lodash/union.js
-var require_union = __commonJS({
- "node_modules/lodash/union.js"(exports2, module2) {
- var baseFlatten = require_baseFlatten();
- var baseRest = require_baseRest();
- var baseUniq = require_baseUniq();
- var isArrayLikeObject = require_isArrayLikeObject();
- var union = baseRest(function(arrays) {
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
- });
- module2.exports = union;
- }
-});
-
-// node_modules/lodash/_overArg.js
-var require_overArg = __commonJS({
- "node_modules/lodash/_overArg.js"(exports2, module2) {
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
};
+ return d;
}
- module2.exports = overArg;
- }
-});
-
-// node_modules/lodash/_getPrototype.js
-var require_getPrototype = __commonJS({
- "node_modules/lodash/_getPrototype.js"(exports2, module2) {
- var overArg = require_overArg();
- var getPrototype = overArg(Object.getPrototypeOf, Object);
- module2.exports = getPrototype;
- }
-});
-
-// node_modules/lodash/isPlainObject.js
-var require_isPlainObject = __commonJS({
- "node_modules/lodash/isPlainObject.js"(exports2, module2) {
- var baseGetTag = require_baseGetTag();
- var getPrototype = require_getPrototype();
- var isObjectLike = require_isObjectLike();
- var objectTag = "[object Object]";
- var funcProto = Function.prototype;
- var objectProto = Object.prototype;
- var funcToString = funcProto.toString;
- var hasOwnProperty = objectProto.hasOwnProperty;
- var objectCtorString = funcToString.call(Object);
- function isPlainObject3(value) {
- if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
- return false;
- }
- var proto = getPrototype(value);
- if (proto === null) {
- return true;
- }
- var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
- }
- module2.exports = isPlainObject3;
- }
-});
-
-// node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
-var require_assert_valid_pattern = __commonJS({
- "node_modules/minimatch/dist/commonjs/assert-valid-pattern.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.assertValidPattern = void 0;
- var MAX_PATTERN_LENGTH = 1024 * 64;
- var assertValidPattern = (pattern) => {
- if (typeof pattern !== "string") {
- throw new TypeError("invalid pattern");
- }
- if (pattern.length > MAX_PATTERN_LENGTH) {
- throw new TypeError("pattern is too long");
- }
- };
- exports2.assertValidPattern = assertValidPattern;
}
});
-// node_modules/minimatch/dist/commonjs/brace-expressions.js
-var require_brace_expressions = __commonJS({
- "node_modules/minimatch/dist/commonjs/brace-expressions.js"(exports2) {
+// node_modules/readable-stream/lib/internal/streams/duplex.js
+var require_duplex = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/duplex.js"(exports2, module2) {
"use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.parseClass = void 0;
- var posixClasses = {
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
- "[:ascii:]": ["\\x00-\\x7f", false],
- "[:blank:]": ["\\p{Zs}\\t", true],
- "[:cntrl:]": ["\\p{Cc}", true],
- "[:digit:]": ["\\p{Nd}", true],
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
- "[:lower:]": ["\\p{Ll}", true],
- "[:print:]": ["\\p{C}", true],
- "[:punct:]": ["\\p{P}", true],
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
- "[:upper:]": ["\\p{Lu}", true],
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
- "[:xdigit:]": ["A-Fa-f0-9", false]
- };
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- var rangesToString = (ranges) => ranges.join("");
- var parseClass = (glob, position) => {
- const pos = position;
- if (glob.charAt(pos) !== "[") {
- throw new Error("not in a brace expression");
+ var {
+ ObjectDefineProperties,
+ ObjectGetOwnPropertyDescriptor,
+ ObjectKeys,
+ ObjectSetPrototypeOf
+ } = require_primordials();
+ module2.exports = Duplex;
+ var Readable7 = require_readable3();
+ var Writable = require_writable();
+ ObjectSetPrototypeOf(Duplex.prototype, Readable7.prototype);
+ ObjectSetPrototypeOf(Duplex, Readable7);
+ {
+ const keys = ObjectKeys(Writable.prototype);
+ for (let i = 0; i < keys.length; i++) {
+ const method = keys[i];
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
}
- const ranges = [];
- const negs = [];
- let i = pos + 1;
- let sawStart = false;
- let uflag = false;
- let escaping = false;
- let negate = false;
- let endPos = pos;
- let rangeStart = "";
- WHILE: while (i < glob.length) {
- const c = glob.charAt(i);
- if ((c === "!" || c === "^") && i === pos + 1) {
- negate = true;
- i++;
- continue;
- }
- if (c === "]" && sawStart && !escaping) {
- endPos = i + 1;
- break;
- }
- sawStart = true;
- if (c === "\\") {
- if (!escaping) {
- escaping = true;
- i++;
- continue;
- }
- }
- if (c === "[" && !escaping) {
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
- if (glob.startsWith(cls, i)) {
- if (rangeStart) {
- return ["$.", false, glob.length - pos, true];
- }
- i += cls.length;
- if (neg)
- negs.push(unip);
- else
- ranges.push(unip);
- uflag = uflag || u;
- continue WHILE;
- }
- }
- }
- escaping = false;
- if (rangeStart) {
- if (c > rangeStart) {
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
- } else if (c === rangeStart) {
- ranges.push(braceEscape(c));
- }
- rangeStart = "";
- i++;
- continue;
- }
- if (glob.startsWith("-]", i + 1)) {
- ranges.push(braceEscape(c + "-"));
- i += 2;
- continue;
+ }
+ function Duplex(options) {
+ if (!(this instanceof Duplex)) return new Duplex(options);
+ Readable7.call(this, options);
+ Writable.call(this, options);
+ if (options) {
+ this.allowHalfOpen = options.allowHalfOpen !== false;
+ if (options.readable === false) {
+ this._readableState.readable = false;
+ this._readableState.ended = true;
+ this._readableState.endEmitted = true;
}
- if (glob.startsWith("-", i + 1)) {
- rangeStart = c;
- i += 2;
- continue;
+ if (options.writable === false) {
+ this._writableState.writable = false;
+ this._writableState.ending = true;
+ this._writableState.ended = true;
+ this._writableState.finished = true;
}
- ranges.push(braceEscape(c));
- i++;
- }
- if (endPos < i) {
- return ["", false, 0, false];
- }
- if (!ranges.length && !negs.length) {
- return ["$.", false, glob.length - pos, true];
+ } else {
+ this.allowHalfOpen = true;
}
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
- return [regexpEscape(r), false, endPos - pos, false];
+ }
+ ObjectDefineProperties(Duplex.prototype, {
+ writable: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writable")
+ },
+ writableHighWaterMark: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableHighWaterMark")
+ },
+ writableObjectMode: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableObjectMode")
+ },
+ writableBuffer: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableBuffer")
+ },
+ writableLength: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableLength")
+ },
+ writableFinished: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableFinished")
+ },
+ writableCorked: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableCorked")
+ },
+ writableEnded: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableEnded")
+ },
+ writableNeedDrain: {
+ __proto__: null,
+ ...ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableNeedDrain")
+ },
+ destroyed: {
+ __proto__: null,
+ get() {
+ if (this._readableState === void 0 || this._writableState === void 0) {
+ return false;
+ }
+ return this._readableState.destroyed && this._writableState.destroyed;
+ },
+ set(value) {
+ if (this._readableState && this._writableState) {
+ this._readableState.destroyed = value;
+ this._writableState.destroyed = value;
+ }
+ }
}
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
- return [comb, uflag, endPos - pos, true];
+ });
+ var webStreamsAdapters;
+ function lazyWebStreams() {
+ if (webStreamsAdapters === void 0) webStreamsAdapters = {};
+ return webStreamsAdapters;
+ }
+ Duplex.fromWeb = function(pair, options) {
+ return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options);
};
- exports2.parseClass = parseClass;
- }
-});
-
-// node_modules/minimatch/dist/commonjs/unescape.js
-var require_unescape = __commonJS({
- "node_modules/minimatch/dist/commonjs/unescape.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.unescape = void 0;
- var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
+ Duplex.toWeb = function(duplex) {
+ return lazyWebStreams().newReadableWritablePairFromDuplex(duplex);
+ };
+ var duplexify;
+ Duplex.from = function(body2) {
+ if (!duplexify) {
+ duplexify = require_duplexify();
+ }
+ return duplexify(body2, "body");
};
- exports2.unescape = unescape;
}
});
-// node_modules/minimatch/dist/commonjs/ast.js
-var require_ast = __commonJS({
- "node_modules/minimatch/dist/commonjs/ast.js"(exports2) {
+// node_modules/readable-stream/lib/internal/streams/transform.js
+var require_transform = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/transform.js"(exports2, module2) {
"use strict";
- var _a;
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.AST = void 0;
- var brace_expressions_js_1 = require_brace_expressions();
- var unescape_js_1 = require_unescape();
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
- var isExtglobType = (c) => types.has(c);
- var isExtglobAST = (c) => isExtglobType(c.type);
- var adoptionMap = /* @__PURE__ */ new Map([
- ["!", ["@"]],
- ["?", ["?", "@"]],
- ["@", ["@"]],
- ["*", ["*", "+", "?", "@"]],
- ["+", ["+", "@"]]
- ]);
- var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
- ["!", ["?"]],
- ["@", ["?"]],
- ["+", ["?", "*"]]
- ]);
- var adoptionAnyMap = /* @__PURE__ */ new Map([
- ["!", ["?", "@"]],
- ["?", ["?", "@"]],
- ["@", ["?", "@"]],
- ["*", ["*", "+", "?", "@"]],
- ["+", ["+", "@", "?", "*"]]
- ]);
- var usurpMap = /* @__PURE__ */ new Map([
- ["!", /* @__PURE__ */ new Map([["!", "@"]])],
- ["?", /* @__PURE__ */ new Map([["*", "*"], ["+", "*"]])],
- ["@", /* @__PURE__ */ new Map([["!", "!"], ["?", "?"], ["@", "@"], ["*", "*"], ["+", "+"]])],
- ["+", /* @__PURE__ */ new Map([["?", "*"], ["*", "*"]])]
- ]);
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
- var startNoDot = "(?!\\.)";
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
- var reSpecials = new Set("().*{}+?[]^$\\!");
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- var qmark = "[^/]";
- var star = qmark + "*?";
- var starNoEmpty = qmark + "+?";
- var AST = class {
- type;
- #root;
- #hasMagic;
- #uflag = false;
- #parts = [];
- #parent;
- #parentIndex;
- #negs;
- #filledNegs = false;
- #options;
- #toString;
- // set to true if it's an extglob with no children
- // (which really means one child of '')
- #emptyExt = false;
- constructor(type, parent, options = {}) {
- this.type = type;
- if (type)
- this.#hasMagic = true;
- this.#parent = parent;
- this.#root = this.#parent ? this.#parent.#root : this;
- this.#options = this.#root === this ? options : this.#root.#options;
- this.#negs = this.#root === this ? [] : this.#root.#negs;
- if (type === "!" && !this.#root.#filledNegs)
- this.#negs.push(this);
- this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
- }
- get hasMagic() {
- if (this.#hasMagic !== void 0)
- return this.#hasMagic;
- for (const p of this.#parts) {
- if (typeof p === "string")
- continue;
- if (p.type || p.hasMagic)
- return this.#hasMagic = true;
- }
- return this.#hasMagic;
- }
- // reconstructs the pattern
- toString() {
- if (this.#toString !== void 0)
- return this.#toString;
- if (!this.type) {
- return this.#toString = this.#parts.map((p) => String(p)).join("");
- } else {
- return this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
- }
- }
- #fillNegs() {
- if (this !== this.#root)
- throw new Error("should only call on root");
- if (this.#filledNegs)
- return this;
- this.toString();
- this.#filledNegs = true;
- let n;
- while (n = this.#negs.pop()) {
- if (n.type !== "!")
- continue;
- let p = n;
- let pp = p.#parent;
- while (pp) {
- for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
- for (const part of n.#parts) {
- if (typeof part === "string") {
- throw new Error("string part in extglob AST??");
- }
- part.copyIn(pp.#parts[i]);
- }
- }
- p = pp;
- pp = p.#parent;
- }
- }
- return this;
- }
- push(...parts) {
- for (const p of parts) {
- if (p === "")
- continue;
- if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
- throw new Error("invalid part: " + p);
- }
- this.#parts.push(p);
- }
- }
- toJSON() {
- const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
- if (this.isStart() && !this.type)
- ret.unshift([]);
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
- ret.push({});
- }
- return ret;
+ var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials();
+ module2.exports = Transform4;
+ var { ERR_METHOD_NOT_IMPLEMENTED } = require_errors2().codes;
+ var Duplex = require_duplex();
+ var { getHighWaterMark } = require_state();
+ ObjectSetPrototypeOf(Transform4.prototype, Duplex.prototype);
+ ObjectSetPrototypeOf(Transform4, Duplex);
+ var kCallback = Symbol2("kCallback");
+ function Transform4(options) {
+ if (!(this instanceof Transform4)) return new Transform4(options);
+ const readableHighWaterMark = options ? getHighWaterMark(this, options, "readableHighWaterMark", true) : null;
+ if (readableHighWaterMark === 0) {
+ options = {
+ ...options,
+ highWaterMark: null,
+ readableHighWaterMark,
+ // TODO (ronag): 0 is not optimal since we have
+ // a "bug" where we check needDrain before calling _write and not after.
+ // Refs: https://github.com/nodejs/node/pull/32887
+ // Refs: https://github.com/nodejs/node/pull/35941
+ writableHighWaterMark: options.writableHighWaterMark || 0
+ };
}
- isStart() {
- if (this.#root === this)
- return true;
- if (!this.#parent?.isStart())
- return false;
- if (this.#parentIndex === 0)
- return true;
- const p = this.#parent;
- for (let i = 0; i < this.#parentIndex; i++) {
- const pp = p.#parts[i];
- if (!(pp instanceof _a && pp.type === "!")) {
- return false;
- }
- }
- return true;
+ Duplex.call(this, options);
+ this._readableState.sync = false;
+ this[kCallback] = null;
+ if (options) {
+ if (typeof options.transform === "function") this._transform = options.transform;
+ if (typeof options.flush === "function") this._flush = options.flush;
}
- isEnd() {
- if (this.#root === this)
- return true;
- if (this.#parent?.type === "!")
- return true;
- if (!this.#parent?.isEnd())
- return false;
- if (!this.type)
- return this.#parent?.isEnd();
- const pl = this.#parent ? this.#parent.#parts.length : 0;
- return this.#parentIndex === pl - 1;
- }
- copyIn(part) {
- if (typeof part === "string")
- this.push(part);
- else
- this.push(part.clone(this));
- }
- clone(parent) {
- const c = new _a(this.type, parent);
- for (const p of this.#parts) {
- c.copyIn(p);
- }
- return c;
- }
- static #parseAST(str, ast, pos, opt, extDepth) {
- const maxDepth = opt.maxExtglobRecursion ?? 2;
- let escaping = false;
- let inBrace = false;
- let braceStart = -1;
- let braceNeg = false;
- if (ast.type === null) {
- let i2 = pos;
- let acc2 = "";
- while (i2 < str.length) {
- const c = str.charAt(i2++);
- if (escaping || c === "\\") {
- escaping = !escaping;
- acc2 += c;
- continue;
- }
- if (inBrace) {
- if (i2 === braceStart + 1) {
- if (c === "^" || c === "!") {
- braceNeg = true;
- }
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
- inBrace = false;
- }
- acc2 += c;
- continue;
- } else if (c === "[") {
- inBrace = true;
- braceStart = i2;
- braceNeg = false;
- acc2 += c;
- continue;
- }
- const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i2) === "(" && extDepth <= maxDepth;
- if (doRecurse) {
- ast.push(acc2);
- acc2 = "";
- const ext = new _a(c, ast);
- i2 = _a.#parseAST(str, ext, i2, opt, extDepth + 1);
- ast.push(ext);
- continue;
- }
- acc2 += c;
- }
- ast.push(acc2);
- return i2;
- }
- let i = pos + 1;
- let part = new _a(null, ast);
- const parts = [];
- let acc = "";
- while (i < str.length) {
- const c = str.charAt(i++);
- if (escaping || c === "\\") {
- escaping = !escaping;
- acc += c;
- continue;
- }
- if (inBrace) {
- if (i === braceStart + 1) {
- if (c === "^" || c === "!") {
- braceNeg = true;
- }
- } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
- inBrace = false;
+ this.on("prefinish", prefinish);
+ }
+ function final(cb) {
+ if (typeof this._flush === "function" && !this.destroyed) {
+ this._flush((er, data) => {
+ if (er) {
+ if (cb) {
+ cb(er);
+ } else {
+ this.destroy(er);
}
- acc += c;
- continue;
- } else if (c === "[") {
- inBrace = true;
- braceStart = i;
- braceNeg = false;
- acc += c;
- continue;
- }
- const doRecurse = isExtglobType(c) && str.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
- (extDepth <= maxDepth || ast && ast.#canAdoptType(c));
- if (doRecurse) {
- const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
- part.push(acc);
- acc = "";
- const ext = new _a(c, part);
- part.push(ext);
- i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
- continue;
+ return;
}
- if (c === "|") {
- part.push(acc);
- acc = "";
- parts.push(part);
- part = new _a(null, ast);
- continue;
+ if (data != null) {
+ this.push(data);
}
- if (c === ")") {
- if (acc === "" && ast.#parts.length === 0) {
- ast.#emptyExt = true;
- }
- part.push(acc);
- acc = "";
- ast.push(...parts, part);
- return i;
+ this.push(null);
+ if (cb) {
+ cb();
}
- acc += c;
- }
- ast.type = null;
- ast.#hasMagic = void 0;
- ast.#parts = [str.substring(pos - 1)];
- return i;
- }
- #canAdoptWithSpace(child) {
- return this.#canAdopt(child, adoptionWithSpaceMap);
- }
- #canAdopt(child, map = adoptionMap) {
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
- return false;
- }
- const gc = child.#parts[0];
- if (!gc || typeof gc !== "object" || gc.type === null) {
- return false;
+ });
+ } else {
+ this.push(null);
+ if (cb) {
+ cb();
}
- return this.#canAdoptType(gc.type, map);
}
- #canAdoptType(c, map = adoptionAnyMap) {
- return !!map.get(this.type)?.includes(c);
- }
- #adoptWithSpace(child, index) {
- const gc = child.#parts[0];
- const blank = new _a(null, gc, this.options);
- blank.#parts.push("");
- gc.push(blank);
- this.#adopt(child, index);
+ }
+ function prefinish() {
+ if (this._final !== final) {
+ final.call(this);
}
- #adopt(child, index) {
- const gc = child.#parts[0];
- this.#parts.splice(index, 1, ...gc.#parts);
- for (const p of gc.#parts) {
- if (typeof p === "object")
- p.#parent = this;
+ }
+ Transform4.prototype._final = final;
+ Transform4.prototype._transform = function(chunk, encoding, callback) {
+ throw new ERR_METHOD_NOT_IMPLEMENTED("_transform()");
+ };
+ Transform4.prototype._write = function(chunk, encoding, callback) {
+ const rState = this._readableState;
+ const wState = this._writableState;
+ const length = rState.length;
+ this._transform(chunk, encoding, (err, val) => {
+ if (err) {
+ callback(err);
+ return;
}
- this.#toString = void 0;
- }
- #canUsurpType(c) {
- const m = usurpMap.get(this.type);
- return !!m?.has(c);
- }
- #canUsurp(child) {
- if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
- return false;
+ if (val != null) {
+ this.push(val);
}
- const gc = child.#parts[0];
- if (!gc || typeof gc !== "object" || gc.type === null) {
- return false;
+ if (wState.ended || // Backwards compat.
+ length === rState.length || // Backwards compat.
+ rState.length < rState.highWaterMark) {
+ callback();
+ } else {
+ this[kCallback] = callback;
}
- return this.#canUsurpType(gc.type);
+ });
+ };
+ Transform4.prototype._read = function() {
+ if (this[kCallback]) {
+ const callback = this[kCallback];
+ this[kCallback] = null;
+ callback();
}
- #usurp(child) {
- const m = usurpMap.get(this.type);
- const gc = child.#parts[0];
- const nt = m?.get(gc.type);
- if (!nt)
- return false;
- this.#parts = gc.#parts;
- for (const p of this.#parts) {
- if (typeof p === "object")
- p.#parent = this;
+ };
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/passthrough.js
+var require_passthrough2 = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/passthrough.js"(exports2, module2) {
+ "use strict";
+ var { ObjectSetPrototypeOf } = require_primordials();
+ module2.exports = PassThrough2;
+ var Transform4 = require_transform();
+ ObjectSetPrototypeOf(PassThrough2.prototype, Transform4.prototype);
+ ObjectSetPrototypeOf(PassThrough2, Transform4);
+ function PassThrough2(options) {
+ if (!(this instanceof PassThrough2)) return new PassThrough2(options);
+ Transform4.call(this, options);
+ }
+ PassThrough2.prototype._transform = function(chunk, encoding, cb) {
+ cb(null, chunk);
+ };
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/pipeline.js
+var require_pipeline = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports2, module2) {
+ var process5 = require_process();
+ var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator, SymbolDispose } = require_primordials();
+ var eos = require_end_of_stream();
+ var { once } = require_util10();
+ var destroyImpl = require_destroy2();
+ var Duplex = require_duplex();
+ var {
+ aggregateTwoErrors,
+ codes: {
+ ERR_INVALID_ARG_TYPE,
+ ERR_INVALID_RETURN_VALUE,
+ ERR_MISSING_ARGS,
+ ERR_STREAM_DESTROYED,
+ ERR_STREAM_PREMATURE_CLOSE
+ },
+ AbortError: AbortError3
+ } = require_errors2();
+ var { validateFunction, validateAbortSignal } = require_validators();
+ var {
+ isIterable,
+ isReadable,
+ isReadableNodeStream,
+ isNodeStream,
+ isTransformStream,
+ isWebStream,
+ isReadableStream: isReadableStream3,
+ isReadableFinished
+ } = require_utils2();
+ var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
+ var PassThrough2;
+ var Readable7;
+ var addAbortListener;
+ function destroyer(stream4, reading, writing) {
+ let finished = false;
+ stream4.on("close", () => {
+ finished = true;
+ });
+ const cleanup = eos(
+ stream4,
+ {
+ readable: reading,
+ writable: writing
+ },
+ (err) => {
+ finished = !err;
}
- this.type = nt;
- this.#toString = void 0;
- this.#emptyExt = false;
+ );
+ return {
+ destroy: (err) => {
+ if (finished) return;
+ finished = true;
+ destroyImpl.destroyer(stream4, err || new ERR_STREAM_DESTROYED("pipe"));
+ },
+ cleanup
+ };
+ }
+ function popCallback(streams) {
+ validateFunction(streams[streams.length - 1], "streams[stream.length - 1]");
+ return streams.pop();
+ }
+ function makeAsyncIterable2(val) {
+ if (isIterable(val)) {
+ return val;
+ } else if (isReadableNodeStream(val)) {
+ return fromReadable(val);
}
- #flatten() {
- if (!isExtglobAST(this)) {
- for (const p of this.#parts) {
- if (typeof p === "object")
- p.#flatten();
- }
- } else {
- let iterations = 0;
- let done = false;
- do {
- done = true;
- for (let i = 0; i < this.#parts.length; i++) {
- const c = this.#parts[i];
- if (typeof c === "object") {
- c.#flatten();
- if (this.#canAdopt(c)) {
- done = false;
- this.#adopt(c, i);
- } else if (this.#canAdoptWithSpace(c)) {
- done = false;
- this.#adoptWithSpace(c, i);
- } else if (this.#canUsurp(c)) {
- done = false;
- this.#usurp(c);
- }
- }
- }
- } while (!done && ++iterations < 10);
- }
- this.#toString = void 0;
- }
- static fromGlob(pattern, options = {}) {
- const ast = new _a(null, void 0, options);
- _a.#parseAST(pattern, ast, 0, options, 0);
- return ast;
- }
- // returns the regular expression if there's magic, or the unescaped
- // string if not.
- toMMPattern() {
- if (this !== this.#root)
- return this.#root.toMMPattern();
- const glob = this.toString();
- const [re, body2, hasMagic, uflag] = this.toRegExpSource();
- const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
- if (!anyMagic) {
- return body2;
- }
- const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
- return Object.assign(new RegExp(`^${re}$`, flags), {
- _src: re,
- _glob: glob
- });
+ throw new ERR_INVALID_ARG_TYPE("val", ["Readable", "Iterable", "AsyncIterable"], val);
+ }
+ async function* fromReadable(val) {
+ if (!Readable7) {
+ Readable7 = require_readable3();
}
- get options() {
- return this.#options;
- }
- // returns the string match, the regexp source, whether there's magic
- // in the regexp (so a regular expression is required) and whether or
- // not the uflag is needed for the regular expression (for posix classes)
- // TODO: instead of injecting the start/end at this point, just return
- // the BODY of the regexp, along with the start/end portions suitable
- // for binding the start/end in either a joined full-path makeRe context
- // (where we bind to (^|/), or a standalone matchPart context (where
- // we bind to ^, and not /). Otherwise slashes get duped!
- //
- // In part-matching mode, the start is:
- // - if not isStart: nothing
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
- // - if dots allowed or not possible: ^
- // - if dots possible and not allowed: ^(?!\.)
- // end is:
- // - if not isEnd(): nothing
- // - else: $
- //
- // In full-path matching mode, we put the slash at the START of the
- // pattern, so start is:
- // - if first pattern: same as part-matching mode
- // - if not isStart(): nothing
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
- // - if dots allowed or not possible: /
- // - if dots possible and not allowed: /(?!\.)
- // end is:
- // - if last pattern, same as part-matching mode
- // - else nothing
- //
- // Always put the (?:$|/) on negated tails, though, because that has to be
- // there to bind the end of the negated pattern portion, and it's easier to
- // just stick it in now rather than try to inject it later in the middle of
- // the pattern.
- //
- // We can just always return the same end, and leave it up to the caller
- // to know whether it's going to be used joined or in parts.
- // And, if the start is adjusted slightly, can do the same there:
- // - if not isStart: nothing
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
- // - if dots allowed or not possible: (?:/|^)
- // - if dots possible and not allowed: (?:/|^)(?!\.)
- //
- // But it's better to have a simpler binding without a conditional, for
- // performance, so probably better to return both start options.
- //
- // Then the caller just ignores the end if it's not the first pattern,
- // and the start always gets applied.
- //
- // But that's always going to be $ if it's the ending pattern, or nothing,
- // so the caller can just attach $ at the end of the pattern when building.
- //
- // So the todo is:
- // - better detect what kind of start is needed
- // - return both flavors of starting pattern
- // - attach $ at the end of the pattern when creating the actual RegExp
- //
- // Ah, but wait, no, that all only applies to the root when the first pattern
- // is not an extglob. If the first pattern IS an extglob, then we need all
- // that dot prevention biz to live in the extglob portions, because eg
- // +(*|.x*) can match .xy but not .yx.
- //
- // So, return the two flavors if it's #root and the first child is not an
- // AST, otherwise leave it to the child AST to handle it, and there,
- // use the (?:^|/) style of start binding.
- //
- // Even simplified further:
- // - Since the start for a join is eg /(?!\.) and the start for a part
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
- // or start or whatever) and prepend ^ or / at the Regexp construction.
- toRegExpSource(allowDot) {
- const dot = allowDot ?? !!this.#options.dot;
- if (this.#root === this) {
- this.#flatten();
- this.#fillNegs();
- }
- if (!isExtglobAST(this)) {
- const noEmpty = this.isStart() && this.isEnd();
- const src = this.#parts.map((p) => {
- const [re, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
- this.#hasMagic = this.#hasMagic || hasMagic;
- this.#uflag = this.#uflag || uflag;
- return re;
- }).join("");
- let start2 = "";
- if (this.isStart()) {
- if (typeof this.#parts[0] === "string") {
- const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
- if (!dotTravAllowed) {
- const aps = addPatternStart;
- const needNoTrav = (
- // dots are allowed, and the pattern starts with [ or .
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
- );
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
- }
- }
- }
- let end = "";
- if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
- end = "(?:$|\\/)";
- }
- const final2 = start2 + src + end;
- return [
- final2,
- (0, unescape_js_1.unescape)(src),
- this.#hasMagic = !!this.#hasMagic,
- this.#uflag
- ];
+ yield* Readable7.prototype[SymbolAsyncIterator].call(val);
+ }
+ async function pumpToNode(iterable, writable, finish, { end }) {
+ let error2;
+ let onresolve = null;
+ const resume = (err) => {
+ if (err) {
+ error2 = err;
+ }
+ if (onresolve) {
+ const callback = onresolve;
+ onresolve = null;
+ callback();
}
- const repeated = this.type === "*" || this.type === "+";
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
- let body2 = this.#partsToRegExp(dot);
- if (this.isStart() && this.isEnd() && !body2 && this.type !== "!") {
- const s = this.toString();
- const me = this;
- me.#parts = [s];
- me.type = null;
- me.#hasMagic = void 0;
- return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
- }
- let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
- if (bodyDotAllowed === body2) {
- bodyDotAllowed = "";
- }
- if (bodyDotAllowed) {
- body2 = `(?:${body2})(?:${bodyDotAllowed})*?`;
- }
- let final = "";
- if (this.type === "!" && this.#emptyExt) {
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
+ };
+ const wait = () => new Promise2((resolve7, reject) => {
+ if (error2) {
+ reject(error2);
} else {
- const close = this.type === "!" ? (
- // !() must match something,but !(x) can match ''
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
- final = start + body2 + close;
- }
- return [
- final,
- (0, unescape_js_1.unescape)(body2),
- this.#hasMagic = !!this.#hasMagic,
- this.#uflag
- ];
- }
- #partsToRegExp(dot) {
- return this.#parts.map((p) => {
- if (typeof p === "string") {
- throw new Error("string type in extglob ast??");
- }
- const [re, _2, _hasMagic, uflag] = p.toRegExpSource(dot);
- this.#uflag = this.#uflag || uflag;
- return re;
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
- }
- static #parseGlob(glob, hasMagic, noEmpty = false) {
- let escaping = false;
- let re = "";
- let uflag = false;
- let inStar = false;
- for (let i = 0; i < glob.length; i++) {
- const c = glob.charAt(i);
- if (escaping) {
- escaping = false;
- re += (reSpecials.has(c) ? "\\" : "") + c;
- inStar = false;
- continue;
- }
- if (c === "\\") {
- if (i === glob.length - 1) {
- re += "\\\\";
+ onresolve = () => {
+ if (error2) {
+ reject(error2);
} else {
- escaping = true;
- }
- continue;
- }
- if (c === "[") {
- const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i);
- if (consumed) {
- re += src;
- uflag = uflag || needUflag;
- i += consumed - 1;
- hasMagic = hasMagic || magic;
- inStar = false;
- continue;
+ resolve7();
}
- }
- if (c === "*") {
- if (inStar)
- continue;
- inStar = true;
- re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
- hasMagic = true;
- continue;
- } else {
- inStar = false;
- }
- if (c === "?") {
- re += qmark;
- hasMagic = true;
- continue;
- }
- re += regExpEscape(c);
+ };
}
- return [re, (0, unescape_js_1.unescape)(glob), !!hasMagic, uflag];
- }
- };
- exports2.AST = AST;
- _a = AST;
- }
-});
-
-// node_modules/minimatch/dist/commonjs/escape.js
-var require_escape = __commonJS({
- "node_modules/minimatch/dist/commonjs/escape.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.escape = void 0;
- var escape2 = (s, { windowsPathsNoEscape = false } = {}) => {
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
- };
- exports2.escape = escape2;
- }
-});
-
-// node_modules/minimatch/dist/commonjs/index.js
-var require_commonjs3 = __commonJS({
- "node_modules/minimatch/dist/commonjs/index.js"(exports2) {
- "use strict";
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
- return mod && mod.__esModule ? mod : { "default": mod };
- };
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.unescape = exports2.escape = exports2.AST = exports2.Minimatch = exports2.match = exports2.makeRe = exports2.braceExpand = exports2.defaults = exports2.filter = exports2.GLOBSTAR = exports2.sep = exports2.minimatch = void 0;
- var brace_expansion_1 = __importDefault(require_brace_expansion());
- var assert_valid_pattern_js_1 = require_assert_valid_pattern();
- var ast_js_1 = require_ast();
- var escape_js_1 = require_escape();
- var unescape_js_1 = require_unescape();
- var minimatch = (p, pattern, options = {}) => {
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
- if (!options.nocomment && pattern.charAt(0) === "#") {
- return false;
- }
- return new Minimatch(pattern, options).match(p);
- };
- exports2.minimatch = minimatch;
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
- var starDotExtTestNocase = (ext2) => {
- ext2 = ext2.toLowerCase();
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
- };
- var starDotExtTestNocaseDot = (ext2) => {
- ext2 = ext2.toLowerCase();
- return (f) => f.toLowerCase().endsWith(ext2);
- };
- var starDotStarRE = /^\*+\.\*+$/;
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
- var dotStarRE = /^\.\*+$/;
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
- var starRE = /^\*+$/;
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
- const noext = qmarksTestNoExt([$0]);
- if (!ext2)
- return noext;
- ext2 = ext2.toLowerCase();
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
- };
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
- const noext = qmarksTestNoExtDot([$0]);
- if (!ext2)
- return noext;
- ext2 = ext2.toLowerCase();
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
- };
- var qmarksTestDot = ([$0, ext2 = ""]) => {
- const noext = qmarksTestNoExtDot([$0]);
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
- };
- var qmarksTest = ([$0, ext2 = ""]) => {
- const noext = qmarksTestNoExt([$0]);
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
- };
- var qmarksTestNoExt = ([$0]) => {
- const len = $0.length;
- return (f) => f.length === len && !f.startsWith(".");
- };
- var qmarksTestNoExtDot = ([$0]) => {
- const len = $0.length;
- return (f) => f.length === len && f !== "." && f !== "..";
- };
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
- var path6 = {
- win32: { sep: "\\" },
- posix: { sep: "/" }
- };
- exports2.sep = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
- exports2.minimatch.sep = exports2.sep;
- exports2.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
- exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
- var qmark = "[^/]";
- var star = qmark + "*?";
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
- var filter = (pattern, options = {}) => (p) => (0, exports2.minimatch)(p, pattern, options);
- exports2.filter = filter;
- exports2.minimatch.filter = exports2.filter;
- var ext = (a, b = {}) => Object.assign({}, a, b);
- var defaults2 = (def) => {
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
- return exports2.minimatch;
- }
- const orig = exports2.minimatch;
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
- return Object.assign(m, {
- Minimatch: class Minimatch extends orig.Minimatch {
- constructor(pattern, options = {}) {
- super(pattern, ext(def, options));
- }
- static defaults(options) {
- return orig.defaults(ext(def, options)).Minimatch;
- }
+ });
+ writable.on("drain", resume);
+ const cleanup = eos(
+ writable,
+ {
+ readable: false
},
- AST: class AST extends orig.AST {
- /* c8 ignore start */
- constructor(type, parent, options = {}) {
- super(type, parent, ext(def, options));
- }
- /* c8 ignore stop */
- static fromGlob(pattern, options = {}) {
- return orig.AST.fromGlob(pattern, ext(def, options));
+ resume
+ );
+ try {
+ if (writable.writableNeedDrain) {
+ await wait();
+ }
+ for await (const chunk of iterable) {
+ if (!writable.write(chunk)) {
+ await wait();
}
- },
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
- defaults: (options) => orig.defaults(ext(def, options)),
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
- sep: orig.sep,
- GLOBSTAR: exports2.GLOBSTAR
- });
- };
- exports2.defaults = defaults2;
- exports2.minimatch.defaults = exports2.defaults;
- var braceExpand = (pattern, options = {}) => {
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
- return [pattern];
- }
- return (0, brace_expansion_1.default)(pattern);
- };
- exports2.braceExpand = braceExpand;
- exports2.minimatch.braceExpand = exports2.braceExpand;
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
- exports2.makeRe = makeRe;
- exports2.minimatch.makeRe = exports2.makeRe;
- var match = (list, pattern, options = {}) => {
- const mm = new Minimatch(pattern, options);
- list = list.filter((f) => mm.match(f));
- if (mm.options.nonull && !list.length) {
- list.push(pattern);
- }
- return list;
- };
- exports2.match = match;
- exports2.minimatch.match = exports2.match;
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- var Minimatch = class {
- options;
- set;
- pattern;
- windowsPathsNoEscape;
- nonegate;
- negate;
- comment;
- empty;
- preserveMultipleSlashes;
- partial;
- globSet;
- globParts;
- nocase;
- isWindows;
- platform;
- windowsNoMagicRoot;
- maxGlobstarRecursion;
- regexp;
- constructor(pattern, options = {}) {
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
- options = options || {};
- this.options = options;
- this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
- this.pattern = pattern;
- this.platform = options.platform || defaultPlatform;
- this.isWindows = this.platform === "win32";
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
- if (this.windowsPathsNoEscape) {
- this.pattern = this.pattern.replace(/\\/g, "/");
}
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
- this.regexp = null;
- this.negate = false;
- this.nonegate = !!options.nonegate;
- this.comment = false;
- this.empty = false;
- this.partial = !!options.partial;
- this.nocase = !!this.options.nocase;
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
- this.globSet = [];
- this.globParts = [];
- this.set = [];
- this.make();
+ if (end) {
+ writable.end();
+ await wait();
+ }
+ finish();
+ } catch (err) {
+ finish(error2 !== err ? aggregateTwoErrors(error2, err) : err);
+ } finally {
+ cleanup();
+ writable.off("drain", resume);
}
- hasMagic() {
- if (this.options.magicalBraces && this.set.length > 1) {
- return true;
+ }
+ async function pumpToWeb(readable, writable, finish, { end }) {
+ if (isTransformStream(writable)) {
+ writable = writable.writable;
+ }
+ const writer = writable.getWriter();
+ try {
+ for await (const chunk of readable) {
+ await writer.ready;
+ writer.write(chunk).catch(() => {
+ });
}
- for (const pattern of this.set) {
- for (const part of pattern) {
- if (typeof part !== "string")
- return true;
- }
+ await writer.ready;
+ if (end) {
+ await writer.close();
+ }
+ finish();
+ } catch (err) {
+ try {
+ await writer.abort(err);
+ finish(err);
+ } catch (err2) {
+ finish(err2);
}
- return false;
}
- debug(..._2) {
+ }
+ function pipeline3(...streams) {
+ return pipelineImpl(streams, once(popCallback(streams)));
+ }
+ function pipelineImpl(streams, callback, opts) {
+ if (streams.length === 1 && ArrayIsArray(streams[0])) {
+ streams = streams[0];
}
- make() {
- const pattern = this.pattern;
- const options = this.options;
- if (!options.nocomment && pattern.charAt(0) === "#") {
- this.comment = true;
- return;
+ if (streams.length < 2) {
+ throw new ERR_MISSING_ARGS("streams");
+ }
+ const ac = new AbortController2();
+ const signal = ac.signal;
+ const outerSignal = opts === null || opts === void 0 ? void 0 : opts.signal;
+ const lastStreamCleanup = [];
+ validateAbortSignal(outerSignal, "options.signal");
+ function abort() {
+ finishImpl(new AbortError3());
+ }
+ addAbortListener = addAbortListener || require_util10().addAbortListener;
+ let disposable;
+ if (outerSignal) {
+ disposable = addAbortListener(outerSignal, abort);
+ }
+ let error2;
+ let value;
+ const destroys = [];
+ let finishCount = 0;
+ function finish(err) {
+ finishImpl(err, --finishCount === 0);
+ }
+ function finishImpl(err, final) {
+ var _disposable;
+ if (err && (!error2 || error2.code === "ERR_STREAM_PREMATURE_CLOSE")) {
+ error2 = err;
}
- if (!pattern) {
- this.empty = true;
+ if (!error2 && !final) {
return;
}
- this.parseNegate();
- this.globSet = [...new Set(this.braceExpand())];
- if (options.debug) {
- this.debug = (...args) => console.error(...args);
- }
- this.debug(this.pattern, this.globSet);
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
- this.globParts = this.preprocess(rawGlobParts);
- this.debug(this.pattern, this.globParts);
- let set = this.globParts.map((s, _2, __) => {
- if (this.isWindows && this.windowsNoMagicRoot) {
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
- const isDrive = /^[a-z]:/i.test(s[0]);
- if (isUNC) {
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
- } else if (isDrive) {
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
- }
- }
- return s.map((ss) => this.parse(ss));
- });
- this.debug(this.pattern, set);
- this.set = set.filter((s) => s.indexOf(false) === -1);
- if (this.isWindows) {
- for (let i = 0; i < this.set.length; i++) {
- const p = this.set[i];
- if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
- p[2] = "?";
- }
- }
+ while (destroys.length) {
+ destroys.shift()(error2);
}
- this.debug(this.pattern, this.set);
- }
- // various transforms to equivalent pattern sets that are
- // faster to process in a filesystem walk. The goal is to
- // eliminate what we can, and push all ** patterns as far
- // to the right as possible, even if it increases the number
- // of patterns that we have to process.
- preprocess(globParts) {
- if (this.options.noglobstar) {
- for (let i = 0; i < globParts.length; i++) {
- for (let j = 0; j < globParts[i].length; j++) {
- if (globParts[i][j] === "**") {
- globParts[i][j] = "*";
- }
- }
+ ;
+ (_disposable = disposable) === null || _disposable === void 0 ? void 0 : _disposable[SymbolDispose]();
+ ac.abort();
+ if (final) {
+ if (!error2) {
+ lastStreamCleanup.forEach((fn) => fn());
}
+ process5.nextTick(callback, error2, value);
}
- const { optimizationLevel = 1 } = this.options;
- if (optimizationLevel >= 2) {
- globParts = this.firstPhasePreProcess(globParts);
- globParts = this.secondPhasePreProcess(globParts);
- } else if (optimizationLevel >= 1) {
- globParts = this.levelOneOptimize(globParts);
- } else {
- globParts = this.adjascentGlobstarOptimize(globParts);
- }
- return globParts;
}
- // just get rid of adjascent ** portions
- adjascentGlobstarOptimize(globParts) {
- return globParts.map((parts) => {
- let gs = -1;
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
- let i = gs;
- while (parts[i + 1] === "**") {
- i++;
+ let ret;
+ for (let i = 0; i < streams.length; i++) {
+ const stream4 = streams[i];
+ const reading = i < streams.length - 1;
+ const writing = i > 0;
+ const end = reading || (opts === null || opts === void 0 ? void 0 : opts.end) !== false;
+ const isLastStream = i === streams.length - 1;
+ if (isNodeStream(stream4)) {
+ let onError2 = function(err) {
+ if (err && err.name !== "AbortError" && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
+ finish(err);
}
- if (i !== gs) {
- parts.splice(gs, i - gs);
+ };
+ var onError = onError2;
+ if (end) {
+ const { destroy: destroy2, cleanup } = destroyer(stream4, reading, writing);
+ destroys.push(destroy2);
+ if (isReadable(stream4) && isLastStream) {
+ lastStreamCleanup.push(cleanup);
}
}
- return parts;
- });
- }
- // get rid of adjascent ** and resolve .. portions
- levelOneOptimize(globParts) {
- return globParts.map((parts) => {
- parts = parts.reduce((set, part) => {
- const prev = set[set.length - 1];
- if (part === "**" && prev === "**") {
- return set;
- }
- if (part === "..") {
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
- set.pop();
- return set;
- }
- }
- set.push(part);
- return set;
- }, []);
- return parts.length === 0 ? [""] : parts;
- });
- }
- levelTwoFileOptimize(parts) {
- if (!Array.isArray(parts)) {
- parts = this.slashSplit(parts);
- }
- let didSomething = false;
- do {
- didSomething = false;
- if (!this.preserveMultipleSlashes) {
- for (let i = 1; i < parts.length - 1; i++) {
- const p = parts[i];
- if (i === 1 && p === "" && parts[0] === "")
- continue;
- if (p === "." || p === "") {
- didSomething = true;
- parts.splice(i, 1);
- i--;
- }
- }
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
- didSomething = true;
- parts.pop();
- }
+ stream4.on("error", onError2);
+ if (isReadable(stream4) && isLastStream) {
+ lastStreamCleanup.push(() => {
+ stream4.removeListener("error", onError2);
+ });
}
- let dd = 0;
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
- const p = parts[dd - 1];
- if (p && p !== "." && p !== ".." && p !== "**") {
- didSomething = true;
- parts.splice(dd - 1, 2);
- dd -= 2;
+ }
+ if (i === 0) {
+ if (typeof stream4 === "function") {
+ ret = stream4({
+ signal
+ });
+ if (!isIterable(ret)) {
+ throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or Stream", "source", ret);
}
+ } else if (isIterable(stream4) || isReadableNodeStream(stream4) || isTransformStream(stream4)) {
+ ret = stream4;
+ } else {
+ ret = Duplex.from(stream4);
}
- } while (didSomething);
- return parts.length === 0 ? [""] : parts;
- }
- // First phase: single-pattern processing
- // <pre> is 1 or more portions
- // <rest> is 1 or more portions
- // <p> is any portion other than ., .., '', or **
- // <e> is . or ''
- //
- // **/.. is *brutal* for filesystem walking performance, because
- // it effectively resets the recursive walk each time it occurs,
- // and ** cannot be reduced out by a .. pattern part like a regexp
- // or most strings (other than .., ., and '') can be.
- //
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
- // <pre>/<e>/<rest> -> <pre>/<rest>
- // <pre>/<p>/../<rest> -> <pre>/<rest>
- // **/**/<rest> -> **/<rest>
- //
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
- // this WOULD be allowed if ** did follow symlinks, or * didn't
- firstPhasePreProcess(globParts) {
- let didSomething = false;
- do {
- didSomething = false;
- for (let parts of globParts) {
- let gs = -1;
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
- let gss = gs;
- while (parts[gss + 1] === "**") {
- gss++;
- }
- if (gss > gs) {
- parts.splice(gs + 1, gss - gs);
- }
- let next = parts[gs + 1];
- const p = parts[gs + 2];
- const p2 = parts[gs + 3];
- if (next !== "..")
- continue;
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
- continue;
- }
- didSomething = true;
- parts.splice(gs, 1);
- const other = parts.slice(0);
- other[gs] = "**";
- globParts.push(other);
- gs--;
+ } else if (typeof stream4 === "function") {
+ if (isTransformStream(ret)) {
+ var _ret;
+ ret = makeAsyncIterable2((_ret = ret) === null || _ret === void 0 ? void 0 : _ret.readable);
+ } else {
+ ret = makeAsyncIterable2(ret);
+ }
+ ret = stream4(ret, {
+ signal
+ });
+ if (reading) {
+ if (!isIterable(ret, true)) {
+ throw new ERR_INVALID_RETURN_VALUE("AsyncIterable", `transform[${i - 1}]`, ret);
}
- if (!this.preserveMultipleSlashes) {
- for (let i = 1; i < parts.length - 1; i++) {
- const p = parts[i];
- if (i === 1 && p === "" && parts[0] === "")
- continue;
- if (p === "." || p === "") {
- didSomething = true;
- parts.splice(i, 1);
- i--;
+ } else {
+ var _ret2;
+ if (!PassThrough2) {
+ PassThrough2 = require_passthrough2();
+ }
+ const pt = new PassThrough2({
+ objectMode: true
+ });
+ const then = (_ret2 = ret) === null || _ret2 === void 0 ? void 0 : _ret2.then;
+ if (typeof then === "function") {
+ finishCount++;
+ then.call(
+ ret,
+ (val) => {
+ value = val;
+ if (val != null) {
+ pt.write(val);
+ }
+ if (end) {
+ pt.end();
+ }
+ process5.nextTick(finish);
+ },
+ (err) => {
+ pt.destroy(err);
+ process5.nextTick(finish, err);
}
- }
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
- didSomething = true;
- parts.pop();
- }
+ );
+ } else if (isIterable(ret, true)) {
+ finishCount++;
+ pumpToNode(ret, pt, finish, {
+ end
+ });
+ } else if (isReadableStream3(ret) || isTransformStream(ret)) {
+ const toRead = ret.readable || ret;
+ finishCount++;
+ pumpToNode(toRead, pt, finish, {
+ end
+ });
+ } else {
+ throw new ERR_INVALID_RETURN_VALUE("AsyncIterable or Promise", "destination", ret);
}
- let dd = 0;
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
- const p = parts[dd - 1];
- if (p && p !== "." && p !== ".." && p !== "**") {
- didSomething = true;
- const needDot = dd === 1 && parts[dd + 1] === "**";
- const splin = needDot ? ["."] : [];
- parts.splice(dd - 1, 2, ...splin);
- if (parts.length === 0)
- parts.push("");
- dd -= 2;
- }
+ ret = pt;
+ const { destroy: destroy2, cleanup } = destroyer(ret, false, true);
+ destroys.push(destroy2);
+ if (isLastStream) {
+ lastStreamCleanup.push(cleanup);
}
}
- } while (didSomething);
- return globParts;
- }
- // second phase: multi-pattern dedupes
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
- //
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
- // ^-- not valid because ** doens't follow symlinks
- secondPhasePreProcess(globParts) {
- for (let i = 0; i < globParts.length - 1; i++) {
- for (let j = i + 1; j < globParts.length; j++) {
- const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
- if (matched) {
- globParts[i] = [];
- globParts[j] = matched;
- break;
+ } else if (isNodeStream(stream4)) {
+ if (isReadableNodeStream(ret)) {
+ finishCount += 2;
+ const cleanup = pipe(ret, stream4, finish, {
+ end
+ });
+ if (isReadable(stream4) && isLastStream) {
+ lastStreamCleanup.push(cleanup);
}
+ } else if (isTransformStream(ret) || isReadableStream3(ret)) {
+ const toRead = ret.readable || ret;
+ finishCount++;
+ pumpToNode(toRead, stream4, finish, {
+ end
+ });
+ } else if (isIterable(ret)) {
+ finishCount++;
+ pumpToNode(ret, stream4, finish, {
+ end
+ });
+ } else {
+ throw new ERR_INVALID_ARG_TYPE(
+ "val",
+ ["Readable", "Iterable", "AsyncIterable", "ReadableStream", "TransformStream"],
+ ret
+ );
+ }
+ ret = stream4;
+ } else if (isWebStream(stream4)) {
+ if (isReadableNodeStream(ret)) {
+ finishCount++;
+ pumpToWeb(makeAsyncIterable2(ret), stream4, finish, {
+ end
+ });
+ } else if (isReadableStream3(ret) || isIterable(ret)) {
+ finishCount++;
+ pumpToWeb(ret, stream4, finish, {
+ end
+ });
+ } else if (isTransformStream(ret)) {
+ finishCount++;
+ pumpToWeb(ret.readable, stream4, finish, {
+ end
+ });
+ } else {
+ throw new ERR_INVALID_ARG_TYPE(
+ "val",
+ ["Readable", "Iterable", "AsyncIterable", "ReadableStream", "TransformStream"],
+ ret
+ );
}
+ ret = stream4;
+ } else {
+ ret = Duplex.from(stream4);
}
- return globParts.filter((gs) => gs.length);
}
- partsMatch(a, b, emptyGSMatch = false) {
- let ai = 0;
- let bi = 0;
- let result = [];
- let which2 = "";
- while (ai < a.length && bi < b.length) {
- if (a[ai] === b[bi]) {
- result.push(which2 === "b" ? b[bi] : a[ai]);
- ai++;
- bi++;
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
- result.push(a[ai]);
- ai++;
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
- result.push(b[bi]);
- bi++;
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
- if (which2 === "b")
- return false;
- which2 = "a";
- result.push(a[ai]);
- ai++;
- bi++;
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
- if (which2 === "a")
- return false;
- which2 = "b";
- result.push(b[bi]);
- ai++;
- bi++;
+ if (signal !== null && signal !== void 0 && signal.aborted || outerSignal !== null && outerSignal !== void 0 && outerSignal.aborted) {
+ process5.nextTick(abort);
+ }
+ return ret;
+ }
+ function pipe(src, dst, finish, { end }) {
+ let ended = false;
+ dst.on("close", () => {
+ if (!ended) {
+ finish(new ERR_STREAM_PREMATURE_CLOSE());
+ }
+ });
+ src.pipe(dst, {
+ end: false
+ });
+ if (end) {
+ let endFn2 = function() {
+ ended = true;
+ dst.end();
+ };
+ var endFn = endFn2;
+ if (isReadableFinished(src)) {
+ process5.nextTick(endFn2);
+ } else {
+ src.once("end", endFn2);
+ }
+ } else {
+ finish();
+ }
+ eos(
+ src,
+ {
+ readable: true,
+ writable: false
+ },
+ (err) => {
+ const rState = src._readableState;
+ if (err && err.code === "ERR_STREAM_PREMATURE_CLOSE" && rState && rState.ended && !rState.errored && !rState.errorEmitted) {
+ src.once("end", finish).once("error", finish);
} else {
- return false;
+ finish(err);
}
}
- return a.length === b.length && result;
+ );
+ return eos(
+ dst,
+ {
+ readable: false,
+ writable: true
+ },
+ finish
+ );
+ }
+ module2.exports = {
+ pipelineImpl,
+ pipeline: pipeline3
+ };
+ }
+});
+
+// node_modules/readable-stream/lib/internal/streams/compose.js
+var require_compose = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
+ "use strict";
+ var { pipeline: pipeline3 } = require_pipeline();
+ var Duplex = require_duplex();
+ var { destroyer } = require_destroy2();
+ var {
+ isNodeStream,
+ isReadable,
+ isWritable,
+ isWebStream,
+ isTransformStream,
+ isWritableStream,
+ isReadableStream: isReadableStream3
+ } = require_utils2();
+ var {
+ AbortError: AbortError3,
+ codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS }
+ } = require_errors2();
+ var eos = require_end_of_stream();
+ module2.exports = function compose(...streams) {
+ if (streams.length === 0) {
+ throw new ERR_MISSING_ARGS("streams");
}
- parseNegate() {
- if (this.nonegate)
- return;
- const pattern = this.pattern;
- let negate = false;
- let negateOffset = 0;
- for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
- negate = !negate;
- negateOffset++;
- }
- if (negateOffset)
- this.pattern = pattern.slice(negateOffset);
- this.negate = negate;
+ if (streams.length === 1) {
+ return Duplex.from(streams[0]);
}
- // set partial to true to test if, for example,
- // "/a/b" matches the start of "/*/b/*/d"
- // Partial means, if you run out of file before you run
- // out of pattern, then that's fine, as long as all
- // the parts match.
- matchOne(file, pattern, partial = false) {
- let fileStartIndex = 0;
- let patternStartIndex = 0;
- if (this.isWindows) {
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
- if (typeof fdi === "number" && typeof pdi === "number") {
- const [fd, pd] = [
- file[fdi],
- pattern[pdi]
- ];
- if (fd.toLowerCase() === pd.toLowerCase()) {
- pattern[pdi] = fd;
- patternStartIndex = pdi;
- fileStartIndex = fdi;
- }
- }
+ const orgStreams = [...streams];
+ if (typeof streams[0] === "function") {
+ streams[0] = Duplex.from(streams[0]);
+ }
+ if (typeof streams[streams.length - 1] === "function") {
+ const idx = streams.length - 1;
+ streams[idx] = Duplex.from(streams[idx]);
+ }
+ for (let n = 0; n < streams.length; ++n) {
+ if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) {
+ continue;
}
- const { optimizationLevel = 1 } = this.options;
- if (optimizationLevel >= 2) {
- file = this.levelTwoFileOptimize(file);
+ if (n < streams.length - 1 && !(isReadable(streams[n]) || isReadableStream3(streams[n]) || isTransformStream(streams[n]))) {
+ throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be readable");
}
- if (pattern.includes(exports2.GLOBSTAR)) {
- return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
+ if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) {
+ throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be writable");
}
- return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
}
- #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
- const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex);
- const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR);
- const [head, body2, tail] = partial ? [
- pattern.slice(patternIndex, firstgs),
- pattern.slice(firstgs + 1),
- []
- ] : [
- pattern.slice(patternIndex, firstgs),
- pattern.slice(firstgs + 1, lastgs),
- pattern.slice(lastgs + 1)
- ];
- if (head.length) {
- const fileHead = file.slice(fileIndex, fileIndex + head.length);
- if (!this.#matchOne(fileHead, head, partial, 0, 0))
- return false;
- fileIndex += head.length;
+ let ondrain;
+ let onfinish;
+ let onreadable;
+ let onclose;
+ let d;
+ function onfinished(err) {
+ const cb = onclose;
+ onclose = null;
+ if (cb) {
+ cb(err);
+ } else if (err) {
+ d.destroy(err);
+ } else if (!readable && !writable) {
+ d.destroy();
}
- let fileTailMatch = 0;
- if (tail.length) {
- if (tail.length + fileIndex > file.length)
- return false;
- let tailStart = file.length - tail.length;
- if (this.#matchOne(file, tail, partial, tailStart, 0)) {
- fileTailMatch = tail.length;
- } else {
- if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
- return false;
+ }
+ const head = streams[0];
+ const tail = pipeline3(streams, onfinished);
+ const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
+ const readable = !!(isReadable(tail) || isReadableStream3(tail) || isTransformStream(tail));
+ d = new Duplex({
+ // TODO (ronag): highWaterMark?
+ writableObjectMode: !!(head !== null && head !== void 0 && head.writableObjectMode),
+ readableObjectMode: !!(tail !== null && tail !== void 0 && tail.readableObjectMode),
+ writable,
+ readable
+ });
+ if (writable) {
+ if (isNodeStream(head)) {
+ d._write = function(chunk, encoding, callback) {
+ if (head.write(chunk, encoding)) {
+ callback();
+ } else {
+ ondrain = callback;
}
- tailStart--;
- if (!this.#matchOne(file, tail, partial, tailStart, 0))
- return false;
- fileTailMatch = tail.length + 1;
- }
- }
- if (!body2.length) {
- let sawSome = !!fileTailMatch;
- for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
- const f = String(file[i2]);
- sawSome = true;
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
- return false;
+ };
+ d._final = function(callback) {
+ head.end();
+ onfinish = callback;
+ };
+ head.on("drain", function() {
+ if (ondrain) {
+ const cb = ondrain;
+ ondrain = null;
+ cb();
}
- }
- return partial || sawSome;
- }
- const bodySegments = [[[], 0]];
- let currentBody = bodySegments[0];
- let nonGsParts = 0;
- const nonGsPartsSums = [0];
- for (const b of body2) {
- if (b === exports2.GLOBSTAR) {
- nonGsPartsSums.push(nonGsParts);
- currentBody = [[], 0];
- bodySegments.push(currentBody);
- } else {
- currentBody[0].push(b);
- nonGsParts++;
- }
- }
- let i = bodySegments.length - 1;
- const fileLength = file.length - fileTailMatch;
- for (const b of bodySegments) {
- b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
- }
- return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
- }
- #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
- const bs = bodySegments[bodyIndex];
- if (!bs) {
- for (let i = fileIndex; i < file.length; i++) {
- sawTail = true;
- const f = file[i];
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
- return false;
+ });
+ } else if (isWebStream(head)) {
+ const writable2 = isTransformStream(head) ? head.writable : head;
+ const writer = writable2.getWriter();
+ d._write = async function(chunk, encoding, callback) {
+ try {
+ await writer.ready;
+ writer.write(chunk).catch(() => {
+ });
+ callback();
+ } catch (err) {
+ callback(err);
}
- }
- return sawTail;
- }
- const [body2, after] = bs;
- while (fileIndex <= after) {
- const m = this.#matchOne(file.slice(0, fileIndex + body2.length), body2, partial, fileIndex, 0);
- if (m && globStarDepth < this.maxGlobstarRecursion) {
- const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body2.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
- if (sub !== false)
- return sub;
- }
- const f = file[fileIndex];
- if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
- return false;
- }
- fileIndex++;
+ };
+ d._final = async function(callback) {
+ try {
+ await writer.ready;
+ writer.close().catch(() => {
+ });
+ onfinish = callback;
+ } catch (err) {
+ callback(err);
+ }
+ };
}
- return partial || null;
- }
- #matchOne(file, pattern, partial, fileIndex, patternIndex) {
- let fi;
- let pi;
- let pl;
- let fl;
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
- this.debug("matchOne loop");
- let p = pattern[pi];
- let f = file[fi];
- this.debug(pattern, p, f);
- if (p === false || p === exports2.GLOBSTAR)
- return false;
- let hit;
- if (typeof p === "string") {
- hit = f === p;
- this.debug("string match", p, f, hit);
- } else {
- hit = p.test(f);
- this.debug("pattern match", p, f, hit);
+ const toRead = isTransformStream(tail) ? tail.readable : tail;
+ eos(toRead, () => {
+ if (onfinish) {
+ const cb = onfinish;
+ onfinish = null;
+ cb();
}
- if (!hit)
- return false;
- }
- if (fi === fl && pi === pl) {
- return true;
- } else if (fi === fl) {
- return partial;
- } else if (pi === pl) {
- return fi === fl - 1 && file[fi] === "";
- } else {
- throw new Error("wtf?");
- }
- }
- braceExpand() {
- return (0, exports2.braceExpand)(this.pattern, this.options);
+ });
}
- parse(pattern) {
- (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
- const options = this.options;
- if (pattern === "**")
- return exports2.GLOBSTAR;
- if (pattern === "")
- return "";
- let m;
- let fastTest = null;
- if (m = pattern.match(starRE)) {
- fastTest = options.dot ? starTestDot : starTest;
- } else if (m = pattern.match(starDotExtRE)) {
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
- } else if (m = pattern.match(qmarksRE)) {
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
- } else if (m = pattern.match(starDotStarRE)) {
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
- } else if (m = pattern.match(dotStarRE)) {
- fastTest = dotStarTest;
- }
- const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
- if (fastTest && typeof re === "object") {
- Reflect.defineProperty(re, "test", { value: fastTest });
- }
- return re;
- }
- makeRe() {
- if (this.regexp || this.regexp === false)
- return this.regexp;
- const set = this.set;
- if (!set.length) {
- this.regexp = false;
- return this.regexp;
- }
- const options = this.options;
- const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
- const flags = new Set(options.nocase ? ["i"] : []);
- let re = set.map((pattern) => {
- const pp = pattern.map((p) => {
- if (p instanceof RegExp) {
- for (const f of p.flags.split(""))
- flags.add(f);
+ if (readable) {
+ if (isNodeStream(tail)) {
+ tail.on("readable", function() {
+ if (onreadable) {
+ const cb = onreadable;
+ onreadable = null;
+ cb();
}
- return typeof p === "string" ? regExpEscape(p) : p === exports2.GLOBSTAR ? exports2.GLOBSTAR : p._src;
});
- pp.forEach((p, i) => {
- const next = pp[i + 1];
- const prev = pp[i - 1];
- if (p !== exports2.GLOBSTAR || prev === exports2.GLOBSTAR) {
- return;
+ tail.on("end", function() {
+ d.push(null);
+ });
+ d._read = function() {
+ while (true) {
+ const buf = tail.read();
+ if (buf === null) {
+ onreadable = d._read;
+ return;
+ }
+ if (!d.push(buf)) {
+ return;
+ }
}
- if (prev === void 0) {
- if (next !== void 0 && next !== exports2.GLOBSTAR) {
- pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
- } else {
- pp[i] = twoStar;
+ };
+ } else if (isWebStream(tail)) {
+ const readable2 = isTransformStream(tail) ? tail.readable : tail;
+ const reader = readable2.getReader();
+ d._read = async function() {
+ while (true) {
+ try {
+ const { value, done } = await reader.read();
+ if (!d.push(value)) {
+ return;
+ }
+ if (done) {
+ d.push(null);
+ return;
+ }
+ } catch {
+ return;
}
- } else if (next === void 0) {
- pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
- } else if (next !== exports2.GLOBSTAR) {
- pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
- pp[i + 1] = exports2.GLOBSTAR;
}
- });
- return pp.filter((p) => p !== exports2.GLOBSTAR).join("/");
- }).join("|");
- const [open3, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
- re = "^" + open3 + re + close + "$";
- if (this.negate)
- re = "^(?!" + re + ").+$";
- try {
- this.regexp = new RegExp(re, [...flags].join(""));
- } catch (ex) {
- this.regexp = false;
- }
- return this.regexp;
- }
- slashSplit(p) {
- if (this.preserveMultipleSlashes) {
- return p.split("/");
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
- return ["", ...p.split(/\/+/)];
- } else {
- return p.split(/\/+/);
+ };
}
}
- match(f, partial = this.partial) {
- this.debug("match", f, this.pattern);
- if (this.comment) {
- return false;
- }
- if (this.empty) {
- return f === "";
- }
- if (f === "/" && partial) {
- return true;
- }
- const options = this.options;
- if (this.isWindows) {
- f = f.split("\\").join("/");
- }
- const ff = this.slashSplit(f);
- this.debug(this.pattern, "split", ff);
- const set = this.set;
- this.debug(this.pattern, "set", set);
- let filename = ff[ff.length - 1];
- if (!filename) {
- for (let i = ff.length - 2; !filename && i >= 0; i--) {
- filename = ff[i];
- }
+ d._destroy = function(err, callback) {
+ if (!err && onclose !== null) {
+ err = new AbortError3();
}
- for (let i = 0; i < set.length; i++) {
- const pattern = set[i];
- let file = ff;
- if (options.matchBase && pattern.length === 1) {
- file = [filename];
- }
- const hit = this.matchOne(file, pattern, partial);
- if (hit) {
- if (options.flipNegate) {
- return true;
- }
- return !this.negate;
+ onreadable = null;
+ ondrain = null;
+ onfinish = null;
+ if (onclose === null) {
+ callback(err);
+ } else {
+ onclose = callback;
+ if (isNodeStream(tail)) {
+ destroyer(tail, err);
}
}
- if (options.flipNegate) {
- return false;
- }
- return this.negate;
- }
- static defaults(def) {
- return exports2.minimatch.defaults(def).Minimatch;
- }
+ };
+ return d;
};
- exports2.Minimatch = Minimatch;
- var ast_js_2 = require_ast();
- Object.defineProperty(exports2, "AST", { enumerable: true, get: function() {
- return ast_js_2.AST;
- } });
- var escape_js_2 = require_escape();
- Object.defineProperty(exports2, "escape", { enumerable: true, get: function() {
- return escape_js_2.escape;
- } });
- var unescape_js_2 = require_unescape();
- Object.defineProperty(exports2, "unescape", { enumerable: true, get: function() {
- return unescape_js_2.unescape;
- } });
- exports2.minimatch.AST = ast_js_1.AST;
- exports2.minimatch.Minimatch = Minimatch;
- exports2.minimatch.escape = escape_js_1.escape;
- exports2.minimatch.unescape = unescape_js_1.unescape;
}
});
-// node_modules/lru-cache/dist/commonjs/index.js
-var require_commonjs4 = __commonJS({
- "node_modules/lru-cache/dist/commonjs/index.js"(exports2) {
+// node_modules/readable-stream/lib/internal/streams/operators.js
+var require_operators = __commonJS({
+ "node_modules/readable-stream/lib/internal/streams/operators.js"(exports2, module2) {
"use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.LRUCache = void 0;
- var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
- var warned = /* @__PURE__ */ new Set();
- var PROCESS = typeof process === "object" && !!process ? process : {};
- var emitWarning = (msg, type, code, fn) => {
- typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
- };
- var AC = globalThis.AbortController;
- var AS = globalThis.AbortSignal;
- if (typeof AC === "undefined") {
- AS = class AbortSignal {
- onabort;
- _onabort = [];
- reason;
- aborted = false;
- addEventListener(_2, fn) {
- this._onabort.push(fn);
- }
- };
- AC = class AbortController {
- constructor() {
- warnACPolyfill();
- }
- signal = new AS();
- abort(reason) {
- if (this.signal.aborted)
- return;
- this.signal.reason = reason;
- this.signal.aborted = true;
- for (const fn of this.signal._onabort) {
- fn(reason);
- }
- this.signal.onabort?.(reason);
- }
- };
- let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
- const warnACPolyfill = () => {
- if (!printACPolyfillWarning)
- return;
- printACPolyfillWarning = false;
- emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
- };
- }
- var shouldWarn = (code) => !warned.has(code);
- var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
- var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
- var ZeroArray = class extends Array {
- constructor(size) {
- super(size);
- this.fill(0);
- }
- };
- var Stack = class _Stack {
- heap;
- length;
- // private constructor
- static #constructing = false;
- static create(max) {
- const HeapCls = getUintArray(max);
- if (!HeapCls)
- return [];
- _Stack.#constructing = true;
- const s = new _Stack(max, HeapCls);
- _Stack.#constructing = false;
- return s;
- }
- constructor(max, HeapCls) {
- if (!_Stack.#constructing) {
- throw new TypeError("instantiate Stack using Stack.create(n)");
- }
- this.heap = new HeapCls(max);
- this.length = 0;
- }
- push(n) {
- this.heap[this.length++] = n;
- }
- pop() {
- return this.heap[--this.length];
- }
- };
- var LRUCache = class _LRUCache {
- // options that cannot be changed without disaster
- #max;
- #maxSize;
- #dispose;
- #disposeAfter;
- #fetchMethod;
- #memoMethod;
- /**
- * {@link LRUCache.OptionsBase.ttl}
- */
- ttl;
- /**
- * {@link LRUCache.OptionsBase.ttlResolution}
- */
- ttlResolution;
- /**
- * {@link LRUCache.OptionsBase.ttlAutopurge}
- */
- ttlAutopurge;
- /**
- * {@link LRUCache.OptionsBase.updateAgeOnGet}
- */
- updateAgeOnGet;
- /**
- * {@link LRUCache.OptionsBase.updateAgeOnHas}
- */
- updateAgeOnHas;
- /**
- * {@link LRUCache.OptionsBase.allowStale}
- */
- allowStale;
- /**
- * {@link LRUCache.OptionsBase.noDisposeOnSet}
- */
- noDisposeOnSet;
- /**
- * {@link LRUCache.OptionsBase.noUpdateTTL}
- */
- noUpdateTTL;
- /**
- * {@link LRUCache.OptionsBase.maxEntrySize}
- */
- maxEntrySize;
- /**
- * {@link LRUCache.OptionsBase.sizeCalculation}
- */
- sizeCalculation;
- /**
- * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
- */
- noDeleteOnFetchRejection;
- /**
- * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
- */
- noDeleteOnStaleGet;
- /**
- * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
- */
- allowStaleOnFetchAbort;
- /**
- * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
- */
- allowStaleOnFetchRejection;
- /**
- * {@link LRUCache.OptionsBase.ignoreFetchAbort}
- */
- ignoreFetchAbort;
- // computed properties
- #size;
- #calculatedSize;
- #keyMap;
- #keyList;
- #valList;
- #next;
- #prev;
- #head;
- #tail;
- #free;
- #disposed;
- #sizes;
- #starts;
- #ttls;
- #hasDispose;
- #hasFetchMethod;
- #hasDisposeAfter;
- /**
- * Do not call this method unless you need to inspect the
- * inner workings of the cache. If anything returned by this
- * object is modified in any way, strange breakage may occur.
- *
- * These fields are private for a reason!
- *
- * @internal
- */
- static unsafeExposeInternals(c) {
- return {
- // properties
- starts: c.#starts,
- ttls: c.#ttls,
- sizes: c.#sizes,
- keyMap: c.#keyMap,
- keyList: c.#keyList,
- valList: c.#valList,
- next: c.#next,
- prev: c.#prev,
- get head() {
- return c.#head;
- },
- get tail() {
- return c.#tail;
- },
- free: c.#free,
- // methods
- isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
- backgroundFetch: (k, index, options, context6) => c.#backgroundFetch(k, index, options, context6),
- moveToTail: (index) => c.#moveToTail(index),
- indexes: (options) => c.#indexes(options),
- rindexes: (options) => c.#rindexes(options),
- isStale: (index) => c.#isStale(index)
- };
- }
- // Protected read-only members
- /**
- * {@link LRUCache.OptionsBase.max} (read-only)
- */
- get max() {
- return this.#max;
- }
- /**
- * {@link LRUCache.OptionsBase.maxSize} (read-only)
- */
- get maxSize() {
- return this.#maxSize;
+ var AbortController2 = globalThis.AbortController || require_abort_controller().AbortController;
+ var {
+ codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },
+ AbortError: AbortError3
+ } = require_errors2();
+ var { validateAbortSignal, validateInteger, validateObject } = require_validators();
+ var kWeakHandler = require_primordials().Symbol("kWeak");
+ var kResistStopPropagation = require_primordials().Symbol("kResistStopPropagation");
+ var { finished } = require_end_of_stream();
+ var staticCompose = require_compose();
+ var { addAbortSignalNoValidate } = require_add_abort_signal();
+ var { isWritable, isNodeStream } = require_utils2();
+ var { deprecate } = require_util10();
+ var {
+ ArrayPrototypePush,
+ Boolean: Boolean2,
+ MathFloor,
+ Number: Number2,
+ NumberIsNaN,
+ Promise: Promise2,
+ PromiseReject,
+ PromiseResolve,
+ PromisePrototypeThen,
+ Symbol: Symbol2
+ } = require_primordials();
+ var kEmpty = Symbol2("kEmpty");
+ var kEof = Symbol2("kEof");
+ function compose(stream4, options) {
+ if (options != null) {
+ validateObject(options, "options");
}
- /**
- * The total computed size of items in the cache (read-only)
- */
- get calculatedSize() {
- return this.#calculatedSize;
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
+ validateAbortSignal(options.signal, "options.signal");
}
- /**
- * The number of items stored in the cache (read-only)
- */
- get size() {
- return this.#size;
+ if (isNodeStream(stream4) && !isWritable(stream4)) {
+ throw new ERR_INVALID_ARG_VALUE("stream", stream4, "must be writable");
}
- /**
- * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
- */
- get fetchMethod() {
- return this.#fetchMethod;
+ const composedStream = staticCompose(this, stream4);
+ if (options !== null && options !== void 0 && options.signal) {
+ addAbortSignalNoValidate(options.signal, composedStream);
}
- get memoMethod() {
- return this.#memoMethod;
+ return composedStream;
+ }
+ function map(fn, options) {
+ if (typeof fn !== "function") {
+ throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
}
- /**
- * {@link LRUCache.OptionsBase.dispose} (read-only)
- */
- get dispose() {
- return this.#dispose;
+ if (options != null) {
+ validateObject(options, "options");
}
- /**
- * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
- */
- get disposeAfter() {
- return this.#disposeAfter;
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
+ validateAbortSignal(options.signal, "options.signal");
}
- constructor(options) {
- const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize: maxSize2 = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
- if (max !== 0 && !isPosInt(max)) {
- throw new TypeError("max option must be a nonnegative integer");
- }
- const UintArray = max ? getUintArray(max) : Array;
- if (!UintArray) {
- throw new Error("invalid max value: " + max);
- }
- this.#max = max;
- this.#maxSize = maxSize2;
- this.maxEntrySize = maxEntrySize || this.#maxSize;
- this.sizeCalculation = sizeCalculation;
- if (this.sizeCalculation) {
- if (!this.#maxSize && !this.maxEntrySize) {
- throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
- }
- if (typeof this.sizeCalculation !== "function") {
- throw new TypeError("sizeCalculation set to non-function");
- }
- }
- if (memoMethod !== void 0 && typeof memoMethod !== "function") {
- throw new TypeError("memoMethod must be a function if defined");
- }
- this.#memoMethod = memoMethod;
- if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
- throw new TypeError("fetchMethod must be a function if specified");
- }
- this.#fetchMethod = fetchMethod;
- this.#hasFetchMethod = !!fetchMethod;
- this.#keyMap = /* @__PURE__ */ new Map();
- this.#keyList = new Array(max).fill(void 0);
- this.#valList = new Array(max).fill(void 0);
- this.#next = new UintArray(max);
- this.#prev = new UintArray(max);
- this.#head = 0;
- this.#tail = 0;
- this.#free = Stack.create(max);
- this.#size = 0;
- this.#calculatedSize = 0;
- if (typeof dispose === "function") {
- this.#dispose = dispose;
- }
- if (typeof disposeAfter === "function") {
- this.#disposeAfter = disposeAfter;
- this.#disposed = [];
- } else {
- this.#disposeAfter = void 0;
- this.#disposed = void 0;
- }
- this.#hasDispose = !!this.#dispose;
- this.#hasDisposeAfter = !!this.#disposeAfter;
- this.noDisposeOnSet = !!noDisposeOnSet;
- this.noUpdateTTL = !!noUpdateTTL;
- this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
- this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
- this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
- this.ignoreFetchAbort = !!ignoreFetchAbort;
- if (this.maxEntrySize !== 0) {
- if (this.#maxSize !== 0) {
- if (!isPosInt(this.#maxSize)) {
- throw new TypeError("maxSize must be a positive integer if specified");
- }
- }
- if (!isPosInt(this.maxEntrySize)) {
- throw new TypeError("maxEntrySize must be a positive integer if specified");
- }
- this.#initializeSizeTracking();
- }
- this.allowStale = !!allowStale;
- this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
- this.updateAgeOnGet = !!updateAgeOnGet;
- this.updateAgeOnHas = !!updateAgeOnHas;
- this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
- this.ttlAutopurge = !!ttlAutopurge;
- this.ttl = ttl || 0;
- if (this.ttl) {
- if (!isPosInt(this.ttl)) {
- throw new TypeError("ttl must be a positive integer if specified");
- }
- this.#initializeTTLTracking();
- }
- if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
- throw new TypeError("At least one of max, maxSize, or ttl is required");
- }
- if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
- const code = "LRU_CACHE_UNBOUNDED";
- if (shouldWarn(code)) {
- warned.add(code);
- const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
- emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache);
- }
- }
+ let concurrency = 1;
+ if ((options === null || options === void 0 ? void 0 : options.concurrency) != null) {
+ concurrency = MathFloor(options.concurrency);
}
- /**
- * Return the number of ms left in the item's TTL. If item is not in cache,
- * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
- */
- getRemainingTTL(key) {
- return this.#keyMap.has(key) ? Infinity : 0;
- }
- #initializeTTLTracking() {
- const ttls = new ZeroArray(this.#max);
- const starts = new ZeroArray(this.#max);
- this.#ttls = ttls;
- this.#starts = starts;
- this.#setItemTTL = (index, ttl, start = perf.now()) => {
- starts[index] = ttl !== 0 ? start : 0;
- ttls[index] = ttl;
- if (ttl !== 0 && this.ttlAutopurge) {
- const t = setTimeout(() => {
- if (this.#isStale(index)) {
- this.#delete(this.#keyList[index], "expire");
- }
- }, ttl + 1);
- if (t.unref) {
- t.unref();
- }
- }
- };
- this.#updateItemAge = (index) => {
- starts[index] = ttls[index] !== 0 ? perf.now() : 0;
- };
- this.#statusTTL = (status, index) => {
- if (ttls[index]) {
- const ttl = ttls[index];
- const start = starts[index];
- if (!ttl || !start)
- return;
- status.ttl = ttl;
- status.start = start;
- status.now = cachedNow || getNow();
- const age = status.now - start;
- status.remainingTTL = ttl - age;
- }
- };
- let cachedNow = 0;
- const getNow = () => {
- const n = perf.now();
- if (this.ttlResolution > 0) {
- cachedNow = n;
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
- if (t.unref) {
- t.unref();
- }
- }
- return n;
- };
- this.getRemainingTTL = (key) => {
- const index = this.#keyMap.get(key);
- if (index === void 0) {
- return 0;
- }
- const ttl = ttls[index];
- const start = starts[index];
- if (!ttl || !start) {
- return Infinity;
- }
- const age = (cachedNow || getNow()) - start;
- return ttl - age;
- };
- this.#isStale = (index) => {
- const s = starts[index];
- const t = ttls[index];
- return !!t && !!s && (cachedNow || getNow()) - s > t;
- };
+ let highWaterMark = concurrency - 1;
+ if ((options === null || options === void 0 ? void 0 : options.highWaterMark) != null) {
+ highWaterMark = MathFloor(options.highWaterMark);
}
- // conditionally set private methods related to TTL
- #updateItemAge = () => {
- };
- #statusTTL = () => {
- };
- #setItemTTL = () => {
- };
- /* c8 ignore stop */
- #isStale = () => false;
- #initializeSizeTracking() {
- const sizes = new ZeroArray(this.#max);
- this.#calculatedSize = 0;
- this.#sizes = sizes;
- this.#removeItemSize = (index) => {
- this.#calculatedSize -= sizes[index];
- sizes[index] = 0;
+ validateInteger(concurrency, "options.concurrency", 1);
+ validateInteger(highWaterMark, "options.highWaterMark", 0);
+ highWaterMark += concurrency;
+ return async function* map2() {
+ const signal = require_util10().AbortSignalAny(
+ [options === null || options === void 0 ? void 0 : options.signal].filter(Boolean2)
+ );
+ const stream4 = this;
+ const queue = [];
+ const signalOpt = {
+ signal
};
- this.#requireSize = (k, v, size, sizeCalculation) => {
- if (this.#isBackgroundFetch(v)) {
- return 0;
+ let next;
+ let resume;
+ let done = false;
+ let cnt = 0;
+ function onCatch() {
+ done = true;
+ afterItemProcessed();
+ }
+ function afterItemProcessed() {
+ cnt -= 1;
+ maybeResume();
+ }
+ function maybeResume() {
+ if (resume && !done && cnt < concurrency && queue.length < highWaterMark) {
+ resume();
+ resume = null;
}
- if (!isPosInt(size)) {
- if (sizeCalculation) {
- if (typeof sizeCalculation !== "function") {
- throw new TypeError("sizeCalculation must be a function");
+ }
+ async function pump2() {
+ try {
+ for await (let val of stream4) {
+ if (done) {
+ return;
}
- size = sizeCalculation(v, k);
- if (!isPosInt(size)) {
- throw new TypeError("sizeCalculation return invalid (expect positive integer)");
+ if (signal.aborted) {
+ throw new AbortError3();
+ }
+ try {
+ val = fn(val, signalOpt);
+ if (val === kEmpty) {
+ continue;
+ }
+ val = PromiseResolve(val);
+ } catch (err) {
+ val = PromiseReject(err);
+ }
+ cnt += 1;
+ PromisePrototypeThen(val, afterItemProcessed, onCatch);
+ queue.push(val);
+ if (next) {
+ next();
+ next = null;
+ }
+ if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) {
+ await new Promise2((resolve7) => {
+ resume = resolve7;
+ });
}
- } else {
- throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
}
- }
- return size;
- };
- this.#addItemSize = (index, size, status) => {
- sizes[index] = size;
- if (this.#maxSize) {
- const maxSize2 = this.#maxSize - sizes[index];
- while (this.#calculatedSize > maxSize2) {
- this.#evict(true);
+ queue.push(kEof);
+ } catch (err) {
+ const val = PromiseReject(err);
+ PromisePrototypeThen(val, afterItemProcessed, onCatch);
+ queue.push(val);
+ } finally {
+ done = true;
+ if (next) {
+ next();
+ next = null;
}
}
- this.#calculatedSize += sizes[index];
- if (status) {
- status.entrySize = size;
- status.totalCalculatedSize = this.#calculatedSize;
- }
- };
- }
- #removeItemSize = (_i) => {
- };
- #addItemSize = (_i, _s, _st) => {
- };
- #requireSize = (_k, _v, size, sizeCalculation) => {
- if (size || sizeCalculation) {
- throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
}
- return 0;
- };
- *#indexes({ allowStale = this.allowStale } = {}) {
- if (this.#size) {
- for (let i = this.#tail; true; ) {
- if (!this.#isValidIndex(i)) {
- break;
- }
- if (allowStale || !this.#isStale(i)) {
- yield i;
- }
- if (i === this.#head) {
- break;
- } else {
- i = this.#prev[i];
+ pump2();
+ try {
+ while (true) {
+ while (queue.length > 0) {
+ const val = await queue[0];
+ if (val === kEof) {
+ return;
+ }
+ if (signal.aborted) {
+ throw new AbortError3();
+ }
+ if (val !== kEmpty) {
+ yield val;
+ }
+ queue.shift();
+ maybeResume();
}
+ await new Promise2((resolve7) => {
+ next = resolve7;
+ });
}
- }
- }
- *#rindexes({ allowStale = this.allowStale } = {}) {
- if (this.#size) {
- for (let i = this.#head; true; ) {
- if (!this.#isValidIndex(i)) {
- break;
- }
- if (allowStale || !this.#isStale(i)) {
- yield i;
- }
- if (i === this.#tail) {
- break;
- } else {
- i = this.#next[i];
- }
+ } finally {
+ done = true;
+ if (resume) {
+ resume();
+ resume = null;
}
}
+ }.call(this);
+ }
+ function asIndexedPairs(options = void 0) {
+ if (options != null) {
+ validateObject(options, "options");
}
- #isValidIndex(index) {
- return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
+ validateAbortSignal(options.signal, "options.signal");
}
- /**
- * Return a generator yielding `[key, value]` pairs,
- * in order from most recently used to least recently used.
- */
- *entries() {
- for (const i of this.#indexes()) {
- if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
- yield [this.#keyList[i], this.#valList[i]];
+ return async function* asIndexedPairs2() {
+ let index = 0;
+ for await (const val of this) {
+ var _options$signal;
+ if (options !== null && options !== void 0 && (_options$signal = options.signal) !== null && _options$signal !== void 0 && _options$signal.aborted) {
+ throw new AbortError3({
+ cause: options.signal.reason
+ });
}
+ yield [index++, val];
}
+ }.call(this);
+ }
+ async function some(fn, options = void 0) {
+ for await (const unused of filter.call(this, fn, options)) {
+ return true;
}
- /**
- * Inverse order version of {@link LRUCache.entries}
- *
- * Return a generator yielding `[key, value]` pairs,
- * in order from least recently used to most recently used.
- */
- *rentries() {
- for (const i of this.#rindexes()) {
- if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
- yield [this.#keyList[i], this.#valList[i]];
- }
- }
+ return false;
+ }
+ async function every(fn, options = void 0) {
+ if (typeof fn !== "function") {
+ throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
}
- /**
- * Return a generator yielding the keys in the cache,
- * in order from most recently used to least recently used.
- */
- *keys() {
- for (const i of this.#indexes()) {
- const k = this.#keyList[i];
- if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
- yield k;
- }
- }
+ return !await some.call(
+ this,
+ async (...args) => {
+ return !await fn(...args);
+ },
+ options
+ );
+ }
+ async function find(fn, options) {
+ for await (const result of filter.call(this, fn, options)) {
+ return result;
}
- /**
- * Inverse order version of {@link LRUCache.keys}
- *
- * Return a generator yielding the keys in the cache,
- * in order from least recently used to most recently used.
- */
- *rkeys() {
- for (const i of this.#rindexes()) {
- const k = this.#keyList[i];
- if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
- yield k;
- }
- }
+ return void 0;
+ }
+ async function forEach(fn, options) {
+ if (typeof fn !== "function") {
+ throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
}
- /**
- * Return a generator yielding the values in the cache,
- * in order from most recently used to least recently used.
- */
- *values() {
- for (const i of this.#indexes()) {
- const v = this.#valList[i];
- if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
- yield this.#valList[i];
- }
- }
+ async function forEachFn(value, options2) {
+ await fn(value, options2);
+ return kEmpty;
}
- /**
- * Inverse order version of {@link LRUCache.values}
- *
- * Return a generator yielding the values in the cache,
- * in order from least recently used to most recently used.
- */
- *rvalues() {
- for (const i of this.#rindexes()) {
- const v = this.#valList[i];
- if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
- yield this.#valList[i];
- }
+ for await (const unused of map.call(this, forEachFn, options)) ;
+ }
+ function filter(fn, options) {
+ if (typeof fn !== "function") {
+ throw new ERR_INVALID_ARG_TYPE("fn", ["Function", "AsyncFunction"], fn);
+ }
+ async function filterFn(value, options2) {
+ if (await fn(value, options2)) {
+ return value;
}
+ return kEmpty;
}
- /**
- * Iterating over the cache itself yields the same results as
- * {@link LRUCache.entries}
- */
- [Symbol.iterator]() {
- return this.entries();
+ return map.call(this, filterFn, options);
+ }
+ var ReduceAwareErrMissingArgs = class extends ERR_MISSING_ARGS {
+ constructor() {
+ super("reduce");
+ this.message = "Reduce of an empty stream requires an initial value";
}
- /**
- * A String value that is used in the creation of the default string
- * description of an object. Called by the built-in method
- * `Object.prototype.toString`.
- */
- [Symbol.toStringTag] = "LRUCache";
- /**
- * Find a value for which the supplied fn method returns a truthy value,
- * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
- */
- find(fn, getOptions = {}) {
- for (const i of this.#indexes()) {
- const v = this.#valList[i];
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
- if (value === void 0)
- continue;
- if (fn(value, this.#keyList[i], this)) {
- return this.get(this.#keyList[i], getOptions);
- }
- }
+ };
+ async function reduce(reducer, initialValue, options) {
+ var _options$signal2;
+ if (typeof reducer !== "function") {
+ throw new ERR_INVALID_ARG_TYPE("reducer", ["Function", "AsyncFunction"], reducer);
}
- /**
- * Call the supplied function on each item in the cache, in order from most
- * recently used to least recently used.
- *
- * `fn` is called as `fn(value, key, cache)`.
- *
- * If `thisp` is provided, function will be called in the `this`-context of
- * the provided object, or the cache if no `thisp` object is provided.
- *
- * Does not update age or recenty of use, or iterate over stale values.
- */
- forEach(fn, thisp = this) {
- for (const i of this.#indexes()) {
- const v = this.#valList[i];
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
- if (value === void 0)
- continue;
- fn.call(thisp, value, this.#keyList[i], this);
- }
+ if (options != null) {
+ validateObject(options, "options");
}
- /**
- * The same as {@link LRUCache.forEach} but items are iterated over in
- * reverse order. (ie, less recently used items are iterated over first.)
- */
- rforEach(fn, thisp = this) {
- for (const i of this.#rindexes()) {
- const v = this.#valList[i];
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
- if (value === void 0)
- continue;
- fn.call(thisp, value, this.#keyList[i], this);
- }
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
+ validateAbortSignal(options.signal, "options.signal");
}
- /**
- * Delete any stale entries. Returns true if anything was removed,
- * false otherwise.
- */
- purgeStale() {
- let deleted = false;
- for (const i of this.#rindexes({ allowStale: true })) {
- if (this.#isStale(i)) {
- this.#delete(this.#keyList[i], "expire");
- deleted = true;
- }
- }
- return deleted;
+ let hasInitialValue = arguments.length > 1;
+ if (options !== null && options !== void 0 && (_options$signal2 = options.signal) !== null && _options$signal2 !== void 0 && _options$signal2.aborted) {
+ const err = new AbortError3(void 0, {
+ cause: options.signal.reason
+ });
+ this.once("error", () => {
+ });
+ await finished(this.destroy(err));
+ throw err;
}
- /**
- * Get the extended info about a given entry, to get its value, size, and
- * TTL info simultaneously. Returns `undefined` if the key is not present.
- *
- * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
- * serialization, the `start` value is always the current timestamp, and the
- * `ttl` is a calculated remaining time to live (negative if expired).
- *
- * Always returns stale values, if their info is found in the cache, so be
- * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
- * if relevant.
- */
- info(key) {
- const i = this.#keyMap.get(key);
- if (i === void 0)
- return void 0;
- const v = this.#valList[i];
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
- if (value === void 0)
- return void 0;
- const entry = { value };
- if (this.#ttls && this.#starts) {
- const ttl = this.#ttls[i];
- const start = this.#starts[i];
- if (ttl && start) {
- const remain = ttl - (perf.now() - start);
- entry.ttl = remain;
- entry.start = Date.now();
+ const ac = new AbortController2();
+ const signal = ac.signal;
+ if (options !== null && options !== void 0 && options.signal) {
+ const opts = {
+ once: true,
+ [kWeakHandler]: this,
+ [kResistStopPropagation]: true
+ };
+ options.signal.addEventListener("abort", () => ac.abort(), opts);
+ }
+ let gotAnyItemFromStream = false;
+ try {
+ for await (const value of this) {
+ var _options$signal3;
+ gotAnyItemFromStream = true;
+ if (options !== null && options !== void 0 && (_options$signal3 = options.signal) !== null && _options$signal3 !== void 0 && _options$signal3.aborted) {
+ throw new AbortError3();
+ }
+ if (!hasInitialValue) {
+ initialValue = value;
+ hasInitialValue = true;
+ } else {
+ initialValue = await reducer(initialValue, value, {
+ signal
+ });
}
}
- if (this.#sizes) {
- entry.size = this.#sizes[i];
+ if (!gotAnyItemFromStream && !hasInitialValue) {
+ throw new ReduceAwareErrMissingArgs();
}
- return entry;
+ } finally {
+ ac.abort();
}
- /**
- * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
- * passed to {@link LRLUCache#load}.
- *
- * The `start` fields are calculated relative to a portable `Date.now()`
- * timestamp, even if `performance.now()` is available.
- *
- * Stale entries are always included in the `dump`, even if
- * {@link LRUCache.OptionsBase.allowStale} is false.
- *
- * Note: this returns an actual array, not a generator, so it can be more
- * easily passed around.
- */
- dump() {
- const arr = [];
- for (const i of this.#indexes({ allowStale: true })) {
- const key = this.#keyList[i];
- const v = this.#valList[i];
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
- if (value === void 0 || key === void 0)
- continue;
- const entry = { value };
- if (this.#ttls && this.#starts) {
- entry.ttl = this.#ttls[i];
- const age = perf.now() - this.#starts[i];
- entry.start = Math.floor(Date.now() - age);
- }
- if (this.#sizes) {
- entry.size = this.#sizes[i];
- }
- arr.unshift([key, entry]);
- }
- return arr;
+ return initialValue;
+ }
+ async function toArray(options) {
+ if (options != null) {
+ validateObject(options, "options");
}
- /**
- * Reset the cache and load in the items in entries in the order listed.
- *
- * The shape of the resulting cache may be different if the same options are
- * not used in both caches.
- *
- * The `start` fields are assumed to be calculated relative to a portable
- * `Date.now()` timestamp, even if `performance.now()` is available.
- */
- load(arr) {
- this.clear();
- for (const [key, entry] of arr) {
- if (entry.start) {
- const age = Date.now() - entry.start;
- entry.start = perf.now() - age;
- }
- this.set(key, entry.value, entry);
- }
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
+ validateAbortSignal(options.signal, "options.signal");
}
- /**
- * Add a value to the cache.
- *
- * Note: if `undefined` is specified as a value, this is an alias for
- * {@link LRUCache#delete}
- *
- * Fields on the {@link LRUCache.SetOptions} options param will override
- * their corresponding values in the constructor options for the scope
- * of this single `set()` operation.
- *
- * If `start` is provided, then that will set the effective start
- * time for the TTL calculation. Note that this must be a previous
- * value of `performance.now()` if supported, or a previous value of
- * `Date.now()` if not.
- *
- * Options object may also include `size`, which will prevent
- * calling the `sizeCalculation` function and just use the specified
- * number if it is a positive integer, and `noDisposeOnSet` which
- * will prevent calling a `dispose` function in the case of
- * overwrites.
- *
- * If the `size` (or return value of `sizeCalculation`) for a given
- * entry is greater than `maxEntrySize`, then the item will not be
- * added to the cache.
- *
- * Will update the recency of the entry.
- *
- * If the value is `undefined`, then this is an alias for
- * `cache.delete(key)`. `undefined` is never stored in the cache.
- */
- set(k, v, setOptions = {}) {
- if (v === void 0) {
- this.delete(k);
- return this;
- }
- const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
- let { noUpdateTTL = this.noUpdateTTL } = setOptions;
- const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
- if (this.maxEntrySize && size > this.maxEntrySize) {
- if (status) {
- status.set = "miss";
- status.maxEntrySizeExceeded = true;
- }
- this.#delete(k, "set");
- return this;
- }
- let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
- if (index === void 0) {
- index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
- this.#keyList[index] = k;
- this.#valList[index] = v;
- this.#keyMap.set(k, index);
- this.#next[this.#tail] = index;
- this.#prev[index] = this.#tail;
- this.#tail = index;
- this.#size++;
- this.#addItemSize(index, size, status);
- if (status)
- status.set = "add";
- noUpdateTTL = false;
- } else {
- this.#moveToTail(index);
- const oldVal = this.#valList[index];
- if (v !== oldVal) {
- if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
- oldVal.__abortController.abort(new Error("replaced"));
- const { __staleWhileFetching: s } = oldVal;
- if (s !== void 0 && !noDisposeOnSet) {
- if (this.#hasDispose) {
- this.#dispose?.(s, k, "set");
- }
- if (this.#hasDisposeAfter) {
- this.#disposed?.push([s, k, "set"]);
- }
- }
- } else if (!noDisposeOnSet) {
- if (this.#hasDispose) {
- this.#dispose?.(oldVal, k, "set");
- }
- if (this.#hasDisposeAfter) {
- this.#disposed?.push([oldVal, k, "set"]);
- }
- }
- this.#removeItemSize(index);
- this.#addItemSize(index, size, status);
- this.#valList[index] = v;
- if (status) {
- status.set = "replace";
- const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
- if (oldValue !== void 0)
- status.oldValue = oldValue;
- }
- } else if (status) {
- status.set = "update";
- }
- }
- if (ttl !== 0 && !this.#ttls) {
- this.#initializeTTLTracking();
- }
- if (this.#ttls) {
- if (!noUpdateTTL) {
- this.#setItemTTL(index, ttl, start);
- }
- if (status)
- this.#statusTTL(status, index);
- }
- if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
- const dt = this.#disposed;
- let task;
- while (task = dt?.shift()) {
- this.#disposeAfter?.(...task);
- }
+ const result = [];
+ for await (const val of this) {
+ var _options$signal4;
+ if (options !== null && options !== void 0 && (_options$signal4 = options.signal) !== null && _options$signal4 !== void 0 && _options$signal4.aborted) {
+ throw new AbortError3(void 0, {
+ cause: options.signal.reason
+ });
}
- return this;
+ ArrayPrototypePush(result, val);
}
- /**
- * Evict the least recently used item, returning its value or
- * `undefined` if cache is empty.
- */
- pop() {
- try {
- while (this.#size) {
- const val = this.#valList[this.#head];
- this.#evict(true);
- if (this.#isBackgroundFetch(val)) {
- if (val.__staleWhileFetching) {
- return val.__staleWhileFetching;
- }
- } else if (val !== void 0) {
- return val;
- }
- }
- } finally {
- if (this.#hasDisposeAfter && this.#disposed) {
- const dt = this.#disposed;
- let task;
- while (task = dt?.shift()) {
- this.#disposeAfter?.(...task);
- }
- }
+ return result;
+ }
+ function flatMap(fn, options) {
+ const values = map.call(this, fn, options);
+ return async function* flatMap2() {
+ for await (const val of values) {
+ yield* val;
}
+ }.call(this);
+ }
+ function toIntegerOrInfinity(number) {
+ number = Number2(number);
+ if (NumberIsNaN(number)) {
+ return 0;
}
- #evict(free) {
- const head = this.#head;
- const k = this.#keyList[head];
- const v = this.#valList[head];
- if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
- v.__abortController.abort(new Error("evicted"));
- } else if (this.#hasDispose || this.#hasDisposeAfter) {
- if (this.#hasDispose) {
- this.#dispose?.(v, k, "evict");
- }
- if (this.#hasDisposeAfter) {
- this.#disposed?.push([v, k, "evict"]);
- }
- }
- this.#removeItemSize(head);
- if (free) {
- this.#keyList[head] = void 0;
- this.#valList[head] = void 0;
- this.#free.push(head);
- }
- if (this.#size === 1) {
- this.#head = this.#tail = 0;
- this.#free.length = 0;
- } else {
- this.#head = this.#next[head];
- }
- this.#keyMap.delete(k);
- this.#size--;
- return head;
+ if (number < 0) {
+ throw new ERR_OUT_OF_RANGE("number", ">= 0", number);
}
- /**
- * Check if a key is in the cache, without updating the recency of use.
- * Will return false if the item is stale, even though it is technically
- * in the cache.
- *
- * Check if a key is in the cache, without updating the recency of
- * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
- * to `true` in either the options or the constructor.
- *
- * Will return `false` if the item is stale, even though it is technically in
- * the cache. The difference can be determined (if it matters) by using a
- * `status` argument, and inspecting the `has` field.
- *
- * Will not update item age unless
- * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
- */
- has(k, hasOptions = {}) {
- const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
- const index = this.#keyMap.get(k);
- if (index !== void 0) {
- const v = this.#valList[index];
- if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) {
- return false;
- }
- if (!this.#isStale(index)) {
- if (updateAgeOnHas) {
- this.#updateItemAge(index);
- }
- if (status) {
- status.has = "hit";
- this.#statusTTL(status, index);
- }
- return true;
- } else if (status) {
- status.has = "stale";
- this.#statusTTL(status, index);
- }
- } else if (status) {
- status.has = "miss";
- }
- return false;
+ return number;
+ }
+ function drop(number, options = void 0) {
+ if (options != null) {
+ validateObject(options, "options");
}
- /**
- * Like {@link LRUCache#get} but doesn't update recency or delete stale
- * items.
- *
- * Returns `undefined` if the item is stale, unless
- * {@link LRUCache.OptionsBase.allowStale} is set.
- */
- peek(k, peekOptions = {}) {
- const { allowStale = this.allowStale } = peekOptions;
- const index = this.#keyMap.get(k);
- if (index === void 0 || !allowStale && this.#isStale(index)) {
- return;
- }
- const v = this.#valList[index];
- return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
+ validateAbortSignal(options.signal, "options.signal");
}
- #backgroundFetch(k, index, options, context6) {
- const v = index === void 0 ? void 0 : this.#valList[index];
- if (this.#isBackgroundFetch(v)) {
- return v;
+ number = toIntegerOrInfinity(number);
+ return async function* drop2() {
+ var _options$signal5;
+ if (options !== null && options !== void 0 && (_options$signal5 = options.signal) !== null && _options$signal5 !== void 0 && _options$signal5.aborted) {
+ throw new AbortError3();
}
- const ac = new AC();
- const { signal } = options;
- signal?.addEventListener("abort", () => ac.abort(signal.reason), {
- signal: ac.signal
- });
- const fetchOpts = {
- signal: ac.signal,
- options,
- context: context6
- };
- const cb = (v2, updateCache = false) => {
- const { aborted } = ac.signal;
- const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
- if (options.status) {
- if (aborted && !updateCache) {
- options.status.fetchAborted = true;
- options.status.fetchError = ac.signal.reason;
- if (ignoreAbort)
- options.status.fetchAbortIgnored = true;
- } else {
- options.status.fetchResolved = true;
- }
- }
- if (aborted && !ignoreAbort && !updateCache) {
- return fetchFail(ac.signal.reason);
- }
- const bf2 = p;
- if (this.#valList[index] === p) {
- if (v2 === void 0) {
- if (bf2.__staleWhileFetching) {
- this.#valList[index] = bf2.__staleWhileFetching;
- } else {
- this.#delete(k, "fetch");
- }
- } else {
- if (options.status)
- options.status.fetchUpdated = true;
- this.set(k, v2, fetchOpts.options);
- }
- }
- return v2;
- };
- const eb = (er) => {
- if (options.status) {
- options.status.fetchRejected = true;
- options.status.fetchError = er;
- }
- return fetchFail(er);
- };
- const fetchFail = (er) => {
- const { aborted } = ac.signal;
- const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
- const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
- const noDelete = allowStale || options.noDeleteOnFetchRejection;
- const bf2 = p;
- if (this.#valList[index] === p) {
- const del = !noDelete || bf2.__staleWhileFetching === void 0;
- if (del) {
- this.#delete(k, "fetch");
- } else if (!allowStaleAborted) {
- this.#valList[index] = bf2.__staleWhileFetching;
- }
+ for await (const val of this) {
+ var _options$signal6;
+ if (options !== null && options !== void 0 && (_options$signal6 = options.signal) !== null && _options$signal6 !== void 0 && _options$signal6.aborted) {
+ throw new AbortError3();
}
- if (allowStale) {
- if (options.status && bf2.__staleWhileFetching !== void 0) {
- options.status.returnedStale = true;
- }
- return bf2.__staleWhileFetching;
- } else if (bf2.__returned === bf2) {
- throw er;
+ if (number-- <= 0) {
+ yield val;
}
- };
- const pcall = (res, rej) => {
- const fmp = this.#fetchMethod?.(k, v, fetchOpts);
- if (fmp && fmp instanceof Promise) {
- fmp.then((v2) => res(v2 === void 0 ? void 0 : v2), rej);
- }
- ac.signal.addEventListener("abort", () => {
- if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
- res(void 0);
- if (options.allowStaleOnFetchAbort) {
- res = (v2) => cb(v2, true);
- }
- }
- });
- };
- if (options.status)
- options.status.fetchDispatched = true;
- const p = new Promise(pcall).then(cb, eb);
- const bf = Object.assign(p, {
- __abortController: ac,
- __staleWhileFetching: v,
- __returned: void 0
- });
- if (index === void 0) {
- this.set(k, bf, { ...fetchOpts.options, status: void 0 });
- index = this.#keyMap.get(k);
- } else {
- this.#valList[index] = bf;
}
- return bf;
+ }.call(this);
+ }
+ function take(number, options = void 0) {
+ if (options != null) {
+ validateObject(options, "options");
}
- #isBackgroundFetch(p) {
- if (!this.#hasFetchMethod)
- return false;
- const b = p;
- return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
+ validateAbortSignal(options.signal, "options.signal");
}
- async fetch(k, fetchOptions = {}) {
- const {
- // get options
- allowStale = this.allowStale,
- updateAgeOnGet = this.updateAgeOnGet,
- noDeleteOnStaleGet = this.noDeleteOnStaleGet,
- // set options
- ttl = this.ttl,
- noDisposeOnSet = this.noDisposeOnSet,
- size = 0,
- sizeCalculation = this.sizeCalculation,
- noUpdateTTL = this.noUpdateTTL,
- // fetch exclusive options
- noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
- allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
- ignoreFetchAbort = this.ignoreFetchAbort,
- allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
- context: context6,
- forceRefresh = false,
- status,
- signal
- } = fetchOptions;
- if (!this.#hasFetchMethod) {
- if (status)
- status.fetch = "get";
- return this.get(k, {
- allowStale,
- updateAgeOnGet,
- noDeleteOnStaleGet,
- status
- });
+ number = toIntegerOrInfinity(number);
+ return async function* take2() {
+ var _options$signal7;
+ if (options !== null && options !== void 0 && (_options$signal7 = options.signal) !== null && _options$signal7 !== void 0 && _options$signal7.aborted) {
+ throw new AbortError3();
}
- const options = {
- allowStale,
- updateAgeOnGet,
- noDeleteOnStaleGet,
- ttl,
- noDisposeOnSet,
- size,
- sizeCalculation,
- noUpdateTTL,
- noDeleteOnFetchRejection,
- allowStaleOnFetchRejection,
- allowStaleOnFetchAbort,
- ignoreFetchAbort,
- status,
- signal
- };
- let index = this.#keyMap.get(k);
- if (index === void 0) {
- if (status)
- status.fetch = "miss";
- const p = this.#backgroundFetch(k, index, options, context6);
- return p.__returned = p;
- } else {
- const v = this.#valList[index];
- if (this.#isBackgroundFetch(v)) {
- const stale = allowStale && v.__staleWhileFetching !== void 0;
- if (status) {
- status.fetch = "inflight";
- if (stale)
- status.returnedStale = true;
- }
- return stale ? v.__staleWhileFetching : v.__returned = v;
- }
- const isStale = this.#isStale(index);
- if (!forceRefresh && !isStale) {
- if (status)
- status.fetch = "hit";
- this.#moveToTail(index);
- if (updateAgeOnGet) {
- this.#updateItemAge(index);
- }
- if (status)
- this.#statusTTL(status, index);
- return v;
- }
- const p = this.#backgroundFetch(k, index, options, context6);
- const hasStale = p.__staleWhileFetching !== void 0;
- const staleVal = hasStale && allowStale;
- if (status) {
- status.fetch = isStale ? "stale" : "refresh";
- if (staleVal && isStale)
- status.returnedStale = true;
- }
- return staleVal ? p.__staleWhileFetching : p.__returned = p;
- }
- }
- async forceFetch(k, fetchOptions = {}) {
- const v = await this.fetch(k, fetchOptions);
- if (v === void 0)
- throw new Error("fetch() returned undefined");
- return v;
- }
- memo(k, memoOptions = {}) {
- const memoMethod = this.#memoMethod;
- if (!memoMethod) {
- throw new Error("no memoMethod provided to constructor");
- }
- const { context: context6, forceRefresh, ...options } = memoOptions;
- const v = this.get(k, options);
- if (!forceRefresh && v !== void 0)
- return v;
- const vv = memoMethod(k, v, {
- options,
- context: context6
- });
- this.set(k, vv, options);
- return vv;
- }
- /**
- * Return a value from the cache. Will update the recency of the cache
- * entry found.
- *
- * If the key is not found, get() will return `undefined`.
- */
- get(k, getOptions = {}) {
- const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
- const index = this.#keyMap.get(k);
- if (index !== void 0) {
- const value = this.#valList[index];
- const fetching = this.#isBackgroundFetch(value);
- if (status)
- this.#statusTTL(status, index);
- if (this.#isStale(index)) {
- if (status)
- status.get = "stale";
- if (!fetching) {
- if (!noDeleteOnStaleGet) {
- this.#delete(k, "expire");
- }
- if (status && allowStale)
- status.returnedStale = true;
- return allowStale ? value : void 0;
- } else {
- if (status && allowStale && value.__staleWhileFetching !== void 0) {
- status.returnedStale = true;
- }
- return allowStale ? value.__staleWhileFetching : void 0;
- }
- } else {
- if (status)
- status.get = "hit";
- if (fetching) {
- return value.__staleWhileFetching;
- }
- this.#moveToTail(index);
- if (updateAgeOnGet) {
- this.#updateItemAge(index);
- }
- return value;
+ for await (const val of this) {
+ var _options$signal8;
+ if (options !== null && options !== void 0 && (_options$signal8 = options.signal) !== null && _options$signal8 !== void 0 && _options$signal8.aborted) {
+ throw new AbortError3();
}
- } else if (status) {
- status.get = "miss";
- }
- }
- #connect(p, n) {
- this.#prev[n] = p;
- this.#next[p] = n;
- }
- #moveToTail(index) {
- if (index !== this.#tail) {
- if (index === this.#head) {
- this.#head = this.#next[index];
- } else {
- this.#connect(this.#prev[index], this.#next[index]);
+ if (number-- > 0) {
+ yield val;
+ }
+ if (number <= 0) {
+ return;
}
- this.#connect(this.#tail, index);
- this.#tail = index;
}
- }
- /**
- * Deletes a key out of the cache.
- *
- * Returns true if the key was deleted, false otherwise.
- */
- delete(k) {
- return this.#delete(k, "delete");
- }
- #delete(k, reason) {
- let deleted = false;
- if (this.#size !== 0) {
- const index = this.#keyMap.get(k);
- if (index !== void 0) {
- deleted = true;
- if (this.#size === 1) {
- this.#clear(reason);
+ }.call(this);
+ }
+ module2.exports.streamReturningOperators = {
+ asIndexedPairs: deprecate(asIndexedPairs, "readable.asIndexedPairs will be removed in a future version."),
+ drop,
+ filter,
+ flatMap,
+ map,
+ take,
+ compose
+ };
+ module2.exports.promiseReturningOperators = {
+ every,
+ forEach,
+ reduce,
+ toArray,
+ some,
+ find
+ };
+ }
+});
+
+// node_modules/readable-stream/lib/stream/promises.js
+var require_promises = __commonJS({
+ "node_modules/readable-stream/lib/stream/promises.js"(exports2, module2) {
+ "use strict";
+ var { ArrayPrototypePop, Promise: Promise2 } = require_primordials();
+ var { isIterable, isNodeStream, isWebStream } = require_utils2();
+ var { pipelineImpl: pl } = require_pipeline();
+ var { finished } = require_end_of_stream();
+ require_stream2();
+ function pipeline3(...streams) {
+ return new Promise2((resolve7, reject) => {
+ let signal;
+ let end;
+ const lastArg = streams[streams.length - 1];
+ if (lastArg && typeof lastArg === "object" && !isNodeStream(lastArg) && !isIterable(lastArg) && !isWebStream(lastArg)) {
+ const options = ArrayPrototypePop(streams);
+ signal = options.signal;
+ end = options.end;
+ }
+ pl(
+ streams,
+ (err, value) => {
+ if (err) {
+ reject(err);
} else {
- this.#removeItemSize(index);
- const v = this.#valList[index];
- if (this.#isBackgroundFetch(v)) {
- v.__abortController.abort(new Error("deleted"));
- } else if (this.#hasDispose || this.#hasDisposeAfter) {
- if (this.#hasDispose) {
- this.#dispose?.(v, k, reason);
- }
- if (this.#hasDisposeAfter) {
- this.#disposed?.push([v, k, reason]);
- }
- }
- this.#keyMap.delete(k);
- this.#keyList[index] = void 0;
- this.#valList[index] = void 0;
- if (index === this.#tail) {
- this.#tail = this.#prev[index];
- } else if (index === this.#head) {
- this.#head = this.#next[index];
- } else {
- const pi = this.#prev[index];
- this.#next[pi] = this.#next[index];
- const ni = this.#next[index];
- this.#prev[ni] = this.#prev[index];
- }
- this.#size--;
- this.#free.push(index);
+ resolve7(value);
}
+ },
+ {
+ signal,
+ end
}
+ );
+ });
+ }
+ module2.exports = {
+ finished,
+ pipeline: pipeline3
+ };
+ }
+});
+
+// node_modules/readable-stream/lib/stream.js
+var require_stream2 = __commonJS({
+ "node_modules/readable-stream/lib/stream.js"(exports2, module2) {
+ "use strict";
+ var { Buffer: Buffer3 } = require("buffer");
+ var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials();
+ var {
+ promisify: { custom: customPromisify }
+ } = require_util10();
+ var { streamReturningOperators, promiseReturningOperators } = require_operators();
+ var {
+ codes: { ERR_ILLEGAL_CONSTRUCTOR }
+ } = require_errors2();
+ var compose = require_compose();
+ var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state();
+ var { pipeline: pipeline3 } = require_pipeline();
+ var { destroyer } = require_destroy2();
+ var eos = require_end_of_stream();
+ var promises4 = require_promises();
+ var utils = require_utils2();
+ var Stream2 = module2.exports = require_legacy().Stream;
+ Stream2.isDestroyed = utils.isDestroyed;
+ Stream2.isDisturbed = utils.isDisturbed;
+ Stream2.isErrored = utils.isErrored;
+ Stream2.isReadable = utils.isReadable;
+ Stream2.isWritable = utils.isWritable;
+ Stream2.Readable = require_readable3();
+ for (const key of ObjectKeys(streamReturningOperators)) {
+ let fn = function(...args) {
+ if (new.target) {
+ throw ERR_ILLEGAL_CONSTRUCTOR();
}
- if (this.#hasDisposeAfter && this.#disposed?.length) {
- const dt = this.#disposed;
- let task;
- while (task = dt?.shift()) {
- this.#disposeAfter?.(...task);
- }
+ return Stream2.Readable.from(ReflectApply(op, this, args));
+ };
+ const op = streamReturningOperators[key];
+ ObjectDefineProperty(fn, "name", {
+ __proto__: null,
+ value: op.name
+ });
+ ObjectDefineProperty(fn, "length", {
+ __proto__: null,
+ value: op.length
+ });
+ ObjectDefineProperty(Stream2.Readable.prototype, key, {
+ __proto__: null,
+ value: fn,
+ enumerable: false,
+ configurable: true,
+ writable: true
+ });
+ }
+ for (const key of ObjectKeys(promiseReturningOperators)) {
+ let fn = function(...args) {
+ if (new.target) {
+ throw ERR_ILLEGAL_CONSTRUCTOR();
}
- return deleted;
+ return ReflectApply(op, this, args);
+ };
+ const op = promiseReturningOperators[key];
+ ObjectDefineProperty(fn, "name", {
+ __proto__: null,
+ value: op.name
+ });
+ ObjectDefineProperty(fn, "length", {
+ __proto__: null,
+ value: op.length
+ });
+ ObjectDefineProperty(Stream2.Readable.prototype, key, {
+ __proto__: null,
+ value: fn,
+ enumerable: false,
+ configurable: true,
+ writable: true
+ });
+ }
+ Stream2.Writable = require_writable();
+ Stream2.Duplex = require_duplex();
+ Stream2.Transform = require_transform();
+ Stream2.PassThrough = require_passthrough2();
+ Stream2.pipeline = pipeline3;
+ var { addAbortSignal } = require_add_abort_signal();
+ Stream2.addAbortSignal = addAbortSignal;
+ Stream2.finished = eos;
+ Stream2.destroy = destroyer;
+ Stream2.compose = compose;
+ Stream2.setDefaultHighWaterMark = setDefaultHighWaterMark;
+ Stream2.getDefaultHighWaterMark = getDefaultHighWaterMark;
+ ObjectDefineProperty(Stream2, "promises", {
+ __proto__: null,
+ configurable: true,
+ enumerable: true,
+ get() {
+ return promises4;
}
- /**
- * Clear the cache entirely, throwing away all values.
- */
- clear() {
- return this.#clear("delete");
+ });
+ ObjectDefineProperty(pipeline3, customPromisify, {
+ __proto__: null,
+ enumerable: true,
+ get() {
+ return promises4.pipeline;
}
- #clear(reason) {
- for (const index of this.#rindexes({ allowStale: true })) {
- const v = this.#valList[index];
- if (this.#isBackgroundFetch(v)) {
- v.__abortController.abort(new Error("deleted"));
- } else {
- const k = this.#keyList[index];
- if (this.#hasDispose) {
- this.#dispose?.(v, k, reason);
- }
- if (this.#hasDisposeAfter) {
- this.#disposed?.push([v, k, reason]);
- }
- }
- }
- this.#keyMap.clear();
- this.#valList.fill(void 0);
- this.#keyList.fill(void 0);
- if (this.#ttls && this.#starts) {
- this.#ttls.fill(0);
- this.#starts.fill(0);
+ });
+ ObjectDefineProperty(eos, customPromisify, {
+ __proto__: null,
+ enumerable: true,
+ get() {
+ return promises4.finished;
+ }
+ });
+ Stream2.Stream = Stream2;
+ Stream2._isUint8Array = function isUint8Array(value) {
+ return value instanceof Uint8Array;
+ };
+ Stream2._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {
+ return Buffer3.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
+ };
+ }
+});
+
+// node_modules/readable-stream/lib/ours/index.js
+var require_ours = __commonJS({
+ "node_modules/readable-stream/lib/ours/index.js"(exports2, module2) {
+ "use strict";
+ var Stream2 = require("stream");
+ if (Stream2 && process.env.READABLE_STREAM === "disable") {
+ const promises4 = Stream2.promises;
+ module2.exports._uint8ArrayToBuffer = Stream2._uint8ArrayToBuffer;
+ module2.exports._isUint8Array = Stream2._isUint8Array;
+ module2.exports.isDisturbed = Stream2.isDisturbed;
+ module2.exports.isErrored = Stream2.isErrored;
+ module2.exports.isReadable = Stream2.isReadable;
+ module2.exports.Readable = Stream2.Readable;
+ module2.exports.Writable = Stream2.Writable;
+ module2.exports.Duplex = Stream2.Duplex;
+ module2.exports.Transform = Stream2.Transform;
+ module2.exports.PassThrough = Stream2.PassThrough;
+ module2.exports.addAbortSignal = Stream2.addAbortSignal;
+ module2.exports.finished = Stream2.finished;
+ module2.exports.destroy = Stream2.destroy;
+ module2.exports.pipeline = Stream2.pipeline;
+ module2.exports.compose = Stream2.compose;
+ Object.defineProperty(Stream2, "promises", {
+ configurable: true,
+ enumerable: true,
+ get() {
+ return promises4;
}
- if (this.#sizes) {
- this.#sizes.fill(0);
+ });
+ module2.exports.Stream = Stream2.Stream;
+ } else {
+ const CustomStream = require_stream2();
+ const promises4 = require_promises();
+ const originalDestroy = CustomStream.Readable.destroy;
+ module2.exports = CustomStream.Readable;
+ module2.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer;
+ module2.exports._isUint8Array = CustomStream._isUint8Array;
+ module2.exports.isDisturbed = CustomStream.isDisturbed;
+ module2.exports.isErrored = CustomStream.isErrored;
+ module2.exports.isReadable = CustomStream.isReadable;
+ module2.exports.Readable = CustomStream.Readable;
+ module2.exports.Writable = CustomStream.Writable;
+ module2.exports.Duplex = CustomStream.Duplex;
+ module2.exports.Transform = CustomStream.Transform;
+ module2.exports.PassThrough = CustomStream.PassThrough;
+ module2.exports.addAbortSignal = CustomStream.addAbortSignal;
+ module2.exports.finished = CustomStream.finished;
+ module2.exports.destroy = CustomStream.destroy;
+ module2.exports.destroy = originalDestroy;
+ module2.exports.pipeline = CustomStream.pipeline;
+ module2.exports.compose = CustomStream.compose;
+ Object.defineProperty(CustomStream, "promises", {
+ configurable: true,
+ enumerable: true,
+ get() {
+ return promises4;
}
- this.#head = 0;
- this.#tail = 0;
- this.#free.length = 0;
- this.#calculatedSize = 0;
- this.#size = 0;
- if (this.#hasDisposeAfter && this.#disposed) {
- const dt = this.#disposed;
- let task;
- while (task = dt?.shift()) {
- this.#disposeAfter?.(...task);
+ });
+ module2.exports.Stream = CustomStream.Stream;
+ }
+ module2.exports.default = module2.exports;
+ }
+});
+
+// node_modules/lodash/_arrayPush.js
+var require_arrayPush = __commonJS({
+ "node_modules/lodash/_arrayPush.js"(exports2, module2) {
+ function arrayPush(array, values) {
+ var index = -1, length = values.length, offset = array.length;
+ while (++index < length) {
+ array[offset + index] = values[index];
+ }
+ return array;
+ }
+ module2.exports = arrayPush;
+ }
+});
+
+// node_modules/lodash/_isFlattenable.js
+var require_isFlattenable = __commonJS({
+ "node_modules/lodash/_isFlattenable.js"(exports2, module2) {
+ var Symbol2 = require_Symbol();
+ var isArguments = require_isArguments();
+ var isArray = require_isArray();
+ var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
+ function isFlattenable(value) {
+ return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
+ }
+ module2.exports = isFlattenable;
+ }
+});
+
+// node_modules/lodash/_baseFlatten.js
+var require_baseFlatten = __commonJS({
+ "node_modules/lodash/_baseFlatten.js"(exports2, module2) {
+ var arrayPush = require_arrayPush();
+ var isFlattenable = require_isFlattenable();
+ function baseFlatten(array, depth, predicate, isStrict, result) {
+ var index = -1, length = array.length;
+ predicate || (predicate = isFlattenable);
+ result || (result = []);
+ while (++index < length) {
+ var value = array[index];
+ if (depth > 0 && predicate(value)) {
+ if (depth > 1) {
+ baseFlatten(value, depth - 1, predicate, isStrict, result);
+ } else {
+ arrayPush(result, value);
}
+ } else if (!isStrict) {
+ result[result.length] = value;
}
}
- };
- exports2.LRUCache = LRUCache;
+ return result;
+ }
+ module2.exports = baseFlatten;
}
});
-// node_modules/minipass/dist/commonjs/index.js
-var require_commonjs5 = __commonJS({
- "node_modules/minipass/dist/commonjs/index.js"(exports2) {
- "use strict";
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
- return mod && mod.__esModule ? mod : { "default": mod };
- };
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.Minipass = exports2.isWritable = exports2.isReadable = exports2.isStream = void 0;
- var proc = typeof process === "object" && process ? process : {
- stdout: null,
- stderr: null
- };
- var node_events_1 = require("node:events");
- var node_stream_1 = __importDefault(require("node:stream"));
- var node_string_decoder_1 = require("node:string_decoder");
- var isStream = (s) => !!s && typeof s === "object" && (s instanceof Minipass || s instanceof node_stream_1.default || (0, exports2.isReadable)(s) || (0, exports2.isWritable)(s));
- exports2.isStream = isStream;
- var isReadable = (s) => !!s && typeof s === "object" && s instanceof node_events_1.EventEmitter && typeof s.pipe === "function" && // node core Writable streams have a pipe() method, but it throws
- s.pipe !== node_stream_1.default.Writable.prototype.pipe;
- exports2.isReadable = isReadable;
- var isWritable = (s) => !!s && typeof s === "object" && s instanceof node_events_1.EventEmitter && typeof s.write === "function" && typeof s.end === "function";
- exports2.isWritable = isWritable;
- var EOF = /* @__PURE__ */ Symbol("EOF");
- var MAYBE_EMIT_END = /* @__PURE__ */ Symbol("maybeEmitEnd");
- var EMITTED_END = /* @__PURE__ */ Symbol("emittedEnd");
- var EMITTING_END = /* @__PURE__ */ Symbol("emittingEnd");
- var EMITTED_ERROR = /* @__PURE__ */ Symbol("emittedError");
- var CLOSED = /* @__PURE__ */ Symbol("closed");
- var READ = /* @__PURE__ */ Symbol("read");
- var FLUSH = /* @__PURE__ */ Symbol("flush");
- var FLUSHCHUNK = /* @__PURE__ */ Symbol("flushChunk");
- var ENCODING = /* @__PURE__ */ Symbol("encoding");
- var DECODER = /* @__PURE__ */ Symbol("decoder");
- var FLOWING = /* @__PURE__ */ Symbol("flowing");
- var PAUSED = /* @__PURE__ */ Symbol("paused");
- var RESUME = /* @__PURE__ */ Symbol("resume");
- var BUFFER = /* @__PURE__ */ Symbol("buffer");
- var PIPES = /* @__PURE__ */ Symbol("pipes");
- var BUFFERLENGTH = /* @__PURE__ */ Symbol("bufferLength");
- var BUFFERPUSH = /* @__PURE__ */ Symbol("bufferPush");
- var BUFFERSHIFT = /* @__PURE__ */ Symbol("bufferShift");
- var OBJECTMODE = /* @__PURE__ */ Symbol("objectMode");
- var DESTROYED = /* @__PURE__ */ Symbol("destroyed");
- var ERROR = /* @__PURE__ */ Symbol("error");
- var EMITDATA = /* @__PURE__ */ Symbol("emitData");
- var EMITEND = /* @__PURE__ */ Symbol("emitEnd");
- var EMITEND2 = /* @__PURE__ */ Symbol("emitEnd2");
- var ASYNC = /* @__PURE__ */ Symbol("async");
- var ABORT = /* @__PURE__ */ Symbol("abort");
- var ABORTED = /* @__PURE__ */ Symbol("aborted");
- var SIGNAL = /* @__PURE__ */ Symbol("signal");
- var DATALISTENERS = /* @__PURE__ */ Symbol("dataListeners");
- var DISCARDED = /* @__PURE__ */ Symbol("discarded");
- var defer = (fn) => Promise.resolve().then(fn);
- var nodefer = (fn) => fn();
- var isEndish = (ev) => ev === "end" || ev === "finish" || ev === "prefinish";
- var isArrayBufferLike = (b) => b instanceof ArrayBuffer || !!b && typeof b === "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0;
- var isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b);
- var Pipe = class {
- src;
- dest;
- opts;
- ondrain;
- constructor(src, dest, opts) {
- this.src = src;
- this.dest = dest;
- this.opts = opts;
- this.ondrain = () => src[RESUME]();
- this.dest.on("drain", this.ondrain);
- }
- unpipe() {
- this.dest.removeListener("drain", this.ondrain);
- }
- // only here for the prototype
- /* c8 ignore start */
- proxyErrors(_er) {
- }
- /* c8 ignore stop */
- end() {
- this.unpipe();
- if (this.opts.end)
- this.dest.end();
- }
- };
- var PipeProxyErrors = class extends Pipe {
- unpipe() {
- this.src.removeListener("error", this.proxyErrors);
- super.unpipe();
- }
- constructor(src, dest, opts) {
- super(src, dest, opts);
- this.proxyErrors = (er) => this.dest.emit("error", er);
- src.on("error", this.proxyErrors);
- }
- };
- var isObjectModeOptions = (o) => !!o.objectMode;
- var isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer";
- var Minipass = class extends node_events_1.EventEmitter {
- [FLOWING] = false;
- [PAUSED] = false;
- [PIPES] = [];
- [BUFFER] = [];
- [OBJECTMODE];
- [ENCODING];
- [ASYNC];
- [DECODER];
- [EOF] = false;
- [EMITTED_END] = false;
- [EMITTING_END] = false;
- [CLOSED] = false;
- [EMITTED_ERROR] = null;
- [BUFFERLENGTH] = 0;
- [DESTROYED] = false;
- [SIGNAL];
- [ABORTED] = false;
- [DATALISTENERS] = 0;
- [DISCARDED] = false;
- /**
- * true if the stream can be written
- */
- writable = true;
- /**
- * true if the stream can be read
- */
- readable = true;
- /**
- * If `RType` is Buffer, then options do not need to be provided.
- * Otherwise, an options object must be provided to specify either
- * {@link Minipass.SharedOptions.objectMode} or
- * {@link Minipass.SharedOptions.encoding}, as appropriate.
- */
- constructor(...args) {
- const options = args[0] || {};
- super();
- if (options.objectMode && typeof options.encoding === "string") {
- throw new TypeError("Encoding and objectMode may not be used together");
- }
- if (isObjectModeOptions(options)) {
- this[OBJECTMODE] = true;
- this[ENCODING] = null;
- } else if (isEncodingOptions(options)) {
- this[ENCODING] = options.encoding;
- this[OBJECTMODE] = false;
- } else {
- this[OBJECTMODE] = false;
- this[ENCODING] = null;
- }
- this[ASYNC] = !!options.async;
- this[DECODER] = this[ENCODING] ? new node_string_decoder_1.StringDecoder(this[ENCODING]) : null;
- if (options && options.debugExposeBuffer === true) {
- Object.defineProperty(this, "buffer", { get: () => this[BUFFER] });
- }
- if (options && options.debugExposePipes === true) {
- Object.defineProperty(this, "pipes", { get: () => this[PIPES] });
- }
- const { signal } = options;
- if (signal) {
- this[SIGNAL] = signal;
- if (signal.aborted) {
- this[ABORT]();
- } else {
- signal.addEventListener("abort", () => this[ABORT]());
- }
- }
- }
- /**
- * The amount of data stored in the buffer waiting to be read.
- *
- * For Buffer strings, this will be the total byte length.
- * For string encoding streams, this will be the string character length,
- * according to JavaScript's `string.length` logic.
- * For objectMode streams, this is a count of the items waiting to be
- * emitted.
- */
- get bufferLength() {
- return this[BUFFERLENGTH];
- }
- /**
- * The `BufferEncoding` currently in use, or `null`
- */
- get encoding() {
- return this[ENCODING];
- }
- /**
- * @deprecated - This is a read only property
- */
- set encoding(_enc) {
- throw new Error("Encoding must be set at instantiation time");
- }
- /**
- * @deprecated - Encoding may only be set at instantiation time
- */
- setEncoding(_enc) {
- throw new Error("Encoding must be set at instantiation time");
- }
- /**
- * True if this is an objectMode stream
- */
- get objectMode() {
- return this[OBJECTMODE];
- }
- /**
- * @deprecated - This is a read-only property
- */
- set objectMode(_om) {
- throw new Error("objectMode must be set at instantiation time");
- }
- /**
- * true if this is an async stream
- */
- get ["async"]() {
- return this[ASYNC];
- }
- /**
- * Set to true to make this stream async.
- *
- * Once set, it cannot be unset, as this would potentially cause incorrect
- * behavior. Ie, a sync stream can be made async, but an async stream
- * cannot be safely made sync.
- */
- set ["async"](a) {
- this[ASYNC] = this[ASYNC] || !!a;
- }
- // drop everything and get out of the flow completely
- [ABORT]() {
- this[ABORTED] = true;
- this.emit("abort", this[SIGNAL]?.reason);
- this.destroy(this[SIGNAL]?.reason);
- }
- /**
- * True if the stream has been aborted.
- */
- get aborted() {
- return this[ABORTED];
- }
- /**
- * No-op setter. Stream aborted status is set via the AbortSignal provided
- * in the constructor options.
- */
- set aborted(_2) {
+// node_modules/lodash/flatten.js
+var require_flatten = __commonJS({
+ "node_modules/lodash/flatten.js"(exports2, module2) {
+ var baseFlatten = require_baseFlatten();
+ function flatten(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? baseFlatten(array, 1) : [];
+ }
+ module2.exports = flatten;
+ }
+});
+
+// node_modules/lodash/_nativeCreate.js
+var require_nativeCreate = __commonJS({
+ "node_modules/lodash/_nativeCreate.js"(exports2, module2) {
+ var getNative = require_getNative();
+ var nativeCreate = getNative(Object, "create");
+ module2.exports = nativeCreate;
+ }
+});
+
+// node_modules/lodash/_hashClear.js
+var require_hashClear = __commonJS({
+ "node_modules/lodash/_hashClear.js"(exports2, module2) {
+ var nativeCreate = require_nativeCreate();
+ function hashClear() {
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
+ this.size = 0;
+ }
+ module2.exports = hashClear;
+ }
+});
+
+// node_modules/lodash/_hashDelete.js
+var require_hashDelete = __commonJS({
+ "node_modules/lodash/_hashDelete.js"(exports2, module2) {
+ function hashDelete(key) {
+ var result = this.has(key) && delete this.__data__[key];
+ this.size -= result ? 1 : 0;
+ return result;
+ }
+ module2.exports = hashDelete;
+ }
+});
+
+// node_modules/lodash/_hashGet.js
+var require_hashGet = __commonJS({
+ "node_modules/lodash/_hashGet.js"(exports2, module2) {
+ var nativeCreate = require_nativeCreate();
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
+ var objectProto = Object.prototype;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ function hashGet(key) {
+ var data = this.__data__;
+ if (nativeCreate) {
+ var result = data[key];
+ return result === HASH_UNDEFINED ? void 0 : result;
}
- write(chunk, encoding, cb) {
- if (this[ABORTED])
- return false;
- if (this[EOF])
- throw new Error("write after end");
- if (this[DESTROYED]) {
- this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" }));
- return true;
- }
- if (typeof encoding === "function") {
- cb = encoding;
- encoding = "utf8";
- }
- if (!encoding)
- encoding = "utf8";
- const fn = this[ASYNC] ? defer : nodefer;
- if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
- if (isArrayBufferView(chunk)) {
- chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
- } else if (isArrayBufferLike(chunk)) {
- chunk = Buffer.from(chunk);
- } else if (typeof chunk !== "string") {
- throw new Error("Non-contiguous data written to non-objectMode stream");
- }
- }
- if (this[OBJECTMODE]) {
- if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
- this[FLUSH](true);
- if (this[FLOWING])
- this.emit("data", chunk);
- else
- this[BUFFERPUSH](chunk);
- if (this[BUFFERLENGTH] !== 0)
- this.emit("readable");
- if (cb)
- fn(cb);
- return this[FLOWING];
- }
- if (!chunk.length) {
- if (this[BUFFERLENGTH] !== 0)
- this.emit("readable");
- if (cb)
- fn(cb);
- return this[FLOWING];
- }
- if (typeof chunk === "string" && // unless it is a string already ready for us to use
- !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) {
- chunk = Buffer.from(chunk, encoding);
- }
- if (Buffer.isBuffer(chunk) && this[ENCODING]) {
- chunk = this[DECODER].write(chunk);
- }
- if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
- this[FLUSH](true);
- if (this[FLOWING])
- this.emit("data", chunk);
- else
- this[BUFFERPUSH](chunk);
- if (this[BUFFERLENGTH] !== 0)
- this.emit("readable");
- if (cb)
- fn(cb);
- return this[FLOWING];
+ return hasOwnProperty.call(data, key) ? data[key] : void 0;
+ }
+ module2.exports = hashGet;
+ }
+});
+
+// node_modules/lodash/_hashHas.js
+var require_hashHas = __commonJS({
+ "node_modules/lodash/_hashHas.js"(exports2, module2) {
+ var nativeCreate = require_nativeCreate();
+ var objectProto = Object.prototype;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ function hashHas(key) {
+ var data = this.__data__;
+ return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
+ }
+ module2.exports = hashHas;
+ }
+});
+
+// node_modules/lodash/_hashSet.js
+var require_hashSet = __commonJS({
+ "node_modules/lodash/_hashSet.js"(exports2, module2) {
+ var nativeCreate = require_nativeCreate();
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
+ function hashSet(key, value) {
+ var data = this.__data__;
+ this.size += this.has(key) ? 0 : 1;
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
+ return this;
+ }
+ module2.exports = hashSet;
+ }
+});
+
+// node_modules/lodash/_Hash.js
+var require_Hash = __commonJS({
+ "node_modules/lodash/_Hash.js"(exports2, module2) {
+ var hashClear = require_hashClear();
+ var hashDelete = require_hashDelete();
+ var hashGet = require_hashGet();
+ var hashHas = require_hashHas();
+ var hashSet = require_hashSet();
+ function Hash(entries) {
+ var index = -1, length = entries == null ? 0 : entries.length;
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
}
- /**
- * Low-level explicit read method.
- *
- * In objectMode, the argument is ignored, and one item is returned if
- * available.
- *
- * `n` is the number of bytes (or in the case of encoding streams,
- * characters) to consume. If `n` is not provided, then the entire buffer
- * is returned, or `null` is returned if no data is available.
- *
- * If `n` is greater that the amount of data in the internal buffer,
- * then `null` is returned.
- */
- read(n) {
- if (this[DESTROYED])
- return null;
- this[DISCARDED] = false;
- if (this[BUFFERLENGTH] === 0 || n === 0 || n && n > this[BUFFERLENGTH]) {
- this[MAYBE_EMIT_END]();
- return null;
- }
- if (this[OBJECTMODE])
- n = null;
- if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
- this[BUFFER] = [
- this[ENCODING] ? this[BUFFER].join("") : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])
- ];
+ }
+ Hash.prototype.clear = hashClear;
+ Hash.prototype["delete"] = hashDelete;
+ Hash.prototype.get = hashGet;
+ Hash.prototype.has = hashHas;
+ Hash.prototype.set = hashSet;
+ module2.exports = Hash;
+ }
+});
+
+// node_modules/lodash/_listCacheClear.js
+var require_listCacheClear = __commonJS({
+ "node_modules/lodash/_listCacheClear.js"(exports2, module2) {
+ function listCacheClear() {
+ this.__data__ = [];
+ this.size = 0;
+ }
+ module2.exports = listCacheClear;
+ }
+});
+
+// node_modules/lodash/_assocIndexOf.js
+var require_assocIndexOf = __commonJS({
+ "node_modules/lodash/_assocIndexOf.js"(exports2, module2) {
+ var eq = require_eq();
+ function assocIndexOf(array, key) {
+ var length = array.length;
+ while (length--) {
+ if (eq(array[length][0], key)) {
+ return length;
}
- const ret = this[READ](n || null, this[BUFFER][0]);
- this[MAYBE_EMIT_END]();
- return ret;
- }
- [READ](n, chunk) {
- if (this[OBJECTMODE])
- this[BUFFERSHIFT]();
- else {
- const c = chunk;
- if (n === c.length || n === null)
- this[BUFFERSHIFT]();
- else if (typeof c === "string") {
- this[BUFFER][0] = c.slice(n);
- chunk = c.slice(0, n);
- this[BUFFERLENGTH] -= n;
- } else {
- this[BUFFER][0] = c.subarray(n);
- chunk = c.subarray(0, n);
- this[BUFFERLENGTH] -= n;
- }
- }
- this.emit("data", chunk);
- if (!this[BUFFER].length && !this[EOF])
- this.emit("drain");
- return chunk;
- }
- end(chunk, encoding, cb) {
- if (typeof chunk === "function") {
- cb = chunk;
- chunk = void 0;
- }
- if (typeof encoding === "function") {
- cb = encoding;
- encoding = "utf8";
- }
- if (chunk !== void 0)
- this.write(chunk, encoding);
- if (cb)
- this.once("end", cb);
- this[EOF] = true;
- this.writable = false;
- if (this[FLOWING] || !this[PAUSED])
- this[MAYBE_EMIT_END]();
- return this;
- }
- // don't let the internal resume be overwritten
- [RESUME]() {
- if (this[DESTROYED])
- return;
- if (!this[DATALISTENERS] && !this[PIPES].length) {
- this[DISCARDED] = true;
- }
- this[PAUSED] = false;
- this[FLOWING] = true;
- this.emit("resume");
- if (this[BUFFER].length)
- this[FLUSH]();
- else if (this[EOF])
- this[MAYBE_EMIT_END]();
- else
- this.emit("drain");
- }
- /**
- * Resume the stream if it is currently in a paused state
- *
- * If called when there are no pipe destinations or `data` event listeners,
- * this will place the stream in a "discarded" state, where all data will
- * be thrown away. The discarded state is removed if a pipe destination or
- * data handler is added, if pause() is called, or if any synchronous or
- * asynchronous iteration is started.
- */
- resume() {
- return this[RESUME]();
- }
- /**
- * Pause the stream
- */
- pause() {
- this[FLOWING] = false;
- this[PAUSED] = true;
- this[DISCARDED] = false;
- }
- /**
- * true if the stream has been forcibly destroyed
- */
- get destroyed() {
- return this[DESTROYED];
- }
- /**
- * true if the stream is currently in a flowing state, meaning that
- * any writes will be immediately emitted.
- */
- get flowing() {
- return this[FLOWING];
}
- /**
- * true if the stream is currently in a paused state
- */
- get paused() {
- return this[PAUSED];
+ return -1;
+ }
+ module2.exports = assocIndexOf;
+ }
+});
+
+// node_modules/lodash/_listCacheDelete.js
+var require_listCacheDelete = __commonJS({
+ "node_modules/lodash/_listCacheDelete.js"(exports2, module2) {
+ var assocIndexOf = require_assocIndexOf();
+ var arrayProto = Array.prototype;
+ var splice = arrayProto.splice;
+ function listCacheDelete(key) {
+ var data = this.__data__, index = assocIndexOf(data, key);
+ if (index < 0) {
+ return false;
}
- [BUFFERPUSH](chunk) {
- if (this[OBJECTMODE])
- this[BUFFERLENGTH] += 1;
- else
- this[BUFFERLENGTH] += chunk.length;
- this[BUFFER].push(chunk);
+ var lastIndex = data.length - 1;
+ if (index == lastIndex) {
+ data.pop();
+ } else {
+ splice.call(data, index, 1);
}
- [BUFFERSHIFT]() {
- if (this[OBJECTMODE])
- this[BUFFERLENGTH] -= 1;
- else
- this[BUFFERLENGTH] -= this[BUFFER][0].length;
- return this[BUFFER].shift();
+ --this.size;
+ return true;
+ }
+ module2.exports = listCacheDelete;
+ }
+});
+
+// node_modules/lodash/_listCacheGet.js
+var require_listCacheGet = __commonJS({
+ "node_modules/lodash/_listCacheGet.js"(exports2, module2) {
+ var assocIndexOf = require_assocIndexOf();
+ function listCacheGet(key) {
+ var data = this.__data__, index = assocIndexOf(data, key);
+ return index < 0 ? void 0 : data[index][1];
+ }
+ module2.exports = listCacheGet;
+ }
+});
+
+// node_modules/lodash/_listCacheHas.js
+var require_listCacheHas = __commonJS({
+ "node_modules/lodash/_listCacheHas.js"(exports2, module2) {
+ var assocIndexOf = require_assocIndexOf();
+ function listCacheHas(key) {
+ return assocIndexOf(this.__data__, key) > -1;
+ }
+ module2.exports = listCacheHas;
+ }
+});
+
+// node_modules/lodash/_listCacheSet.js
+var require_listCacheSet = __commonJS({
+ "node_modules/lodash/_listCacheSet.js"(exports2, module2) {
+ var assocIndexOf = require_assocIndexOf();
+ function listCacheSet(key, value) {
+ var data = this.__data__, index = assocIndexOf(data, key);
+ if (index < 0) {
+ ++this.size;
+ data.push([key, value]);
+ } else {
+ data[index][1] = value;
}
- [FLUSH](noDrain = false) {
- do {
- } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
- if (!noDrain && !this[BUFFER].length && !this[EOF])
- this.emit("drain");
+ return this;
+ }
+ module2.exports = listCacheSet;
+ }
+});
+
+// node_modules/lodash/_ListCache.js
+var require_ListCache = __commonJS({
+ "node_modules/lodash/_ListCache.js"(exports2, module2) {
+ var listCacheClear = require_listCacheClear();
+ var listCacheDelete = require_listCacheDelete();
+ var listCacheGet = require_listCacheGet();
+ var listCacheHas = require_listCacheHas();
+ var listCacheSet = require_listCacheSet();
+ function ListCache(entries) {
+ var index = -1, length = entries == null ? 0 : entries.length;
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+ ListCache.prototype.clear = listCacheClear;
+ ListCache.prototype["delete"] = listCacheDelete;
+ ListCache.prototype.get = listCacheGet;
+ ListCache.prototype.has = listCacheHas;
+ ListCache.prototype.set = listCacheSet;
+ module2.exports = ListCache;
+ }
+});
+
+// node_modules/lodash/_Map.js
+var require_Map = __commonJS({
+ "node_modules/lodash/_Map.js"(exports2, module2) {
+ var getNative = require_getNative();
+ var root = require_root();
+ var Map2 = getNative(root, "Map");
+ module2.exports = Map2;
+ }
+});
+
+// node_modules/lodash/_mapCacheClear.js
+var require_mapCacheClear = __commonJS({
+ "node_modules/lodash/_mapCacheClear.js"(exports2, module2) {
+ var Hash = require_Hash();
+ var ListCache = require_ListCache();
+ var Map2 = require_Map();
+ function mapCacheClear() {
+ this.size = 0;
+ this.__data__ = {
+ "hash": new Hash(),
+ "map": new (Map2 || ListCache)(),
+ "string": new Hash()
+ };
+ }
+ module2.exports = mapCacheClear;
+ }
+});
+
+// node_modules/lodash/_isKeyable.js
+var require_isKeyable = __commonJS({
+ "node_modules/lodash/_isKeyable.js"(exports2, module2) {
+ function isKeyable(value) {
+ var type = typeof value;
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
+ }
+ module2.exports = isKeyable;
+ }
+});
+
+// node_modules/lodash/_getMapData.js
+var require_getMapData = __commonJS({
+ "node_modules/lodash/_getMapData.js"(exports2, module2) {
+ var isKeyable = require_isKeyable();
+ function getMapData(map, key) {
+ var data = map.__data__;
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
+ }
+ module2.exports = getMapData;
+ }
+});
+
+// node_modules/lodash/_mapCacheDelete.js
+var require_mapCacheDelete = __commonJS({
+ "node_modules/lodash/_mapCacheDelete.js"(exports2, module2) {
+ var getMapData = require_getMapData();
+ function mapCacheDelete(key) {
+ var result = getMapData(this, key)["delete"](key);
+ this.size -= result ? 1 : 0;
+ return result;
+ }
+ module2.exports = mapCacheDelete;
+ }
+});
+
+// node_modules/lodash/_mapCacheGet.js
+var require_mapCacheGet = __commonJS({
+ "node_modules/lodash/_mapCacheGet.js"(exports2, module2) {
+ var getMapData = require_getMapData();
+ function mapCacheGet(key) {
+ return getMapData(this, key).get(key);
+ }
+ module2.exports = mapCacheGet;
+ }
+});
+
+// node_modules/lodash/_mapCacheHas.js
+var require_mapCacheHas = __commonJS({
+ "node_modules/lodash/_mapCacheHas.js"(exports2, module2) {
+ var getMapData = require_getMapData();
+ function mapCacheHas(key) {
+ return getMapData(this, key).has(key);
+ }
+ module2.exports = mapCacheHas;
+ }
+});
+
+// node_modules/lodash/_mapCacheSet.js
+var require_mapCacheSet = __commonJS({
+ "node_modules/lodash/_mapCacheSet.js"(exports2, module2) {
+ var getMapData = require_getMapData();
+ function mapCacheSet(key, value) {
+ var data = getMapData(this, key), size = data.size;
+ data.set(key, value);
+ this.size += data.size == size ? 0 : 1;
+ return this;
+ }
+ module2.exports = mapCacheSet;
+ }
+});
+
+// node_modules/lodash/_MapCache.js
+var require_MapCache = __commonJS({
+ "node_modules/lodash/_MapCache.js"(exports2, module2) {
+ var mapCacheClear = require_mapCacheClear();
+ var mapCacheDelete = require_mapCacheDelete();
+ var mapCacheGet = require_mapCacheGet();
+ var mapCacheHas = require_mapCacheHas();
+ var mapCacheSet = require_mapCacheSet();
+ function MapCache(entries) {
+ var index = -1, length = entries == null ? 0 : entries.length;
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
}
- [FLUSHCHUNK](chunk) {
- this.emit("data", chunk);
- return this[FLOWING];
+ }
+ MapCache.prototype.clear = mapCacheClear;
+ MapCache.prototype["delete"] = mapCacheDelete;
+ MapCache.prototype.get = mapCacheGet;
+ MapCache.prototype.has = mapCacheHas;
+ MapCache.prototype.set = mapCacheSet;
+ module2.exports = MapCache;
+ }
+});
+
+// node_modules/lodash/_setCacheAdd.js
+var require_setCacheAdd = __commonJS({
+ "node_modules/lodash/_setCacheAdd.js"(exports2, module2) {
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
+ function setCacheAdd(value) {
+ this.__data__.set(value, HASH_UNDEFINED);
+ return this;
+ }
+ module2.exports = setCacheAdd;
+ }
+});
+
+// node_modules/lodash/_setCacheHas.js
+var require_setCacheHas = __commonJS({
+ "node_modules/lodash/_setCacheHas.js"(exports2, module2) {
+ function setCacheHas(value) {
+ return this.__data__.has(value);
+ }
+ module2.exports = setCacheHas;
+ }
+});
+
+// node_modules/lodash/_SetCache.js
+var require_SetCache = __commonJS({
+ "node_modules/lodash/_SetCache.js"(exports2, module2) {
+ var MapCache = require_MapCache();
+ var setCacheAdd = require_setCacheAdd();
+ var setCacheHas = require_setCacheHas();
+ function SetCache(values) {
+ var index = -1, length = values == null ? 0 : values.length;
+ this.__data__ = new MapCache();
+ while (++index < length) {
+ this.add(values[index]);
}
- /**
- * Pipe all data emitted by this stream into the destination provided.
- *
- * Triggers the flow of data.
- */
- pipe(dest, opts) {
- if (this[DESTROYED])
- return dest;
- this[DISCARDED] = false;
- const ended = this[EMITTED_END];
- opts = opts || {};
- if (dest === proc.stdout || dest === proc.stderr)
- opts.end = false;
- else
- opts.end = opts.end !== false;
- opts.proxyErrors = !!opts.proxyErrors;
- if (ended) {
- if (opts.end)
- dest.end();
- } else {
- this[PIPES].push(!opts.proxyErrors ? new Pipe(this, dest, opts) : new PipeProxyErrors(this, dest, opts));
- if (this[ASYNC])
- defer(() => this[RESUME]());
- else
- this[RESUME]();
+ }
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
+ SetCache.prototype.has = setCacheHas;
+ module2.exports = SetCache;
+ }
+});
+
+// node_modules/lodash/_baseFindIndex.js
+var require_baseFindIndex = __commonJS({
+ "node_modules/lodash/_baseFindIndex.js"(exports2, module2) {
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
+ var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
+ while (fromRight ? index-- : ++index < length) {
+ if (predicate(array[index], index, array)) {
+ return index;
}
- return dest;
}
- /**
- * Fully unhook a piped destination stream.
- *
- * If the destination stream was the only consumer of this stream (ie,
- * there are no other piped destinations or `'data'` event listeners)
- * then the flow of data will stop until there is another consumer or
- * {@link Minipass#resume} is explicitly called.
- */
- unpipe(dest) {
- const p = this[PIPES].find((p2) => p2.dest === dest);
- if (p) {
- if (this[PIPES].length === 1) {
- if (this[FLOWING] && this[DATALISTENERS] === 0) {
- this[FLOWING] = false;
- }
- this[PIPES] = [];
- } else
- this[PIPES].splice(this[PIPES].indexOf(p), 1);
- p.unpipe();
+ return -1;
+ }
+ module2.exports = baseFindIndex;
+ }
+});
+
+// node_modules/lodash/_baseIsNaN.js
+var require_baseIsNaN = __commonJS({
+ "node_modules/lodash/_baseIsNaN.js"(exports2, module2) {
+ function baseIsNaN(value) {
+ return value !== value;
+ }
+ module2.exports = baseIsNaN;
+ }
+});
+
+// node_modules/lodash/_strictIndexOf.js
+var require_strictIndexOf = __commonJS({
+ "node_modules/lodash/_strictIndexOf.js"(exports2, module2) {
+ function strictIndexOf(array, value, fromIndex) {
+ var index = fromIndex - 1, length = array.length;
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
}
}
- /**
- * Alias for {@link Minipass#on}
- */
- addListener(ev, handler2) {
- return this.on(ev, handler2);
- }
- /**
- * Mostly identical to `EventEmitter.on`, with the following
- * behavior differences to prevent data loss and unnecessary hangs:
- *
- * - Adding a 'data' event handler will trigger the flow of data
- *
- * - Adding a 'readable' event handler when there is data waiting to be read
- * will cause 'readable' to be emitted immediately.
- *
- * - Adding an 'endish' event handler ('end', 'finish', etc.) which has
- * already passed will cause the event to be emitted immediately and all
- * handlers removed.
- *
- * - Adding an 'error' event handler after an error has been emitted will
- * cause the event to be re-emitted immediately with the error previously
- * raised.
- */
- on(ev, handler2) {
- const ret = super.on(ev, handler2);
- if (ev === "data") {
- this[DISCARDED] = false;
- this[DATALISTENERS]++;
- if (!this[PIPES].length && !this[FLOWING]) {
- this[RESUME]();
- }
- } else if (ev === "readable" && this[BUFFERLENGTH] !== 0) {
- super.emit("readable");
- } else if (isEndish(ev) && this[EMITTED_END]) {
- super.emit(ev);
- this.removeAllListeners(ev);
- } else if (ev === "error" && this[EMITTED_ERROR]) {
- const h = handler2;
- if (this[ASYNC])
- defer(() => h.call(this, this[EMITTED_ERROR]));
- else
- h.call(this, this[EMITTED_ERROR]);
+ return -1;
+ }
+ module2.exports = strictIndexOf;
+ }
+});
+
+// node_modules/lodash/_baseIndexOf.js
+var require_baseIndexOf = __commonJS({
+ "node_modules/lodash/_baseIndexOf.js"(exports2, module2) {
+ var baseFindIndex = require_baseFindIndex();
+ var baseIsNaN = require_baseIsNaN();
+ var strictIndexOf = require_strictIndexOf();
+ function baseIndexOf(array, value, fromIndex) {
+ return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
+ }
+ module2.exports = baseIndexOf;
+ }
+});
+
+// node_modules/lodash/_arrayIncludes.js
+var require_arrayIncludes = __commonJS({
+ "node_modules/lodash/_arrayIncludes.js"(exports2, module2) {
+ var baseIndexOf = require_baseIndexOf();
+ function arrayIncludes(array, value) {
+ var length = array == null ? 0 : array.length;
+ return !!length && baseIndexOf(array, value, 0) > -1;
+ }
+ module2.exports = arrayIncludes;
+ }
+});
+
+// node_modules/lodash/_arrayIncludesWith.js
+var require_arrayIncludesWith = __commonJS({
+ "node_modules/lodash/_arrayIncludesWith.js"(exports2, module2) {
+ function arrayIncludesWith(array, value, comparator) {
+ var index = -1, length = array == null ? 0 : array.length;
+ while (++index < length) {
+ if (comparator(value, array[index])) {
+ return true;
}
- return ret;
}
- /**
- * Alias for {@link Minipass#off}
- */
- removeListener(ev, handler2) {
- return this.off(ev, handler2);
+ return false;
+ }
+ module2.exports = arrayIncludesWith;
+ }
+});
+
+// node_modules/lodash/_arrayMap.js
+var require_arrayMap = __commonJS({
+ "node_modules/lodash/_arrayMap.js"(exports2, module2) {
+ function arrayMap(array, iteratee) {
+ var index = -1, length = array == null ? 0 : array.length, result = Array(length);
+ while (++index < length) {
+ result[index] = iteratee(array[index], index, array);
}
- /**
- * Mostly identical to `EventEmitter.off`
- *
- * If a 'data' event handler is removed, and it was the last consumer
- * (ie, there are no pipe destinations or other 'data' event listeners),
- * then the flow of data will stop until there is another consumer or
- * {@link Minipass#resume} is explicitly called.
- */
- off(ev, handler2) {
- const ret = super.off(ev, handler2);
- if (ev === "data") {
- this[DATALISTENERS] = this.listeners("data").length;
- if (this[DATALISTENERS] === 0 && !this[DISCARDED] && !this[PIPES].length) {
- this[FLOWING] = false;
- }
- }
- return ret;
+ return result;
+ }
+ module2.exports = arrayMap;
+ }
+});
+
+// node_modules/lodash/_cacheHas.js
+var require_cacheHas = __commonJS({
+ "node_modules/lodash/_cacheHas.js"(exports2, module2) {
+ function cacheHas(cache, key) {
+ return cache.has(key);
+ }
+ module2.exports = cacheHas;
+ }
+});
+
+// node_modules/lodash/_baseDifference.js
+var require_baseDifference = __commonJS({
+ "node_modules/lodash/_baseDifference.js"(exports2, module2) {
+ var SetCache = require_SetCache();
+ var arrayIncludes = require_arrayIncludes();
+ var arrayIncludesWith = require_arrayIncludesWith();
+ var arrayMap = require_arrayMap();
+ var baseUnary = require_baseUnary();
+ var cacheHas = require_cacheHas();
+ var LARGE_ARRAY_SIZE = 200;
+ function baseDifference(array, values, iteratee, comparator) {
+ var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
+ if (!length) {
+ return result;
}
- /**
- * Mostly identical to `EventEmitter.removeAllListeners`
- *
- * If all 'data' event handlers are removed, and they were the last consumer
- * (ie, there are no pipe destinations), then the flow of data will stop
- * until there is another consumer or {@link Minipass#resume} is explicitly
- * called.
- */
- removeAllListeners(ev) {
- const ret = super.removeAllListeners(ev);
- if (ev === "data" || ev === void 0) {
- this[DATALISTENERS] = 0;
- if (!this[DISCARDED] && !this[PIPES].length) {
- this[FLOWING] = false;
- }
- }
- return ret;
+ if (iteratee) {
+ values = arrayMap(values, baseUnary(iteratee));
}
- /**
- * true if the 'end' event has been emitted
- */
- get emittedEnd() {
- return this[EMITTED_END];
+ if (comparator) {
+ includes = arrayIncludesWith;
+ isCommon = false;
+ } else if (values.length >= LARGE_ARRAY_SIZE) {
+ includes = cacheHas;
+ isCommon = false;
+ values = new SetCache(values);
}
- [MAYBE_EMIT_END]() {
- if (!this[EMITTING_END] && !this[EMITTED_END] && !this[DESTROYED] && this[BUFFER].length === 0 && this[EOF]) {
- this[EMITTING_END] = true;
- this.emit("end");
- this.emit("prefinish");
- this.emit("finish");
- if (this[CLOSED])
- this.emit("close");
- this[EMITTING_END] = false;
+ outer:
+ while (++index < length) {
+ var value = array[index], computed = iteratee == null ? value : iteratee(value);
+ value = comparator || value !== 0 ? value : 0;
+ if (isCommon && computed === computed) {
+ var valuesIndex = valuesLength;
+ while (valuesIndex--) {
+ if (values[valuesIndex] === computed) {
+ continue outer;
+ }
+ }
+ result.push(value);
+ } else if (!includes(values, computed, comparator)) {
+ result.push(value);
+ }
}
- }
- /**
- * Mostly identical to `EventEmitter.emit`, with the following
- * behavior differences to prevent data loss and unnecessary hangs:
- *
- * If the stream has been destroyed, and the event is something other
- * than 'close' or 'error', then `false` is returned and no handlers
- * are called.
- *
- * If the event is 'end', and has already been emitted, then the event
- * is ignored. If the stream is in a paused or non-flowing state, then
- * the event will be deferred until data flow resumes. If the stream is
- * async, then handlers will be called on the next tick rather than
- * immediately.
- *
- * If the event is 'close', and 'end' has not yet been emitted, then
- * the event will be deferred until after 'end' is emitted.
- *
- * If the event is 'error', and an AbortSignal was provided for the stream,
- * and there are no listeners, then the event is ignored, matching the
- * behavior of node core streams in the presense of an AbortSignal.
- *
- * If the event is 'finish' or 'prefinish', then all listeners will be
- * removed after emitting the event, to prevent double-firing.
- */
- emit(ev, ...args) {
- const data = args[0];
- if (ev !== "error" && ev !== "close" && ev !== DESTROYED && this[DESTROYED]) {
- return false;
- } else if (ev === "data") {
- return !this[OBJECTMODE] && !data ? false : this[ASYNC] ? (defer(() => this[EMITDATA](data)), true) : this[EMITDATA](data);
- } else if (ev === "end") {
- return this[EMITEND]();
- } else if (ev === "close") {
- this[CLOSED] = true;
- if (!this[EMITTED_END] && !this[DESTROYED])
- return false;
- const ret2 = super.emit("close");
- this.removeAllListeners("close");
- return ret2;
- } else if (ev === "error") {
- this[EMITTED_ERROR] = data;
- super.emit(ERROR, data);
- const ret2 = !this[SIGNAL] || this.listeners("error").length ? super.emit("error", data) : false;
- this[MAYBE_EMIT_END]();
- return ret2;
- } else if (ev === "resume") {
- const ret2 = super.emit("resume");
- this[MAYBE_EMIT_END]();
- return ret2;
- } else if (ev === "finish" || ev === "prefinish") {
- const ret2 = super.emit(ev);
- this.removeAllListeners(ev);
- return ret2;
- }
- const ret = super.emit(ev, ...args);
- this[MAYBE_EMIT_END]();
- return ret;
- }
- [EMITDATA](data) {
- for (const p of this[PIPES]) {
- if (p.dest.write(data) === false)
- this.pause();
+ return result;
+ }
+ module2.exports = baseDifference;
+ }
+});
+
+// node_modules/lodash/isArrayLikeObject.js
+var require_isArrayLikeObject = __commonJS({
+ "node_modules/lodash/isArrayLikeObject.js"(exports2, module2) {
+ var isArrayLike = require_isArrayLike();
+ var isObjectLike = require_isObjectLike();
+ function isArrayLikeObject(value) {
+ return isObjectLike(value) && isArrayLike(value);
+ }
+ module2.exports = isArrayLikeObject;
+ }
+});
+
+// node_modules/lodash/difference.js
+var require_difference = __commonJS({
+ "node_modules/lodash/difference.js"(exports2, module2) {
+ var baseDifference = require_baseDifference();
+ var baseFlatten = require_baseFlatten();
+ var baseRest = require_baseRest();
+ var isArrayLikeObject = require_isArrayLikeObject();
+ var difference = baseRest(function(array, values) {
+ return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
+ });
+ module2.exports = difference;
+ }
+});
+
+// node_modules/lodash/_Set.js
+var require_Set = __commonJS({
+ "node_modules/lodash/_Set.js"(exports2, module2) {
+ var getNative = require_getNative();
+ var root = require_root();
+ var Set2 = getNative(root, "Set");
+ module2.exports = Set2;
+ }
+});
+
+// node_modules/lodash/noop.js
+var require_noop = __commonJS({
+ "node_modules/lodash/noop.js"(exports2, module2) {
+ function noop3() {
+ }
+ module2.exports = noop3;
+ }
+});
+
+// node_modules/lodash/_setToArray.js
+var require_setToArray = __commonJS({
+ "node_modules/lodash/_setToArray.js"(exports2, module2) {
+ function setToArray(set) {
+ var index = -1, result = Array(set.size);
+ set.forEach(function(value) {
+ result[++index] = value;
+ });
+ return result;
+ }
+ module2.exports = setToArray;
+ }
+});
+
+// node_modules/lodash/_createSet.js
+var require_createSet = __commonJS({
+ "node_modules/lodash/_createSet.js"(exports2, module2) {
+ var Set2 = require_Set();
+ var noop3 = require_noop();
+ var setToArray = require_setToArray();
+ var INFINITY = 1 / 0;
+ var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop3 : function(values) {
+ return new Set2(values);
+ };
+ module2.exports = createSet;
+ }
+});
+
+// node_modules/lodash/_baseUniq.js
+var require_baseUniq = __commonJS({
+ "node_modules/lodash/_baseUniq.js"(exports2, module2) {
+ var SetCache = require_SetCache();
+ var arrayIncludes = require_arrayIncludes();
+ var arrayIncludesWith = require_arrayIncludesWith();
+ var cacheHas = require_cacheHas();
+ var createSet = require_createSet();
+ var setToArray = require_setToArray();
+ var LARGE_ARRAY_SIZE = 200;
+ function baseUniq(array, iteratee, comparator) {
+ var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
+ if (comparator) {
+ isCommon = false;
+ includes = arrayIncludesWith;
+ } else if (length >= LARGE_ARRAY_SIZE) {
+ var set = iteratee ? null : createSet(array);
+ if (set) {
+ return setToArray(set);
}
- const ret = this[DISCARDED] ? false : super.emit("data", data);
- this[MAYBE_EMIT_END]();
- return ret;
+ isCommon = false;
+ includes = cacheHas;
+ seen = new SetCache();
+ } else {
+ seen = iteratee ? [] : result;
}
- [EMITEND]() {
- if (this[EMITTED_END])
- return false;
- this[EMITTED_END] = true;
- this.readable = false;
- return this[ASYNC] ? (defer(() => this[EMITEND2]()), true) : this[EMITEND2]();
- }
- [EMITEND2]() {
- if (this[DECODER]) {
- const data = this[DECODER].end();
- if (data) {
- for (const p of this[PIPES]) {
- p.dest.write(data);
+ outer:
+ while (++index < length) {
+ var value = array[index], computed = iteratee ? iteratee(value) : value;
+ value = comparator || value !== 0 ? value : 0;
+ if (isCommon && computed === computed) {
+ var seenIndex = seen.length;
+ while (seenIndex--) {
+ if (seen[seenIndex] === computed) {
+ continue outer;
+ }
}
- if (!this[DISCARDED])
- super.emit("data", data);
- }
- }
- for (const p of this[PIPES]) {
- p.end();
- }
- const ret = super.emit("end");
- this.removeAllListeners("end");
- return ret;
- }
- /**
- * Return a Promise that resolves to an array of all emitted data once
- * the stream ends.
- */
- async collect() {
- const buf = Object.assign([], {
- dataLength: 0
- });
- if (!this[OBJECTMODE])
- buf.dataLength = 0;
- const p = this.promise();
- this.on("data", (c) => {
- buf.push(c);
- if (!this[OBJECTMODE])
- buf.dataLength += c.length;
- });
- await p;
- return buf;
- }
- /**
- * Return a Promise that resolves to the concatenation of all emitted data
- * once the stream ends.
- *
- * Not allowed on objectMode streams.
- */
- async concat() {
- if (this[OBJECTMODE]) {
- throw new Error("cannot concat in objectMode");
- }
- const buf = await this.collect();
- return this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
- }
- /**
- * Return a void Promise that resolves once the stream ends.
- */
- async promise() {
- return new Promise((resolve7, reject) => {
- this.on(DESTROYED, () => reject(new Error("stream destroyed")));
- this.on("error", (er) => reject(er));
- this.on("end", () => resolve7());
- });
- }
- /**
- * Asynchronous `for await of` iteration.
- *
- * This will continue emitting all chunks until the stream terminates.
- */
- [Symbol.asyncIterator]() {
- this[DISCARDED] = false;
- let stopped = false;
- const stop = async () => {
- this.pause();
- stopped = true;
- return { value: void 0, done: true };
- };
- const next = () => {
- if (stopped)
- return stop();
- const res = this.read();
- if (res !== null)
- return Promise.resolve({ done: false, value: res });
- if (this[EOF])
- return stop();
- let resolve7;
- let reject;
- const onerr = (er) => {
- this.off("data", ondata);
- this.off("end", onend);
- this.off(DESTROYED, ondestroy);
- stop();
- reject(er);
- };
- const ondata = (value) => {
- this.off("error", onerr);
- this.off("end", onend);
- this.off(DESTROYED, ondestroy);
- this.pause();
- resolve7({ value, done: !!this[EOF] });
- };
- const onend = () => {
- this.off("error", onerr);
- this.off("data", ondata);
- this.off(DESTROYED, ondestroy);
- stop();
- resolve7({ done: true, value: void 0 });
- };
- const ondestroy = () => onerr(new Error("stream destroyed"));
- return new Promise((res2, rej) => {
- reject = rej;
- resolve7 = res2;
- this.once(DESTROYED, ondestroy);
- this.once("error", onerr);
- this.once("end", onend);
- this.once("data", ondata);
- });
- };
- return {
- next,
- throw: stop,
- return: stop,
- [Symbol.asyncIterator]() {
- return this;
- },
- [Symbol.asyncDispose]: async () => {
- }
- };
- }
- /**
- * Synchronous `for of` iteration.
- *
- * The iteration will terminate when the internal buffer runs out, even
- * if the stream has not yet terminated.
- */
- [Symbol.iterator]() {
- this[DISCARDED] = false;
- let stopped = false;
- const stop = () => {
- this.pause();
- this.off(ERROR, stop);
- this.off(DESTROYED, stop);
- this.off("end", stop);
- stopped = true;
- return { done: true, value: void 0 };
- };
- const next = () => {
- if (stopped)
- return stop();
- const value = this.read();
- return value === null ? stop() : { done: false, value };
- };
- this.once("end", stop);
- this.once(ERROR, stop);
- this.once(DESTROYED, stop);
- return {
- next,
- throw: stop,
- return: stop,
- [Symbol.iterator]() {
- return this;
- },
- [Symbol.dispose]: () => {
+ if (iteratee) {
+ seen.push(computed);
+ }
+ result.push(value);
+ } else if (!includes(seen, computed, comparator)) {
+ if (seen !== result) {
+ seen.push(computed);
+ }
+ result.push(value);
}
- };
- }
- /**
- * Destroy a stream, preventing it from being used for any further purpose.
- *
- * If the stream has a `close()` method, then it will be called on
- * destruction.
- *
- * After destruction, any attempt to write data, read data, or emit most
- * events will be ignored.
- *
- * If an error argument is provided, then it will be emitted in an
- * 'error' event.
- */
- destroy(er) {
- if (this[DESTROYED]) {
- if (er)
- this.emit("error", er);
- else
- this.emit(DESTROYED);
- return this;
}
- this[DESTROYED] = true;
- this[DISCARDED] = true;
- this[BUFFER].length = 0;
- this[BUFFERLENGTH] = 0;
- const wc = this;
- if (typeof wc.close === "function" && !this[CLOSED])
- wc.close();
- if (er)
- this.emit("error", er);
- else
- this.emit(DESTROYED);
- return this;
- }
- /**
- * Alias for {@link isStream}
- *
- * Former export location, maintained for backwards compatibility.
- *
- * @deprecated
- */
- static get isStream() {
- return exports2.isStream;
- }
- };
- exports2.Minipass = Minipass;
+ return result;
+ }
+ module2.exports = baseUniq;
}
});
-// node_modules/path-scurry/dist/commonjs/index.js
-var require_commonjs6 = __commonJS({
- "node_modules/path-scurry/dist/commonjs/index.js"(exports2) {
- "use strict";
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
- if (k2 === void 0) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() {
- return m[k];
- } };
- }
- Object.defineProperty(o, k2, desc);
- }) : (function(o, m, k, k2) {
- if (k2 === void 0) k2 = k;
- o[k2] = m[k];
- }));
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
- }) : function(o, v) {
- o["default"] = v;
+// node_modules/lodash/union.js
+var require_union = __commonJS({
+ "node_modules/lodash/union.js"(exports2, module2) {
+ var baseFlatten = require_baseFlatten();
+ var baseRest = require_baseRest();
+ var baseUniq = require_baseUniq();
+ var isArrayLikeObject = require_isArrayLikeObject();
+ var union = baseRest(function(arrays) {
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
- var __importStar = exports2 && exports2.__importStar || function(mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) {
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ module2.exports = union;
+ }
+});
+
+// node_modules/lodash/_overArg.js
+var require_overArg = __commonJS({
+ "node_modules/lodash/_overArg.js"(exports2, module2) {
+ function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+ }
+ module2.exports = overArg;
+ }
+});
+
+// node_modules/lodash/_getPrototype.js
+var require_getPrototype = __commonJS({
+ "node_modules/lodash/_getPrototype.js"(exports2, module2) {
+ var overArg = require_overArg();
+ var getPrototype = overArg(Object.getPrototypeOf, Object);
+ module2.exports = getPrototype;
+ }
+});
+
+// node_modules/lodash/isPlainObject.js
+var require_isPlainObject = __commonJS({
+ "node_modules/lodash/isPlainObject.js"(exports2, module2) {
+ var baseGetTag = require_baseGetTag();
+ var getPrototype = require_getPrototype();
+ var isObjectLike = require_isObjectLike();
+ var objectTag = "[object Object]";
+ var funcProto = Function.prototype;
+ var objectProto = Object.prototype;
+ var funcToString = funcProto.toString;
+ var hasOwnProperty = objectProto.hasOwnProperty;
+ var objectCtorString = funcToString.call(Object);
+ function isPlainObject3(value) {
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
+ return false;
}
- __setModuleDefault(result, mod);
- return result;
- };
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0;
- var lru_cache_1 = require_commonjs4();
- var node_path_1 = require("node:path");
- var node_url_1 = require("node:url");
- var fs_1 = require("fs");
- var actualFS = __importStar(require("node:fs"));
- var realpathSync = fs_1.realpathSync.native;
- var promises_1 = require("node:fs/promises");
- var minipass_1 = require_commonjs5();
- var defaultFS = {
- lstatSync: fs_1.lstatSync,
- readdir: fs_1.readdir,
- readdirSync: fs_1.readdirSync,
- readlinkSync: fs_1.readlinkSync,
- realpathSync,
- promises: {
- lstat: promises_1.lstat,
- readdir: promises_1.readdir,
- readlink: promises_1.readlink,
- realpath: promises_1.realpath
- }
- };
- var fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ? defaultFS : {
- ...defaultFS,
- ...fsOption,
- promises: {
- ...defaultFS.promises,
- ...fsOption.promises || {}
- }
- };
- var uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i;
- var uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\");
- var eitherSep = /[\\\/]/;
- var UNKNOWN = 0;
- var IFIFO = 1;
- var IFCHR = 2;
- var IFDIR = 4;
- var IFBLK = 6;
- var IFREG = 8;
- var IFLNK = 10;
- var IFSOCK = 12;
- var IFMT = 15;
- var IFMT_UNKNOWN = ~IFMT;
- var READDIR_CALLED = 16;
- var LSTAT_CALLED = 32;
- var ENOTDIR = 64;
- var ENOENT = 128;
- var ENOREADLINK = 256;
- var ENOREALPATH = 512;
- var ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
- var TYPEMASK = 1023;
- var entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN;
- var normalizeCache = /* @__PURE__ */ new Map();
- var normalize2 = (s) => {
- const c = normalizeCache.get(s);
- if (c)
- return c;
- const n = s.normalize("NFKD");
- normalizeCache.set(s, n);
- return n;
- };
- var normalizeNocaseCache = /* @__PURE__ */ new Map();
- var normalizeNocase = (s) => {
- const c = normalizeNocaseCache.get(s);
- if (c)
- return c;
- const n = normalize2(s.toLowerCase());
- normalizeNocaseCache.set(s, n);
- return n;
- };
- var ResolveCache = class extends lru_cache_1.LRUCache {
- constructor() {
- super({ max: 256 });
+ var proto = getPrototype(value);
+ if (proto === null) {
+ return true;
}
- };
- exports2.ResolveCache = ResolveCache;
- var ChildrenCache = class extends lru_cache_1.LRUCache {
- constructor(maxSize2 = 16 * 1024) {
- super({
- maxSize: maxSize2,
- // parent + children
- sizeCalculation: (a) => a.length + 1
- });
+ var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
+ return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
+ }
+ module2.exports = isPlainObject3;
+ }
+});
+
+// node_modules/glob/dist/commonjs/index.min.js
+var require_index_min = __commonJS({
+ "node_modules/glob/dist/commonjs/index.min.js"(exports2) {
+ "use strict";
+ var x = (n, t) => () => {
+ try {
+ return t || n((t = { exports: {} }).exports, t), t.exports;
+ } catch (e) {
+ throw t = 0, e;
}
};
- exports2.ChildrenCache = ChildrenCache;
- var setAsCwd = /* @__PURE__ */ Symbol("PathScurry setAsCwd");
- var PathBase = class {
- /**
- * the basename of this path
- *
- * **Important**: *always* test the path name against any test string
- * usingthe {@link isNamed} method, and not by directly comparing this
- * string. Otherwise, unicode path strings that the system sees as identical
- * will not be properly treated as the same path, leading to incorrect
- * behavior and possible security issues.
- */
- name;
- /**
- * the Path entry corresponding to the path root.
- *
- * @internal
- */
- root;
- /**
- * All roots found within the current PathScurry family
- *
- * @internal
- */
- roots;
- /**
- * a reference to the parent path, or undefined in the case of root entries
- *
- * @internal
- */
- parent;
- /**
- * boolean indicating whether paths are compared case-insensitively
- * @internal
- */
- nocase;
- /**
- * boolean indicating that this path is the current working directory
- * of the PathScurry collection that contains it.
- */
- isCWD = false;
- // potential default fs override
- #fs;
- // Stats fields
- #dev;
- get dev() {
- return this.#dev;
- }
- #mode;
- get mode() {
- return this.#mode;
- }
- #nlink;
- get nlink() {
- return this.#nlink;
- }
- #uid;
- get uid() {
- return this.#uid;
- }
- #gid;
- get gid() {
- return this.#gid;
- }
- #rdev;
- get rdev() {
- return this.#rdev;
- }
- #blksize;
- get blksize() {
- return this.#blksize;
- }
- #ino;
- get ino() {
- return this.#ino;
- }
- #size;
- get size() {
- return this.#size;
- }
- #blocks;
- get blocks() {
- return this.#blocks;
- }
- #atimeMs;
- get atimeMs() {
- return this.#atimeMs;
- }
- #mtimeMs;
- get mtimeMs() {
- return this.#mtimeMs;
- }
- #ctimeMs;
- get ctimeMs() {
- return this.#ctimeMs;
- }
- #birthtimeMs;
- get birthtimeMs() {
- return this.#birthtimeMs;
- }
- #atime;
- get atime() {
- return this.#atime;
- }
- #mtime;
- get mtime() {
- return this.#mtime;
- }
- #ctime;
- get ctime() {
- return this.#ctime;
- }
- #birthtime;
- get birthtime() {
- return this.#birthtime;
- }
- #matchName;
- #depth;
- #fullpath;
- #fullpathPosix;
- #relative;
- #relativePosix;
- #type;
- #children;
- #linkTarget;
- #realpath;
- /**
- * This property is for compatibility with the Dirent class as of
- * Node v20, where Dirent['parentPath'] refers to the path of the
- * directory that was passed to readdir. For root entries, it's the path
- * to the entry itself.
- */
- get parentPath() {
- return (this.parent || this).fullpath();
- }
- /**
- * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
- * this property refers to the *parent* path, not the path object itself.
- */
- get path() {
- return this.parentPath;
- }
- /**
- * Do not create new Path objects directly. They should always be accessed
- * via the PathScurry class or other methods on the Path class.
- *
- * @internal
- */
- constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
- this.name = name;
- this.#matchName = nocase ? normalizeNocase(name) : normalize2(name);
- this.#type = type & TYPEMASK;
- this.nocase = nocase;
- this.roots = roots;
- this.root = root || this;
- this.#children = children;
- this.#fullpath = opts.fullpath;
- this.#relative = opts.relative;
- this.#relativePosix = opts.relativePosix;
- this.parent = opts.parent;
- if (this.parent) {
- this.#fs = this.parent.#fs;
- } else {
- this.#fs = fsFromOption(opts.fs);
+ var ls = x((tt) => {
+ "use strict";
+ Object.defineProperty(tt, "__esModule", { value: true });
+ tt.range = tt.balanced = void 0;
+ var di = (n, t, e) => {
+ let s = n instanceof RegExp ? as(n, e) : n, i = t instanceof RegExp ? as(t, e) : t, r = s !== null && i != null && (0, tt.range)(s, i, e);
+ return r && { start: r[0], end: r[1], pre: e.slice(0, r[0]), body: e.slice(r[0] + s.length, r[1]), post: e.slice(r[1] + i.length) };
+ };
+ tt.balanced = di;
+ var as = (n, t) => {
+ let e = t.match(n);
+ return e ? e[0] : null;
+ }, pi = (n, t, e) => {
+ let s, i, r, h, a, o = e.indexOf(n), l = e.indexOf(t, o + 1), c = o;
+ if (o >= 0 && l > 0) {
+ if (n === t) return [o, l];
+ for (s = [], r = e.length; c >= 0 && !a; ) {
+ if (c === o) s.push(c), o = e.indexOf(n, c + 1);
+ else if (s.length === 1) {
+ let u = s.pop();
+ u !== void 0 && (a = [u, l]);
+ } else i = s.pop(), i !== void 0 && i < r && (r = i, h = l), l = e.indexOf(t, c + 1);
+ c = o < l && o >= 0 ? o : l;
+ }
+ s.length && h !== void 0 && (a = [r, h]);
+ }
+ return a;
+ };
+ tt.range = pi;
+ });
+ var ms = x((T) => {
+ "use strict";
+ Object.defineProperty(T, "__esModule", { value: true });
+ T.EXPANSION_MAX_REWRITES = T.EXPANSION_MAX_DEPTH = T.EXPANSION_MAX_LENGTH = T.EXPANSION_MAX = void 0;
+ T.expand = Mi;
+ var cs = ls(), us = "\0SLASH" + Math.random() + "\0", fs9 = "\0OPEN" + Math.random() + "\0", ve = "\0CLOSE" + Math.random() + "\0", ds = "\0COMMA" + Math.random() + "\0", ps = "\0PERIOD" + Math.random() + "\0", mi = new RegExp(us, "g"), gi = new RegExp(fs9, "g"), wi = new RegExp(ve, "g"), bi = new RegExp(ds, "g"), yi = new RegExp(ps, "g"), Si = /\\\\/g, vi = /\\{/g, _i = /\\}/g, Ei = /\\,/g, Oi = /\\\./g;
+ T.EXPANSION_MAX = 1e5;
+ T.EXPANSION_MAX_LENGTH = 4e6;
+ T.EXPANSION_MAX_DEPTH = 1e3;
+ T.EXPANSION_MAX_REWRITES = 1e3;
+ function be(n) {
+ return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
+ }
+ function Ci(n) {
+ return n.replace(Si, us).replace(vi, fs9).replace(_i, ve).replace(Ei, ds).replace(Oi, ps);
+ }
+ function Ai(n) {
+ return n.replace(mi, "\\").replace(gi, "{").replace(wi, "}").replace(bi, ",").replace(yi, ".");
+ }
+ function ye(n, t) {
+ for (let e = 0; e < t.length; e++) n.push(t[e]);
+ }
+ function ki(n) {
+ let t = [], e = "";
+ for (; ; ) {
+ let s = (0, cs.balanced)("{", "}", n);
+ if (!s) {
+ let o = n.split(",");
+ return o[0] = e + o[0], ye(t, o), t;
+ }
+ let { pre: i, body: r, post: h } = s, a = i.split(",");
+ if (a[0] = e + a[0], a[a.length - 1] += "{" + r + "}", !h.length) return ye(t, a), t;
+ e = a.pop(), ye(t, a), n = h;
}
}
- /**
- * Returns the depth of the Path object from its root.
- *
- * For example, a path at `/foo/bar` would have a depth of 2.
- */
- depth() {
- if (this.#depth !== void 0)
- return this.#depth;
- if (!this.parent)
- return this.#depth = 0;
- return this.#depth = this.parent.depth() + 1;
+ function Mi(n, t = {}) {
+ if (!n) return [];
+ let { max: e = T.EXPANSION_MAX, maxLength: s = T.EXPANSION_MAX_LENGTH, maxDepth: i = T.EXPANSION_MAX_DEPTH, maxRewrites: r = T.EXPANSION_MAX_REWRITES } = t;
+ return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), Se(Ci(n), e, s, i, 0, r, true).map(Ai);
}
- /**
- * @internal
- */
- childrenCache() {
- return this.#children;
+ function xi(n) {
+ return "{" + n + "}";
}
- /**
- * Get the Path object referenced by the string path, resolved from this Path
- */
- resolve(path6) {
- if (!path6) {
- return this;
+ function Ri(n) {
+ return /^-?0\d/.test(n);
+ }
+ function Pi(n, t) {
+ return n <= t;
+ }
+ function Ti(n, t) {
+ return n >= t;
+ }
+ function lt(n, t, e, s, i, r) {
+ let h = [], a = 0;
+ for (let o = 0; o < n.length; o++) for (let l = 0; l < e.length; l++) {
+ if (h.length >= s) return h;
+ let c = n[o] + t + e[l];
+ if (!(r && !c)) {
+ if (a + c.length > i) return h;
+ h.push(c), a += c.length;
+ }
}
- const rootPath = this.getRootString(path6);
- const dir = path6.substring(rootPath.length);
- const dirParts = dir.split(this.splitSep);
- const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
- return result;
+ return h;
}
- #resolveParts(dirParts) {
- let p = this;
- for (const part of dirParts) {
- p = p.child(part);
+ function Fi(n, t, e, s) {
+ let i = n.split(/\.\./), r = [];
+ if (i[0] === void 0 || i[1] === void 0) return r;
+ let h = be(i[0]), a = be(i[1]), o = Math.max(i[0].length, i[1].length), l = i.length === 3 && i[2] !== void 0 ? Math.max(Math.abs(be(i[2])), 1) : 1, c = Pi;
+ a < h && (l *= -1, c = Ti);
+ let p = i.some(Ri), d = 0;
+ for (let g = h; c(g, a) && r.length < e; g += l) {
+ let f;
+ if (t) f = String.fromCharCode(g), f === "\\" && (f = "");
+ else if (f = String(g), p) {
+ let b = o - f.length;
+ if (b > 0) {
+ let m = new Array(b + 1).join("0");
+ g < 0 ? f = "-" + m + f.slice(1) : f = m + f;
+ }
+ }
+ if (d + f.length > s) break;
+ r.push(f), d += f.length;
}
- return p;
+ return r;
}
- /**
- * Returns the cached children Path objects, if still available. If they
- * have fallen out of the cache, then returns an empty array, and resets the
- * READDIR_CALLED bit, so that future calls to readdir() will require an fs
- * lookup.
- *
- * @internal
- */
- children() {
- const cached = this.#children.get(this);
- if (cached) {
- return cached;
+ function Se(n, t, e, s, i, r, h) {
+ if (i > s) return [n];
+ let a = [""], o = 0, l = false, c = true;
+ for (; ; ) {
+ let u = (0, cs.balanced)("{", "}", n);
+ if (!u) return lt(a, n, [""], t, e, l);
+ let p = u.pre;
+ if (/\$$/.test(p)) {
+ if (a = lt(a, p + "{" + u.body + "}", [""], t, e, l && !u.post.length), c = false, !u.post.length) break;
+ n = u.post;
+ continue;
+ }
+ let d = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(u.body), g = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(u.body), f = d || g, b = u.body.indexOf(",") >= 0;
+ if (!f && !b) {
+ if (o < r && u.post.match(/,(?!,).*\}/)) {
+ o++, n = u.pre + "{" + u.body + ve + u.post, h = true;
+ continue;
+ }
+ return lt(a, p + "{" + u.body + "}" + u.post, [""], t, e, l);
+ }
+ c && (l = h && !f, c = false);
+ let m;
+ if (f) m = Fi(u.body, g, t, e);
+ else {
+ let y = ki(u.body);
+ if (y.length === 1 && y[0] !== void 0 && (y = Se(y[0], t, e, s, i + 1, r, false).map(xi), y.length === 1)) {
+ if (a = lt(a, p + y[0], [""], t, e, l && !u.post.length), !u.post.length) break;
+ n = u.post;
+ continue;
+ }
+ let _2 = l && !u.post.length && !p;
+ for (let S = 0; _2 && S < a.length; S++) a[S] && (_2 = false);
+ m = [];
+ let v = 0;
+ t: for (let S = 0; S < y.length; S++) {
+ let K = Se(y[S], t, e, s, i + 1, r, false);
+ for (let z = 0; z < K.length; z++) {
+ let $ = K[z];
+ if (!(_2 && !$)) {
+ if (m.length >= t || v + $.length > e) break t;
+ m.push($), v += $.length;
+ }
+ }
+ }
+ }
+ if (a = lt(a, p, m, t, e, l && !u.post.length), !u.post.length) break;
+ n = u.post;
}
- const children = Object.assign([], { provisional: 0 });
- this.#children.set(this, children);
- this.#type &= ~READDIR_CALLED;
- return children;
+ return a;
}
- /**
- * Resolves a path portion and returns or creates the child Path.
- *
- * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is
- * `'..'`.
- *
- * This should not be called directly. If `pathPart` contains any path
- * separators, it will lead to unsafe undefined behavior.
- *
- * Use `Path.resolve()` instead.
- *
- * @internal
- */
- child(pathPart, opts) {
- if (pathPart === "" || pathPart === ".") {
- return this;
+ });
+ var gs = x((Tt) => {
+ "use strict";
+ Object.defineProperty(Tt, "__esModule", { value: true });
+ Tt.parseClass = void 0;
+ var ji = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"], "[:alpha:]": ["\\p{L}\\p{Nl}"], "[:ascii:]": ["\\x00-\\x7f"], "[:blank:]": ["\\p{Zs}\\t"], "[:cntrl:]": ["\\p{Cc}"], "[:digit:]": ["\\p{Nd}"], "[:graph:]": ["\\p{Z}\\p{C}", true], "[:lower:]": ["\\p{Ll}"], "[:print:]": ["\\p{C}", true], "[:punct:]": ["\\p{P}\\p{S}"], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"], "[:upper:]": ["\\p{Lu}"], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"], "[:xdigit:]": ["A-Fa-f0-9"] }, ct = (n) => n.replace(/[[\]\\-]/g, "\\$&"), _e = /$./, Di = (n, t, e = false, s) => {
+ let i = (m) => {
+ let y = s ? m.normalize(s) : m;
+ return [...y].length === 1 ? y : m;
+ }, r = t;
+ if (n.charAt(r) !== "[") throw new Error("not in a brace expression");
+ let h = [], a = [], o = r + 1, l = false, c = false, u = false, p = r, d = "";
+ t: for (; o < n.length; ) {
+ let m = String.fromCodePoint(n.codePointAt(o));
+ if ((m === "!" || m === "^") && o === r + 1) {
+ u = true, o++;
+ continue;
+ }
+ if (m === "]" && l && !c) {
+ p = o + 1;
+ break;
+ }
+ if (l = true, m === "\\" && !c) {
+ c = true, o++;
+ continue;
+ }
+ if (m === "[" && !c) {
+ for (let [_2, [v, S]] of Object.entries(ji)) if (n.startsWith(_2, o)) {
+ if (d) return [_e, n.length - r];
+ o += _2.length, S ? a.push(v) : h.push(v);
+ continue t;
+ }
+ }
+ c = false;
+ let y = i(m);
+ if (d) {
+ y.codePointAt(0) > d.codePointAt(0) ? h.push(ct(d) + "-" + ct(y)) : y === d && h.push(ct(y)), d = "", o += m.length;
+ continue;
+ }
+ if (n.startsWith("-]", o + m.length)) {
+ h.push(ct(y + "-")), o += m.length + 1;
+ continue;
+ }
+ if (n.startsWith("-", o + m.length)) {
+ d = y, o += m.length + 1;
+ continue;
+ }
+ h.push(ct(y)), o += m.length;
}
- if (pathPart === "..") {
- return this.parent || this;
+ if (p < o) return [_e, 0];
+ if (!h.length && !a.length) return [_e, n.length - r];
+ let g = "[" + (u ? "^" : "") + h.join("") + "]", f = "[" + (u ? "" : "^") + a.join("") + "]", b = "^" + (h.length && a.length ? "(" + g + "|" + f + ")" : h.length ? g : f);
+ return [new RegExp(b, e ? "iu" : "u"), p - r];
+ };
+ Tt.parseClass = Di;
+ });
+ var Cs = x((jt) => {
+ "use strict";
+ Object.defineProperty(jt, "__esModule", { value: true });
+ jt.Matcher = void 0;
+ var Ni = gs(), Ee = { t: "match", id: 0 }, Li = "!?+*@", et = (n) => ({ t: "lit", ch: n }), Wi = (n) => n.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&"), Oe = (n) => new RegExp(`^${Wi(n)}$`, "iu"), Me = (n, t) => {
+ if (t === n.ch) return true;
+ if (!n.re) return false;
+ let e = t.charCodeAt(0);
+ if (e >= 128) return n.re.test(t);
+ let s = n.ascii ??= new Uint8Array(128);
+ return s[e] ||= n.re.test(t) ? 1 : 2, s[e] === 1;
+ }, Bi = (n, t, e, s) => {
+ let i = [];
+ for (let r = 0; r < n.length; ) {
+ let h = String.fromCodePoint(n.codePointAt(r));
+ if (h === "\\") {
+ let a = n.codePointAt(r + 1), o = a === void 0 ? h : String.fromCodePoint(a);
+ i.push(et(o)), r += 1 + o.length;
+ continue;
+ }
+ if (h === "[") {
+ let [a, o] = (0, Ni.parseClass)(n, r, t, s);
+ if (o) {
+ i.push({ t: "class", re: a }), r += o;
+ continue;
+ }
+ }
+ if (!e && Li.includes(h) && n[r + 1] === "(") {
+ i.push({ t: "open", type: h }), r += 2;
+ continue;
+ }
+ i.push(!e && h === "|" ? { t: "bar" } : !e && h === ")" ? { t: "close" } : h === "*" ? { t: "star" } : h === "?" ? { t: "any" } : et(h)), r += h.length;
}
- const children = this.children();
- const name = this.nocase ? normalizeNocase(pathPart) : normalize2(pathPart);
- for (const p of children) {
- if (p.#matchName === name) {
- return p;
+ return i;
+ }, zi = (n) => {
+ let t = /* @__PURE__ */ new Map(), e = [];
+ return n.forEach((s, i) => {
+ s.t === "open" ? e.push(i) : s.t === "close" && e.length && t.set(e.pop(), i);
+ }), t;
+ }, Ss = (n, t, e, s, i) => {
+ let r = [], h = [r];
+ for (let a = e; a < s; a++) {
+ let o = n[a], l = t.get(a);
+ if (o.t === "open" && l !== void 0) {
+ let c = Ss(n, t, a + 1, l, false);
+ r.push({ t: "ext", type: o.type, alts: c }), a = l;
+ } else o.t === "bar" && !i ? h.push(r = []) : o.t === "open" ? r.push(et(o.type), et("(")) : o.t === "bar" ? r.push(et("|")) : o.t === "close" ? r.push(et(")")) : r.push(o);
+ }
+ return h;
+ }, vs = (n, t) => {
+ let e = [], s = "", i = () => {
+ for (let r of s.normalize(t)) e.push(et(r));
+ s = "";
+ };
+ for (let r of n) {
+ if (r.t === "lit") {
+ s += r.ch;
+ continue;
+ }
+ i(), e.push(r.t === "ext" ? { ...r, alts: r.alts.map((h) => vs(h, t)) } : r);
+ }
+ return i(), e;
+ }, Gi = (n, t) => {
+ let e = 1, s = (a) => ({ t: "split", id: e++, out: a }), i = (a, o) => a.reduceRight((l, c) => r(c, l), o), r = (a, o) => {
+ switch (a.t) {
+ case "lit":
+ let p = t ? Oe(a.ch) : void 0;
+ return { t: "lit", id: e++, ch: a.ch, re: p, next: o };
+ case "any":
+ case "star":
+ return { t: a.t, id: e++, next: o };
+ case "class":
+ return { t: "class", id: e++, re: a.re, next: o };
+ }
+ let l = (p) => a.alts.map((d) => i(d, p));
+ switch (a.type) {
+ case "@":
+ return s(l(o));
+ case "?":
+ return s([o, ...l(o)]);
+ case "!":
+ return { t: "neg", id: e++, sub: s(l(Ee)), next: o };
+ }
+ let c = s([]), u = s(l(c));
+ return c.out.push(o, u), a.type === "*" ? c : u;
+ };
+ return [i(n, Ee), e];
+ }, Ii = (n) => {
+ let t = [], e = /* @__PURE__ */ new Set(), s = (r) => r.t === "match" ? "match" : String(r.id), i = (r, h) => {
+ if (r.t === "match" || e.has(r)) return;
+ e.add(r);
+ let a = (o) => t.push(`${h}${r.id}: ${o}`);
+ switch (r.t) {
+ case "split":
+ a(`split -> ${r.out.map(s).join(", ")}`);
+ for (let o of r.out) i(o, h);
+ return;
+ case "neg":
+ return a(`!(${s(r.sub)}) -> ${s(r.next)}`), i(r.sub, h + " "), i(r.next, h);
+ case "lit":
+ a(`${JSON.stringify(r.ch)} -> ${s(r.next)}`);
+ break;
+ case "class":
+ a(`${r.re} -> ${s(r.next)}`);
+ break;
+ default:
+ a(`${r.t === "any" ? "?" : "*"} -> ${s(r.next)}`);
+ }
+ i(r.next, h);
+ };
+ return i(n, ""), [`start -> ${s(n)}`, ...t].join(`
+`);
+ }, Ce = class {
+ gen;
+ threads = [];
+ match = false;
+ runs = [];
+ ids = [];
+ constructor(t) {
+ this.gen = t;
+ }
+ get dead() {
+ return !this.threads.length && !this.match && !this.runs.length;
+ }
+ }, _s = (n, t) => n.ids.length !== t.ids.length || n.runs.length !== t.runs.length || n.ids.some((e, s) => e !== t.ids[s]) ? false : n.runs.every((e) => t.runs.some((s) => s.neg === e.neg && _s(s.state, e.state))), ws = (n) => ({ has: new Float64Array(n), seen: new Float64Array(n), gen: 0 }), ut = class {
+ dots;
+ dotStart;
+ #t;
+ constructor(t, e, s) {
+ this.dots = t, this.dotStart = e, this.#t = s;
+ }
+ state() {
+ return new Ce(++this.#t.gen);
+ }
+ done(t) {
+ return t.ids = t.threads.map((e) => e.id).sort((e, s) => e - s), t.match && t.ids.unshift(Ee.id), t;
+ }
+ #i(t, e) {
+ let { seen: s } = this.#t;
+ return s[e.id] === t.gen ? false : (s[e.id] = t.gen, true);
+ }
+ #e(t, e) {
+ let { has: s } = this.#t;
+ return s[e.id] === t.gen ? false : (s[e.id] = t.gen, t.threads.push(e), true);
+ }
+ restricted(t, e) {
+ return e && (this.dots || this.dotStart && t === 0);
+ }
+ add(t, e, s, i) {
+ switch (e.t) {
+ case "split":
+ if (!this.#i(t, e)) return;
+ for (let h of e.out) this.add(t, h, s, i);
+ return;
+ case "neg":
+ if (!this.#i(t, e)) return;
+ let r = this.state();
+ return this.add(r, e.sub, s, false), this.done(r), this.addRun(t, { t: "run", neg: e, state: r }, s, i);
+ case "star":
+ if (this.restricted(s, i)) return;
+ this.#e(t, e) && this.add(t, e.next, s, i);
+ return;
+ case "match":
+ t.match = true;
+ return;
+ default:
+ this.#e(t, e);
}
}
- const s = this.parent ? this.sep : "";
- const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : void 0;
- const pchild = this.newChild(pathPart, UNKNOWN, {
- ...opts,
- parent: this,
- fullpath
- });
- if (!this.canReaddir()) {
- pchild.#type |= ENOENT;
+ addRun(t, e, s, i) {
+ for (let r of t.runs) if (r.neg === e.neg && _s(r.state, e.state)) return;
+ t.runs.push(e), e.state.match || this.add(t, e.neg.next, s, i);
}
- children.push(pchild);
- return pchild;
- }
- /**
- * The relative path from the cwd. If it does not share an ancestor with
- * the cwd, then this ends up being equivalent to the fullpath()
- */
- relative() {
- if (this.isCWD)
- return "";
- if (this.#relative !== void 0) {
- return this.#relative;
+ step(t, e, s, i) {
+ let r = this.state();
+ for (let h of t.threads) switch (h.t) {
+ case "lit":
+ Me(h, e) && this.add(r, h.next, s + 1, i);
+ break;
+ case "any":
+ this.restricted(s, i) || this.add(r, h.next, s + 1, i);
+ break;
+ case "class":
+ !this.restricted(s, i) && h.re.test(e) && this.add(r, h.next, s + 1, i);
+ break;
+ case "star":
+ this.restricted(s, i) || this.add(r, h, s + 1, i);
+ }
+ if (!this.restricted(s, i)) for (let h of t.runs) {
+ if (h.state.dead) {
+ this.addRun(r, h, s + 1, i);
+ continue;
+ }
+ let a = this.step(h.state, e, s, false);
+ this.addRun(r, { t: "run", neg: h.neg, state: a }, s + 1, i);
+ }
+ return this.done(r);
+ }
+ }, Es = (n) => {
+ let t = n.ids.join();
+ if (!n.runs.length) return t;
+ let e = n.runs.map((s) => `${s.neg.id}(${Es(s.state)})`);
+ return `${t}|${e.sort().join("|")}`;
+ }, Ui = 1 << 18, Ae = class {
+ #t;
+ #i = /* @__PURE__ */ new Map();
+ #e = 0;
+ #h;
+ #n;
+ #d;
+ #c;
+ constructor(t, e) {
+ this.#t = t, this.#d = new ut(false, false, e), this.#c = new ut(false, true, e);
+ }
+ #p(t) {
+ return { state: t, match: t.match, dead: t.dead, next: /* @__PURE__ */ new Map() };
+ }
+ #o(t) {
+ let e = Es(t), s = this.#i.get(e);
+ if (s) return s;
+ this.#e > Ui && this.#m();
+ let i = this.#p(t);
+ return this.#i.set(e, i), this.#e += e.length + 1, i;
+ }
+ #m() {
+ this.#i.clear(), this.#e = 0, this.#h = void 0, this.#n = void 0;
+ }
+ start(t) {
+ if (t) {
+ if (this.#n) return this.#n;
+ let s = this.#c.state();
+ return this.#c.add(s, this.#t, 0, true), this.#n = this.#p(this.#c.done(s));
+ }
+ if (this.#h) return this.#h;
+ let e = this.#d.state();
+ return this.#d.add(e, this.#t, 0, true), this.#h = this.#o(this.#d.done(e));
+ }
+ next(t, e) {
+ let s = e.charCodeAt(0), i = s < 128 ? void 0 : t.next.get(e);
+ if (i) return i;
+ let r = t === this.#n ? this.#o(this.#c.step(t.state, e, 0, true)) : this.#o(this.#d.step(t.state, e, 1, true));
+ return s < 128 ? (t.ascii || (t.ascii = new Array(128), this.#e += 128), t.ascii[s] = r) : t.next.set(e, r), this.#e++, r;
+ }
+ }, $i = (n) => {
+ let t = [];
+ for (let e = n; e.t !== "match"; e = e.next) {
+ if (e.t === "split" || e.t === "neg") return;
+ t.push(e);
+ }
+ return t;
+ }, qi = (n, t, e, s) => {
+ let i = 0, r = e, h = -1, a = 0;
+ for (; r < s; ) {
+ let o = n[i];
+ if (o?.t === "star") {
+ h = i++, a = r;
+ continue;
+ }
+ let l = t[r];
+ if (o && (o.t === "any" || o.t === "lit" && Me(o, l) || o.t === "class" && o.re.test(l))) {
+ i++, r++;
+ continue;
+ }
+ if (h === -1) return false;
+ i = h + 1, r = ++a;
+ }
+ for (; n[i]?.t === "star"; ) i++;
+ return i === n.length;
+ }, Os = (n) => {
+ let t = 0, e = 0;
+ for (let s of n) {
+ let [i, r] = Hi(s);
+ t += i, e += r;
+ }
+ return [t, e];
+ }, Hi = (n) => {
+ if (n.t === "star") return [0, 1 / 0];
+ if (n.t !== "ext") return [1, 1];
+ if (n.type === "!") return [0, 1 / 0];
+ let t = n.alts.map(Os), e = Math.min(...t.map((r) => r[0])), s = Math.max(...t.map((r) => r[1])), i = s === 0 ? 0 : 1 / 0;
+ return n.type === "@" ? [e, s] : n.type === "?" ? [0, s] : n.type === "*" ? [0, i] : [e, i];
+ }, bs = (n, t, e) => {
+ for (let s = 0; s < n.length; s++) if (!Me(n[s], t[e + s])) return false;
+ return true;
+ }, Xi = /[/\ud800-\udfff]/, Ki = /[\ud800-\udfff]/, Ft = (n) => Ki.test(n) ? [...n] : n, ys = (n) => {
+ if (n.includes("/")) throw new Error("can only match a single path portion, got: " + n);
+ }, ke = class {
+ pattern;
+ options;
+ #t;
+ #i;
+ #e;
+ #h;
+ #n;
+ #d;
+ #c;
+ #p = false;
+ #o = 0;
+ #m = 1 / 0;
+ #a = [];
+ #l = [];
+ #r;
+ #w;
+ #_ = false;
+ #b;
+ #u;
+ constructor(t, e = {}) {
+ if (t.includes("/")) throw new Error("can only match a single path portion, got pattern: " + t);
+ this.pattern = t, this.options = e;
+ let { nocase: s = false, noext: i = false, normalize: r } = e;
+ this.#u = r === true ? "NFC" : r || void 0;
+ let h = /^[?*+@]\(\)$/.test(t), a = Bi(t, s, i || h, this.#u), [o] = Ss(a, zi(a), 0, a.length, true);
+ this.#u && (o = vs(o, this.#u));
+ let [l, c] = Gi(o, s);
+ if (this.#t = l, this.#i = c, o.every((u) => u.t === "lit")) this.#n = o.map((u) => u.ch).join(""), s && (this.#d = Oe(this.#n));
+ else {
+ let u = (g) => g.t !== "lit" ? void 0 : s ? { ch: g.ch, re: Oe(g.ch) } : { ch: g.ch };
+ for (let g of o) {
+ let f = u(g);
+ if (!f) break;
+ this.#a.push(f);
+ }
+ for (let g = o.length - 1; g >= 0; g--) {
+ let f = u(o[g]);
+ if (!f) break;
+ this.#l.unshift(f);
+ }
+ this.#_ = !!(this.#a.length || this.#l.length), s || (this.#r = this.#a.map((g) => g.ch).join(""), this.#w = this.#l.map((g) => g.ch).join("")), this.#c = $i(this.#t)?.slice(this.#a.length, -this.#l.length || void 0), this.#p = !!this.#c?.every((g) => g.t === "star" || g.t === "any");
+ let [p, d] = Os(o);
+ this.#o = p, this.#m = d;
+ }
+ }
+ test(t) {
+ return this.#u ? (ys(t), this.#v(t.normalize(this.#u))) : Xi.test(t) ? (ys(t), this.#v(t, [...t])) : this.#v(t, t);
+ }
+ testUnchecked(t) {
+ return this.#v(this.#u ? t.normalize(this.#u) : t);
+ }
+ #v(t, e) {
+ if (this.#n !== void 0) return this.#d ? this.#d.test(t) : t === this.#n;
+ let s = this.#o, i = this.#m;
+ if (e === void 0) {
+ let c = t.length, u = c + 1 >> 1;
+ if (c < s || u > i) return false;
+ (u < s || c > i) && (e = Ft(t));
+ }
+ if (e !== void 0 && (e.length < s || e.length > i)) return false;
+ let r = this.#a.length;
+ if (this.#_) if (this.#r !== void 0 && this.#w !== void 0) {
+ if (!t.startsWith(this.#r) || !t.endsWith(this.#w)) return false;
+ } else {
+ e ??= Ft(t);
+ let c = e.length - this.#l.length;
+ if (!bs(this.#a, e, 0) || !bs(this.#l, e, c)) return false;
+ }
+ let h = !this.options.dot && t.startsWith(".");
+ if (this.#c) {
+ if (t === "." || t === ".." || h && !r) return false;
+ if (this.#p) return true;
+ e ??= Ft(t);
+ let c = e.length - this.#l.length;
+ return qi(this.#c, e, r, c);
+ }
+ if (e ??= Ft(t), t === "." || t === "..") {
+ this.#e ??= ws(this.#i);
+ let c = this.#h ??= new ut(true, false, this.#e), u = c.state();
+ c.add(u, this.#t, 0, true);
+ let p = c.done(u);
+ for (let d = 0; d < e.length; d++) p = c.step(p, e[d], d, true);
+ return p.match;
+ }
+ this.#e ??= ws(this.#i);
+ let a = this.#b ??= new Ae(this.#t, this.#e), o = a.start(h), l = e === t;
+ for (let c = 0; c < e.length; c++) {
+ if (o.dead) return false;
+ let u = l ? t.charCodeAt(c) : e[c].charCodeAt(0);
+ o = o.ascii?.[u] ?? a.next(o, e[c]);
+ }
+ return o.match;
}
- const name = this.name;
- const p = this.parent;
- if (!p) {
- return this.#relative = this.name;
+ toString() {
+ return Ii(this.#t);
}
- const pv = p.relative();
- return pv + (!pv || !p.parent ? "" : this.sep) + name;
- }
- /**
- * The relative path from the cwd, using / as the path separator.
- * If it does not share an ancestor with
- * the cwd, then this ends up being equivalent to the fullpathPosix()
- * On posix systems, this is identical to relative().
- */
- relativePosix() {
- if (this.sep === "/")
- return this.relative();
- if (this.isCWD)
- return "";
- if (this.#relativePosix !== void 0)
- return this.#relativePosix;
- const name = this.name;
- const p = this.parent;
- if (!p) {
- return this.#relativePosix = this.fullpathPosix();
+ };
+ jt.Matcher = ke;
+ });
+ var As = x((Dt) => {
+ "use strict";
+ Object.defineProperty(Dt, "__esModule", { value: true });
+ Dt.assertValidPattern = void 0;
+ var Vi = 1024 * 64, Yi = (n) => {
+ if (typeof n != "string") throw new TypeError("invalid pattern");
+ if (n.length > Vi) throw new TypeError("pattern is too long");
+ };
+ Dt.assertValidPattern = Yi;
+ });
+ var xe = x((Nt) => {
+ "use strict";
+ Object.defineProperty(Nt, "__esModule", { value: true });
+ Nt.escape = void 0;
+ var Zi = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
+ Nt.escape = Zi;
+ });
+ var Re = x((Lt) => {
+ "use strict";
+ Object.defineProperty(Lt, "__esModule", { value: true });
+ Lt.unescape = void 0;
+ var Ji = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => e ? t ? n.replace(/\[([^/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1") : t ? n.replace(/\[([^/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
+ Lt.unescape = Ji;
+ });
+ var Y = x((w) => {
+ "use strict";
+ Object.defineProperty(w, "__esModule", { value: true });
+ w.unescape = w.escape = w.Minimatch = w.match = w.braceExpand = w.defaults = w.filter = w.GLOBSTAR = w.sep = w.minimatch = void 0;
+ var Qi = ms(), ks = Cs(), zt = As(), tr = xe(), er = Re(), sr = (n, t, e = {}) => ((0, zt.assertValidPattern)(t), !e.nocomment && t.charAt(0) === "#" ? false : new ht(t, e).match(n));
+ w.minimatch = sr;
+ var Fs = typeof process == "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", Ms = { win32: { sep: "\\" }, posix: { sep: "/" } };
+ w.sep = Fs === "win32" ? Ms.win32.sep : Ms.posix.sep;
+ w.minimatch.sep = w.sep;
+ w.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
+ w.minimatch.GLOBSTAR = w.GLOBSTAR;
+ var ir = (n, t = {}) => (e) => (0, w.minimatch)(e, n, t);
+ w.filter = ir;
+ w.minimatch.filter = w.filter;
+ var q = (n, t = {}) => Object.assign({}, n, t), rr = (n) => {
+ if (!n || typeof n != "object" || !Object.keys(n).length) return w.minimatch;
+ let t = w.minimatch;
+ return Object.assign((s, i, r = {}) => t(s, i, q(n, r)), { Minimatch: class extends t.Minimatch {
+ constructor(i, r = {}) {
+ super(i, q(n, r));
+ }
+ static defaults(i) {
+ return t.defaults(q(n, i)).Minimatch;
+ }
+ }, unescape: (s, i = {}) => t.unescape(s, q(n, i)), escape: (s, i = {}) => t.escape(s, q(n, i)), filter: (s, i = {}) => t.filter(s, q(n, i)), defaults: (s) => t.defaults(q(n, s)), braceExpand: (s, i = {}) => t.braceExpand(s, q(n, i)), match: (s, i, r = {}) => t.match(s, i, q(n, r)), sep: t.sep, GLOBSTAR: w.GLOBSTAR });
+ };
+ w.defaults = rr;
+ w.minimatch.defaults = w.defaults;
+ var nr = (n, t = {}) => ((0, zt.assertValidPattern)(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : (0, Qi.expand)(n, { max: t.braceExpandMax }));
+ w.braceExpand = nr;
+ w.minimatch.braceExpand = w.braceExpand;
+ var hr = (n, t, e = {}) => {
+ let s = new ht(t, e);
+ return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
+ };
+ w.match = hr;
+ w.minimatch.match = w.match;
+ var xs = /[?*]|[+@!]\(.*?\)|\[|\]/, js = (n, t) => {
+ let e = t + 1;
+ (n.charAt(e) === "!" || n.charAt(e) === "^") && e++;
+ let s = false;
+ for (; e < n.length; e++) {
+ let i = n.charAt(e);
+ if (i === "]" && s) return e;
+ s = true, i === "\\" && e++;
}
- const pv = p.relativePosix();
- return pv + (!pv || !p.parent ? "" : "/") + name;
- }
- /**
- * The fully resolved path string for this Path entry
- */
- fullpath() {
- if (this.#fullpath !== void 0) {
- return this.#fullpath;
+ return -1;
+ }, or = (n, t) => {
+ if (!t && (n === "+()" || n === "@()")) return n;
+ let e = "";
+ for (let s = 0; s < n.length; s++) {
+ let i = n.charAt(s);
+ if (i === "\\") e += n.charAt(++s) || i;
+ else {
+ if (i === "*" || i === "?") return;
+ if (i === "[") {
+ let r = js(n, s);
+ if (r === -1) {
+ e += i;
+ continue;
+ }
+ let h = n.slice(s + 1, r);
+ if (h.startsWith("\\") && (h = h.slice(1)), [...h].length !== 1 || "!^".includes(n.charAt(s + 1))) return;
+ e += h, s = r;
+ } else {
+ if (!t && "+@!".includes(i) && n.charAt(s + 1) === "(" && n.includes(")", s + 2)) return;
+ e += i;
+ }
+ }
+ }
+ return e;
+ }, ar = (n) => {
+ if (/^[?*+@]\(\)$/.test(n) || n.includes("[:")) return false;
+ let t = 0;
+ for (let e = 0; e < n.length; e++) {
+ let s = n.charAt(e);
+ if (s === "\\") {
+ if (++e === n.length) return false;
+ } else if (s === "[") {
+ let i = js(n, e);
+ i !== -1 && (e = i);
+ } else if ("+@!?*".includes(s) && n.charAt(e + 1) === "(") t++, e++;
+ else if (s === ")") {
+ if (!t--) return false;
+ } else if (s === "|" && !t) return false;
+ }
+ return !t;
+ }, Pe, Rs, V = (n, t) => typeof n == "string" ? t === n : t !== "" && n.testUnchecked(t), Ps = (n, t, e, s, i) => V(n, t) ? e : s !== void 0 && V(n, s) ? i : -1, je = (n) => n === "." || n === "..", Te = (n) => typeof n == "string" && /^[a-z]:$/i.test(n), Bt = (n) => typeof n == "string" && /^unc$/i.test(n), Fe = (n) => {
+ if (n[0] !== "" || n[1] !== "") return -1;
+ let t = n[2] !== "?" ? 2 : Bt(n[3]) ? 4 : -1, e = n[t], s = n[t + 1];
+ return t !== -1 && e !== void 0 && e !== "" && e !== w.GLOBSTAR && s !== void 0 && s !== "" && s !== w.GLOBSTAR ? t : -1;
+ }, Wt = (n, t) => !je(n) && (t || !n.startsWith(".")), ft = (n, t, e, s, i) => {
+ for (let r = t; r < e; ) {
+ if (n.charCodeAt(r) === 46) {
+ if (!s) return true;
+ let a = n.charCodeAt(r + 1) === 46 ? r + 2 : r + 1;
+ if (a >= e || Gt(n.charCodeAt(a), i)) return true;
+ }
+ let h = De(n, r, i);
+ if (h === -1) return false;
+ for (r = h + 1; r < e && Gt(n.charCodeAt(r), i); ) r++;
+ }
+ return false;
+ }, Gt = (n, t) => t === "/" ? n === 47 : t === "\\" ? n === 92 : n === 47 || n === 92, De = (n, t, e) => {
+ if (e !== "both") return n.indexOf(e, t);
+ let s = n.indexOf("/", t), i = n.indexOf("\\", t);
+ return s === -1 ? i : i === -1 ? s : Math.min(s, i);
+ }, Ts = (n, t, e) => e !== "both" ? n.lastIndexOf(e, t) : Math.max(n.lastIndexOf("/", t), n.lastIndexOf("\\", t)), ht = class {
+ options;
+ set;
+ pattern;
+ windowsPathsNoEscape;
+ nonegate;
+ negate;
+ comment;
+ empty;
+ preserveMultipleSlashes;
+ partial;
+ globSet;
+ globParts;
+ nocase;
+ isWindows;
+ platform;
+ windowsNoMagicRoot;
+ maxGlobstarRecursion;
+ #t;
+ #i;
+ #e;
+ #h;
+ #n = [];
+ #d = [];
+ #c = [];
+ #p = /* @__PURE__ */ new Map();
+ #o = /* @__PURE__ */ new WeakMap();
+ constructor(t, e = {}) {
+ (0, zt.assertValidPattern)(t), e = e || {}, this.options = e, this.maxGlobstarRecursion = e.maxGlobstarRecursion ?? 200, this.pattern = t, this.platform = e.platform || Fs, this.isWindows = this.platform === "win32";
+ let s = "allowWindowsEscape";
+ this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === false, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.negate = false, this.nonegate = !!e.nonegate, this.comment = false, this.empty = false, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.#t = !this.preserveMultipleSlashes, this.#e = (e.optimizationLevel ?? 1) >= 2;
+ let i = e.normalize;
+ this.#h = i === true ? "NFC" : i || void 0, this.make();
+ let r = this.set.map((h) => this.#a(h));
+ this.#c = this.set.map((h, a) => this.#t && h.length - 1 > r[a]), this.#n = this.set.map((h, a) => {
+ let o = this.#c[a] ? h.length - 1 : h.length, l = h.slice(r[a] + 1, o).filter((c) => typeof c == "string" && !!c);
+ return [...new Set(l)];
+ }), this.#i = this.#n.some((h) => h.length), this.#d = this.set.map((h, a) => {
+ let [o, l, c] = h;
+ if (this.#c[a] && h.length === 2 && o === w.GLOBSTAR && l !== w.GLOBSTAR) return "tail";
+ if (this.#c[a] && e.matchBase && h.length === 1 && o !== w.GLOBSTAR && o !== "") return "base";
+ if (!(!this.#t || r[a] !== -1)) {
+ if (h.length === 3 && o === w.GLOBSTAR && c === w.GLOBSTAR && l !== w.GLOBSTAR && l !== "" && this.maxGlobstarRecursion > 0) return "mid";
+ if (h.length === 2 && l === w.GLOBSTAR && o !== w.GLOBSTAR && o !== "") return "head";
+ }
+ });
}
- const name = this.name;
- const p = this.parent;
- if (!p) {
- return this.#fullpath = this.name;
+ #m(t) {
+ return this.#h ? t.normalize(this.#h) : t;
}
- const pv = p.fullpath();
- const fp = pv + (!p.parent ? "" : this.sep) + name;
- return this.#fullpath = fp;
- }
- /**
- * On platforms other than windows, this is identical to fullpath.
- *
- * On windows, this is overridden to return the forward-slash form of the
- * full UNC path.
- */
- fullpathPosix() {
- if (this.#fullpathPosix !== void 0)
- return this.#fullpathPosix;
- if (this.sep === "/")
- return this.#fullpathPosix = this.fullpath();
- if (!this.parent) {
- const p2 = this.fullpath().replace(/\\/g, "/");
- if (/^[a-z]:\//i.test(p2)) {
- return this.#fullpathPosix = `//?/${p2}`;
- } else {
- return this.#fullpathPosix = p2;
+ #a(t) {
+ if (!this.isWindows) return -1;
+ if (Te(t[0])) return 0;
+ if (t[0] === "" && t[1] === "" && t[2] === "?" && Te(t[3])) return 3;
+ let s = Fe(t);
+ return s === -1 ? -1 : s + 1;
+ }
+ hasMagic() {
+ if (this.options.magicalBraces && this.set.length > 1) return true;
+ for (let t of this.set) for (let e of t) if (typeof e != "string") return true;
+ return false;
+ }
+ make() {
+ let t = this.pattern, e = this.options;
+ if (!e.nocomment && t.charAt(0) === "#") {
+ this.comment = true;
+ return;
+ }
+ if (!t) {
+ this.empty = true;
+ return;
+ }
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())];
+ let s = this.globSet.map((r) => this.#S(r));
+ this.globParts = this.preprocess(s);
+ let i = this.globParts.map((r, h, a) => {
+ if (this.isWindows && this.windowsNoMagicRoot) {
+ let o = r[2] === "?" && Bt(r[3]) ? 6 : 4, l = r[0] === "" && r[1] === "" && (r[2] === "?" || !xs.test(r[2])) && r.slice(3, o).every((u) => !xs.test(u)), c = /^[a-z]:/i.test(r[0]);
+ if (l) return [...r.slice(0, o).map((u) => this.#m(u)), ...r.slice(o).map((u) => this.parse(u))];
+ if (c) return [this.#m(r[0]), ...r.slice(1).map((u) => this.parse(u))];
+ }
+ return r.map((o) => this.parse(o));
+ });
+ if (this.set = i.filter((r) => r.indexOf(false) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) {
+ let h = this.set[r];
+ h[0] === "" && h[1] === "" && this.globParts[r][2] === "?" && (Te(h[3]) || Bt(this.globParts[r][3])) && (Bt(this.globParts[r][3]) && (h[3] = "UNC"), h[2] = "?");
+ }
+ e.noext || this.mergeRows();
+ }
+ mergeRows() {
+ let t = true;
+ for (; t; ) {
+ t = false;
+ let e = Math.max(0, ...this.set.map((s) => s.length));
+ for (let s = 0; s < e; s++) {
+ let i = /* @__PURE__ */ new Map();
+ this.set.forEach((h, a) => {
+ if (!(h[s] instanceof ks.Matcher) || !ar(this.globParts[a][s])) return;
+ let o = [...this.globParts[a]];
+ o[s] = "";
+ let l = `${h.length}/${o.join("/")}`, c = i.get(l);
+ c ? c.push(a) : i.set(l, [a]);
+ });
+ let r = /* @__PURE__ */ new Set();
+ for (let h of i.values()) {
+ if (h.length < 2) continue;
+ let [a, ...o] = h, c = `@(${h.map((u) => this.globParts[u][s]).join("|")})`;
+ this.globParts[a][s] = c, this.set[a][s] = this.parse(c);
+ for (let u of o) r.add(u);
+ }
+ r.size && (t = true, this.set = this.set.filter((h, a) => !r.has(a)), this.globParts = this.globParts.filter((h, a) => !r.has(a)));
+ }
}
}
- const p = this.parent;
- const pfpp = p.fullpathPosix();
- const fpp = pfpp + (!pfpp || !p.parent ? "" : "/") + this.name;
- return this.#fullpathPosix = fpp;
- }
- /**
- * Is the Path of an unknown type?
- *
- * Note that we might know *something* about it if there has been a previous
- * filesystem operation, for example that it does not exist, or is not a
- * link, or whether it has child entries.
- */
- isUnknown() {
- return (this.#type & IFMT) === UNKNOWN;
- }
- isType(type) {
- return this[`is${type}`]();
- }
- getType() {
- return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : (
- /* c8 ignore start */
- this.isSocket() ? "Socket" : "Unknown"
- );
- }
- /**
- * Is the Path a regular file?
- */
- isFile() {
- return (this.#type & IFMT) === IFREG;
- }
- /**
- * Is the Path a directory?
- */
- isDirectory() {
- return (this.#type & IFMT) === IFDIR;
- }
- /**
- * Is the path a character device?
- */
- isCharacterDevice() {
- return (this.#type & IFMT) === IFCHR;
- }
- /**
- * Is the path a block device?
- */
- isBlockDevice() {
- return (this.#type & IFMT) === IFBLK;
- }
- /**
- * Is the path a FIFO pipe?
- */
- isFIFO() {
- return (this.#type & IFMT) === IFIFO;
- }
- /**
- * Is the path a socket?
- */
- isSocket() {
- return (this.#type & IFMT) === IFSOCK;
- }
- /**
- * Is the path a symbolic link?
- */
- isSymbolicLink() {
- return (this.#type & IFLNK) === IFLNK;
- }
- /**
- * Return the entry if it has been subject of a successful lstat, or
- * undefined otherwise.
- *
- * Does not read the filesystem, so an undefined result *could* simply
- * mean that we haven't called lstat on it.
- */
- lstatCached() {
- return this.#type & LSTAT_CALLED ? this : void 0;
- }
- /**
- * Return the cached link target if the entry has been the subject of a
- * successful readlink, or undefined otherwise.
- *
- * Does not read the filesystem, so an undefined result *could* just mean we
- * don't have any cached data. Only use it if you are very sure that a
- * readlink() has been called at some point.
- */
- readlinkCached() {
- return this.#linkTarget;
- }
- /**
- * Returns the cached realpath target if the entry has been the subject
- * of a successful realpath, or undefined otherwise.
- *
- * Does not read the filesystem, so an undefined result *could* just mean we
- * don't have any cached data. Only use it if you are very sure that a
- * realpath() has been called at some point.
- */
- realpathCached() {
- return this.#realpath;
- }
- /**
- * Returns the cached child Path entries array if the entry has been the
- * subject of a successful readdir(), or [] otherwise.
- *
- * Does not read the filesystem, so an empty array *could* just mean we
- * don't have any cached data. Only use it if you are very sure that a
- * readdir() has been called recently enough to still be valid.
- */
- readdirCached() {
- const children = this.children();
- return children.slice(0, children.provisional);
- }
- /**
- * Return true if it's worth trying to readlink. Ie, we don't (yet) have
- * any indication that readlink will definitely fail.
- *
- * Returns false if the path is known to not be a symlink, if a previous
- * readlink failed, or if the entry does not exist.
- */
- canReadlink() {
- if (this.#linkTarget)
- return true;
- if (!this.parent)
+ preprocess(t) {
+ if (this.options.noglobstar) for (let s of t) for (let i = 0; i < s.length; i++) s[i] === "**" && (s[i] = "*");
+ let { optimizationLevel: e = 1 } = this.options;
+ return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
+ }
+ adjascentGlobstarOptimize(t) {
+ return t.map((e) => {
+ let s = -1;
+ for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
+ let i = s;
+ for (; e[i + 1] === "**"; ) i++;
+ i !== s && e.splice(s, i - s);
+ }
+ return e;
+ });
+ }
+ levelOneOptimize(t) {
+ return t.map((e) => {
+ let s = this.#a(e) + 1;
+ return e = e.reduce((i, r) => {
+ let h = i[i.length - 1];
+ return r === "**" && h === "**" ? i : r === ".." && i.length > s && h && h !== ".." && h !== "." && h !== "**" ? (i.pop(), i) : (i.push(r), i);
+ }, []), e.length === 0 ? [""] : e;
+ });
+ }
+ #l(t) {
+ let e = !this.isWindows || !t.includes("\\") ? "/" : t.includes("/") ? "both" : "\\", s = this.#t ? 0 : -1, i = "", r = 0, h, a = 0, o = !!this.options.dot;
+ t: for (let l = 0; l < this.set.length; l++) {
+ let c = this.set[l], u = c[c.length - 1], p = s !== -1 && this.#c[l] && u !== w.GLOBSTAR;
+ if (p && s === 0) {
+ let f = Ts(t, t.length, e);
+ if (r = f + 1, i = t.slice(r), i === "" && f >= 0) {
+ let m = f;
+ for (; m > 0 && Gt(t.charCodeAt(m - 1), e); ) m--;
+ a = m === 0 ? 0 : Ts(t, m - 1, e) + 1, h = t.slice(a, m);
+ }
+ let b = this.#e && (je(i) || i === "" && h !== void 0 && je(h));
+ s = b ? -1 : 1, p = !b;
+ }
+ let d = -1;
+ if (p && typeof u == "string" && (d = Ps(u, i, r, h, a), d === -1)) continue;
+ if (this.#i) {
+ for (let f of this.#n[l]) if (!t.includes(f)) continue t;
+ }
+ if (p && typeof u == "object" && (d = Ps(u, i, r, h, a), d === -1)) continue;
+ let g = this.#d[l];
+ if (g === "base" && p) return "yes";
+ if (g === "tail" && p) {
+ if (this.#e && ft(t, 0, d, true, e)) return "maybe";
+ if (!ft(t, 0, d, o, e)) return "yes";
+ continue;
+ }
+ if (g === "mid" || g === "head") {
+ let f = this.#w(t, c, g === "head", o, e);
+ if (f !== "no") return f;
+ continue;
+ }
+ return "maybe";
+ }
+ return "no";
+ }
+ #r(t, e, s) {
+ let i = !!this.options.dot, r = t.length;
+ if (s === "head") {
+ if (r < 2 || !V(e[0], t[0])) return false;
+ for (let a = 1; a < r; a++) if (!Wt(t[a], i)) return false;
+ return true;
+ }
+ let h = e[1];
+ if (s === "tail") {
+ let a = r - 1;
+ if (!V(h, t[a]) && (t[a] !== "" || r === 1 || !V(h, t[--a]))) return false;
+ for (let o = 0; o < a; o++) if (!Wt(t[o], i)) return false;
+ return true;
+ }
+ for (let a = 0; a < r; a++) {
+ if (V(h, t[a]) && a + 1 < r) {
+ let o = a + 1;
+ for (; o < r && Wt(t[o], i); ) o++;
+ if (o === r) return true;
+ }
+ if (!Wt(t[a], i)) return false;
+ }
return false;
- const ifmt = this.#type & IFMT;
- return !(ifmt !== UNKNOWN && ifmt !== IFLNK || this.#type & ENOREADLINK || this.#type & ENOENT);
- }
- /**
- * Return true if readdir has previously been successfully called on this
- * path, indicating that cachedReaddir() is likely valid.
- */
- calledReaddir() {
- return !!(this.#type & READDIR_CALLED);
- }
- /**
- * Returns true if the path is known to not exist. That is, a previous lstat
- * or readdir failed to verify its existence when that would have been
- * expected, or a parent entry was marked either enoent or enotdir.
- */
- isENOENT() {
- return !!(this.#type & ENOENT);
- }
- /**
- * Return true if the path is a match for the given path name. This handles
- * case sensitivity and unicode normalization.
- *
- * Note: even on case-sensitive systems, it is **not** safe to test the
- * equality of the `.name` property to determine whether a given pathname
- * matches, due to unicode normalization mismatches.
- *
- * Always use this method instead of testing the `path.name` property
- * directly.
- */
- isNamed(n) {
- return !this.nocase ? this.#matchName === normalize2(n) : this.#matchName === normalizeNocase(n);
- }
- /**
- * Return the Path object corresponding to the target of a symbolic link.
- *
- * If the Path is not a symbolic link, or if the readlink call fails for any
- * reason, `undefined` is returned.
- *
- * Result is cached, and thus may be outdated if the filesystem is mutated.
- */
- async readlink() {
- const target = this.#linkTarget;
- if (target) {
- return target;
}
- if (!this.canReadlink()) {
- return void 0;
+ #w(t, e, s, i, r) {
+ if (this.#e && ft(t, 0, t.length, true, r)) return "maybe";
+ let h = e[s ? 0 : 1], a = 0;
+ for (let o = De(t, a, r); o !== -1; o = De(t, a, r)) {
+ let l = o + 1;
+ for (; l < t.length && Gt(t.charCodeAt(l), r); ) l++;
+ if ((typeof h == "string" ? o - a === h.length && t.startsWith(h, a) : o > a && h.testUnchecked(t.slice(a, o))) && !ft(t, l, t.length, i, r)) return "yes";
+ if (s || ft(t, a, l, i, r)) return "no";
+ a = l;
+ }
+ return "no";
}
- if (!this.parent) {
- return void 0;
+ #_(t) {
+ let e = Pe;
+ return e?.f === t && e.isWindows === this.isWindows && e.preserveMultipleSlashes === this.preserveMultipleSlashes && e.normalize === this.#h ? e : void 0;
+ }
+ #b(t) {
+ let { isWindows: e, preserveMultipleSlashes: s } = this, i = this.#S(e ? t.split("\\").join("/") : t), r = this.#h;
+ return r && (i = i.map((h) => h.normalize(r))), Pe = { f: t, isWindows: e, preserveMultipleSlashes: s, normalize: r, parts: i }, Pe;
+ }
+ #u(t) {
+ let e = [...t], s = false;
+ do {
+ if (s = false, !this.preserveMultipleSlashes) {
+ for (let h = 1; h < e.length - 1; h++) {
+ let a = e[h];
+ h === 1 && a === "" && e[0] === "" || (a === "." || a === "") && (s = true, e.splice(h, 1), h--);
+ }
+ e[0] === "." && e.length === 2 && (e[1] === "." || e[1] === "") && (s = true, e.pop());
+ }
+ let i = this.#a(e) + 1, r = i;
+ for (; (r = e.indexOf("..", r + 1)) !== -1; ) {
+ let h = e[r - 1];
+ h && h !== "." && h !== ".." && h !== "**" && (s = true, e.splice(r - 1, 2), r = Math.max(r - 2, i));
+ }
+ } while (s);
+ return e.length === 0 ? [""] : e;
+ }
+ firstPhasePreProcess(t) {
+ let { braceExpandMax: e = 1e5 } = this.options, s = false;
+ do {
+ s = false;
+ for (let i of t) {
+ let r = -1;
+ for (; (r = i.indexOf("**", r + 1)) !== -1; ) {
+ let o = r;
+ for (; i[o + 1] === "**"; ) o++;
+ o > r && i.splice(r + 1, o - r);
+ let l = i[r + 1], c = i[r + 2], u = i[r + 3];
+ if (l !== ".." || !c || c === "." || c === ".." || !u || u === "." || u === ".." || t.length >= e) continue;
+ s = true, i.splice(r, 1);
+ let p = i.slice(0);
+ p[r] = "**", t.push(p), r--;
+ }
+ if (!this.preserveMultipleSlashes) {
+ for (let o = 1; o < i.length - 1; o++) {
+ let l = i[o];
+ o === 1 && l === "" && i[0] === "" || (l === "." || l === "") && (s = true, i.splice(o, 1), o--);
+ }
+ i[0] === "." && i.length === 2 && (i[1] === "." || i[1] === "") && (s = true, i.pop());
+ }
+ let h = this.#a(i) + 1, a = h;
+ for (; (a = i.indexOf("..", a + 1)) !== -1; ) {
+ let o = i[a - 1];
+ if (o && o !== "." && o !== ".." && o !== "**") {
+ s = true;
+ let c = a === 1 && i[a + 1] === "**" ? ["."] : [];
+ i.splice(a - 1, 2, ...c), i.length === 0 && i.push(""), a = Math.max(a - 2, h);
+ }
+ }
+ }
+ } while (s);
+ return t;
+ }
+ secondPhasePreProcess(t) {
+ if (t.length > 1e3) return t;
+ for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
+ let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
+ if (i) {
+ t[e] = [], t[s] = i;
+ break;
+ }
+ }
+ return t.filter((e) => e.length);
+ }
+ partsMatch(t, e, s = false) {
+ let i = 0, r = 0, h = [], a = "";
+ for (; i < t.length && r < e.length; ) if (t[i] === e[r]) h.push(a === "b" ? e[r] : t[i]), i++, r++;
+ else if (s && t[i] === "**" && e[r] === t[i + 1]) h.push(t[i]), i++;
+ else if (s && e[r] === "**" && t[i] === e[r + 1]) h.push(e[r]), r++;
+ else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
+ if (a === "b") return false;
+ a = "a", h.push(t[i]), i++, r++;
+ } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
+ if (a === "a") return false;
+ a = "b", h.push(e[r]), i++, r++;
+ } else return false;
+ return t.length === e.length && h;
+ }
+ parseNegate() {
+ if (this.nonegate) return;
+ let t = this.pattern, e = false, s = 0;
+ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
+ s && (this.pattern = t.slice(s)), this.negate = e;
+ }
+ #v(t, e, s, i) {
+ let r = 0, h = 0, a = this.isWindows ? Fe(e) : -1, o = a === -1 ? -1 : Fe(s);
+ if (o !== -1) {
+ let l = s[o], c = s[o + 1];
+ typeof l != "string" || typeof c != "string" ? (r = a, h = o) : e[a].toLowerCase() === l.toLowerCase() && e[a + 1].toLowerCase() === c.toLowerCase() && (r = a + 2, h = o + 2);
+ } else if (this.isWindows) {
+ let l = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), c = !l && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), u = typeof s[0] == "string" && /^[a-z]:$/i.test(s[0]), p = !u && s[0] === "" && s[1] === "" && s[2] === "?" && typeof s[3] == "string" && /^[a-z]:$/i.test(s[3]), d = c ? 3 : l ? 0 : void 0, g = p ? 3 : u ? 0 : void 0;
+ if (typeof d == "number" && typeof g == "number") {
+ let [f, b] = [t[d], s[g]];
+ f.toLowerCase() === b.toLowerCase() && (h = g + 1, r = d + 1);
+ }
+ }
+ return t = e, s.includes(w.GLOBSTAR) ? this.#y(t, s, i, r, h) : this.#g(t, s, i, r, h);
+ }
+ #y(t, e, s, i, r) {
+ let { head: h, body: a, tail: o, segments: l } = this.#E(e, s, r);
+ if (h.length) {
+ let u = i + h.length;
+ if (!this.#g(t, h, s, i, 0, u)) return false;
+ i += h.length, r += h.length;
+ }
+ let c = 0;
+ if (o.length) {
+ if (o.length + i > t.length) return false;
+ let u = t.length - o.length;
+ if (this.#g(t, o, s, u, 0)) c = o.length;
+ else {
+ if (t[t.length - 1] !== "" || i + o.length === t.length || (u--, !this.#g(t, o, s, u, 0))) return false;
+ c = o.length + 1;
+ }
+ }
+ if (!a.length) {
+ let u = !!c;
+ for (let p = i; p < t.length - c; p++) {
+ let d = String(t[p]);
+ if (u = true, d === "." || d === ".." || !this.options.dot && d.startsWith(".")) return false;
+ }
+ return s || u;
+ }
+ return !!this.#O(t, l, t.length - c, i, 0, s, 0, !!c, /* @__PURE__ */ new Set());
}
- try {
- const read = await this.#fs.promises.readlink(this.fullpath());
- const linkTarget = (await this.parent.realpath())?.resolve(read);
- if (linkTarget) {
- return this.#linkTarget = linkTarget;
+ #E(t, e, s) {
+ let i = this.#o.get(t);
+ i || (i = [], this.#o.set(t, i));
+ let r = s * 2 + (e ? 1 : 0), h = i[r];
+ if (h) return h;
+ let a = t.indexOf(w.GLOBSTAR, s), o = t.lastIndexOf(w.GLOBSTAR), l = t.slice(s, a), c = t.slice(a + 1, e ? void 0 : o), u = e ? [] : t.slice(o + 1), p = [[[], 0]], d = p[0], g = 0, f = [0];
+ for (let m of c) m === w.GLOBSTAR ? (f.push(g), d = [[], 0], p.push(d)) : (d[0].push(m), g++);
+ p.forEach((m, y) => {
+ m[1] = g - f[y];
+ });
+ let b = { head: l, body: c, tail: u, segments: p };
+ return i[r] = b, b;
+ }
+ #O(t, e, s, i, r, h, a, o, l) {
+ let c = e[r];
+ if (!c) {
+ if (h) return i >= s || i === s - 1 && t[i] === "";
+ for (let g = i; g < s; g++) {
+ o = true;
+ let f = t[g];
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
+ }
+ return o;
+ }
+ let [u, p] = c, d = h ? s : s - p;
+ for (; i <= d; ) {
+ let g = r * (t.length + 1) + i;
+ if (l.has(g)) return false;
+ if (l.add(g), this.#g(t, u, h, i, 0, i + u.length) && a < this.maxGlobstarRecursion) {
+ let m = this.#O(t, e, s, i + u.length, r + 1, h, a + 1, o, l);
+ if (m !== false) return m;
+ }
+ if (i === d) break;
+ let b = t[i];
+ if (b === "." || b === ".." || !this.options.dot && b.startsWith(".")) return false;
+ i++;
}
- } catch (er) {
- this.#readlinkFail(er.code);
- return void 0;
+ return h || null;
}
- }
- /**
- * Synchronous {@link PathBase.readlink}
- */
- readlinkSync() {
- const target = this.#linkTarget;
- if (target) {
- return target;
+ #g(t, e, s, i, r, h = t.length) {
+ let a, o, l, c;
+ for (a = i, o = r, c = Math.min(h, t.length), l = e.length; a < c && o < l; a++, o++) {
+ let u = e[o], p = t[a];
+ if (u === false || u === w.GLOBSTAR || !V(u, p)) return false;
+ }
+ if (a === c && o === l) return true;
+ if (a === c) return s;
+ if (o === l) return a === c - 1 && t[a] === "";
+ throw new Error("wtf?");
}
- if (!this.canReadlink()) {
- return void 0;
+ braceExpand() {
+ return (0, w.braceExpand)(this.pattern, this.options);
+ }
+ parse(t) {
+ (0, zt.assertValidPattern)(t);
+ let e = this.options;
+ if (t === "**") return w.GLOBSTAR;
+ if (t === "") return "";
+ let { nocase: s, nocaseMagicOnly: i, noext: r = false, dot: h, normalize: a } = e, o = or(t, r);
+ if (o !== void 0 && !(s && !i && t.toUpperCase() !== t.toLowerCase())) return this.#m(o);
+ let l = this.#p.get(t);
+ return l || (l = new ks.Matcher(t, { nocase: s, noext: r, dot: h, normalize: a }), this.#p.set(t, l)), l;
+ }
+ #S(t) {
+ return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
+ }
+ match(t, e = this.partial) {
+ if (this.comment) return false;
+ if (this.empty) return t === "";
+ if (t === "/" && e) return true;
+ let s = this.options, i = this.#_(t);
+ if (!i) {
+ if (!e && !this.#h && (this.#t || this.#i) && Rs !== t) {
+ Rs = t;
+ let l = this.#l(t);
+ if (l === "no") return s.flipNegate ? false : this.negate;
+ if (l === "yes") return s.flipNegate ? true : !this.negate;
+ }
+ i = this.#b(t);
+ }
+ let r = i.parts, h = this.#e ? i.resolved ??= this.#u(r) : r, a = this.set, o = r[r.length - 1];
+ if (!o) for (let l = r.length - 2; !o && l >= 0; l--) o = r[l];
+ for (let l = 0; l < a.length; l++) {
+ let c = a[l], u = e ? void 0 : this.#d[l];
+ if (u === "base" ? V(c[0], o) : u ? this.#r(h, c, u) : s.matchBase && c.length === 1 ? this.#v([o], [o], c, e) : this.#v(r, h, c, e)) return s.flipNegate ? true : !this.negate;
+ }
+ return s.flipNegate ? false : this.negate;
+ }
+ static defaults(t) {
+ return w.minimatch.defaults(t).Minimatch;
}
- if (!this.parent) {
- return void 0;
+ };
+ w.Minimatch = ht;
+ var lr = xe();
+ Object.defineProperty(w, "escape", { enumerable: true, get: function() {
+ return lr.escape;
+ } });
+ var cr = Re();
+ Object.defineProperty(w, "unescape", { enumerable: true, get: function() {
+ return cr.unescape;
+ } });
+ w.minimatch.Minimatch = ht;
+ w.minimatch.escape = tr.escape;
+ w.minimatch.unescape = er.unescape;
+ });
+ var zs = x((Ut) => {
+ "use strict";
+ var Ns = (n, t) => () => (t || n((t = { exports: {} }).exports, t), t.exports), ur = Ns((n) => {
+ "use strict";
+ Object.defineProperty(n, "__esModule", { value: true }), n.tracing = n.metrics = void 0;
+ var t = require("node:diagnostics_channel");
+ n.metrics = (0, t.channel)("lru-cache:metrics"), n.tracing = (0, t.tracingChannel)("lru-cache");
+ }), fr = Ns((n) => {
+ "use strict";
+ Object.defineProperty(n, "__esModule", { value: true }), n.defaultPerf = void 0, n.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
+ });
+ Object.defineProperty(Ut, "__esModule", { value: true });
+ Ut.LRUCache = void 0;
+ var O = ur(), dr = fr(), Ne = () => O.metrics.hasSubscribers || O.tracing.hasSubscribers, Ls = /* @__PURE__ */ new Set(), Ds = typeof process == "object" && process ? process : {}, pr = (n, t, e, s) => {
+ typeof Ds.emitWarning == "function" ? Ds.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
+ }, mr = (n) => !Ls.has(n), Z = (n) => !!n && n === Math.floor(n) && n > 0 && isFinite(n), Ws = (n) => Z(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? It : null : null, It = class extends Array {
+ constructor(n) {
+ super(n), this.fill(0);
+ }
+ }, gr = class dt {
+ heap;
+ length;
+ static #t = false;
+ static create(t) {
+ let e = Ws(t);
+ if (!e) return [];
+ dt.#t = true;
+ let s = new dt(t, e);
+ return dt.#t = false, s;
+ }
+ constructor(t, e) {
+ if (!dt.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
+ this.heap = new e(t), this.length = 0;
+ }
+ push(t) {
+ this.heap[this.length++] = t;
}
- try {
- const read = this.#fs.readlinkSync(this.fullpath());
- const linkTarget = this.parent.realpathSync()?.resolve(read);
- if (linkTarget) {
- return this.#linkTarget = linkTarget;
- }
- } catch (er) {
- this.#readlinkFail(er.code);
- return void 0;
+ pop() {
+ return this.heap[--this.length];
+ }
+ }, wr = class Bs {
+ #t;
+ #i;
+ #e;
+ #h;
+ #n;
+ #d;
+ #c;
+ #p;
+ get perf() {
+ return this.#p;
+ }
+ ttl;
+ ttlResolution;
+ ttlAutopurge;
+ updateAgeOnGet;
+ updateAgeOnHas;
+ allowStale;
+ noDisposeOnSet;
+ noUpdateTTL;
+ maxEntrySize;
+ sizeCalculation;
+ noDeleteOnFetchRejection;
+ noDeleteOnStaleGet;
+ allowStaleOnFetchAbort;
+ allowStaleOnFetchRejection;
+ ignoreFetchAbort;
+ backgroundFetchSize;
+ #o;
+ #m;
+ #a;
+ #l;
+ #r;
+ #w;
+ #_;
+ #b;
+ #u;
+ #v;
+ #y;
+ #E;
+ #O;
+ #g;
+ #S;
+ #C;
+ #M;
+ #s;
+ #P;
+ static unsafeExposeInternals(t) {
+ return { starts: t.#O, ttls: t.#g, autopurgeTimers: t.#S, sizes: t.#E, keyMap: t.#a, keyList: t.#l, valList: t.#r, next: t.#w, prev: t.#_, get head() {
+ return t.#b;
+ }, get tail() {
+ return t.#u;
+ }, free: t.#v, isBackgroundFetch: (e) => t.#f(e), backgroundFetch: (e, s, i, r) => t.#L(e, s, i, r), moveToTail: (e) => t.#K(e), indexes: (e) => t.#x(e), rindexes: (e) => t.#R(e), isStale: (e) => t.#A(e) };
+ }
+ get max() {
+ return this.#t;
+ }
+ get maxSize() {
+ return this.#i;
+ }
+ get calculatedSize() {
+ return this.#m;
+ }
+ get size() {
+ return this.#o;
+ }
+ get fetchMethod() {
+ return this.#d;
+ }
+ get memoMethod() {
+ return this.#c;
+ }
+ get dispose() {
+ return this.#e;
+ }
+ get onInsert() {
+ return this.#h;
+ }
+ get disposeAfter() {
+ return this.#n;
+ }
+ constructor(t) {
+ let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: h, updateAgeOnHas: a, allowStale: o, dispose: l, onInsert: c, disposeAfter: u, noDisposeOnSet: p, noUpdateTTL: d, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: b, fetchMethod: m, memoMethod: y, noDeleteOnFetchRejection: _2, noDeleteOnStaleGet: v, allowStaleOnFetchRejection: S, allowStaleOnFetchAbort: K, ignoreFetchAbort: z, backgroundFetchSize: $ = 1, perf: nt } = t;
+ if (this.backgroundFetchSize = $, nt !== void 0 && typeof nt?.now != "function") throw new TypeError("perf option must have a now() method if specified");
+ if (this.#p = nt ?? dr.defaultPerf, e !== 0 && !Z(e)) throw new TypeError("max option must be a nonnegative integer");
+ let ge = e ? Ws(e) : Array;
+ if (!ge) throw new Error("invalid max value: " + e);
+ if (this.#t = e, this.#i = g, this.maxEntrySize = f || this.#i, this.sizeCalculation = b, this.sizeCalculation) {
+ if (!this.#i && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
+ if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
+ }
+ if (y !== void 0 && typeof y != "function") throw new TypeError("memoMethod must be a function if defined");
+ if (this.#c = y, m !== void 0 && typeof m != "function") throw new TypeError("fetchMethod must be a function if specified");
+ if (this.#d = m, this.#M = !!m, this.#a = /* @__PURE__ */ new Map(), this.#l = Array.from({ length: e }).fill(void 0), this.#r = Array.from({ length: e }).fill(void 0), this.#w = new ge(e), this.#_ = new ge(e), this.#b = 0, this.#u = 0, this.#v = gr.create(e), this.#o = 0, this.#m = 0, typeof l == "function" && (this.#e = l), typeof c == "function" && (this.#h = c), typeof u == "function" ? (this.#n = u, this.#y = []) : (this.#n = void 0, this.#y = void 0), this.#C = !!this.#e, this.#P = !!this.#h, this.#s = !!this.#n, this.noDisposeOnSet = !!p, this.noUpdateTTL = !!d, this.noDeleteOnFetchRejection = !!_2, this.allowStaleOnFetchRejection = !!S, this.allowStaleOnFetchAbort = !!K, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
+ if (this.#i !== 0 && !Z(this.#i)) throw new TypeError("maxSize must be a positive integer if specified");
+ if (!Z(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
+ this.#$();
+ }
+ if (this.allowStale = !!o, this.noDeleteOnStaleGet = !!v, this.updateAgeOnGet = !!h, this.updateAgeOnHas = !!a, this.ttlResolution = Z(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
+ if (!Z(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
+ this.#T();
+ }
+ if (this.#t === 0 && this.ttl === 0 && this.#i === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
+ if (!this.ttlAutopurge && !this.#t && !this.#i) {
+ let we = "LRU_CACHE_UNBOUNDED";
+ mr(we) && (Ls.add(we), pr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", we, Bs));
+ }
+ }
+ getRemainingTTL(t) {
+ return this.#a.has(t) ? 1 / 0 : 0;
+ }
+ #T() {
+ let t = new It(this.#t), e = new It(this.#t);
+ this.#g = t, this.#O = e;
+ let s = this.ttlAutopurge ? Array.from({ length: this.#t }) : void 0;
+ this.#S = s, this.#B = (o, l, c = this.#p.now()) => {
+ e[o] = l !== 0 ? c : 0, t[o] = l, i(o, l);
+ }, this.#k = (o) => {
+ e[o] = t[o] !== 0 ? this.#p.now() : 0, i(o, t[o]);
+ };
+ let i = this.ttlAutopurge ? (o, l) => {
+ if (s?.[o] && (clearTimeout(s[o]), s[o] = void 0), l && l !== 0 && s) {
+ let c = setTimeout(() => {
+ this.#A(o) ? (this.#W(this.#l[o], "expire"), s[o] = void 0) : i(o, a(o));
+ }, l + 1);
+ c.unref && c.unref(), s[o] = c;
+ }
+ } : () => {
+ };
+ this.#F = (o, l) => {
+ if (t[l]) {
+ let c = t[l], u = e[l];
+ if (!c || !u) return;
+ o.ttl = c, o.start = u, o.now = r || h();
+ let p = o.now - u;
+ o.remainingTTL = c - p;
+ }
+ };
+ let r = 0, h = () => {
+ let o = this.#p.now();
+ if (this.ttlResolution > 0) {
+ r = o;
+ let l = setTimeout(() => r = 0, this.ttlResolution);
+ l.unref && l.unref();
+ }
+ return o;
+ };
+ this.getRemainingTTL = (o) => {
+ let l = this.#a.get(o);
+ return l === void 0 ? 0 : a(l);
+ };
+ let a = (o) => {
+ let l = t[o], c = e[o];
+ if (!l || !c) return 1 / 0;
+ let u = (r || h()) - c;
+ return l - u;
+ };
+ this.#A = (o) => {
+ let l = e[o], c = t[o];
+ return !!c && !!l && (r || h()) - l > c;
+ };
}
- }
- #readdirSuccess(children) {
- this.#type |= READDIR_CALLED;
- for (let p = children.provisional; p < children.length; p++) {
- const c = children[p];
- if (c)
- c.#markENOENT();
+ #k = () => {
+ };
+ #F = () => {
+ };
+ #B = () => {
+ };
+ #A = () => false;
+ #$() {
+ let t = new It(this.#t);
+ this.#m = 0, this.#E = t, this.#D = (e) => {
+ this.#m -= t[e], t[e] = 0;
+ }, this.#z = (e, s, i, r) => {
+ if (!Z(i)) {
+ if (this.#f(s)) return this.backgroundFetchSize;
+ if (r) {
+ if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
+ if (i = r(s, e), !Z(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
+ }
+ return i;
+ }, this.#j = (e, s, i) => {
+ if (t[e] = s, this.#i) {
+ let r = this.#i - t[e];
+ for (; this.#m > r; ) this.#U(true);
+ }
+ this.#m += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#m);
+ };
}
- }
- #markENOENT() {
- if (this.#type & ENOENT)
- return;
- this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN;
- this.#markChildrenENOENT();
- }
- #markChildrenENOENT() {
- const children = this.children();
- children.provisional = 0;
- for (const p of children) {
- p.#markENOENT();
+ #D = (t) => {
+ };
+ #j = (t, e, s) => {
+ };
+ #z = (t, e, s, i) => {
+ if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
+ return 0;
+ };
+ *#x({ allowStale: t = this.allowStale } = {}) {
+ if (this.#o) for (let e = this.#u; this.#G(e) && ((t || !this.#A(e)) && (yield e), e !== this.#b); ) e = this.#_[e];
}
- }
- #markENOREALPATH() {
- this.#type |= ENOREALPATH;
- this.#markENOTDIR();
- }
- // save the information when we know the entry is not a dir
- #markENOTDIR() {
- if (this.#type & ENOTDIR)
- return;
- let t = this.#type;
- if ((t & IFMT) === IFDIR)
- t &= IFMT_UNKNOWN;
- this.#type = t | ENOTDIR;
- this.#markChildrenENOENT();
- }
- #readdirFail(code = "") {
- if (code === "ENOTDIR" || code === "EPERM") {
- this.#markENOTDIR();
- } else if (code === "ENOENT") {
- this.#markENOENT();
- } else {
- this.children().provisional = 0;
+ *#R({ allowStale: t = this.allowStale } = {}) {
+ if (this.#o) for (let e = this.#b; this.#G(e) && ((t || !this.#A(e)) && (yield e), e !== this.#u); ) e = this.#w[e];
}
- }
- #lstatFail(code = "") {
- if (code === "ENOTDIR") {
- const p = this.parent;
- p.#markENOTDIR();
- } else if (code === "ENOENT") {
- this.#markENOENT();
+ #G(t) {
+ return t !== void 0 && this.#a.get(this.#l[t]) === t;
}
- }
- #readlinkFail(code = "") {
- let ter = this.#type;
- ter |= ENOREADLINK;
- if (code === "ENOENT")
- ter |= ENOENT;
- if (code === "EINVAL" || code === "UNKNOWN") {
- ter &= IFMT_UNKNOWN;
+ *entries() {
+ for (let t of this.#x()) this.#r[t] !== void 0 && this.#l[t] !== void 0 && !this.#f(this.#r[t]) && (yield [this.#l[t], this.#r[t]]);
}
- this.#type = ter;
- if (code === "ENOTDIR" && this.parent) {
- this.parent.#markENOTDIR();
+ *rentries() {
+ for (let t of this.#R()) this.#r[t] !== void 0 && this.#l[t] !== void 0 && !this.#f(this.#r[t]) && (yield [this.#l[t], this.#r[t]]);
}
- }
- #readdirAddChild(e, c) {
- return this.#readdirMaybePromoteChild(e, c) || this.#readdirAddNewChild(e, c);
- }
- #readdirAddNewChild(e, c) {
- const type = entToType(e);
- const child = this.newChild(e.name, type, { parent: this });
- const ifmt = child.#type & IFMT;
- if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) {
- child.#type |= ENOTDIR;
+ *keys() {
+ for (let t of this.#x()) {
+ let e = this.#l[t];
+ e !== void 0 && !this.#f(this.#r[t]) && (yield e);
+ }
}
- c.unshift(child);
- c.provisional++;
- return child;
- }
- #readdirMaybePromoteChild(e, c) {
- for (let p = c.provisional; p < c.length; p++) {
- const pchild = c[p];
- const name = this.nocase ? normalizeNocase(e.name) : normalize2(e.name);
- if (name !== pchild.#matchName) {
- continue;
+ *rkeys() {
+ for (let t of this.#R()) {
+ let e = this.#l[t];
+ e !== void 0 && !this.#f(this.#r[t]) && (yield e);
}
- return this.#readdirPromoteChild(e, pchild, p, c);
}
- }
- #readdirPromoteChild(e, p, index, c) {
- const v = p.name;
- p.#type = p.#type & IFMT_UNKNOWN | entToType(e);
- if (v !== e.name)
- p.name = e.name;
- if (index !== c.provisional) {
- if (index === c.length - 1)
- c.pop();
- else
- c.splice(index, 1);
- c.unshift(p);
+ *values() {
+ for (let t of this.#x()) this.#r[t] !== void 0 && !this.#f(this.#r[t]) && (yield this.#r[t]);
}
- c.provisional++;
- return p;
- }
- /**
- * Call lstat() on this Path, and update all known information that can be
- * determined.
- *
- * Note that unlike `fs.lstat()`, the returned value does not contain some
- * information, such as `mode`, `dev`, `nlink`, and `ino`. If that
- * information is required, you will need to call `fs.lstat` yourself.
- *
- * If the Path refers to a nonexistent file, or if the lstat call fails for
- * any reason, `undefined` is returned. Otherwise the updated Path object is
- * returned.
- *
- * Results are cached, and thus may be out of date if the filesystem is
- * mutated.
- */
- async lstat() {
- if ((this.#type & ENOENT) === 0) {
- try {
- this.#applyStat(await this.#fs.promises.lstat(this.fullpath()));
- return this;
- } catch (er) {
- this.#lstatFail(er.code);
+ *rvalues() {
+ for (let t of this.#R()) this.#r[t] !== void 0 && !this.#f(this.#r[t]) && (yield this.#r[t]);
+ }
+ [Symbol.iterator]() {
+ return this.entries();
+ }
+ [Symbol.toStringTag] = "LRUCache";
+ find(t, e = {}) {
+ for (let s of this.#x()) {
+ let i = this.#r[s], r = this.#f(i) ? i.__staleWhileFetching : i;
+ if (r !== void 0 && t(r, this.#l[s], this)) return this.#X(this.#l[s], e);
}
}
- }
- /**
- * synchronous {@link PathBase.lstat}
- */
- lstatSync() {
- if ((this.#type & ENOENT) === 0) {
- try {
- this.#applyStat(this.#fs.lstatSync(this.fullpath()));
- return this;
- } catch (er) {
- this.#lstatFail(er.code);
- }
- }
- }
- #applyStat(st) {
- const { atime, atimeMs, birthtime, birthtimeMs, blksize, blocks: blocks2, ctime, ctimeMs, dev, gid, ino, mode, mtime, mtimeMs, nlink, rdev, size, uid } = st;
- this.#atime = atime;
- this.#atimeMs = atimeMs;
- this.#birthtime = birthtime;
- this.#birthtimeMs = birthtimeMs;
- this.#blksize = blksize;
- this.#blocks = blocks2;
- this.#ctime = ctime;
- this.#ctimeMs = ctimeMs;
- this.#dev = dev;
- this.#gid = gid;
- this.#ino = ino;
- this.#mode = mode;
- this.#mtime = mtime;
- this.#mtimeMs = mtimeMs;
- this.#nlink = nlink;
- this.#rdev = rdev;
- this.#size = size;
- this.#uid = uid;
- const ifmt = entToType(st);
- this.#type = this.#type & IFMT_UNKNOWN | ifmt | LSTAT_CALLED;
- if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) {
- this.#type |= ENOTDIR;
+ forEach(t, e = this) {
+ for (let s of this.#x()) {
+ let i = this.#r[s], r = this.#f(i) ? i.__staleWhileFetching : i;
+ r !== void 0 && t.call(e, r, this.#l[s], this);
+ }
}
- }
- #onReaddirCB = [];
- #readdirCBInFlight = false;
- #callOnReaddirCB(children) {
- this.#readdirCBInFlight = false;
- const cbs = this.#onReaddirCB.slice();
- this.#onReaddirCB.length = 0;
- cbs.forEach((cb) => cb(null, children));
- }
- /**
- * Standard node-style callback interface to get list of directory entries.
- *
- * If the Path cannot or does not contain any children, then an empty array
- * is returned.
- *
- * Results are cached, and thus may be out of date if the filesystem is
- * mutated.
- *
- * @param cb The callback called with (er, entries). Note that the `er`
- * param is somewhat extraneous, as all readdir() errors are handled and
- * simply result in an empty set of entries being returned.
- * @param allowZalgo Boolean indicating that immediately known results should
- * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release
- * zalgo at your peril, the dark pony lord is devious and unforgiving.
- */
- readdirCB(cb, allowZalgo = false) {
- if (!this.canReaddir()) {
- if (allowZalgo)
- cb(null, []);
- else
- queueMicrotask(() => cb(null, []));
- return;
+ rforEach(t, e = this) {
+ for (let s of this.#R()) {
+ let i = this.#r[s], r = this.#f(i) ? i.__staleWhileFetching : i;
+ r !== void 0 && t.call(e, r, this.#l[s], this);
+ }
}
- const children = this.children();
- if (this.calledReaddir()) {
- const c = children.slice(0, children.provisional);
- if (allowZalgo)
- cb(null, c);
- else
- queueMicrotask(() => cb(null, c));
- return;
+ purgeStale() {
+ let t = false;
+ for (let e of this.#R({ allowStale: true })) this.#A(e) && (this.#W(this.#l[e], "expire"), t = true);
+ return t;
}
- this.#onReaddirCB.push(cb);
- if (this.#readdirCBInFlight) {
- return;
+ info(t) {
+ let e = this.#a.get(t);
+ if (e === void 0) return;
+ let s = this.#r[e], i = this.#f(s) ? s.__staleWhileFetching : s;
+ if (i === void 0) return;
+ let r = { value: i };
+ if (this.#g && this.#O) {
+ let h = this.#g[e], a = this.#O[e];
+ if (h && a) {
+ let o = h - (this.#p.now() - a);
+ r.ttl = o, r.start = Date.now();
+ }
+ }
+ return this.#E && (r.size = this.#E[e]), r;
}
- this.#readdirCBInFlight = true;
- const fullpath = this.fullpath();
- this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => {
- if (er) {
- this.#readdirFail(er.code);
- children.provisional = 0;
- } else {
- for (const e of entries) {
- this.#readdirAddChild(e, children);
+ dump() {
+ let t = [];
+ for (let e of this.#x({ allowStale: true })) {
+ let s = this.#l[e], i = this.#r[e], r = this.#f(i) ? i.__staleWhileFetching : i;
+ if (r === void 0 || s === void 0) continue;
+ let h = { value: r };
+ if (this.#g && this.#O) {
+ h.ttl = this.#g[e];
+ let a = this.#p.now() - this.#O[e];
+ h.start = Math.floor(Date.now() - a);
}
- this.#readdirSuccess(children);
+ this.#E && (h.size = this.#E[e]), t.unshift([s, h]);
+ }
+ return t;
+ }
+ load(t) {
+ this.clear();
+ for (let [e, s] of t) {
+ if (s.start) {
+ let i = Date.now() - s.start;
+ s.start = this.#p.now() - i;
+ }
+ this.#N(e, s.value, s);
}
- this.#callOnReaddirCB(children.slice(0, children.provisional));
- return;
- });
- }
- #asyncReaddirInFlight;
- /**
- * Return an array of known child entries.
- *
- * If the Path cannot or does not contain any children, then an empty array
- * is returned.
- *
- * Results are cached, and thus may be out of date if the filesystem is
- * mutated.
- */
- async readdir() {
- if (!this.canReaddir()) {
- return [];
}
- const children = this.children();
- if (this.calledReaddir()) {
- return children.slice(0, children.provisional);
+ set(t, e, s = {}) {
+ let { status: i = O.metrics.hasSubscribers ? {} : void 0 } = s;
+ s.status = i, i && (i.op = "set", i.key = t, e !== void 0 && (i.value = e), i.cache = this);
+ let r = this.#N(t, e, s);
+ return i && O.metrics.hasSubscribers && O.metrics.publish(i), r;
}
- const fullpath = this.fullpath();
- if (this.#asyncReaddirInFlight) {
- await this.#asyncReaddirInFlight;
- } else {
- let resolve7 = () => {
- };
- this.#asyncReaddirInFlight = new Promise((res) => resolve7 = res);
+ #N(t, e, s, i) {
+ let { ttl: r = this.ttl, start: h, noDisposeOnSet: a = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: l } = s, c = this.#f(e);
+ if (e === void 0) return l && (l.set = "deleted"), this.delete(t), this;
+ let { noUpdateTTL: u = this.noUpdateTTL } = s;
+ l && !c && (l.value = e);
+ let p = this.#z(t, e, s.size || 0, o, l);
+ if (this.maxEntrySize && p > this.maxEntrySize) return this.#W(t, "set"), l && (l.set = "miss", l.maxEntrySizeExceeded = true), this;
+ let d = this.#o === 0 ? void 0 : this.#a.get(t);
+ if (d === void 0) d = this.#o === 0 ? this.#u : this.#v.length !== 0 ? this.#v.pop() : this.#o === this.#t ? this.#U(false) : this.#o, this.#l[d] = t, this.#r[d] = e, this.#a.set(t, d), this.#w[this.#u] = d, this.#_[d] = this.#u, this.#u = d, this.#o++, this.#j(d, p, l), l && (l.set = "add"), u = false, this.#P && !c && this.#h?.(e, t, "add");
+ else {
+ this.#K(d);
+ let g = this.#r[d];
+ if (e !== g) {
+ if (!a) if (this.#f(g)) {
+ g !== i && g.__abortController.abort(new Error("replaced"));
+ let { __staleWhileFetching: f } = g;
+ f !== void 0 && f !== e && (this.#C && this.#e?.(f, t, "set"), this.#s && this.#y?.push([f, t, "set"]));
+ } else this.#C && this.#e?.(g, t, "set"), this.#s && this.#y?.push([g, t, "set"]);
+ if (this.#D(d), this.#j(d, p, l), this.#r[d] = e, !c) {
+ let f = g && this.#f(g) ? g.__staleWhileFetching : g, b = f === void 0 ? "add" : e !== f ? "replace" : "update";
+ l && (l.set = b, f !== void 0 && (l.oldValue = f)), this.#P && this.onInsert?.(e, t, b);
+ }
+ } else c || (l && (l.set = "update"), this.#P && this.onInsert?.(e, t, "update"));
+ }
+ if (r !== 0 && !this.#g && this.#T(), this.#g && (u || this.#B(d, r, h), l && this.#F(l, d)), !a && this.#s && this.#y) {
+ let g = this.#y, f;
+ for (; f = g?.shift(); ) this.#n?.(...f);
+ }
+ return this;
+ }
+ pop() {
try {
- for (const e of await this.#fs.promises.readdir(fullpath, {
- withFileTypes: true
- })) {
- this.#readdirAddChild(e, children);
+ for (; this.#o; ) {
+ let t = this.#r[this.#b];
+ if (this.#U(true), this.#f(t)) {
+ if (t.__staleWhileFetching) return t.__staleWhileFetching;
+ } else if (t !== void 0) return t;
}
- this.#readdirSuccess(children);
- } catch (er) {
- this.#readdirFail(er.code);
- children.provisional = 0;
+ } finally {
+ if (this.#s && this.#y) {
+ let t = this.#y, e;
+ for (; e = t?.shift(); ) this.#n?.(...e);
+ }
+ }
+ }
+ #U(t) {
+ let e = this.#b, s = this.#l[e], i = this.#r[e], r = this.#f(i);
+ r && i.__abortController.abort(new Error("evicted"));
+ let h = r ? i.__staleWhileFetching : i;
+ return (this.#C || this.#s) && h !== void 0 && (this.#C && this.#e?.(h, s, "evict"), this.#s && this.#y?.push([h, s, "evict"])), this.#D(e), this.#S?.[e] && (clearTimeout(this.#S[e]), this.#S[e] = void 0), t && (this.#l[e] = void 0, this.#r[e] = void 0, this.#v.push(e)), this.#o === 1 ? (this.#b = this.#u = 0, this.#v.length = 0) : this.#b = this.#w[e], this.#a.delete(s), this.#o--, e;
+ }
+ has(t, e = {}) {
+ let { status: s = O.metrics.hasSubscribers ? {} : void 0 } = e;
+ e.status = s, s && (s.op = "has", s.key = t, s.cache = this);
+ let i = this.#V(t, e);
+ return O.metrics.hasSubscribers && O.metrics.publish(s), i;
+ }
+ #V(t, e = {}) {
+ let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#a.get(t);
+ if (r !== void 0) {
+ let h = this.#r[r];
+ if (this.#f(h) && h.__staleWhileFetching === void 0) return false;
+ if (this.#A(r)) i && (i.has = "stale", this.#F(i, r));
+ else return s && this.#k(r), i && (i.has = "hit", this.#F(i, r)), true;
+ } else i && (i.has = "miss");
+ return false;
+ }
+ peek(t, e = {}) {
+ let { status: s = Ne() ? {} : void 0 } = e;
+ s && (s.op = "peek", s.key = t, s.cache = this), e.status = s;
+ let i = this.#q(t, e);
+ return O.metrics.hasSubscribers && O.metrics.publish(s), i;
+ }
+ #q(t, e) {
+ let { status: s, allowStale: i = this.allowStale } = e, r = this.#a.get(t);
+ if (r === void 0 || !i && this.#A(r)) {
+ s && (s.peek = r === void 0 ? "miss" : "stale");
+ return;
}
- this.#asyncReaddirInFlight = void 0;
- resolve7();
+ let h = this.#r[r], a = this.#f(h) ? h.__staleWhileFetching : h;
+ return s && (a !== void 0 ? (s.peek = "hit", s.value = a) : s.peek = "miss"), a;
+ }
+ #L(t, e, s, i) {
+ let r = e === void 0 ? void 0 : this.#r[e];
+ if (this.#f(r)) return r;
+ let h = new AbortController(), { signal: a } = s;
+ a?.addEventListener("abort", () => h.abort(a.reason), { signal: h.signal });
+ let o = { signal: h.signal, options: s, context: i }, l = (f, b = false) => {
+ let { aborted: m } = h.signal, y = s.ignoreFetchAbort && f !== void 0, _2 = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && f !== void 0);
+ if (s.status && (m && !b ? (s.status.fetchAborted = true, s.status.fetchError = h.signal.reason, y && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), m && !y && !b) return u(h.signal.reason, _2);
+ let v = d, S = this.#r[e];
+ return (S === d || S === void 0 && y && b) && (f === void 0 ? v.__staleWhileFetching !== void 0 ? this.#r[e] = v.__staleWhileFetching : this.#W(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.#N(t, f, o.options, v))), f;
+ }, c = (f) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = f), u(f, false)), u = (f, b) => {
+ let { aborted: m } = h.signal, y = m && s.allowStaleOnFetchAbort, _2 = y || s.allowStaleOnFetchRejection, v = _2 || s.noDeleteOnFetchRejection, S = d;
+ if (this.#r[e] === d && (!v || !b && S.__staleWhileFetching === void 0 ? this.#W(t, "fetch") : y || (this.#r[e] = S.__staleWhileFetching)), _2) return s.status && S.__staleWhileFetching !== void 0 && (s.status.returnedStale = true), S.__staleWhileFetching;
+ if (S.__returned === S) throw f;
+ }, p = (f, b) => {
+ let m = this.#d?.(t, r, o);
+ h.signal.addEventListener("abort", () => {
+ (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (f(void 0), s.allowStaleOnFetchAbort && (f = (y) => l(y, true)));
+ }), m && m instanceof Promise ? m.then((y) => f(y === void 0 ? void 0 : y), b) : m !== void 0 && f(m);
+ };
+ s.status && (s.status.fetchDispatched = true);
+ let d = new Promise(p).then(l, c), g = Object.assign(d, { __abortController: h, __staleWhileFetching: r, __returned: void 0 });
+ return e === void 0 ? (this.#N(t, g, { ...o.options, status: void 0 }), e = this.#a.get(t)) : this.#r[e] = g, g;
+ }
+ #f(t) {
+ if (!this.#M) return false;
+ let e = t;
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController;
+ }
+ fetch(t, e = {}) {
+ let s = O.tracing.hasSubscribers, { status: i = Ne() ? {} : void 0 } = e;
+ e.status = i, i && e.context && (i.context = e.context);
+ let r = this.#H(t, e);
+ return i && s && (i.trace = true, O.tracing.tracePromise(() => r, i).catch(() => {
+ })), r;
+ }
+ async #H(t, e = {}) {
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: h = this.ttl, noDisposeOnSet: a = this.noDisposeOnSet, size: o = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: p = this.allowStaleOnFetchRejection, ignoreFetchAbort: d = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: b = false, status: m, signal: y } = e;
+ if (m && (m.op = "fetch", m.key = t, b && (m.forceRefresh = true), m.cache = this), !this.#M) return m && (m.fetch = "get"), this.#X(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: m });
+ let _2 = { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, ttl: h, noDisposeOnSet: a, size: o, sizeCalculation: l, noUpdateTTL: c, noDeleteOnFetchRejection: u, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: g, ignoreFetchAbort: d, status: m, signal: y }, v = this.#a.get(t);
+ if (v === void 0) {
+ m && (m.fetch = "miss");
+ let S = this.#L(t, v, _2, f);
+ return S.__returned = S;
+ } else {
+ let S = this.#r[v];
+ if (this.#f(S)) {
+ let nt = s && S.__staleWhileFetching !== void 0;
+ return m && (m.fetch = "inflight", nt && (m.returnedStale = true)), nt ? S.__staleWhileFetching : S.__returned = S;
+ }
+ let K = this.#A(v);
+ if (!b && !K) return m && (m.fetch = "hit"), this.#K(v), i && this.#k(v), m && this.#F(m, v), S;
+ let z = this.#L(t, v, _2, f), $ = z.__staleWhileFetching !== void 0 && s;
+ return m && (m.fetch = K ? "stale" : "refresh", $ && K && (m.returnedStale = true)), $ ? z.__staleWhileFetching : z.__returned = z;
+ }
+ }
+ forceFetch(t, e = {}) {
+ let s = O.tracing.hasSubscribers, { status: i = Ne() ? {} : void 0 } = e;
+ e.status = i, i && e.context && (i.context = e.context);
+ let r = this.#I(t, e);
+ return i && s && (i.trace = true, O.tracing.tracePromise(() => r, i).catch(() => {
+ })), r;
+ }
+ async #I(t, e = {}) {
+ let s = await this.#H(t, e);
+ if (s === void 0) throw new Error("fetch() returned undefined");
+ return s;
+ }
+ memo(t, e = {}) {
+ let { status: s = O.metrics.hasSubscribers ? {} : void 0 } = e;
+ e.status = s, s && (s.op = "memo", s.key = t, e.context && (s.context = e.context), s.cache = this);
+ let i = this.#J(t, e);
+ return s && (s.value = i), O.metrics.hasSubscribers && O.metrics.publish(s), i;
+ }
+ #J(t, e = {}) {
+ let s = this.#c;
+ if (!s) throw new Error("no memoMethod provided to constructor");
+ let { context: i, status: r, forceRefresh: h, ...a } = e;
+ r && h && (r.forceRefresh = true);
+ let o = this.#X(t, a), l = h || o === void 0;
+ if (r && (r.memo = l ? "miss" : "hit", l || (r.value = o)), !l) return o;
+ let c = s(t, o, { options: a, context: i });
+ return r && (r.value = c), this.#N(t, c, a), c;
+ }
+ get(t, e = {}) {
+ let { status: s = O.metrics.hasSubscribers ? {} : void 0 } = e;
+ e.status = s, s && (s.op = "get", s.key = t, s.cache = this);
+ let i = this.#X(t, e);
+ return s && (i !== void 0 && (s.value = i), O.metrics.hasSubscribers && O.metrics.publish(s)), i;
+ }
+ #X(t, e = {}) {
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: h } = e, a = this.#a.get(t);
+ if (a === void 0) {
+ h && (h.get = "miss");
+ return;
+ }
+ let o = this.#r[a], l = this.#f(o);
+ return h && this.#F(h, a), this.#A(a) ? l ? (h && (h.get = "stale-fetching"), s && o.__staleWhileFetching !== void 0 ? (h && (h.returnedStale = true), o.__staleWhileFetching) : void 0) : (r || this.#W(t, "expire"), h && (h.get = "stale"), s ? (h && (h.returnedStale = true), o) : void 0) : (h && (h.get = l ? "fetching" : "hit"), this.#K(a), i && this.#k(a), l ? o.__staleWhileFetching : o);
}
- return children.slice(0, children.provisional);
- }
- /**
- * synchronous {@link PathBase.readdir}
- */
- readdirSync() {
- if (!this.canReaddir()) {
- return [];
+ #Y(t, e) {
+ this.#_[e] = t, this.#w[t] = e;
}
- const children = this.children();
- if (this.calledReaddir()) {
- return children.slice(0, children.provisional);
+ #K(t) {
+ t !== this.#u && (t === this.#b ? this.#b = this.#w[t] : this.#Y(this.#_[t], this.#w[t]), this.#Y(this.#u, t), this.#u = t);
}
- const fullpath = this.fullpath();
- try {
- for (const e of this.#fs.readdirSync(fullpath, {
- withFileTypes: true
- })) {
- this.#readdirAddChild(e, children);
+ delete(t) {
+ return this.#W(t, "delete");
+ }
+ #W(t, e) {
+ O.metrics.hasSubscribers && O.metrics.publish({ op: "delete", delete: e, key: t, cache: this });
+ let s = false;
+ if (this.#o !== 0) {
+ let i = this.#a.get(t);
+ if (i !== void 0) if (this.#S?.[i] && (clearTimeout(this.#S[i]), this.#S[i] = void 0), s = true, this.#o === 1) this.#Z(e);
+ else {
+ this.#D(i);
+ let r = this.#r[i];
+ if (this.#f(r) ? r.__abortController.abort(new Error("deleted")) : (this.#C || this.#s) && (this.#C && this.#e?.(r, t, e), this.#s && this.#y?.push([r, t, e])), this.#a.delete(t), this.#l[i] = void 0, this.#r[i] = void 0, i === this.#u) this.#u = this.#_[i];
+ else if (i === this.#b) this.#b = this.#w[i];
+ else {
+ let h = this.#_[i];
+ this.#w[h] = this.#w[i];
+ let a = this.#w[i];
+ this.#_[a] = this.#_[i];
+ }
+ this.#o--, this.#v.push(i);
+ }
+ }
+ if (this.#s && this.#y?.length) {
+ let i = this.#y, r;
+ for (; r = i?.shift(); ) this.#n?.(...r);
}
- this.#readdirSuccess(children);
- } catch (er) {
- this.#readdirFail(er.code);
- children.provisional = 0;
+ return s;
}
- return children.slice(0, children.provisional);
- }
- canReaddir() {
- if (this.#type & ENOCHILD)
- return false;
- const ifmt = IFMT & this.#type;
- if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) {
- return false;
+ clear() {
+ return this.#Z("delete");
}
- return true;
- }
- shouldWalk(dirs, walkFilter) {
- return (this.#type & IFDIR) === IFDIR && !(this.#type & ENOCHILD) && !dirs.has(this) && (!walkFilter || walkFilter(this));
- }
- /**
- * Return the Path object corresponding to path as resolved
- * by realpath(3).
- *
- * If the realpath call fails for any reason, `undefined` is returned.
- *
- * Result is cached, and thus may be outdated if the filesystem is mutated.
- * On success, returns a Path object.
- */
- async realpath() {
- if (this.#realpath)
- return this.#realpath;
- if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type)
- return void 0;
- try {
- const rp = await this.#fs.promises.realpath(this.fullpath());
- return this.#realpath = this.resolve(rp);
- } catch (_2) {
- this.#markENOREALPATH();
+ #Z(t) {
+ for (let e of this.#R({ allowStale: true })) {
+ let s = this.#r[e];
+ if (this.#f(s)) s.__abortController.abort(new Error("deleted"));
+ else {
+ let i = this.#l[e];
+ this.#C && this.#e?.(s, i, t), this.#s && this.#y?.push([s, i, t]);
+ }
+ }
+ if (this.#a.clear(), this.#r.fill(void 0), this.#l.fill(void 0), this.#g && this.#O) {
+ this.#g.fill(0), this.#O.fill(0);
+ for (let e of this.#S ?? []) e !== void 0 && clearTimeout(e);
+ this.#S?.fill(void 0);
+ }
+ if (this.#E && this.#E.fill(0), this.#b = 0, this.#u = 0, this.#v.length = 0, this.#m = 0, this.#o = 0, this.#s && this.#y) {
+ let e = this.#y, s;
+ for (; s = e?.shift(); ) this.#n?.(...s);
+ }
}
- }
- /**
- * Synchronous {@link realpath}
- */
- realpathSync() {
- if (this.#realpath)
- return this.#realpath;
- if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type)
- return void 0;
- try {
- const rp = this.#fs.realpathSync(this.fullpath());
- return this.#realpath = this.resolve(rp);
- } catch (_2) {
- this.#markENOREALPATH();
+ };
+ Ut.LRUCache = wr;
+ });
+ var $e = x((j) => {
+ "use strict";
+ var br = j && j.__importDefault || function(n) {
+ return n && n.__esModule ? n : { default: n };
+ };
+ Object.defineProperty(j, "__esModule", { value: true });
+ j.Minipass = j.isWritable = j.isReadable = j.isStream = void 0;
+ var Gs = typeof process == "object" && process ? process : { stdout: null, stderr: null }, Ue = require("node:events"), qs = br(require("node:stream")), yr = require("node:string_decoder"), Sr = (n) => !!n && typeof n == "object" && (n instanceof Yt || n instanceof qs.default || (0, j.isReadable)(n) || (0, j.isWritable)(n));
+ j.isStream = Sr;
+ var vr = (n) => !!n && typeof n == "object" && n instanceof Ue.EventEmitter && typeof n.pipe == "function" && n.pipe !== qs.default.Writable.prototype.pipe;
+ j.isReadable = vr;
+ var _r = (n) => !!n && typeof n == "object" && n instanceof Ue.EventEmitter && typeof n.write == "function" && typeof n.end == "function";
+ j.isWritable = _r;
+ var H = /* @__PURE__ */ Symbol("EOF"), X = /* @__PURE__ */ Symbol("maybeEmitEnd"), J = /* @__PURE__ */ Symbol("emittedEnd"), $t = /* @__PURE__ */ Symbol("emittingEnd"), pt = /* @__PURE__ */ Symbol("emittedError"), qt = /* @__PURE__ */ Symbol("closed"), Is = /* @__PURE__ */ Symbol("read"), Ht = /* @__PURE__ */ Symbol("flush"), Us = /* @__PURE__ */ Symbol("flushChunk"), W = /* @__PURE__ */ Symbol("encoding"), ot = /* @__PURE__ */ Symbol("decoder"), A = /* @__PURE__ */ Symbol("flowing"), mt = /* @__PURE__ */ Symbol("paused"), at = /* @__PURE__ */ Symbol("resume"), k = /* @__PURE__ */ Symbol("buffer"), F = /* @__PURE__ */ Symbol("pipes"), M = /* @__PURE__ */ Symbol("bufferLength"), Le = /* @__PURE__ */ Symbol("bufferPush"), Xt = /* @__PURE__ */ Symbol("bufferShift"), P = /* @__PURE__ */ Symbol("objectMode"), C = /* @__PURE__ */ Symbol("destroyed"), We = /* @__PURE__ */ Symbol("error"), Be = /* @__PURE__ */ Symbol("emitData"), $s = /* @__PURE__ */ Symbol("emitEnd"), ze = /* @__PURE__ */ Symbol("emitEnd2"), G = /* @__PURE__ */ Symbol("async"), Ge = /* @__PURE__ */ Symbol("abort"), Kt = /* @__PURE__ */ Symbol("aborted"), gt = /* @__PURE__ */ Symbol("signal"), st = /* @__PURE__ */ Symbol("dataListeners"), D = /* @__PURE__ */ Symbol("discarded"), wt = (n) => Promise.resolve().then(n), Er = (n) => n(), Or = (n) => n === "end" || n === "finish" || n === "prefinish", Cr = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, Ar = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Vt = class {
+ src;
+ dest;
+ opts;
+ ondrain;
+ constructor(t, e, s) {
+ this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[at](), this.dest.on("drain", this.ondrain);
+ }
+ unpipe() {
+ this.dest.removeListener("drain", this.ondrain);
+ }
+ proxyErrors(t) {
+ }
+ end() {
+ this.unpipe(), this.opts.end && this.dest.end();
+ }
+ }, Ie = class extends Vt {
+ unpipe() {
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
+ }
+ constructor(t, e, s) {
+ super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
+ }
+ }, kr = (n) => !!n.objectMode, Mr = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", Yt = class extends Ue.EventEmitter {
+ [A] = false;
+ [mt] = false;
+ [F] = [];
+ [k] = [];
+ [P];
+ [W];
+ [G];
+ [ot];
+ [H] = false;
+ [J] = false;
+ [$t] = false;
+ [qt] = false;
+ [pt] = null;
+ [M] = 0;
+ [C] = false;
+ [gt];
+ [Kt] = false;
+ [st] = 0;
+ [D] = false;
+ writable = true;
+ readable = true;
+ constructor(...t) {
+ let e = t[0] || {};
+ if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
+ kr(e) ? (this[P] = true, this[W] = null) : Mr(e) ? (this[W] = e.encoding, this[P] = false) : (this[P] = false, this[W] = null), this[G] = !!e.async, this[ot] = this[W] ? new yr.StringDecoder(this[W]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[k] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[F] });
+ let { signal: s } = e;
+ s && (this[gt] = s, s.aborted ? this[Ge]() : s.addEventListener("abort", () => this[Ge]()));
+ }
+ get bufferLength() {
+ return this[M];
+ }
+ get encoding() {
+ return this[W];
+ }
+ set encoding(t) {
+ throw new Error("Encoding must be set at instantiation time");
+ }
+ setEncoding(t) {
+ throw new Error("Encoding must be set at instantiation time");
+ }
+ get objectMode() {
+ return this[P];
+ }
+ set objectMode(t) {
+ throw new Error("objectMode must be set at instantiation time");
+ }
+ get async() {
+ return this[G];
+ }
+ set async(t) {
+ this[G] = this[G] || !!t;
+ }
+ [Ge]() {
+ this[Kt] = true, this.emit("abort", this[gt]?.reason), this.destroy(this[gt]?.reason);
+ }
+ get aborted() {
+ return this[Kt];
+ }
+ set aborted(t) {
+ }
+ write(t, e, s) {
+ if (this[Kt]) return false;
+ if (this[H]) throw new Error("write after end");
+ if (this[C]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
+ typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
+ let i = this[G] ? wt : Er;
+ if (!this[P] && !Buffer.isBuffer(t)) {
+ if (Ar(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
+ else if (Cr(t)) t = Buffer.from(t);
+ else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
+ }
+ return this[P] ? (this[A] && this[M] !== 0 && this[Ht](true), this[A] ? this.emit("data", t) : this[Le](t), this[M] !== 0 && this.emit("readable"), s && i(s), this[A]) : t.length ? (typeof t == "string" && !(e === this[W] && !this[ot]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[W] && (t = this[ot].write(t)), this[A] && this[M] !== 0 && this[Ht](true), this[A] ? this.emit("data", t) : this[Le](t), this[M] !== 0 && this.emit("readable"), s && i(s), this[A]) : (this[M] !== 0 && this.emit("readable"), s && i(s), this[A]);
+ }
+ read(t) {
+ if (this[C]) return null;
+ if (this[D] = false, this[M] === 0 || t === 0 || t && t > this[M]) return this[X](), null;
+ this[P] && (t = null), this[k].length > 1 && !this[P] && (this[k] = [this[W] ? this[k].join("") : Buffer.concat(this[k], this[M])]);
+ let e = this[Is](t || null, this[k][0]);
+ return this[X](), e;
+ }
+ [Is](t, e) {
+ if (this[P]) this[Xt]();
+ else {
+ let s = e;
+ t === s.length || t === null ? this[Xt]() : typeof s == "string" ? (this[k][0] = s.slice(t), e = s.slice(0, t), this[M] -= t) : (this[k][0] = s.subarray(t), e = s.subarray(0, t), this[M] -= t);
+ }
+ return this.emit("data", e), !this[k].length && !this[H] && this.emit("drain"), e;
}
- }
- /**
- * Internal method to mark this Path object as the scurry cwd,
- * called by {@link PathScurry#chdir}
- *
- * @internal
- */
- [setAsCwd](oldCwd) {
- if (oldCwd === this)
- return;
- oldCwd.isCWD = false;
- this.isCWD = true;
- const changed = /* @__PURE__ */ new Set([]);
- let rp = [];
- let p = this;
- while (p && p.parent) {
- changed.add(p);
- p.#relative = rp.join(this.sep);
- p.#relativePosix = rp.join("/");
- p = p.parent;
- rp.push("..");
- }
- p = oldCwd;
- while (p && p.parent && !changed.has(p)) {
- p.#relative = void 0;
- p.#relativePosix = void 0;
- p = p.parent;
- }
- }
- };
- exports2.PathBase = PathBase;
- var PathWin32 = class _PathWin32 extends PathBase {
- /**
- * Separator for generating path strings.
- */
- sep = "\\";
- /**
- * Separator for parsing path strings.
- */
- splitSep = eitherSep;
- /**
- * Do not create new Path objects directly. They should always be accessed
- * via the PathScurry class or other methods on the Path class.
- *
- * @internal
- */
- constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
- super(name, type, root, roots, nocase, children, opts);
- }
- /**
- * @internal
- */
- newChild(name, type = UNKNOWN, opts = {}) {
- return new _PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
- }
- /**
- * @internal
- */
- getRootString(path6) {
- return node_path_1.win32.parse(path6).root;
- }
- /**
- * @internal
- */
- getRoot(rootPath) {
- rootPath = uncToDrive(rootPath.toUpperCase());
- if (rootPath === this.root.name) {
- return this.root;
+ end(t, e, s) {
+ return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[H] = true, this.writable = false, (this[A] || !this[mt]) && this[X](), this;
}
- for (const [compare, root] of Object.entries(this.roots)) {
- if (this.sameRoot(rootPath, compare)) {
- return this.roots[rootPath] = root;
- }
+ [at]() {
+ this[C] || (!this[st] && !this[F].length && (this[D] = true), this[mt] = false, this[A] = true, this.emit("resume"), this[k].length ? this[Ht]() : this[H] ? this[X]() : this.emit("drain"));
}
- return this.roots[rootPath] = new PathScurryWin32(rootPath, this).root;
- }
- /**
- * @internal
- */
- sameRoot(rootPath, compare = this.root.name) {
- rootPath = rootPath.toUpperCase().replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\");
- return rootPath === compare;
- }
- };
- exports2.PathWin32 = PathWin32;
- var PathPosix = class _PathPosix extends PathBase {
- /**
- * separator for parsing path strings
- */
- splitSep = "/";
- /**
- * separator for generating path strings
- */
- sep = "/";
- /**
- * Do not create new Path objects directly. They should always be accessed
- * via the PathScurry class or other methods on the Path class.
- *
- * @internal
- */
- constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
- super(name, type, root, roots, nocase, children, opts);
- }
- /**
- * @internal
- */
- getRootString(path6) {
- return path6.startsWith("/") ? "/" : "";
- }
- /**
- * @internal
- */
- getRoot(_rootPath) {
- return this.root;
- }
- /**
- * @internal
- */
- newChild(name, type = UNKNOWN, opts = {}) {
- return new _PathPosix(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
- }
- };
- exports2.PathPosix = PathPosix;
- var PathScurryBase = class {
- /**
- * The root Path entry for the current working directory of this Scurry
- */
- root;
- /**
- * The string path for the root of this Scurry's current working directory
- */
- rootPath;
- /**
- * A collection of all roots encountered, referenced by rootPath
- */
- roots;
- /**
- * The Path entry corresponding to this PathScurry's current working directory.
- */
- cwd;
- #resolveCache;
- #resolvePosixCache;
- #children;
- /**
- * Perform path comparisons case-insensitively.
- *
- * Defaults true on Darwin and Windows systems, false elsewhere.
- */
- nocase;
- #fs;
- /**
- * This class should not be instantiated directly.
- *
- * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry
- *
- * @internal
- */
- constructor(cwd = process.cwd(), pathImpl, sep7, { nocase, childrenCacheSize = 16 * 1024, fs: fs9 = defaultFS } = {}) {
- this.#fs = fsFromOption(fs9);
- if (cwd instanceof URL || cwd.startsWith("file://")) {
- cwd = (0, node_url_1.fileURLToPath)(cwd);
- }
- const cwdPath = pathImpl.resolve(cwd);
- this.roots = /* @__PURE__ */ Object.create(null);
- this.rootPath = this.parseRootPath(cwdPath);
- this.#resolveCache = new ResolveCache();
- this.#resolvePosixCache = new ResolveCache();
- this.#children = new ChildrenCache(childrenCacheSize);
- const split = cwdPath.substring(this.rootPath.length).split(sep7);
- if (split.length === 1 && !split[0]) {
- split.pop();
- }
- if (nocase === void 0) {
- throw new TypeError("must provide nocase setting to PathScurryBase ctor");
- }
- this.nocase = nocase;
- this.root = this.newRoot(this.#fs);
- this.roots[this.rootPath] = this.root;
- let prev = this.root;
- let len = split.length - 1;
- const joinSep = pathImpl.sep;
- let abs = this.rootPath;
- let sawFirst = false;
- for (const part of split) {
- const l = len--;
- prev = prev.child(part, {
- relative: new Array(l).fill("..").join(joinSep),
- relativePosix: new Array(l).fill("..").join("/"),
- fullpath: abs += (sawFirst ? "" : joinSep) + part
+ resume() {
+ return this[at]();
+ }
+ pause() {
+ this[A] = false, this[mt] = true, this[D] = false;
+ }
+ get destroyed() {
+ return this[C];
+ }
+ get flowing() {
+ return this[A];
+ }
+ get paused() {
+ return this[mt];
+ }
+ [Le](t) {
+ this[P] ? this[M] += 1 : this[M] += t.length, this[k].push(t);
+ }
+ [Xt]() {
+ return this[P] ? this[M] -= 1 : this[M] -= this[k][0].length, this[k].shift();
+ }
+ [Ht](t = false) {
+ do
+ ;
+ while (this[Us](this[Xt]()) && this[k].length);
+ !t && !this[k].length && !this[H] && this.emit("drain");
+ }
+ [Us](t) {
+ return this.emit("data", t), this[A];
+ }
+ pipe(t, e) {
+ if (this[C]) return t;
+ this[D] = false;
+ let s = this[J];
+ return e = e || {}, t === Gs.stdout || t === Gs.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new Ie(this, t, e) : new Vt(this, t, e)), this[G] ? wt(() => this[at]()) : this[at]()), t;
+ }
+ unpipe(t) {
+ let e = this[F].find((s) => s.dest === t);
+ e && (this[F].length === 1 ? (this[A] && this[st] === 0 && (this[A] = false), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
+ }
+ addListener(t, e) {
+ return this.on(t, e);
+ }
+ on(t, e) {
+ let s = super.on(t, e);
+ if (t === "data") this[D] = false, this[st]++, !this[F].length && !this[A] && this[at]();
+ else if (t === "readable" && this[M] !== 0) super.emit("readable");
+ else if (Or(t) && this[J]) super.emit(t), this.removeAllListeners(t);
+ else if (t === "error" && this[pt]) {
+ let i = e;
+ this[G] ? wt(() => i.call(this, this[pt])) : i.call(this, this[pt]);
+ }
+ return s;
+ }
+ removeListener(t, e) {
+ return this.off(t, e);
+ }
+ off(t, e) {
+ let s = super.off(t, e);
+ return t === "data" && (this[st] = this.listeners("data").length, this[st] === 0 && !this[D] && !this[F].length && (this[A] = false)), s;
+ }
+ removeAllListeners(t) {
+ let e = super.removeAllListeners(t);
+ return (t === "data" || t === void 0) && (this[st] = 0, !this[D] && !this[F].length && (this[A] = false)), e;
+ }
+ get emittedEnd() {
+ return this[J];
+ }
+ [X]() {
+ !this[$t] && !this[J] && !this[C] && this[k].length === 0 && this[H] && (this[$t] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[qt] && this.emit("close"), this[$t] = false);
+ }
+ emit(t, ...e) {
+ let s = e[0];
+ if (t !== "error" && t !== "close" && t !== C && this[C]) return false;
+ if (t === "data") return !this[P] && !s ? false : this[G] ? (wt(() => this[Be](s)), true) : this[Be](s);
+ if (t === "end") return this[$s]();
+ if (t === "close") {
+ if (this[qt] = true, !this[J] && !this[C]) return false;
+ let r = super.emit("close");
+ return this.removeAllListeners("close"), r;
+ } else if (t === "error") {
+ this[pt] = s, super.emit(We, s);
+ let r = !this[gt] || this.listeners("error").length ? super.emit("error", s) : false;
+ return this[X](), r;
+ } else if (t === "resume") {
+ let r = super.emit("resume");
+ return this[X](), r;
+ } else if (t === "finish" || t === "prefinish") {
+ let r = super.emit(t);
+ return this.removeAllListeners(t), r;
+ }
+ let i = super.emit(t, ...e);
+ return this[X](), i;
+ }
+ [Be](t) {
+ for (let s of this[F]) s.dest.write(t) === false && this.pause();
+ let e = this[D] ? false : super.emit("data", t);
+ return this[X](), e;
+ }
+ [$s]() {
+ return this[J] ? false : (this[J] = true, this.readable = false, this[G] ? (wt(() => this[ze]()), true) : this[ze]());
+ }
+ [ze]() {
+ if (this[ot]) {
+ let e = this[ot].end();
+ if (e) {
+ for (let s of this[F]) s.dest.write(e);
+ this[D] || super.emit("data", e);
+ }
+ }
+ for (let e of this[F]) e.end();
+ let t = super.emit("end");
+ return this.removeAllListeners("end"), t;
+ }
+ async collect() {
+ let t = Object.assign([], { dataLength: 0 });
+ this[P] || (t.dataLength = 0);
+ let e = this.promise();
+ return this.on("data", (s) => {
+ t.push(s), this[P] || (t.dataLength += s.length);
+ }), await e, t;
+ }
+ async concat() {
+ if (this[P]) throw new Error("cannot concat in objectMode");
+ let t = await this.collect();
+ return this[W] ? t.join("") : Buffer.concat(t, t.dataLength);
+ }
+ async promise() {
+ return new Promise((t, e) => {
+ this.on(C, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
});
- sawFirst = true;
}
- this.cwd = prev;
- }
- /**
- * Get the depth of a provided path, string, or the cwd
- */
- depth(path6 = this.cwd) {
- if (typeof path6 === "string") {
- path6 = this.cwd.resolve(path6);
+ [Symbol.asyncIterator]() {
+ this[D] = false;
+ let t = false, e = async () => (this.pause(), t = true, { value: void 0, done: true });
+ return { next: () => {
+ if (t) return e();
+ let i = this.read();
+ if (i !== null) return Promise.resolve({ done: false, value: i });
+ if (this[H]) return e();
+ let r, h, a = (u) => {
+ this.off("data", o), this.off("end", l), this.off(C, c), e(), h(u);
+ }, o = (u) => {
+ this.off("error", a), this.off("end", l), this.off(C, c), this.pause(), r({ value: u, done: !!this[H] });
+ }, l = () => {
+ this.off("error", a), this.off("data", o), this.off(C, c), e(), r({ done: true, value: void 0 });
+ }, c = () => a(new Error("stream destroyed"));
+ return new Promise((u, p) => {
+ h = p, r = u, this.once(C, c), this.once("error", a), this.once("end", l), this.once("data", o);
+ });
+ }, throw: e, return: e, [Symbol.asyncIterator]() {
+ return this;
+ }, [Symbol.asyncDispose]: async () => {
+ } };
+ }
+ [Symbol.iterator]() {
+ this[D] = false;
+ let t = false, e = () => (this.pause(), this.off(We, e), this.off(C, e), this.off("end", e), t = true, { done: true, value: void 0 }), s = () => {
+ if (t) return e();
+ let i = this.read();
+ return i === null ? e() : { done: false, value: i };
+ };
+ return this.once("end", e), this.once(We, e), this.once(C, e), { next: s, throw: e, return: e, [Symbol.iterator]() {
+ return this;
+ }, [Symbol.dispose]: () => {
+ } };
}
- return path6.depth();
- }
- /**
- * Return the cache of child entries. Exposed so subclasses can create
- * child Path objects in a platform-specific way.
- *
- * @internal
- */
- childrenCache() {
- return this.#children;
- }
- /**
- * Resolve one or more path strings to a resolved string
- *
- * Same interface as require('path').resolve.
- *
- * Much faster than path.resolve() when called multiple times for the same
- * path, because the resolved Path objects are cached. Much slower
- * otherwise.
- */
- resolve(...paths) {
- let r = "";
- for (let i = paths.length - 1; i >= 0; i--) {
- const p = paths[i];
- if (!p || p === ".")
- continue;
- r = r ? `${p}/${r}` : p;
- if (this.isAbsolute(p)) {
- break;
+ destroy(t) {
+ if (this[C]) return t ? this.emit("error", t) : this.emit(C), this;
+ this[C] = true, this[D] = true, this[k].length = 0, this[M] = 0;
+ let e = this;
+ return typeof e.close == "function" && !this[qt] && e.close(), t ? this.emit("error", t) : this.emit(C), this;
+ }
+ static get isStream() {
+ return j.isStream;
+ }
+ };
+ j.Minipass = Yt;
+ });
+ var ni = x((E) => {
+ "use strict";
+ var xr = E && E.__createBinding || (Object.create ? (function(n, t, e, s) {
+ s === void 0 && (s = e);
+ var i = Object.getOwnPropertyDescriptor(t, e);
+ (!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = { enumerable: true, get: function() {
+ return t[e];
+ } }), Object.defineProperty(n, s, i);
+ }) : (function(n, t, e, s) {
+ s === void 0 && (s = e), n[s] = t[e];
+ })), Rr = E && E.__setModuleDefault || (Object.create ? (function(n, t) {
+ Object.defineProperty(n, "default", { enumerable: true, value: t });
+ }) : function(n, t) {
+ n.default = t;
+ }), Pr = E && E.__importStar || /* @__PURE__ */ (function() {
+ var n = function(t) {
+ return n = Object.getOwnPropertyNames || function(e) {
+ var s = [];
+ for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (s[s.length] = i);
+ return s;
+ }, n(t);
+ };
+ return function(t) {
+ if (t && t.__esModule) return t;
+ var e = {};
+ if (t != null) for (var s = n(t), i = 0; i < s.length; i++) s[i] !== "default" && xr(e, t, s[i]);
+ return Rr(e, t), e;
+ };
+ })();
+ Object.defineProperty(E, "__esModule", { value: true });
+ E.PathScurry = E.Path = E.PathScurryDarwin = E.PathScurryPosix = E.PathScurryWin32 = E.PathScurryBase = E.PathPosix = E.PathWin32 = E.PathBase = E.ChildrenCache = E.ResolveCache = void 0;
+ var re = zs(), ee = require("node:path"), Tr = require("node:url"), yt = require("fs"), Fr = Pr(require("node:fs")), jr = yt.realpathSync.native, Zt = require("node:fs/promises"), Hs = $e(), St = { lstatSync: yt.lstatSync, readdir: yt.readdir, readdirSync: yt.readdirSync, readlinkSync: yt.readlinkSync, realpathSync: jr, promises: { lstat: Zt.lstat, readdir: Zt.readdir, readlink: Zt.readlink, realpath: Zt.realpath } }, Js = (n) => !n || n === St || n === Fr ? St : { ...St, ...n, promises: { ...St.promises, ...n.promises } }, Dr = /^\\\\\?\\([a-z]:)\\?$/i, Nr = /^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i, Lr = /^\\\\[^\\?]+\\[^\\]+$/, Xs = (n) => n.replace(/\//g, "\\").replace(Dr, "$1\\").replace(Nr, "\\\\$1\\").replace(Lr, "$&\\"), Wr = /^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i, Br = /^[\\/]{2}\?[\\/](?=[a-z]:)/i, zr = /^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i, Gr = /[\\/]/, L = 0, Qs = 1, ti = 2, I = 4, ei = 6, si = 8, it = 10, ii = 12, N = 15, bt = ~N, qe = 16, Ks = 32, vt = 64, B = 128, Jt = 256, te = 512, Vs = vt | B | te, Ir = 1023, He = (n) => n.isFile() ? si : n.isDirectory() ? I : n.isSymbolicLink() ? it : n.isCharacterDevice() ? ti : n.isBlockDevice() ? ei : n.isSocket() ? ii : n.isFIFO() ? Qs : L, Ys = new re.LRUCache({ max: 2 ** 12 }), _t = (n) => {
+ let t = Ys.get(n);
+ if (t) return t;
+ let e = n.normalize("NFKD");
+ return Ys.set(n, e), e;
+ }, Zs = new re.LRUCache({ max: 2 ** 12 }), Qt = (n) => {
+ let t = Zs.get(n);
+ if (t) return t;
+ let e = _t(n.toLowerCase());
+ return Zs.set(n, e), e;
+ }, Et = class extends re.LRUCache {
+ constructor() {
+ super({ max: 256 });
+ }
+ };
+ E.ResolveCache = Et;
+ var se = class extends re.LRUCache {
+ constructor(t = 16 * 1024) {
+ super({ maxSize: t, sizeCalculation: (e) => e.length + 1 });
+ }
+ };
+ E.ChildrenCache = se;
+ var ri = /* @__PURE__ */ Symbol("PathScurry setAsCwd"), R = class {
+ name;
+ root;
+ roots;
+ parent;
+ nocase;
+ isCWD = false;
+ #t;
+ #i;
+ get dev() {
+ return this.#i;
+ }
+ #e;
+ get mode() {
+ return this.#e;
+ }
+ #h;
+ get nlink() {
+ return this.#h;
+ }
+ #n;
+ get uid() {
+ return this.#n;
+ }
+ #d;
+ get gid() {
+ return this.#d;
+ }
+ #c;
+ get rdev() {
+ return this.#c;
+ }
+ #p;
+ get blksize() {
+ return this.#p;
+ }
+ #o;
+ get ino() {
+ return this.#o;
+ }
+ #m;
+ get size() {
+ return this.#m;
+ }
+ #a;
+ get blocks() {
+ return this.#a;
+ }
+ #l;
+ get atimeMs() {
+ return this.#l;
+ }
+ #r;
+ get mtimeMs() {
+ return this.#r;
+ }
+ #w;
+ get ctimeMs() {
+ return this.#w;
+ }
+ #_;
+ get birthtimeMs() {
+ return this.#_;
+ }
+ #b;
+ get atime() {
+ return this.#b;
+ }
+ #u;
+ get mtime() {
+ return this.#u;
+ }
+ #v;
+ get ctime() {
+ return this.#v;
+ }
+ #y;
+ get birthtime() {
+ return this.#y;
+ }
+ #E;
+ #O;
+ #g;
+ #S;
+ #C;
+ #M;
+ #s;
+ #P;
+ #T;
+ #k;
+ get parentPath() {
+ return (this.parent || this).fullpath();
+ }
+ get path() {
+ return this.parentPath;
+ }
+ constructor(t, e = L, s, i, r, h, a) {
+ this.name = t, this.#E = r ? Qt(t) : _t(t), this.#s = e & Ir, this.nocase = r, this.roots = i, this.root = s || this, this.#P = h, this.#g = a.fullpath, this.#C = a.relative, this.#M = a.relativePosix, this.parent = a.parent, this.parent ? this.#t = this.parent.#t : this.#t = Js(a.fs);
+ }
+ get fs() {
+ return this.#t;
+ }
+ depth() {
+ return this.#O !== void 0 ? this.#O : this.parent ? this.#O = this.parent.depth() + 1 : this.#O = 0;
+ }
+ childrenCache() {
+ return this.#P;
+ }
+ resolve(t) {
+ if (!t) return this;
+ let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
+ return e ? this.getRoot(e).#F(i) : this.#F(i);
+ }
+ #F(t) {
+ let e = this;
+ for (let s of t) e = e.child(s);
+ return e;
+ }
+ children() {
+ let t = this.#P.get(this);
+ if (t) return t;
+ let e = Object.assign([], { provisional: 0 });
+ return this.#P.set(this, e), this.#s &= ~qe, e;
+ }
+ child(t, e) {
+ if (t === "" || t === ".") return this;
+ if (t === "..") return this.parent || this;
+ let s = this.children(), i = this.nocase ? Qt(t) : _t(t);
+ for (let o of s) if (o.#E === i) return o;
+ let r = this.parent ? this.sep : "", h = this.#g ? this.#g + r + t : void 0, a = this.newChild(t, L, { ...e, parent: this, fullpath: h });
+ return this.canReaddir() || (a.#s |= B), s.push(a), a;
+ }
+ relative() {
+ if (this.isCWD) return "";
+ if (this.#C !== void 0) return this.#C;
+ let t = this.name, e = this.parent;
+ if (!e) return this.#C = this.name;
+ let s = e.relative();
+ return s + (!s || !e.parent ? "" : this.sep) + t;
+ }
+ relativePosix() {
+ if (this.sep === "/") return this.relative();
+ if (this.isCWD) return "";
+ if (this.#M !== void 0) return this.#M;
+ let t = this.name, e = this.parent;
+ if (!e) return this.#M = this.fullpathPosix();
+ let s = e.relativePosix();
+ return s + (!s || !e.parent ? "" : "/") + t;
+ }
+ fullpath() {
+ if (this.#g !== void 0) return this.#g;
+ let t = this.name, e = this.parent;
+ if (!e) return this.#g = this.name;
+ let i = e.fullpath() + (e.parent ? this.sep : "") + t;
+ return this.#g = i;
+ }
+ fullpathPosix() {
+ if (this.#S !== void 0) return this.#S;
+ if (this.sep === "/") return this.#S = this.fullpath();
+ if (!this.parent) {
+ let i = this.fullpath().replace(/\\/g, "/");
+ return /^[a-z]:\//i.test(i) ? this.#S = `//?/${i}` : this.#S = i;
+ }
+ let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
+ return this.#S = s;
+ }
+ isUnknown() {
+ return (this.#s & N) === L;
+ }
+ isType(t) {
+ return this[`is${t}`]();
+ }
+ getType() {
+ return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
+ }
+ isFile() {
+ return (this.#s & N) === si;
+ }
+ isDirectory() {
+ return (this.#s & N) === I;
+ }
+ isCharacterDevice() {
+ return (this.#s & N) === ti;
+ }
+ isBlockDevice() {
+ return (this.#s & N) === ei;
+ }
+ isFIFO() {
+ return (this.#s & N) === Qs;
+ }
+ isSocket() {
+ return (this.#s & N) === ii;
+ }
+ isSymbolicLink() {
+ return (this.#s & it) === it;
+ }
+ lstatCached() {
+ return this.#s & Ks ? this : void 0;
+ }
+ readlinkCached() {
+ return this.#T;
+ }
+ realpathCached() {
+ return this.#k;
+ }
+ readdirCached() {
+ let t = this.children();
+ return t.slice(0, t.provisional);
+ }
+ canReadlink() {
+ if (this.#T) return true;
+ if (!this.parent) return false;
+ let t = this.#s & N;
+ return !(t !== L && t !== it || this.#s & Jt || this.#s & B);
+ }
+ calledReaddir() {
+ return !!(this.#s & qe);
+ }
+ isENOENT() {
+ return !!(this.#s & B);
+ }
+ isNamed(t) {
+ return this.nocase ? this.#E === Qt(t) : this.#E === _t(t);
+ }
+ async readlink() {
+ let t = this.#T;
+ if (t) return t;
+ if (this.canReadlink() && this.parent) try {
+ let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
+ if (s) return this.#T = s;
+ } catch (e) {
+ this.#R(e.code);
+ return;
}
}
- const cached = this.#resolveCache.get(r);
- if (cached !== void 0) {
- return cached;
+ readlinkSync() {
+ let t = this.#T;
+ if (t) return t;
+ if (this.canReadlink() && this.parent) try {
+ let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
+ if (s) return this.#T = s;
+ } catch (e) {
+ this.#R(e.code);
+ return;
+ }
}
- const result = this.cwd.resolve(r).fullpath();
- this.#resolveCache.set(r, result);
- return result;
- }
- /**
- * Resolve one or more path strings to a resolved string, returning
- * the posix path. Identical to .resolve() on posix systems, but on
- * windows will return a forward-slash separated UNC path.
- *
- * Same interface as require('path').resolve.
- *
- * Much faster than path.resolve() when called multiple times for the same
- * path, because the resolved Path objects are cached. Much slower
- * otherwise.
- */
- resolvePosix(...paths) {
- let r = "";
- for (let i = paths.length - 1; i >= 0; i--) {
- const p = paths[i];
- if (!p || p === ".")
- continue;
- r = r ? `${p}/${r}` : p;
- if (this.isAbsolute(p)) {
- break;
+ #B(t) {
+ this.#s |= qe;
+ for (let e = t.provisional; e < t.length; e++) {
+ let s = t[e];
+ s && s.#A();
}
}
- const cached = this.#resolvePosixCache.get(r);
- if (cached !== void 0) {
- return cached;
+ #A() {
+ this.#s & B || (this.#s = (this.#s | B) & bt, this.#$());
}
- const result = this.cwd.resolve(r).fullpathPosix();
- this.#resolvePosixCache.set(r, result);
- return result;
- }
- /**
- * find the relative path from the cwd to the supplied path string or entry
- */
- relative(entry = this.cwd) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
+ #$() {
+ let t = this.children();
+ t.provisional = 0;
+ for (let e of t) e.#A();
}
- return entry.relative();
- }
- /**
- * find the relative path from the cwd to the supplied path string or
- * entry, using / as the path delimiter, even on Windows.
- */
- relativePosix(entry = this.cwd) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
+ #D() {
+ this.#s |= te, this.#j();
}
- return entry.relativePosix();
- }
- /**
- * Return the basename for the provided string or Path object
- */
- basename(entry = this.cwd) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
+ #j() {
+ if (this.#s & vt) return;
+ let t = this.#s;
+ (t & N) === I && (t &= bt), this.#s = t | vt, this.#$();
}
- return entry.name;
- }
- /**
- * Return the dirname for the provided string or Path object
- */
- dirname(entry = this.cwd) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
+ #z(t = "") {
+ t === "ENOTDIR" || t === "EPERM" ? this.#j() : t === "ENOENT" ? this.#A() : this.children().provisional = 0;
}
- return (entry.parent || entry).fullpath();
- }
- async readdir(entry = this.cwd, opts = {
- withFileTypes: true
- }) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- opts = entry;
- entry = this.cwd;
- }
- const { withFileTypes } = opts;
- if (!entry.canReaddir()) {
- return [];
- } else {
- const p = await entry.readdir();
- return withFileTypes ? p : p.map((e) => e.name);
+ #x(t = "") {
+ t === "ENOTDIR" ? this.parent.#j() : t === "ENOENT" && this.#A();
}
- }
- readdirSync(entry = this.cwd, opts = {
- withFileTypes: true
- }) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- opts = entry;
- entry = this.cwd;
- }
- const { withFileTypes = true } = opts;
- if (!entry.canReaddir()) {
- return [];
- } else if (withFileTypes) {
- return entry.readdirSync();
- } else {
- return entry.readdirSync().map((e) => e.name);
+ #R(t = "") {
+ let e = this.#s;
+ e |= Jt, t === "ENOENT" && (e |= B), (t === "EINVAL" || t === "UNKNOWN") && (e &= bt), this.#s = e, t === "ENOTDIR" && this.parent && this.parent.#j();
}
- }
- /**
- * Call lstat() on the string or Path object, and update all known
- * information that can be determined.
- *
- * Note that unlike `fs.lstat()`, the returned value does not contain some
- * information, such as `mode`, `dev`, `nlink`, and `ino`. If that
- * information is required, you will need to call `fs.lstat` yourself.
- *
- * If the Path refers to a nonexistent file, or if the lstat call fails for
- * any reason, `undefined` is returned. Otherwise the updated Path object is
- * returned.
- *
- * Results are cached, and thus may be out of date if the filesystem is
- * mutated.
- */
- async lstat(entry = this.cwd) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
+ #G(t, e) {
+ return this.#U(t, e) || this.#N(t, e);
}
- return entry.lstat();
- }
- /**
- * synchronous {@link PathScurryBase.lstat}
- */
- lstatSync(entry = this.cwd) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
+ #N(t, e) {
+ let s = He(t), i = this.newChild(t.name, s, { parent: this }), r = i.#s & N;
+ return r !== I && r !== it && r !== L && (i.#s |= vt), e.unshift(i), e.provisional++, i;
}
- return entry.lstatSync();
- }
- async readlink(entry = this.cwd, { withFileTypes } = {
- withFileTypes: false
- }) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- withFileTypes = entry.withFileTypes;
- entry = this.cwd;
+ #U(t, e) {
+ for (let s = e.provisional; s < e.length; s++) {
+ let i = e[s];
+ if ((this.nocase ? Qt(t.name) : _t(t.name)) === i.#E) return this.#V(t, i, s, e);
+ }
}
- const e = await entry.readlink();
- return withFileTypes ? e : e?.fullpath();
- }
- readlinkSync(entry = this.cwd, { withFileTypes } = {
- withFileTypes: false
- }) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- withFileTypes = entry.withFileTypes;
- entry = this.cwd;
+ #V(t, e, s, i) {
+ let r = e.name;
+ return e.#s = e.#s & bt | He(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
}
- const e = entry.readlinkSync();
- return withFileTypes ? e : e?.fullpath();
- }
- async realpath(entry = this.cwd, { withFileTypes } = {
- withFileTypes: false
- }) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- withFileTypes = entry.withFileTypes;
- entry = this.cwd;
+ async lstat() {
+ if ((this.#s & B) === 0) try {
+ return this.#q(await this.#t.promises.lstat(this.fullpath())), this;
+ } catch (t) {
+ this.#x(t.code);
+ }
}
- const e = await entry.realpath();
- return withFileTypes ? e : e?.fullpath();
- }
- realpathSync(entry = this.cwd, { withFileTypes } = {
- withFileTypes: false
- }) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- withFileTypes = entry.withFileTypes;
- entry = this.cwd;
- }
- const e = entry.realpathSync();
- return withFileTypes ? e : e?.fullpath();
- }
- async walk(entry = this.cwd, opts = {}) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- opts = entry;
- entry = this.cwd;
- }
- const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
- const results = [];
- if (!filter || filter(entry)) {
- results.push(withFileTypes ? entry : entry.fullpath());
- }
- const dirs = /* @__PURE__ */ new Set();
- const walk = (dir, cb) => {
- dirs.add(dir);
- dir.readdirCB((er, entries) => {
- if (er) {
- return cb(er);
- }
- let len = entries.length;
- if (!len)
- return cb();
- const next = () => {
- if (--len === 0) {
- cb();
- }
- };
- for (const e of entries) {
- if (!filter || filter(e)) {
- results.push(withFileTypes ? e : e.fullpath());
- }
- if (follow && e.isSymbolicLink()) {
- e.realpath().then((r) => r?.isUnknown() ? r.lstat() : r).then((r) => r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next());
- } else {
- if (e.shouldWalk(dirs, walkFilter)) {
- walk(e, next);
- } else {
- next();
- }
- }
+ lstatSync() {
+ if ((this.#s & B) === 0) try {
+ return this.#q(this.#t.lstatSync(this.fullpath())), this;
+ } catch (t) {
+ this.#x(t.code);
+ }
+ }
+ #q(t) {
+ let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: h, blocks: a, ctime: o, ctimeMs: l, dev: c, gid: u, ino: p, mode: d, mtime: g, mtimeMs: f, nlink: b, rdev: m, size: y, uid: _2 } = t;
+ this.#b = e, this.#l = s, this.#y = i, this.#_ = r, this.#p = h, this.#a = a, this.#v = o, this.#w = l, this.#i = c, this.#d = u, this.#o = p, this.#e = d, this.#u = g, this.#r = f, this.#h = b, this.#c = m, this.#m = y, this.#n = _2;
+ let v = He(t);
+ this.#s = this.#s & bt | v | Ks, v !== L && v !== I && v !== it && (this.#s |= vt);
+ }
+ #L = [];
+ #f = false;
+ #H(t) {
+ this.#f = false;
+ let e = this.#L.slice();
+ this.#L.length = 0, e.forEach((s) => s(null, t));
+ }
+ readdirCB(t, e = false) {
+ if (!this.canReaddir()) {
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
+ return;
+ }
+ let s = this.children();
+ if (this.calledReaddir()) {
+ let r = s.slice(0, s.provisional);
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
+ return;
+ }
+ if (this.#L.push(t), this.#f) return;
+ this.#f = true;
+ let i = this.fullpath();
+ this.#t.readdir(i, { withFileTypes: true }, (r, h) => {
+ if (r) this.#z(r.code), s.provisional = 0;
+ else {
+ for (let a of h) this.#G(a, s);
+ this.#B(s);
}
- }, true);
- };
- const start = entry;
- return new Promise((res, rej) => {
- walk(start, (er) => {
- if (er)
- return rej(er);
- res(results);
+ this.#H(s.slice(0, s.provisional));
});
- });
- }
- walkSync(entry = this.cwd, opts = {}) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- opts = entry;
- entry = this.cwd;
- }
- const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
- const results = [];
- if (!filter || filter(entry)) {
- results.push(withFileTypes ? entry : entry.fullpath());
- }
- const dirs = /* @__PURE__ */ new Set([entry]);
- for (const dir of dirs) {
- const entries = dir.readdirSync();
- for (const e of entries) {
- if (!filter || filter(e)) {
- results.push(withFileTypes ? e : e.fullpath());
- }
- let r = e;
- if (e.isSymbolicLink()) {
- if (!(follow && (r = e.realpathSync())))
- continue;
- if (r.isUnknown())
- r.lstatSync();
- }
- if (r.shouldWalk(dirs, walkFilter)) {
- dirs.add(r);
+ }
+ #I;
+ async readdir() {
+ if (!this.canReaddir()) return [];
+ let t = this.children();
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
+ let e = this.fullpath();
+ if (this.#I) await this.#I;
+ else {
+ let s = () => {
+ };
+ this.#I = new Promise((i) => s = i);
+ try {
+ for (let i of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#G(i, t);
+ this.#B(t);
+ } catch (i) {
+ this.#z(i.code), t.provisional = 0;
}
+ this.#I = void 0, s();
}
+ return t.slice(0, t.provisional);
}
- return results;
- }
- /**
- * Support for `for await`
- *
- * Alias for {@link PathScurryBase.iterate}
- *
- * Note: As of Node 19, this is very slow, compared to other methods of
- * walking. Consider using {@link PathScurryBase.stream} if memory overhead
- * and backpressure are concerns, or {@link PathScurryBase.walk} if not.
- */
- [Symbol.asyncIterator]() {
- return this.iterate();
- }
- iterate(entry = this.cwd, options = {}) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- options = entry;
- entry = this.cwd;
+ readdirSync() {
+ if (!this.canReaddir()) return [];
+ let t = this.children();
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
+ let e = this.fullpath();
+ try {
+ for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#G(s, t);
+ this.#B(t);
+ } catch (s) {
+ this.#z(s.code), t.provisional = 0;
+ }
+ return t.slice(0, t.provisional);
+ }
+ canReaddir() {
+ if (this.#s & Vs) return false;
+ let t = N & this.#s;
+ return t === L || t === I || t === it;
+ }
+ shouldWalk(t, e) {
+ return (this.#s & I) === I && !(this.#s & Vs) && !t.has(this) && (!e || e(this));
+ }
+ async realpath() {
+ if (this.#k) return this.#k;
+ if (!((te | Jt | B) & this.#s)) try {
+ let t = await this.#t.promises.realpath(this.fullpath());
+ return this.#k = this.resolve(t);
+ } catch {
+ this.#D();
+ }
}
- return this.stream(entry, options)[Symbol.asyncIterator]();
- }
- /**
- * Iterating over a PathScurry performs a synchronous walk.
- *
- * Alias for {@link PathScurryBase.iterateSync}
- */
- [Symbol.iterator]() {
- return this.iterateSync();
- }
- *iterateSync(entry = this.cwd, opts = {}) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- opts = entry;
- entry = this.cwd;
- }
- const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
- if (!filter || filter(entry)) {
- yield withFileTypes ? entry : entry.fullpath();
- }
- const dirs = /* @__PURE__ */ new Set([entry]);
- for (const dir of dirs) {
- const entries = dir.readdirSync();
- for (const e of entries) {
- if (!filter || filter(e)) {
- yield withFileTypes ? e : e.fullpath();
- }
- let r = e;
- if (e.isSymbolicLink()) {
- if (!(follow && (r = e.realpathSync())))
- continue;
- if (r.isUnknown())
- r.lstatSync();
- }
- if (r.shouldWalk(dirs, walkFilter)) {
- dirs.add(r);
+ realpathSync() {
+ if (this.#k) return this.#k;
+ if (!((te | Jt | B) & this.#s)) try {
+ let t = this.#t.realpathSync(this.fullpath());
+ return this.#k = this.resolve(t);
+ } catch {
+ this.#D();
+ }
+ }
+ [ri](t) {
+ if (t === this) return;
+ t.isCWD = false, this.isCWD = true;
+ let e = /* @__PURE__ */ new Set([]), s = [], i = this;
+ for (; i && i.parent; ) e.add(i), i.#C = s.join(this.sep), i.#M = s.join("/"), i = i.parent, s.push("..");
+ for (i = t; i && i.parent && !e.has(i); ) i.#C = void 0, i.#M = void 0, i = i.parent;
+ }
+ };
+ E.PathBase = R;
+ var Ot = class n extends R {
+ sep = "\\";
+ splitSep = Gr;
+ constructor(t, e = L, s, i, r, h, a) {
+ super(t, e, s, i, r, h, a);
+ }
+ newChild(t, e = L, s = {}) {
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
+ }
+ getRootString(t) {
+ return Wr.exec(t)?.[0] ?? ee.win32.parse(t).root;
+ }
+ getRoot(t) {
+ if (t = Xs(t.toUpperCase()), t === this.root.name || /^[\\/]$/.test(t)) return this.root;
+ for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
+ return this.roots[t] = new kt(t, { nocase: this.nocase, fs: this.fs }).root;
+ }
+ sameRoot(t, e = this.root.name) {
+ return Xs(t.toUpperCase()) === e;
+ }
+ };
+ E.PathWin32 = Ot;
+ var Ct = class n extends R {
+ splitSep = "/";
+ sep = "/";
+ constructor(t, e = L, s, i, r, h, a) {
+ super(t, e, s, i, r, h, a);
+ }
+ getRootString(t) {
+ return t.startsWith("/") ? "/" : "";
+ }
+ getRoot(t) {
+ return this.root;
+ }
+ newChild(t, e = L, s = {}) {
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
+ }
+ };
+ E.PathPosix = Ct;
+ var At = class {
+ root;
+ rootPath;
+ roots;
+ cwd;
+ #t;
+ #i;
+ #e;
+ nocase;
+ #h;
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: h = St } = {}) {
+ this.#h = Js(h), (t instanceof URL || t.startsWith("file://")) && (t = (0, Tr.fileURLToPath)(t));
+ let a = e.resolve(t);
+ this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(a), this.#t = new Et(), this.#i = new Et(), this.#e = new se(r);
+ let o = a.substring(this.rootPath.length).split(s);
+ if (o.length === 1 && !o[0] && o.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
+ this.nocase = i, this.root = this.newRoot(this.#h), this.roots[this.rootPath] = this.root;
+ let l = this.root, c = o.length - 1, u = e.sep, p = this.rootPath, d = false;
+ for (let g of o) {
+ let f = c--;
+ l = l.child(g, { relative: new Array(f).fill("..").join(u), relativePosix: new Array(f).fill("..").join("/"), fullpath: p += (d ? "" : u) + g }), d = true;
+ }
+ this.cwd = l;
+ }
+ depth(t = this.cwd) {
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
+ }
+ childrenCache() {
+ return this.#e;
+ }
+ resolve(...t) {
+ let e = "";
+ for (let r = t.length - 1; r >= 0; r--) {
+ let h = t[r];
+ if (!(!h || h === ".") && (e = e ? `${h}/${e}` : h, this.isAbsolute(h))) break;
+ }
+ let s = this.#t.get(e);
+ if (s !== void 0) return s;
+ let i = this.cwd.resolve(e).fullpath();
+ return this.#t.set(e, i), i;
+ }
+ resolvePosix(...t) {
+ let e = "";
+ for (let r = t.length - 1; r >= 0; r--) {
+ let h = t[r];
+ if (!(!h || h === ".") && (e = e ? `${h}/${e}` : h, this.isAbsolute(h))) break;
+ }
+ let s = this.#i.get(e);
+ if (s !== void 0) return s;
+ let i = this.cwd.resolve(e).fullpathPosix();
+ return this.#i.set(e, i), i;
+ }
+ relative(t = this.cwd) {
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
+ }
+ relativePosix(t = this.cwd) {
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
+ }
+ basename(t = this.cwd) {
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
+ }
+ dirname(t = this.cwd) {
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
+ }
+ async readdir(t = this.cwd, e = { withFileTypes: true }) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
+ let { withFileTypes: s } = e;
+ if (t.canReaddir()) {
+ let i = await t.readdir();
+ return s ? i : i.map((r) => r.name);
+ } else return [];
+ }
+ readdirSync(t = this.cwd, e = { withFileTypes: true }) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
+ let { withFileTypes: s = true } = e;
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
+ }
+ async lstat(t = this.cwd) {
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
+ }
+ lstatSync(t = this.cwd) {
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
+ }
+ async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
+ let s = await t.readlink();
+ return e ? s : s?.fullpath();
+ }
+ readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
+ let s = t.readlinkSync();
+ return e ? s : s?.fullpath();
+ }
+ async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
+ let s = await t.realpath();
+ return e ? s : s?.fullpath();
+ }
+ realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
+ let s = t.realpathSync();
+ return e ? s : s?.fullpath();
+ }
+ async walk(t = this.cwd, e = {}) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = [];
+ (!r || r(t)) && a.push(s ? t : t.fullpath());
+ let o = /* @__PURE__ */ new Set(), l = (u, p) => {
+ o.add(u), u.readdirCB((d, g) => {
+ if (d) return p(d);
+ let f = g.length;
+ if (!f) return p();
+ let b = () => {
+ --f === 0 && p();
+ };
+ for (let m of g) (!r || r(m)) && a.push(s ? m : m.fullpath()), i && m.isSymbolicLink() ? m.realpath().then((y) => y?.isUnknown() ? y.lstat() : y).then((y) => y?.shouldWalk(o, h) ? l(y, b) : b()) : m.shouldWalk(o, h) ? l(m, b) : b();
+ }, true);
+ }, c = t;
+ return new Promise((u, p) => {
+ l(c, (d) => {
+ if (d) return p(d);
+ u(a);
+ });
+ });
+ }
+ walkSync(t = this.cwd, e = {}) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = [];
+ (!r || r(t)) && a.push(s ? t : t.fullpath());
+ let o = /* @__PURE__ */ new Set([t]);
+ for (let l of o) {
+ let c = l.readdirSync();
+ for (let u of c) {
+ (!r || r(u)) && a.push(s ? u : u.fullpath());
+ let p = u;
+ if (u.isSymbolicLink()) {
+ if (!(i && (p = u.realpathSync()))) continue;
+ p.isUnknown() && p.lstatSync();
+ }
+ p.shouldWalk(o, h) && o.add(p);
}
}
+ return a;
}
- }
- stream(entry = this.cwd, opts = {}) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- opts = entry;
- entry = this.cwd;
- }
- const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
- const results = new minipass_1.Minipass({ objectMode: true });
- if (!filter || filter(entry)) {
- results.write(withFileTypes ? entry : entry.fullpath());
- }
- const dirs = /* @__PURE__ */ new Set();
- const queue = [entry];
- let processing = 0;
- const process5 = () => {
- let paused = false;
- while (!paused) {
- const dir = queue.shift();
- if (!dir) {
- if (processing === 0)
- results.end();
- return;
+ [Symbol.asyncIterator]() {
+ return this.iterate();
+ }
+ iterate(t = this.cwd, e = {}) {
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
+ }
+ [Symbol.iterator]() {
+ return this.iterateSync();
+ }
+ *iterateSync(t = this.cwd, e = {}) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e;
+ (!r || r(t)) && (yield s ? t : t.fullpath());
+ let a = /* @__PURE__ */ new Set([t]);
+ for (let o of a) {
+ let l = o.readdirSync();
+ for (let c of l) {
+ (!r || r(c)) && (yield s ? c : c.fullpath());
+ let u = c;
+ if (c.isSymbolicLink()) {
+ if (!(i && (u = c.realpathSync()))) continue;
+ u.isUnknown() && u.lstatSync();
+ }
+ u.shouldWalk(a, h) && a.add(u);
}
- processing++;
- dirs.add(dir);
- const onReaddir = (er, entries, didRealpaths = false) => {
- if (er)
- return results.emit("error", er);
- if (follow && !didRealpaths) {
- const promises4 = [];
- for (const e of entries) {
- if (e.isSymbolicLink()) {
- promises4.push(e.realpath().then((r) => r?.isUnknown() ? r.lstat() : r));
- }
- }
- if (promises4.length) {
- Promise.all(promises4).then(() => onReaddir(null, entries, true));
- return;
- }
+ }
+ }
+ stream(t = this.cwd, e = {}) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = new Hs.Minipass({ objectMode: true });
+ (!r || r(t)) && a.write(s ? t : t.fullpath());
+ let o = /* @__PURE__ */ new Set(), l = [t], c = 0, u = () => {
+ let p = false;
+ for (; !p; ) {
+ let d = l.shift();
+ if (!d) {
+ c === 0 && a.end();
+ return;
}
- for (const e of entries) {
- if (e && (!filter || filter(e))) {
- if (!results.write(withFileTypes ? e : e.fullpath())) {
- paused = true;
+ c++, o.add(d);
+ let g = (b, m, y = false) => {
+ if (b) return a.emit("error", b);
+ if (i && !y) {
+ let _2 = [];
+ for (let v of m) v.isSymbolicLink() && _2.push(v.realpath().then((S) => S?.isUnknown() ? S.lstat() : S));
+ if (_2.length) {
+ Promise.all(_2).then(() => g(null, m, true));
+ return;
}
}
- }
- processing--;
- for (const e of entries) {
- const r = e.realpathCached() || e;
- if (r.shouldWalk(dirs, walkFilter)) {
- queue.push(r);
- }
- }
- if (paused && !results.flowing) {
- results.once("drain", process5);
- } else if (!sync) {
- process5();
- }
- };
- let sync = true;
- dir.readdirCB(onReaddir, true);
- sync = false;
- }
- };
- process5();
- return results;
- }
- streamSync(entry = this.cwd, opts = {}) {
- if (typeof entry === "string") {
- entry = this.cwd.resolve(entry);
- } else if (!(entry instanceof PathBase)) {
- opts = entry;
- entry = this.cwd;
- }
- const { withFileTypes = true, follow = false, filter, walkFilter } = opts;
- const results = new minipass_1.Minipass({ objectMode: true });
- const dirs = /* @__PURE__ */ new Set();
- if (!filter || filter(entry)) {
- results.write(withFileTypes ? entry : entry.fullpath());
- }
- const queue = [entry];
- let processing = 0;
- const process5 = () => {
- let paused = false;
- while (!paused) {
- const dir = queue.shift();
- if (!dir) {
- if (processing === 0)
- results.end();
- return;
- }
- processing++;
- dirs.add(dir);
- const entries = dir.readdirSync();
- for (const e of entries) {
- if (!filter || filter(e)) {
- if (!results.write(withFileTypes ? e : e.fullpath())) {
- paused = true;
+ for (let _2 of m) _2 && (!r || r(_2)) && (a.write(s ? _2 : _2.fullpath()) || (p = true));
+ c--;
+ for (let _2 of m) {
+ let v = _2.realpathCached() || _2;
+ v.shouldWalk(o, h) && l.push(v);
}
- }
+ p && !a.flowing ? a.once("drain", u) : f || u();
+ }, f = true;
+ d.readdirCB(g, true), f = false;
}
- processing--;
- for (const e of entries) {
- let r = e;
- if (e.isSymbolicLink()) {
- if (!(follow && (r = e.realpathSync())))
- continue;
- if (r.isUnknown())
- r.lstatSync();
+ };
+ return u(), a;
+ }
+ streamSync(t = this.cwd, e = {}) {
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, a = new Hs.Minipass({ objectMode: true }), o = /* @__PURE__ */ new Set();
+ (!r || r(t)) && a.write(s ? t : t.fullpath());
+ let l = [t], c = 0, u = () => {
+ let p = false;
+ for (; !p; ) {
+ let d = l.shift();
+ if (!d) {
+ c === 0 && a.end();
+ return;
}
- if (r.shouldWalk(dirs, walkFilter)) {
- queue.push(r);
+ c++, o.add(d);
+ let g = d.readdirSync();
+ for (let f of g) (!r || r(f)) && (a.write(s ? f : f.fullpath()) || (p = true));
+ c--;
+ for (let f of g) {
+ let b = f;
+ if (f.isSymbolicLink()) {
+ if (!(i && (b = f.realpathSync()))) continue;
+ b.isUnknown() && b.lstatSync();
+ }
+ b.shouldWalk(o, h) && l.push(b);
}
}
- }
- if (paused && !results.flowing)
- results.once("drain", process5);
- };
- process5();
- return results;
- }
- chdir(path6 = this.cwd) {
- const oldCwd = this.cwd;
- this.cwd = typeof path6 === "string" ? this.cwd.resolve(path6) : path6;
- this.cwd[setAsCwd](oldCwd);
- }
- };
- exports2.PathScurryBase = PathScurryBase;
- var PathScurryWin32 = class extends PathScurryBase {
- /**
- * separator for generating path strings
- */
- sep = "\\";
- constructor(cwd = process.cwd(), opts = {}) {
- const { nocase = true } = opts;
- super(cwd, node_path_1.win32, "\\", { ...opts, nocase });
- this.nocase = nocase;
- for (let p = this.cwd; p; p = p.parent) {
- p.nocase = this.nocase;
+ p && !a.flowing && a.once("drain", u);
+ };
+ return u(), a;
}
- }
- /**
- * @internal
- */
- parseRootPath(dir) {
- return node_path_1.win32.parse(dir).root.toUpperCase();
- }
- /**
- * @internal
- */
- newRoot(fs9) {
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
- }
- /**
- * Return true if the provided path string is an absolute path
- */
- isAbsolute(p) {
- return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p);
- }
- };
- exports2.PathScurryWin32 = PathScurryWin32;
- var PathScurryPosix = class extends PathScurryBase {
- /**
- * separator for generating path strings
- */
- sep = "/";
- constructor(cwd = process.cwd(), opts = {}) {
- const { nocase = false } = opts;
- super(cwd, node_path_1.posix, "/", { ...opts, nocase });
- this.nocase = nocase;
- }
- /**
- * @internal
- */
- parseRootPath(_dir) {
- return "/";
- }
- /**
- * @internal
- */
- newRoot(fs9) {
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs9 });
- }
- /**
- * Return true if the provided path string is an absolute path
- */
- isAbsolute(p) {
- return p.startsWith("/");
- }
- };
- exports2.PathScurryPosix = PathScurryPosix;
- var PathScurryDarwin = class extends PathScurryPosix {
- constructor(cwd = process.cwd(), opts = {}) {
- const { nocase = true } = opts;
- super(cwd, { ...opts, nocase });
- }
- };
- exports2.PathScurryDarwin = PathScurryDarwin;
- exports2.Path = process.platform === "win32" ? PathWin32 : PathPosix;
- exports2.PathScurry = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix;
- }
-});
-
-// node_modules/glob/dist/commonjs/pattern.js
-var require_pattern = __commonJS({
- "node_modules/glob/dist/commonjs/pattern.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.Pattern = void 0;
- var minimatch_1 = require_commonjs3();
- var isPatternList = (pl) => pl.length >= 1;
- var isGlobList = (gl) => gl.length >= 1;
- var Pattern = class _Pattern {
- #patternList;
- #globList;
- #index;
- length;
- #platform;
- #rest;
- #globString;
- #isDrive;
- #isUNC;
- #isAbsolute;
- #followGlobstar = true;
- constructor(patternList, globList, index, platform2) {
- if (!isPatternList(patternList)) {
- throw new TypeError("empty pattern list");
- }
- if (!isGlobList(globList)) {
- throw new TypeError("empty glob list");
- }
- if (globList.length !== patternList.length) {
- throw new TypeError("mismatched pattern list and glob list lengths");
- }
- this.length = patternList.length;
- if (index < 0 || index >= this.length) {
- throw new TypeError("index out of range");
- }
- this.#patternList = patternList;
- this.#globList = globList;
- this.#index = index;
- this.#platform = platform2;
- if (this.#index === 0) {
- if (this.isUNC()) {
- const [p0, p1, p2, p3, ...prest] = this.#patternList;
- const [g0, g1, g2, g3, ...grest] = this.#globList;
- if (prest[0] === "") {
- prest.shift();
- grest.shift();
- }
- const p = [p0, p1, p2, p3, ""].join("/");
- const g = [g0, g1, g2, g3, ""].join("/");
- this.#patternList = [p, ...prest];
- this.#globList = [g, ...grest];
- this.length = this.#patternList.length;
- } else if (this.isDrive() || this.isAbsolute()) {
- const [p1, ...prest] = this.#patternList;
- const [g1, ...grest] = this.#globList;
- if (prest[0] === "") {
- prest.shift();
- grest.shift();
- }
- const p = p1 + "/";
- const g = g1 + "/";
- this.#patternList = [p, ...prest];
- this.#globList = [g, ...grest];
- this.length = this.#patternList.length;
- }
+ chdir(t = this.cwd) {
+ let e = this.cwd;
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[ri](e);
}
- }
- /**
- * The first entry in the parsed list of patterns
- */
- pattern() {
- return this.#patternList[this.#index];
- }
- /**
- * true of if pattern() returns a string
- */
- isString() {
- return typeof this.#patternList[this.#index] === "string";
- }
- /**
- * true of if pattern() returns GLOBSTAR
- */
- isGlobstar() {
- return this.#patternList[this.#index] === minimatch_1.GLOBSTAR;
- }
- /**
- * true if pattern() returns a regexp
- */
- isRegExp() {
- return this.#patternList[this.#index] instanceof RegExp;
- }
- /**
- * The /-joined set of glob parts that make up this pattern
- */
- globString() {
- return this.#globString = this.#globString || (this.#index === 0 ? this.isAbsolute() ? this.#globList[0] + this.#globList.slice(1).join("/") : this.#globList.join("/") : this.#globList.slice(this.#index).join("/"));
- }
- /**
- * true if there are more pattern parts after this one
- */
- hasMore() {
- return this.length > this.#index + 1;
- }
- /**
- * The rest of the pattern after this part, or null if this is the end
- */
- rest() {
- if (this.#rest !== void 0)
- return this.#rest;
- if (!this.hasMore())
- return this.#rest = null;
- this.#rest = new _Pattern(this.#patternList, this.#globList, this.#index + 1, this.#platform);
- this.#rest.#isAbsolute = this.#isAbsolute;
- this.#rest.#isUNC = this.#isUNC;
- this.#rest.#isDrive = this.#isDrive;
- return this.#rest;
- }
- /**
- * true if the pattern represents a //unc/path/ on windows
- */
- isUNC() {
- const pl = this.#patternList;
- return this.#isUNC !== void 0 ? this.#isUNC : this.#isUNC = this.#platform === "win32" && this.#index === 0 && pl[0] === "" && pl[1] === "" && typeof pl[2] === "string" && !!pl[2] && typeof pl[3] === "string" && !!pl[3];
- }
- // pattern like C:/...
- // split = ['C:', ...]
- // XXX: would be nice to handle patterns like `c:*` to test the cwd
- // in c: for *, but I don't know of a way to even figure out what that
- // cwd is without actually chdir'ing into it?
- /**
- * True if the pattern starts with a drive letter on Windows
- */
- isDrive() {
- const pl = this.#patternList;
- return this.#isDrive !== void 0 ? this.#isDrive : this.#isDrive = this.#platform === "win32" && this.#index === 0 && this.length > 1 && typeof pl[0] === "string" && /^[a-z]:$/i.test(pl[0]);
- }
- // pattern = '/' or '/...' or '/x/...'
- // split = ['', ''] or ['', ...] or ['', 'x', ...]
- // Drive and UNC both considered absolute on windows
- /**
- * True if the pattern is rooted on an absolute path
- */
- isAbsolute() {
- const pl = this.#patternList;
- return this.#isAbsolute !== void 0 ? this.#isAbsolute : this.#isAbsolute = pl[0] === "" && pl.length > 1 || this.isDrive() || this.isUNC();
- }
- /**
- * consume the root of the pattern, and return it
- */
- root() {
- const p = this.#patternList[0];
- return typeof p === "string" && this.isAbsolute() && this.#index === 0 ? p : "";
- }
- /**
- * Check to see if the current globstar pattern is allowed to follow
- * a symbolic link.
- */
- checkFollowGlobstar() {
- return !(this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar);
- }
- /**
- * Mark that the current globstar pattern is following a symbolic link
- */
- markFollowGlobstar() {
- if (this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar)
+ };
+ E.PathScurryBase = At;
+ var kt = class extends At {
+ sep = "\\";
+ constructor(t = process.cwd(), e = {}) {
+ let { nocase: s = true } = e;
+ typeof t == "string" && !t.startsWith("file://") && (t = t.replace(Br, "").replace(zr, "\\")), super(t, ee.win32, "\\", { ...e, nocase: s }), this.nocase = s;
+ for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
+ }
+ parseRootPath(t) {
+ return ee.win32.parse(t).root.toUpperCase();
+ }
+ newRoot(t) {
+ return new Ot(this.rootPath, I, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
+ }
+ isAbsolute(t) {
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
+ }
+ };
+ E.PathScurryWin32 = kt;
+ var Mt = class extends At {
+ sep = "/";
+ constructor(t = process.cwd(), e = {}) {
+ let { nocase: s = false } = e;
+ super(t, ee.posix, "/", { ...e, nocase: s }), this.nocase = s;
+ }
+ parseRootPath(t) {
+ return "/";
+ }
+ newRoot(t) {
+ return new Ct(this.rootPath, I, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
+ }
+ isAbsolute(t) {
+ return t.startsWith("/");
+ }
+ };
+ E.PathScurryPosix = Mt;
+ var ie = class extends Mt {
+ constructor(t = process.cwd(), e = {}) {
+ let { nocase: s = true } = e;
+ super(t, { ...e, nocase: s });
+ }
+ };
+ E.PathScurryDarwin = ie;
+ E.Path = process.platform === "win32" ? Ot : Ct;
+ E.PathScurry = process.platform === "win32" ? kt : process.platform === "darwin" ? ie : Mt;
+ });
+ var Ke = x((ne) => {
+ "use strict";
+ Object.defineProperty(ne, "__esModule", { value: true });
+ ne.Pattern = void 0;
+ var Ur = Y(), $r = (n) => n.length >= 1, qr = (n) => n.length >= 1, Hr = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), Xe = class n {
+ #t;
+ #i;
+ #e;
+ length;
+ #h;
+ #n;
+ #d;
+ #c;
+ #p;
+ #o;
+ #m = true;
+ constructor(t, e, s, i) {
+ if (!$r(t)) throw new TypeError("empty pattern list");
+ if (!qr(e)) throw new TypeError("empty glob list");
+ if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
+ if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
+ if (this.#t = t, this.#i = e, this.#e = s, this.#h = i, this.#e === 0) {
+ if (this.isUNC()) {
+ let r = this.#a() ? 6 : 4, h = this.#t.slice(0, r), a = this.#i.slice(0, r), o = this.#t.slice(r), l = this.#i.slice(r);
+ o[0] === "" && (o.shift(), l.shift());
+ let c = [...h, ""].join("/"), u = [...a, ""].join("/");
+ this.#t = [c, ...o], this.#i = [u, ...l], this.length = this.#t.length;
+ } else if (this.isDrive() || this.isAbsolute()) {
+ let [r, ...h] = this.#t, [a, ...o] = this.#i;
+ h[0] === "" && (h.shift(), o.shift());
+ let l = `${r}/`, c = `${a}/`;
+ this.#t = [l, ...h], this.#i = [c, ...o], this.length = this.#t.length;
+ }
+ }
+ }
+ [Hr]() {
+ return `Pattern <${this.#i.slice(this.#e).join("/")}>`;
+ }
+ pattern() {
+ return this.#t[this.#e];
+ }
+ isString() {
+ return typeof this.#t[this.#e] == "string";
+ }
+ isGlobstar() {
+ return this.#t[this.#e] === Ur.GLOBSTAR;
+ }
+ isMatcher() {
+ return typeof this.#t[this.#e] == "object";
+ }
+ globString() {
+ return this.#d = this.#d || (this.#e === 0 ? this.isAbsolute() ? this.#i[0] + this.#i.slice(1).join("/") : this.#i.join("/") : this.#i.slice(this.#e).join("/"));
+ }
+ hasMore() {
+ return this.length > this.#e + 1;
+ }
+ rest() {
+ return this.#n !== void 0 ? this.#n : this.hasMore() ? (this.#n = new n(this.#t, this.#i, this.#e + 1, this.#h), this.#n.#o = this.#o, this.#n.#p = this.#p, this.#n.#c = this.#c, this.#n) : this.#n = null;
+ }
+ #a() {
+ let t = this.#t;
+ return t[2] === "?" && typeof t[3] == "string" && /^unc$/i.test(t[3]);
+ }
+ isUNC() {
+ let t = this.#t, e = this.#a() ? 4 : 2;
+ return this.#p !== void 0 ? this.#p : this.#p = this.#h === "win32" && this.#e === 0 && t[0] === "" && t[1] === "" && typeof t[e] == "string" && !!t[e] && typeof t[e + 1] == "string" && !!t[e + 1];
+ }
+ isDrive() {
+ let t = this.#t;
+ return this.#c !== void 0 ? this.#c : this.#c = this.#h === "win32" && this.#e === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
+ }
+ isAbsolute() {
+ let t = this.#t;
+ return this.#o !== void 0 ? this.#o : this.#o = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
+ }
+ root() {
+ let t = this.#t[0];
+ return typeof t == "string" && this.isAbsolute() && this.#e === 0 ? t : "";
+ }
+ checkFollowGlobstar() {
+ return !(this.#e === 0 || !this.isGlobstar() || !this.#m);
+ }
+ markFollowGlobstar() {
+ return this.#e === 0 || !this.isGlobstar() || !this.#m ? false : (this.#m = false, true);
+ }
+ };
+ ne.Pattern = Xe;
+ });
+ var Ze = x((he) => {
+ "use strict";
+ Object.defineProperty(he, "__esModule", { value: true });
+ he.Ignore = void 0;
+ var Ve = Y(), Xr = Ke(), Kr = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Ye = class {
+ relative;
+ relativeChildren;
+ absolute;
+ absoluteChildren;
+ platform;
+ mmopts;
+ slashRoot;
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, normalize: h, platform: a = Kr, root: o, windowsPathsNoEscape: l, allowWindowsEscape: c }, u) {
+ this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = a, l = !!l || c === false, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i, noglobstar: r, normalize: h, optimizationLevel: 2, platform: a, nocomment: true, nonegate: true, windowsPathsNoEscape: l };
+ let p = u?.resolve(o ?? "/").fullpath() ?? "/";
+ this.slashRoot = (0, Ve.escape)(p.replace(/\\/g, "/").replace(/\/$/, ""), { windowsPathsNoEscape: l });
+ for (let d of t) this.add(d);
+ }
+ add(t) {
+ let e = new Ve.Minimatch(t, this.mmopts);
+ for (let s = 0; s < e.set.length; s++) {
+ let i = e.set[s], r = e.globParts[s];
+ if (!i || !r) throw new Error("invalid pattern object");
+ for (; i[0] === "." && r[0] === "."; ) i.shift(), r.shift();
+ let h = new Xr.Pattern(i, r, 0, this.platform), a = h.root() === "/" ? `${this.slashRoot}/${h.rest()?.globString() ?? ""}` : h.globString(), o = new Ve.Minimatch(a, this.mmopts), l = r[r.length - 1] === "**", c = h.isAbsolute();
+ c ? this.absolute.push(o) : this.relative.push(o), l && (c ? this.absoluteChildren.push(o) : this.relativeChildren.push(o));
+ }
+ }
+ ignored(t) {
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
+ for (let h of this.relative) if (h.match(i) || h.match(r)) return true;
+ for (let h of this.absolute) if (h.match(e) || h.match(s)) return true;
return false;
- this.#followGlobstar = false;
- return true;
- }
- };
- exports2.Pattern = Pattern;
- }
-});
-
-// node_modules/glob/dist/commonjs/ignore.js
-var require_ignore = __commonJS({
- "node_modules/glob/dist/commonjs/ignore.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.Ignore = void 0;
- var minimatch_1 = require_commonjs3();
- var pattern_js_1 = require_pattern();
- var defaultPlatform = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
- var Ignore = class {
- relative;
- relativeChildren;
- absolute;
- absoluteChildren;
- platform;
- mmopts;
- constructor(ignored, { nobrace, nocase, noext, noglobstar, platform: platform2 = defaultPlatform }) {
- this.relative = [];
- this.absolute = [];
- this.relativeChildren = [];
- this.absoluteChildren = [];
- this.platform = platform2;
- this.mmopts = {
- dot: true,
- nobrace,
- nocase,
- noext,
- noglobstar,
- optimizationLevel: 2,
- platform: platform2,
- nocomment: true,
- nonegate: true
- };
- for (const ign of ignored)
- this.add(ign);
- }
- add(ign) {
- const mm = new minimatch_1.Minimatch(ign, this.mmopts);
- for (let i = 0; i < mm.set.length; i++) {
- const parsed = mm.set[i];
- const globParts = mm.globParts[i];
- if (!parsed || !globParts) {
- throw new Error("invalid pattern object");
- }
- while (parsed[0] === "." && globParts[0] === ".") {
- parsed.shift();
- globParts.shift();
- }
- const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform);
- const m = new minimatch_1.Minimatch(p.globString(), this.mmopts);
- const children = globParts[globParts.length - 1] === "**";
- const absolute = p.isAbsolute();
- if (absolute)
- this.absolute.push(m);
- else
- this.relative.push(m);
- if (children) {
- if (absolute)
- this.absoluteChildren.push(m);
- else
- this.relativeChildren.push(m);
- }
}
- }
- ignored(p) {
- const fullpath = p.fullpath();
- const fullpaths = `${fullpath}/`;
- const relative4 = p.relative() || ".";
- const relatives = `${relative4}/`;
- for (const m of this.relative) {
- if (m.match(relative4) || m.match(relatives))
- return true;
+ childrenIgnored(t) {
+ let e = `${t.fullpath()}/`, s = `${t.relative() || "."}/`;
+ for (let i of this.relativeChildren) if (i.match(s)) return true;
+ for (let i of this.absoluteChildren) if (i.match(e)) return true;
+ return false;
}
- for (const m of this.absolute) {
- if (m.match(fullpath) || m.match(fullpaths))
- return true;
+ };
+ he.Ignore = Ye;
+ });
+ var oi = x((U) => {
+ "use strict";
+ Object.defineProperty(U, "__esModule", { value: true });
+ U.Processor = U.SubWalks = U.MatchRecord = U.HasWalkedCache = void 0;
+ var hi = Y(), oe = class n {
+ parent;
+ store;
+ constructor(t) {
+ this.parent = t;
}
- return false;
- }
- childrenIgnored(p) {
- const fullpath = p.fullpath() + "/";
- const relative4 = (p.relative() || ".") + "/";
- for (const m of this.relativeChildren) {
- if (m.match(relative4))
- return true;
+ copy() {
+ return new n(this);
}
- for (const m of this.absoluteChildren) {
- if (m.match(fullpath))
- return true;
+ #t(t) {
+ let e = this.store?.get(t);
+ return e || !this.parent ? e : this.parent.#t(t);
}
- return false;
- }
- };
- exports2.Ignore = Ignore;
- }
-});
-
-// node_modules/glob/dist/commonjs/processor.js
-var require_processor = __commonJS({
- "node_modules/glob/dist/commonjs/processor.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.Processor = exports2.SubWalks = exports2.MatchRecord = exports2.HasWalkedCache = void 0;
- var minimatch_1 = require_commonjs3();
- var HasWalkedCache = class _HasWalkedCache {
- store;
- constructor(store = /* @__PURE__ */ new Map()) {
- this.store = store;
- }
- copy() {
- return new _HasWalkedCache(new Map(this.store));
- }
- hasWalked(target, pattern) {
- return this.store.get(target.fullpath())?.has(pattern.globString());
- }
- storeWalked(target, pattern) {
- const fullpath = target.fullpath();
- const cached = this.store.get(fullpath);
- if (cached)
- cached.add(pattern.globString());
- else
- this.store.set(fullpath, /* @__PURE__ */ new Set([pattern.globString()]));
- }
- };
- exports2.HasWalkedCache = HasWalkedCache;
- var MatchRecord = class {
- store = /* @__PURE__ */ new Map();
- add(target, absolute, ifDir) {
- const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0);
- const current = this.store.get(target);
- this.store.set(target, current === void 0 ? n : n & current);
- }
- // match, absolute, ifdir
- entries() {
- return [...this.store.entries()].map(([path6, n]) => [
- path6,
- !!(n & 2),
- !!(n & 1)
- ]);
- }
- };
- exports2.MatchRecord = MatchRecord;
- var SubWalks = class {
- store = /* @__PURE__ */ new Map();
- add(target, pattern) {
- if (!target.canReaddir()) {
- return;
+ hasWalked(t, e) {
+ return !!this.#t(t.fullpath())?.has(e.globString());
}
- const subs = this.store.get(target);
- if (subs) {
- if (!subs.find((p) => p.globString() === pattern.globString())) {
- subs.push(pattern);
- }
- } else
- this.store.set(target, [pattern]);
- }
- get(target) {
- const subs = this.store.get(target);
- if (!subs) {
- throw new Error("attempting to walk unknown path");
- }
- return subs;
- }
- entries() {
- return this.keys().map((k) => [k, this.store.get(k)]);
- }
- keys() {
- return [...this.store.keys()].filter((t) => t.canReaddir());
- }
- };
- exports2.SubWalks = SubWalks;
- var Processor = class _Processor {
- hasWalkedCache;
- matches = new MatchRecord();
- subwalks = new SubWalks();
- patterns;
- follow;
- dot;
- opts;
- constructor(opts, hasWalkedCache) {
- this.opts = opts;
- this.follow = !!opts.follow;
- this.dot = !!opts.dot;
- this.hasWalkedCache = hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache();
- }
- processPatterns(target, patterns) {
- this.patterns = patterns;
- const processingSet = patterns.map((p) => [target, p]);
- for (let [t, pattern] of processingSet) {
- this.hasWalkedCache.storeWalked(t, pattern);
- const root = pattern.root();
- const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
- if (root) {
- t = t.resolve(root === "/" && this.opts.root !== void 0 ? this.opts.root : root);
- const rest2 = pattern.rest();
- if (!rest2) {
- this.matches.add(t, true, false);
- continue;
- } else {
- pattern = rest2;
+ storeWalked(t, e) {
+ let s = t.fullpath(), i = this.#t(s);
+ i ? i.add(e.globString()) : (this.store ??= /* @__PURE__ */ new Map()).set(s, /* @__PURE__ */ new Set([e.globString()]));
+ }
+ };
+ U.HasWalkedCache = oe;
+ var ae = class n {
+ static ABSOLUTE = 2;
+ static IF_DIR = 1;
+ store = /* @__PURE__ */ new Map();
+ add(t, e, s) {
+ let i = (e ? n.ABSOLUTE : 0) | (s ? n.IF_DIR : 0), r = this.store.get(t);
+ this.store.set(t, r === void 0 ? i : i & r);
+ }
+ };
+ U.MatchRecord = ae;
+ var le = class {
+ store = /* @__PURE__ */ new Map();
+ add(t, e) {
+ if (!t.canReaddir()) return;
+ let s = this.store.get(t);
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
+ }
+ get(t) {
+ let e = this.store.get(t);
+ if (!e) throw new Error("attempting to walk unknown path");
+ return e;
+ }
+ entries() {
+ return this.keys().map((t) => [t, this.store.get(t)]);
+ }
+ keys() {
+ return [...this.store.keys()].filter((t) => t.canReaddir());
+ }
+ };
+ U.SubWalks = le;
+ var Je = class n {
+ hasWalkedCache;
+ matches = new ae();
+ subwalks = new le();
+ patterns;
+ follow;
+ dot;
+ opts;
+ constructor(t, e) {
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
+ }
+ processPatterns(t, e) {
+ this.patterns = e;
+ let s = e.map((i) => [t, i]);
+ for (let [i, r] of s) {
+ this.hasWalkedCache.storeWalked(i, r);
+ let h = r.root(), a = r.isAbsolute() && this.opts.absolute !== false;
+ if (h) {
+ i = i.resolve(h === "/" && this.opts.root !== void 0 ? this.opts.root : h);
+ let u = r.rest();
+ if (u) r = u;
+ else {
+ this.matches.add(i, true, false);
+ continue;
+ }
}
- }
- if (t.isENOENT())
- continue;
- let p;
- let rest;
- let changed = false;
- while (typeof (p = pattern.pattern()) === "string" && (rest = pattern.rest())) {
- const c = t.resolve(p);
- t = c;
- pattern = rest;
- changed = true;
- }
- p = pattern.pattern();
- rest = pattern.rest();
- if (changed) {
- if (this.hasWalkedCache.hasWalked(t, pattern))
- continue;
- this.hasWalkedCache.storeWalked(t, pattern);
- }
- if (typeof p === "string") {
- const ifDir = p === ".." || p === "" || p === ".";
- this.matches.add(t.resolve(p), absolute, ifDir);
- continue;
- } else if (p === minimatch_1.GLOBSTAR) {
- if (!t.isSymbolicLink() || this.follow || pattern.checkFollowGlobstar()) {
- this.subwalks.add(t, pattern);
+ if (i.isENOENT()) continue;
+ let o, l, c = false;
+ for (; typeof (o = r.pattern()) == "string" && (l = r.rest()); ) i = i.resolve(o), r = l, c = true;
+ if (o = r.pattern(), l = r.rest(), c) {
+ if (this.hasWalkedCache.hasWalked(i, r)) continue;
+ this.hasWalkedCache.storeWalked(i, r);
}
- const rp = rest?.pattern();
- const rrest = rest?.rest();
- if (!rest || (rp === "" || rp === ".") && !rrest) {
- this.matches.add(t, absolute, rp === "" || rp === ".");
- } else {
- if (rp === "..") {
- const tp = t.parent || t;
- if (!rrest)
- this.matches.add(tp, absolute, true);
- else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {
- this.subwalks.add(tp, rrest);
- }
+ if (typeof o == "string") {
+ let u = o === ".." || o === "" || o === ".";
+ this.matches.add(i.resolve(o), a, u);
+ continue;
+ } else if (o === hi.GLOBSTAR) {
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
+ let u = l?.pattern(), p = l?.rest();
+ if (!l || (u === "" || u === ".") && !p) this.matches.add(i, a, u === "" || u === ".");
+ else if (u === "..") {
+ let d = i.parent || i;
+ p ? this.hasWalkedCache.hasWalked(d, p) || this.subwalks.add(d, p) : this.matches.add(d, a, true);
}
- }
- } else if (p instanceof RegExp) {
- this.subwalks.add(t, pattern);
+ } else typeof o == "object" && this.subwalks.add(i, r);
}
+ return this;
}
- return this;
- }
- subwalkTargets() {
- return this.subwalks.keys();
- }
- child() {
- return new _Processor(this.opts, this.hasWalkedCache);
- }
- // return a new Processor containing the subwalks for each
- // child entry, and a set of matches, and
- // a hasWalkedCache that's a copy of this one
- // then we're going to call
- filterEntries(parent, entries) {
- const patterns = this.subwalks.get(parent);
- const results = this.child();
- for (const e of entries) {
- for (const pattern of patterns) {
- const absolute = pattern.isAbsolute();
- const p = pattern.pattern();
- const rest = pattern.rest();
- if (p === minimatch_1.GLOBSTAR) {
- results.testGlobstar(e, pattern, rest, absolute);
- } else if (p instanceof RegExp) {
- results.testRegExp(e, p, rest, absolute);
- } else {
- results.testString(e, p, rest, absolute);
- }
- }
+ subwalkTargets() {
+ return this.subwalks.keys();
}
- return results;
- }
- testGlobstar(e, pattern, rest, absolute) {
- if (this.dot || !e.name.startsWith(".")) {
- if (!pattern.hasMore()) {
- this.matches.add(e, absolute, false);
- }
- if (e.canReaddir()) {
- if (this.follow || !e.isSymbolicLink()) {
- this.subwalks.add(e, pattern);
- } else if (e.isSymbolicLink()) {
- if (rest && pattern.checkFollowGlobstar()) {
- this.subwalks.add(e, rest);
- } else if (pattern.markFollowGlobstar()) {
- this.subwalks.add(e, pattern);
- }
- }
- }
+ child() {
+ return new n(this.opts, this.hasWalkedCache);
}
- if (rest) {
- const rp = rest.pattern();
- if (typeof rp === "string" && // dots and empty were handled already
- rp !== ".." && rp !== "" && rp !== ".") {
- this.testString(e, rp, rest.rest(), absolute);
- } else if (rp === "..") {
- const ep = e.parent || e;
- this.subwalks.add(ep, rest);
- } else if (rp instanceof RegExp) {
- this.testRegExp(e, rp, rest.rest(), absolute);
+ filterEntries(t, e) {
+ let s = this.subwalks.get(t), i = this.child();
+ for (let r of e) for (let h of s) {
+ let a = h.isAbsolute(), o = h.pattern(), l = h.rest();
+ o === hi.GLOBSTAR ? i.testGlobstar(r, h, l, a) : typeof o == "object" ? i.testMatcher(r, o, l, a) : i.testString(r, o, l, a);
}
+ return i;
}
- }
- testRegExp(e, p, rest, absolute) {
- if (!p.test(e.name))
- return;
- if (!rest) {
- this.matches.add(e, absolute, false);
- } else {
- this.subwalks.add(e, rest);
- }
- }
- testString(e, p, rest, absolute) {
- if (!e.isNamed(p))
- return;
- if (!rest) {
- this.matches.add(e, absolute, false);
- } else {
- this.subwalks.add(e, rest);
+ testGlobstar(t, e, s, i) {
+ if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, false), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
+ let r = s.pattern();
+ if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
+ else if (r === "..") {
+ let h = t.parent || t;
+ this.subwalks.add(h, s);
+ } else typeof r == "object" && this.testMatcher(t, r, s.rest(), i);
+ }
}
- }
- };
- exports2.Processor = Processor;
- }
-});
-
-// node_modules/glob/dist/commonjs/walker.js
-var require_walker = __commonJS({
- "node_modules/glob/dist/commonjs/walker.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0;
- var minipass_1 = require_commonjs5();
- var ignore_js_1 = require_ignore();
- var processor_js_1 = require_processor();
- var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore;
- var GlobUtil = class {
- path;
- patterns;
- opts;
- seen = /* @__PURE__ */ new Set();
- paused = false;
- aborted = false;
- #onResume = [];
- #ignore;
- #sep;
- signal;
- maxDepth;
- includeChildMatches;
- constructor(patterns, path6, opts) {
- this.patterns = patterns;
- this.path = path6;
- this.opts = opts;
- this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
- this.includeChildMatches = opts.includeChildMatches !== false;
- if (opts.ignore || !this.includeChildMatches) {
- this.#ignore = makeIgnore(opts.ignore ?? [], opts);
- if (!this.includeChildMatches && typeof this.#ignore.add !== "function") {
- const m = "cannot ignore child matches, ignore lacks add() method.";
- throw new Error(m);
- }
- }
- this.maxDepth = opts.maxDepth || Infinity;
- if (opts.signal) {
- this.signal = opts.signal;
- this.signal.addEventListener("abort", () => {
- this.#onResume.length = 0;
- });
+ testMatcher(t, e, s, i) {
+ e.testUnchecked(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
}
- }
- #ignored(path6) {
- return this.seen.has(path6) || !!this.#ignore?.ignored?.(path6);
- }
- #childrenIgnored(path6) {
- return !!this.#ignore?.childrenIgnored?.(path6);
- }
- // backpressure mechanism
- pause() {
- this.paused = true;
- }
- resume() {
- if (this.signal?.aborted)
- return;
- this.paused = false;
- let fn = void 0;
- while (!this.paused && (fn = this.#onResume.shift())) {
- fn();
+ testString(t, e, s, i) {
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
}
- }
- onResume(fn) {
- if (this.signal?.aborted)
- return;
- if (!this.paused) {
- fn();
- } else {
- this.#onResume.push(fn);
+ };
+ U.Processor = Je;
+ });
+ var li = x((Q) => {
+ "use strict";
+ Object.defineProperty(Q, "__esModule", { value: true });
+ Q.GlobStream = Q.GlobWalker = Q.GlobUtil = void 0;
+ var Vr = $e(), ai = Ze(), Qe = oi(), { ABSOLUTE: ce, IF_DIR: ue } = Qe.MatchRecord, Yr = (n, t, e) => typeof n == "string" ? new ai.Ignore([n], t, e) : Array.isArray(n) ? new ai.Ignore(n, t, e) : n, xt = class {
+ path;
+ patterns;
+ opts;
+ seen = /* @__PURE__ */ new Set();
+ paused = false;
+ aborted = false;
+ #t = [];
+ #i;
+ #e;
+ signal;
+ maxDepth;
+ includeChildMatches;
+ constructor(t, e, s) {
+ if (this.patterns = t, this.path = e, this.opts = s, this.#e = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== false, (s.ignore || !this.includeChildMatches) && (this.#i = Yr(s.ignore ?? [], s, e), !this.includeChildMatches && typeof this.#i.add != "function")) {
+ let i = "cannot ignore child matches, ignore lacks add() method.";
+ throw new Error(i);
+ }
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
+ this.#t.length = 0;
+ }));
}
- }
- // do the requisite realpath/stat checking, and return the path
- // to add or undefined to filter it out.
- async matchCheck(e, ifDir) {
- if (ifDir && this.opts.nodir)
- return void 0;
- let rpc;
- if (this.opts.realpath) {
- rpc = e.realpathCached() || await e.realpath();
- if (!rpc)
- return void 0;
- e = rpc;
+ #h(t) {
+ return this.seen.has(t) || !!this.#i?.ignored?.(t);
}
- const needStat = e.isUnknown() || this.opts.stat;
- const s = needStat ? await e.lstat() : e;
- if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
- const target = await s.realpath();
- if (target && (target.isUnknown() || this.opts.stat)) {
- await target.lstat();
- }
+ #n(t) {
+ return !!this.#i?.childrenIgnored?.(t);
}
- return this.matchCheckTest(s, ifDir);
- }
- matchCheckTest(e, ifDir) {
- return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0;
- }
- matchCheckSync(e, ifDir) {
- if (ifDir && this.opts.nodir)
- return void 0;
- let rpc;
- if (this.opts.realpath) {
- rpc = e.realpathCached() || e.realpathSync();
- if (!rpc)
- return void 0;
- e = rpc;
+ pause() {
+ this.paused = true;
}
- const needStat = e.isUnknown() || this.opts.stat;
- const s = needStat ? e.lstatSync() : e;
- if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
- const target = s.realpathSync();
- if (target && (target?.isUnknown() || this.opts.stat)) {
- target.lstatSync();
+ resume() {
+ if (this.signal?.aborted) return;
+ this.paused = false;
+ let t;
+ for (; !this.paused && (t = this.#t.shift()); ) t();
+ }
+ onResume(t) {
+ this.paused ? this.#t.push(t) : t();
+ }
+ async matchCheck(t, e) {
+ if (e && this.opts.nodir) return;
+ let s, i;
+ if (this.opts.realpath) {
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
+ i = s;
+ } else i = t;
+ let h = i.isUnknown() || this.opts.stat ? await i.lstat() : i;
+ if (this.opts.follow && this.opts.nodir && h?.isSymbolicLink()) {
+ let a = await h.realpath();
+ a && (a.isUnknown() || this.opts.stat) && await a.lstat();
+ }
+ return this.matchCheckTest(h, e);
+ }
+ matchCheckTest(t, e) {
+ return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#h(t) ? t : void 0;
+ }
+ matchCheckSync(t, e) {
+ if (e && this.opts.nodir) return;
+ let s, i;
+ if (this.opts.realpath) {
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
+ i = s;
+ } else i = t;
+ let h = i.isUnknown() || this.opts.stat ? i.lstatSync() : i;
+ if (this.opts.follow && this.opts.nodir && h?.isSymbolicLink()) {
+ let a = h.realpathSync();
+ a && (a?.isUnknown() || this.opts.stat) && a.lstatSync();
+ }
+ return this.matchCheckTest(h, e);
+ }
+ matchFinish(t, e) {
+ this.#h(t) || this.#d(t, e);
+ }
+ #d(t, e) {
+ if (!this.includeChildMatches && this.#i?.add) {
+ let r = `${t.relativePosix()}/**`;
+ this.#i.add(r);
+ }
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
+ this.seen.add(t);
+ let i = this.opts.mark && t.isDirectory() ? this.#e : "";
+ if (this.opts.withFileTypes) this.matchEmit(t);
+ else if (s) {
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
+ this.matchEmit(r + i);
+ } else {
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), h = this.opts.dotRelative && !r.startsWith(`..${this.#e}`) ? `.${this.#e}` : "";
+ this.matchEmit(r ? h + r + i : `.${i}`);
}
}
- return this.matchCheckTest(s, ifDir);
- }
- matchFinish(e, absolute) {
- if (this.#ignored(e))
- return;
- if (!this.includeChildMatches && this.#ignore?.add) {
- const ign = `${e.relativePosix()}/**`;
- this.#ignore.add(ign);
- }
- const abs = this.opts.absolute === void 0 ? absolute : this.opts.absolute;
- this.seen.add(e);
- const mark = this.opts.mark && e.isDirectory() ? this.#sep : "";
- if (this.opts.withFileTypes) {
- this.matchEmit(e);
- } else if (abs) {
- const abs2 = this.opts.posix ? e.fullpathPosix() : e.fullpath();
- this.matchEmit(abs2 + mark);
- } else {
- const rel = this.opts.posix ? e.relativePosix() : e.relative();
- const pre = this.opts.dotRelative && !rel.startsWith(".." + this.#sep) ? "." + this.#sep : "";
- this.matchEmit(!rel ? "." + mark : pre + rel + mark);
+ async match(t, e, s) {
+ let i = await this.matchCheck(t, s);
+ i && this.matchFinish(i, e);
}
- }
- async match(e, absolute, ifDir) {
- const p = await this.matchCheck(e, ifDir);
- if (p)
- this.matchFinish(p, absolute);
- }
- matchSync(e, absolute, ifDir) {
- const p = this.matchCheckSync(e, ifDir);
- if (p)
- this.matchFinish(p, absolute);
- }
- walkCB(target, patterns, cb) {
- if (this.signal?.aborted)
- cb();
- this.walkCB2(target, patterns, new processor_js_1.Processor(this.opts), cb);
- }
- walkCB2(target, patterns, processor, cb) {
- if (this.#childrenIgnored(target))
- return cb();
- if (this.signal?.aborted)
- cb();
- if (this.paused) {
- this.onResume(() => this.walkCB2(target, patterns, processor, cb));
- return;
+ matchSync(t, e, s) {
+ let i = this.matchCheckSync(t, s);
+ i && this.#d(i, e);
}
- processor.processPatterns(target, patterns);
- let tasks = 1;
- const next = () => {
- if (--tasks === 0)
- cb();
- };
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
- if (this.#ignored(m))
- continue;
- tasks++;
- this.match(m, absolute, ifDir).then(() => next());
+ walkCB(t, e, s) {
+ if (this.signal?.aborted) return s();
+ this.walkCB2(t, e, new Qe.Processor(this.opts), s);
}
- for (const t of processor.subwalkTargets()) {
- if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
- continue;
+ walkCB2(t, e, s, i) {
+ if (this.#n(t) || this.signal?.aborted) return i();
+ if (this.paused) {
+ this.onResume(() => this.walkCB2(t, e, s, i));
+ return;
}
- tasks++;
- const childrenCached = t.readdirCached();
- if (t.calledReaddir())
- this.walkCB3(t, childrenCached, processor, next);
- else {
- t.readdirCB((_2, entries) => this.walkCB3(t, entries, processor, next), true);
+ s.processPatterns(t, e);
+ let r = 1, h = () => {
+ --r === 0 && i();
+ };
+ for (let [a, o] of s.matches.store) this.#h(a) || (r++, this.match(a, !!(o & ce), !!(o & ue)).then(() => h()));
+ for (let a of s.subwalkTargets()) {
+ if (this.maxDepth !== 1 / 0 && a.depth() >= this.maxDepth) continue;
+ r++;
+ let o = a.readdirCached();
+ a.calledReaddir() ? this.walkCB3(a, o, s, h) : a.readdirCB((l, c) => this.walkCB3(a, c, s, h), true);
+ }
+ h();
+ }
+ walkCB3(t, e, s, i) {
+ let r = s.filterEntries(t, e), h = 1, a = () => {
+ --h === 0 && i();
+ };
+ for (let [o, l] of r.matches.store) this.#h(o) || (h++, this.match(o, !!(l & ce), !!(l & ue)).then(() => a()));
+ for (let [o, l] of r.subwalks.entries()) h++, this.walkCB2(o, l, r.child(), a);
+ a();
+ }
+ walkCBSync(t, e, s) {
+ if (this.signal?.aborted) return s();
+ this.walkCB2Sync(t, e, new Qe.Processor(this.opts), s);
+ }
+ walkCB2Sync(t, e, s, i) {
+ if (this.#n(t) || this.signal?.aborted) return i();
+ if (this.paused) {
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
+ return;
}
+ s.processPatterns(t, e);
+ let r = 1, h = () => {
+ --r === 0 && i();
+ };
+ for (let [a, o] of s.matches.store) this.#h(a) || this.matchSync(a, !!(o & ce), !!(o & ue));
+ for (let a of s.subwalkTargets()) {
+ if (this.maxDepth !== 1 / 0 && a.depth() >= this.maxDepth) continue;
+ r++;
+ let o = a.readdirSync();
+ this.walkCB3Sync(a, o, s, h);
+ }
+ h();
+ }
+ walkCB3Sync(t, e, s, i) {
+ let r = s.filterEntries(t, e), h = 1, a = () => {
+ --h === 0 && i();
+ };
+ for (let [o, l] of r.matches.store) this.#h(o) || this.matchSync(o, !!(l & ce), !!(l & ue));
+ for (let [o, l] of r.subwalks.entries()) h++, this.walkCB2Sync(o, l, r.child(), a);
+ a();
}
- next();
- }
- walkCB3(target, entries, processor, cb) {
- processor = processor.filterEntries(target, entries);
- let tasks = 1;
- const next = () => {
- if (--tasks === 0)
- cb();
- };
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
- if (this.#ignored(m))
- continue;
- tasks++;
- this.match(m, absolute, ifDir).then(() => next());
+ };
+ Q.GlobUtil = xt;
+ var ts = class extends xt {
+ matches = [];
+ constructor(t, e, s) {
+ super(t, e, s);
+ }
+ matchEmit(t) {
+ this.matches.push(t);
+ }
+ async walk() {
+ if (this.signal?.aborted) throw this.signal.reason;
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
+ this.walkCB(this.path, this.patterns, () => {
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
+ });
+ }), this.matches;
}
- for (const [target2, patterns] of processor.subwalks.entries()) {
- tasks++;
- this.walkCB2(target2, patterns, processor.child(), next);
+ walkSync() {
+ if (this.signal?.aborted) throw this.signal.reason;
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
+ if (this.signal?.aborted) throw this.signal.reason;
+ }), this.matches;
}
- next();
- }
- walkCBSync(target, patterns, cb) {
- if (this.signal?.aborted)
- cb();
- this.walkCB2Sync(target, patterns, new processor_js_1.Processor(this.opts), cb);
- }
- walkCB2Sync(target, patterns, processor, cb) {
- if (this.#childrenIgnored(target))
- return cb();
- if (this.signal?.aborted)
- cb();
- if (this.paused) {
- this.onResume(() => this.walkCB2Sync(target, patterns, processor, cb));
- return;
+ };
+ Q.GlobWalker = ts;
+ var es = class extends xt {
+ results;
+ constructor(t, e, s) {
+ super(t, e, s), this.results = new Vr.Minipass({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
}
- processor.processPatterns(target, patterns);
- let tasks = 1;
- const next = () => {
- if (--tasks === 0)
- cb();
- };
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
- if (this.#ignored(m))
- continue;
- this.matchSync(m, absolute, ifDir);
+ matchEmit(t) {
+ this.results.write(t), this.results.flowing || this.pause();
}
- for (const t of processor.subwalkTargets()) {
- if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {
- continue;
- }
- tasks++;
- const children = t.readdirSync();
- this.walkCB3Sync(t, children, processor, next);
+ stream() {
+ let t = this.path;
+ return t.isUnknown() ? t.lstat().then(() => {
+ this.walkCB(t, this.patterns, () => this.results.end());
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
}
- next();
- }
- walkCB3Sync(target, entries, processor, cb) {
- processor = processor.filterEntries(target, entries);
- let tasks = 1;
- const next = () => {
- if (--tasks === 0)
- cb();
- };
- for (const [m, absolute, ifDir] of processor.matches.entries()) {
- if (this.#ignored(m))
- continue;
- this.matchSync(m, absolute, ifDir);
+ streamSync() {
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
}
- for (const [target2, patterns] of processor.subwalks.entries()) {
- tasks++;
- this.walkCB2Sync(target2, patterns, processor.child(), next);
+ };
+ Q.GlobStream = es;
+ });
+ var is = x((pe) => {
+ "use strict";
+ Object.defineProperty(pe, "__esModule", { value: true });
+ pe.Glob = void 0;
+ var Zr = Y(), Jr = require("node:url"), fe = ni(), Qr = Ke(), de = li(), tn = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", ss = class {
+ absolute;
+ cwd;
+ root;
+ dot;
+ dotRelative;
+ follow;
+ ignore;
+ magicalBraces;
+ mark;
+ matchBase;
+ maxDepth;
+ nobrace;
+ nocase;
+ nodir;
+ noext;
+ noglobstar;
+ pattern;
+ platform;
+ realpath;
+ scurry;
+ stat;
+ signal;
+ windowsPathsNoEscape;
+ withFileTypes;
+ includeChildMatches;
+ opts;
+ patterns;
+ constructor(t, e) {
+ if (!e) throw new TypeError("glob options required");
+ if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = (0, Jr.fileURLToPath)(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== false, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
+ let s = typeof t == "string" ? [t] : t;
+ if (this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (s = s.map((l) => l.replace(/\\/g, "/"))), this.matchBase) {
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
+ s = s.map((l) => l.includes("/") ? l : `./**/${l}`);
+ }
+ if (this.pattern = s, this.platform = e.platform || tn, this.opts = { ...e, platform: this.platform }, e.scurry) {
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
+ } else {
+ let l = e.platform === "win32" ? fe.PathScurryWin32 : e.platform === "darwin" ? fe.PathScurryDarwin : e.platform ? fe.PathScurryPosix : fe.PathScurry;
+ this.scurry = new l(this.cwd, { nocase: e.nocase, fs: e.fs });
+ }
+ this.nocase = this.scurry.nocase;
+ let i = this.platform === "darwin" || this.platform === "win32", r = { braceExpandMax: 1e4, ...e, dot: this.dot, matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, nocaseMagicOnly: i, nocomment: true, noext: this.noext, nonegate: true, optimizationLevel: 2, platform: this.platform, windowsPathsNoEscape: this.windowsPathsNoEscape }, h = this.pattern.map((l) => new Zr.Minimatch(l, r)), [a, o] = h.reduce((l, c) => (l[0].push(...c.set), l[1].push(...c.globParts), l), [[], []]);
+ this.patterns = a.map((l, c) => {
+ let u = o[c];
+ if (!u) throw new Error("invalid pattern object");
+ return new Qr.Pattern(l, u, 0, this.platform);
+ });
}
- next();
- }
- };
- exports2.GlobUtil = GlobUtil;
- var GlobWalker = class extends GlobUtil {
- matches = /* @__PURE__ */ new Set();
- constructor(patterns, path6, opts) {
- super(patterns, path6, opts);
- }
- matchEmit(e) {
- this.matches.add(e);
- }
- async walk() {
- if (this.signal?.aborted)
- throw this.signal.reason;
- if (this.path.isUnknown()) {
- await this.path.lstat();
+ async walk() {
+ return await new de.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walk();
}
- await new Promise((res, rej) => {
- this.walkCB(this.path, this.patterns, () => {
- if (this.signal?.aborted) {
- rej(this.signal.reason);
- } else {
- res(this.matches);
- }
- });
- });
- return this.matches;
- }
- walkSync() {
- if (this.signal?.aborted)
- throw this.signal.reason;
- if (this.path.isUnknown()) {
- this.path.lstatSync();
+ walkSync() {
+ return new de.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walkSync();
}
- this.walkCBSync(this.path, this.patterns, () => {
- if (this.signal?.aborted)
- throw this.signal.reason;
- });
- return this.matches;
- }
- };
- exports2.GlobWalker = GlobWalker;
- var GlobStream = class extends GlobUtil {
- results;
- constructor(patterns, path6, opts) {
- super(patterns, path6, opts);
- this.results = new minipass_1.Minipass({
- signal: this.signal,
- objectMode: true
- });
- this.results.on("drain", () => this.resume());
- this.results.on("resume", () => this.resume());
- }
- matchEmit(e) {
- this.results.write(e);
- if (!this.results.flowing)
- this.pause();
- }
- stream() {
- const target = this.path;
- if (target.isUnknown()) {
- target.lstat().then(() => {
- this.walkCB(target, this.patterns, () => this.results.end());
- });
- } else {
- this.walkCB(target, this.patterns, () => this.results.end());
+ stream() {
+ return new de.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).stream();
}
- return this.results;
- }
- streamSync() {
- if (this.path.isUnknown()) {
- this.path.lstatSync();
+ streamSync() {
+ return new de.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).streamSync();
}
- this.walkCBSync(this.path, this.patterns, () => this.results.end());
- return this.results;
- }
- };
- exports2.GlobStream = GlobStream;
- }
-});
-
-// node_modules/glob/dist/commonjs/glob.js
-var require_glob = __commonJS({
- "node_modules/glob/dist/commonjs/glob.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.Glob = void 0;
- var minimatch_1 = require_commonjs3();
- var node_url_1 = require("node:url");
- var path_scurry_1 = require_commonjs6();
- var pattern_js_1 = require_pattern();
- var walker_js_1 = require_walker();
- var defaultPlatform = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
- var Glob = class {
- absolute;
- cwd;
- root;
- dot;
- dotRelative;
- follow;
- ignore;
- magicalBraces;
- mark;
- matchBase;
- maxDepth;
- nobrace;
- nocase;
- nodir;
- noext;
- noglobstar;
- pattern;
- platform;
- realpath;
- scurry;
- stat;
- signal;
- windowsPathsNoEscape;
- withFileTypes;
- includeChildMatches;
- /**
- * The options provided to the constructor.
- */
- opts;
- /**
- * An array of parsed immutable {@link Pattern} objects.
- */
- patterns;
- /**
- * All options are stored as properties on the `Glob` object.
- *
- * See {@link GlobOptions} for full options descriptions.
- *
- * Note that a previous `Glob` object can be passed as the
- * `GlobOptions` to another `Glob` instantiation to re-use settings
- * and caches with a new pattern.
- *
- * Traversal functions can be called multiple times to run the walk
- * again.
- */
- constructor(pattern, opts) {
- if (!opts)
- throw new TypeError("glob options required");
- this.withFileTypes = !!opts.withFileTypes;
- this.signal = opts.signal;
- this.follow = !!opts.follow;
- this.dot = !!opts.dot;
- this.dotRelative = !!opts.dotRelative;
- this.nodir = !!opts.nodir;
- this.mark = !!opts.mark;
- if (!opts.cwd) {
- this.cwd = "";
- } else if (opts.cwd instanceof URL || opts.cwd.startsWith("file://")) {
- opts.cwd = (0, node_url_1.fileURLToPath)(opts.cwd);
- }
- this.cwd = opts.cwd || "";
- this.root = opts.root;
- this.magicalBraces = !!opts.magicalBraces;
- this.nobrace = !!opts.nobrace;
- this.noext = !!opts.noext;
- this.realpath = !!opts.realpath;
- this.absolute = opts.absolute;
- this.includeChildMatches = opts.includeChildMatches !== false;
- this.noglobstar = !!opts.noglobstar;
- this.matchBase = !!opts.matchBase;
- this.maxDepth = typeof opts.maxDepth === "number" ? opts.maxDepth : Infinity;
- this.stat = !!opts.stat;
- this.ignore = opts.ignore;
- if (this.withFileTypes && this.absolute !== void 0) {
- throw new Error("cannot set absolute and withFileTypes:true");
- }
- if (typeof pattern === "string") {
- pattern = [pattern];
- }
- this.windowsPathsNoEscape = !!opts.windowsPathsNoEscape || opts.allowWindowsEscape === false;
- if (this.windowsPathsNoEscape) {
- pattern = pattern.map((p) => p.replace(/\\/g, "/"));
+ iterateSync() {
+ return this.streamSync()[Symbol.iterator]();
}
- if (this.matchBase) {
- if (opts.noglobstar) {
- throw new TypeError("base matching requires globstar");
- }
- pattern = pattern.map((p) => p.includes("/") ? p : `./**/${p}`);
+ [Symbol.iterator]() {
+ return this.iterateSync();
}
- this.pattern = pattern;
- this.platform = opts.platform || defaultPlatform;
- this.opts = { ...opts, platform: this.platform };
- if (opts.scurry) {
- this.scurry = opts.scurry;
- if (opts.nocase !== void 0 && opts.nocase !== opts.scurry.nocase) {
- throw new Error("nocase option contradicts provided scurry option");
- }
- } else {
- const Scurry = opts.platform === "win32" ? path_scurry_1.PathScurryWin32 : opts.platform === "darwin" ? path_scurry_1.PathScurryDarwin : opts.platform ? path_scurry_1.PathScurryPosix : path_scurry_1.PathScurry;
- this.scurry = new Scurry(this.cwd, {
- nocase: opts.nocase,
- fs: opts.fs
- });
+ iterate() {
+ return this.stream()[Symbol.asyncIterator]();
}
- this.nocase = this.scurry.nocase;
- const nocaseMagicOnly = this.platform === "darwin" || this.platform === "win32";
- const mmo = {
- // default nocase based on platform
- ...opts,
- dot: this.dot,
- matchBase: this.matchBase,
- nobrace: this.nobrace,
- nocase: this.nocase,
- nocaseMagicOnly,
- nocomment: true,
- noext: this.noext,
- nonegate: true,
- optimizationLevel: 2,
- platform: this.platform,
- windowsPathsNoEscape: this.windowsPathsNoEscape,
- debug: !!this.opts.debug
- };
- const mms = this.pattern.map((p) => new minimatch_1.Minimatch(p, mmo));
- const [matchSet, globParts] = mms.reduce((set, m) => {
- set[0].push(...m.set);
- set[1].push(...m.globParts);
- return set;
- }, [[], []]);
- this.patterns = matchSet.map((set, i) => {
- const g = globParts[i];
- if (!g)
- throw new Error("invalid pattern object");
- return new pattern_js_1.Pattern(set, g, 0, this.platform);
- });
- }
- async walk() {
- return [
- ...await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
- ...this.opts,
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
- platform: this.platform,
- nocase: this.nocase,
- includeChildMatches: this.includeChildMatches
- }).walk()
- ];
- }
- walkSync() {
- return [
- ...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
- ...this.opts,
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
- platform: this.platform,
- nocase: this.nocase,
- includeChildMatches: this.includeChildMatches
- }).walkSync()
- ];
- }
- stream() {
- return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
- ...this.opts,
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
- platform: this.platform,
- nocase: this.nocase,
- includeChildMatches: this.includeChildMatches
- }).stream();
- }
- streamSync() {
- return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
- ...this.opts,
- maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
- platform: this.platform,
- nocase: this.nocase,
- includeChildMatches: this.includeChildMatches
- }).streamSync();
- }
- /**
- * Default sync iteration function. Returns a Generator that
- * iterates over the results.
- */
- iterateSync() {
- return this.streamSync()[Symbol.iterator]();
- }
- [Symbol.iterator]() {
- return this.iterateSync();
- }
- /**
- * Default async iteration function. Returns an AsyncGenerator that
- * iterates over the results.
- */
- iterate() {
- return this.stream()[Symbol.asyncIterator]();
- }
- [Symbol.asyncIterator]() {
- return this.iterate();
- }
- };
- exports2.Glob = Glob;
- }
-});
-
-// node_modules/glob/dist/commonjs/has-magic.js
-var require_has_magic = __commonJS({
- "node_modules/glob/dist/commonjs/has-magic.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.hasMagic = void 0;
- var minimatch_1 = require_commonjs3();
- var hasMagic = (pattern, options = {}) => {
- if (!Array.isArray(pattern)) {
- pattern = [pattern];
- }
- for (const p of pattern) {
- if (new minimatch_1.Minimatch(p, options).hasMagic())
- return true;
- }
- return false;
- };
- exports2.hasMagic = hasMagic;
- }
-});
-
-// node_modules/glob/dist/commonjs/index.js
-var require_commonjs7 = __commonJS({
- "node_modules/glob/dist/commonjs/index.js"(exports2) {
- "use strict";
+ [Symbol.asyncIterator]() {
+ return this.iterate();
+ }
+ };
+ pe.Glob = ss;
+ });
+ var rs = x((me) => {
+ "use strict";
+ Object.defineProperty(me, "__esModule", { value: true });
+ me.hasMagic = void 0;
+ var en = Y(), sn = (n, t = {}) => {
+ for (let e of Array.isArray(n) ? n : [n]) if (new en.Minimatch(e, t).hasMagic()) return true;
+ return false;
+ };
+ me.hasMagic = sn;
+ });
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.glob = exports2.sync = exports2.iterate = exports2.iterateSync = exports2.stream = exports2.streamSync = exports2.Ignore = exports2.hasMagic = exports2.Glob = exports2.unescape = exports2.escape = void 0;
- exports2.globStreamSync = globStreamSync;
- exports2.globStream = globStream;
- exports2.globSync = globSync;
- exports2.globIterateSync = globIterateSync;
- exports2.globIterate = globIterate;
- var minimatch_1 = require_commonjs3();
- var glob_js_1 = require_glob();
- var has_magic_js_1 = require_has_magic();
- var minimatch_2 = require_commonjs3();
+ exports2.globStreamSync = Rt;
+ exports2.globStream = ns;
+ exports2.globSync = hs;
+ exports2.globIterateSync = Pt;
+ exports2.globIterate = os7;
+ var ci = Y();
+ var rt = is();
+ var rn = rs();
+ var fi = Y();
Object.defineProperty(exports2, "escape", { enumerable: true, get: function() {
- return minimatch_2.escape;
+ return fi.escape;
} });
Object.defineProperty(exports2, "unescape", { enumerable: true, get: function() {
- return minimatch_2.unescape;
+ return fi.unescape;
} });
- var glob_js_2 = require_glob();
+ var nn = is();
Object.defineProperty(exports2, "Glob", { enumerable: true, get: function() {
- return glob_js_2.Glob;
+ return nn.Glob;
} });
- var has_magic_js_2 = require_has_magic();
+ var hn = rs();
Object.defineProperty(exports2, "hasMagic", { enumerable: true, get: function() {
- return has_magic_js_2.hasMagic;
+ return hn.hasMagic;
} });
- var ignore_js_1 = require_ignore();
+ var on = Ze();
Object.defineProperty(exports2, "Ignore", { enumerable: true, get: function() {
- return ignore_js_1.Ignore;
+ return on.Ignore;
} });
- function globStreamSync(pattern, options = {}) {
- return new glob_js_1.Glob(pattern, options).streamSync();
+ function Rt(n, t = {}) {
+ return new rt.Glob(n, t).streamSync();
}
- function globStream(pattern, options = {}) {
- return new glob_js_1.Glob(pattern, options).stream();
+ function ns(n, t = {}) {
+ return new rt.Glob(n, t).stream();
}
- function globSync(pattern, options = {}) {
- return new glob_js_1.Glob(pattern, options).walkSync();
+ function hs(n, t = {}) {
+ return new rt.Glob(n, t).walkSync();
}
- async function glob_(pattern, options = {}) {
- return new glob_js_1.Glob(pattern, options).walk();
+ async function ui(n, t = {}) {
+ return new rt.Glob(n, t).walk();
}
- function globIterateSync(pattern, options = {}) {
- return new glob_js_1.Glob(pattern, options).iterateSync();
+ function Pt(n, t = {}) {
+ return new rt.Glob(n, t).iterateSync();
}
- function globIterate(pattern, options = {}) {
- return new glob_js_1.Glob(pattern, options).iterate();
+ function os7(n, t = {}) {
+ return new rt.Glob(n, t).iterate();
}
- exports2.streamSync = globStreamSync;
- exports2.stream = Object.assign(globStream, { sync: globStreamSync });
- exports2.iterateSync = globIterateSync;
- exports2.iterate = Object.assign(globIterate, {
- sync: globIterateSync
- });
- exports2.sync = Object.assign(globSync, {
- stream: globStreamSync,
- iterate: globIterateSync
- });
- exports2.glob = Object.assign(glob_, {
- glob: glob_,
- globSync,
- sync: exports2.sync,
- globStream,
- stream: exports2.stream,
- globStreamSync,
- streamSync: exports2.streamSync,
- globIterate,
- iterate: exports2.iterate,
- globIterateSync,
- iterateSync: exports2.iterateSync,
- Glob: glob_js_1.Glob,
- hasMagic: has_magic_js_1.hasMagic,
- escape: minimatch_1.escape,
- unescape: minimatch_1.unescape
- });
+ exports2.streamSync = Rt;
+ exports2.stream = Object.assign(ns, { sync: Rt });
+ exports2.iterateSync = Pt;
+ exports2.iterate = Object.assign(os7, { sync: Pt });
+ exports2.sync = Object.assign(hs, { stream: Rt, iterate: Pt });
+ exports2.glob = Object.assign(ui, { glob: ui, globSync: hs, sync: exports2.sync, globStream: ns, stream: exports2.stream, globStreamSync: Rt, streamSync: exports2.streamSync, globIterate: os7, iterate: exports2.iterate, globIterateSync: Pt, iterateSync: exports2.iterateSync, Glob: rt.Glob, hasMagic: rn.hasMagic, escape: ci.escape, unescape: ci.unescape });
exports2.glob.glob = exports2.glob;
}
});
@@ -45413,7 +43410,7 @@ var require_file2 = __commonJS({
var difference = require_difference();
var union = require_union();
var isPlainObject3 = require_isPlainObject();
- var glob = require_commonjs7();
+ var glob = require_index_min();
var file = module2.exports = {};
var pathSeparatorRe = /[\/\\]/g;
var processPatterns = function(patterns, fn) {
diff --git a/github-action/package-lock.json b/github-action/package-lock.json
index 7c163e2cc..a74ccf750 100644
--- a/github-action/package-lock.json
+++ b/github-action/package-lock.json
@@ -750,22 +750,11 @@
"node": ">=18"
}
},
- "node_modules/@isaacs/cliui": {
- "version": "8.0.2",
- "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
- "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
- "license": "ISC",
- "dependencies": {
- "string-width": "^5.1.2",
- "string-width-cjs": "npm:string-width@^4.2.0",
- "strip-ansi": "^7.0.1",
- "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
- "wrap-ansi": "^8.1.0",
- "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
- },
- "engines": {
- "node": ">=12"
- }
+ "node_modules/@isaacs/nonrecursive-glob-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.0.2.tgz",
+ "integrity": "sha512-GJPHIgPPtFl+nLhFHyF0zZoFcOFLsZWbHFFzo+Zr+PWDXJbl9hHxb2w+9SiF2fHmLgKaXIpUzQo3SbBBZ9WObw==",
+ "license": "BlueOak-1.0.0"
},
"node_modules/@nodable/entities": {
"version": "3.0.0",
@@ -981,16 +970,6 @@
"@octokit/openapi-types": "^29.0.1"
}
},
- "node_modules/@pkgjs/parseargs": {
- "version": "0.11.0",
- "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
- "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">=14"
- }
- },
"node_modules/@protobuf-ts/runtime": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.11.1.tgz",
@@ -1391,30 +1370,6 @@
"node": ">= 14"
}
},
- "node_modules/ansi-regex": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz",
- "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==",
- "license": "MIT",
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-regex?sponsor=1"
- }
- },
- "node_modules/ansi-styles": {
- "version": "6.2.3",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
- "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
- "license": "MIT",
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
"node_modules/anynum": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/anynum/-/anynum-1.0.1.tgz",
@@ -1483,12 +1438,6 @@
}
}
},
- "node_modules/balanced-match": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
- "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
- "license": "MIT"
- },
"node_modules/bare-events": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz",
@@ -1614,15 +1563,6 @@
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==",
"license": "MIT"
},
- "node_modules/brace-expansion": {
- "version": "2.1.7",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz",
- "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==",
- "license": "MIT",
- "dependencies": {
- "balanced-match": "^1.0.0"
- }
- },
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
@@ -1676,24 +1616,6 @@
"node": "*"
}
},
- "node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "license": "MIT",
- "dependencies": {
- "color-name": "~1.1.4"
- },
- "engines": {
- "node": ">=7.0.0"
- }
- },
- "node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "license": "MIT"
- },
"node_modules/compress-commons": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz",
@@ -1754,20 +1676,6 @@
"node": ">= 14"
}
},
- "node_modules/cross-spawn": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
- "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
- "license": "MIT",
- "dependencies": {
- "path-key": "^3.1.0",
- "shebang-command": "^2.0.0",
- "which": "^2.0.1"
- },
- "engines": {
- "node": ">= 8"
- }
- },
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
@@ -1785,18 +1693,6 @@
}
}
},
- "node_modules/eastasianwidth": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
- "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
- "license": "MIT"
- },
- "node_modules/emoji-regex": {
- "version": "9.2.2",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
- "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
- "license": "MIT"
- },
"node_modules/esbuild": {
"version": "0.28.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz",
@@ -1911,22 +1807,6 @@
"fxparser": "src/cli/cli.js"
}
},
- "node_modules/foreground-child": {
- "version": "3.3.1",
- "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
- "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
- "license": "ISC",
- "dependencies": {
- "cross-spawn": "^7.0.6",
- "signal-exit": "^4.0.1"
- },
- "engines": {
- "node": ">=14"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
@@ -1943,21 +1823,17 @@
}
},
"node_modules/glob": {
- "version": "10.5.0",
- "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
- "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
- "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]",
- "license": "ISC",
+ "version": "14.0.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-14.0.3.tgz",
+ "integrity": "sha512-A1vjIwC3qpdCso45Iw127gnp7sPhqgY8lUQhDrArIs+GbmfaaVPFuoyy7WyLT9EPZCRZ7j7aLdwUhQmHWesEow==",
+ "license": "BlueOak-1.0.0",
"dependencies": {
- "foreground-child": "^3.1.0",
- "jackspeak": "^3.1.2",
- "minimatch": "^9.0.4",
- "minipass": "^7.1.2",
- "package-json-from-dist": "^1.0.0",
- "path-scurry": "^1.11.1"
+ "minimatch": "^11.0.2",
+ "minipass": "^7.1.3",
+ "path-scurry": "^3.0.0"
},
- "bin": {
- "glob": "dist/esm/bin.mjs"
+ "engines": {
+ "node": "18 || 20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
@@ -2021,15 +1897,6 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
- "node_modules/is-fullwidth-code-point": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
@@ -2060,27 +1927,6 @@
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"license": "MIT"
},
- "node_modules/isexe": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
- "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
- "license": "ISC"
- },
- "node_modules/jackspeak": {
- "version": "3.4.3",
- "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
- "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "@isaacs/cliui": "^8.0.2"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- },
- "optionalDependencies": {
- "@pkgjs/parseargs": "^0.11.0"
- }
- },
"node_modules/json-with-bigint": {
"version": "3.5.12",
"resolved": "https://registry.npmjs.org/json-with-bigint/-/json-with-bigint-3.5.12.tgz",
@@ -2145,26 +1991,51 @@
"license": "MIT"
},
"node_modules/lru-cache": {
- "version": "10.4.3",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
- "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
- "license": "ISC"
+ "version": "11.5.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz",
+ "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==",
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": "20 || >=22"
+ }
},
"node_modules/minimatch": {
- "version": "9.0.9",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
- "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
- "license": "ISC",
+ "version": "11.0.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.2.tgz",
+ "integrity": "sha512-pWTgz5CN3tjqyZNSK2tePlSmu9IwM41q8yn8Usdqqwe9TIHh+9dEpLLjF4uApsfPEAZY71qtSiA2B2APEr+1Yw==",
+ "license": "BlueOak-1.0.0",
"dependencies": {
- "brace-expansion": "^2.0.2"
+ "@isaacs/nonrecursive-glob-match": "^1.0.2",
+ "brace-expansion": "^5.0.12"
},
"engines": {
- "node": ">=16 || 14 >=14.17"
+ "node": "18 || 20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/minimatch/node_modules/balanced-match": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
+ "license": "MIT",
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/minimatch/node_modules/brace-expansion": {
+ "version": "5.0.12",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
+ "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^4.0.2"
+ },
+ "engines": {
+ "node": "20 || >=22"
+ }
+ },
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
@@ -2210,12 +2081,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/package-json-from-dist": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
- "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
- "license": "BlueOak-1.0.0"
- },
"node_modules/path-expression-matcher": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.2.tgz",
@@ -2231,26 +2096,17 @@
"node": ">=14.0.0"
}
},
- "node_modules/path-key": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
- "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/path-scurry": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
- "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-3.0.0.tgz",
+ "integrity": "sha512-1pTbQqH1wIwMi/eleQ5leFTTCkzFsPcgXNjwOA8YGGW/W4/kHT3dssE7Z6NH+zuqNLOzOB0uaD61yl7cAcVhgg==",
"license": "BlueOak-1.0.0",
"dependencies": {
- "lru-cache": "^10.2.0",
- "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
+ "lru-cache": "^11.0.0",
+ "minipass": "^7.1.2"
},
"engines": {
- "node": ">=16 || 14 >=14.18"
+ "node": "18 || 20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
@@ -2312,18 +2168,6 @@
"minimatch": "^5.1.0"
}
},
- "node_modules/readdir-glob/node_modules/minimatch": {
- "version": "5.1.9",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
- "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
- "license": "ISC",
- "dependencies": {
- "brace-expansion": "^2.0.1"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@@ -2344,39 +2188,6 @@
],
"license": "MIT"
},
- "node_modules/shebang-command": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
- "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
- "license": "MIT",
- "dependencies": {
- "shebang-regex": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/shebang-regex": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
- "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/signal-exit": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
- "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
- "license": "ISC",
- "engines": {
- "node": ">=14"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/streamx": {
"version": "2.28.1",
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.1.tgz",
@@ -2397,102 +2208,6 @@
"safe-buffer": "~5.2.0"
}
},
- "node_modules/string-width": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
- "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
- "license": "MIT",
- "dependencies": {
- "eastasianwidth": "^0.2.0",
- "emoji-regex": "^9.2.2",
- "strip-ansi": "^7.0.1"
- },
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/string-width-cjs": {
- "name": "string-width",
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
- "license": "MIT",
- "dependencies": {
- "emoji-regex": "^8.0.0",
- "is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/string-width-cjs/node_modules/ansi-regex": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/string-width-cjs/node_modules/emoji-regex": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
- "license": "MIT"
- },
- "node_modules/string-width-cjs/node_modules/strip-ansi": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
- "license": "MIT",
- "dependencies": {
- "ansi-regex": "^5.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/strip-ansi": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
- "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
- "license": "MIT",
- "dependencies": {
- "ansi-regex": "^6.2.2"
- },
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/chalk/strip-ansi?sponsor=1"
- }
- },
- "node_modules/strip-ansi-cjs": {
- "name": "strip-ansi",
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
- "license": "MIT",
- "dependencies": {
- "ansi-regex": "^5.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/strnum": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.4.2.tgz",
@@ -2654,112 +2369,6 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"license": "MIT"
},
- "node_modules/which": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
- "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
- "license": "ISC",
- "dependencies": {
- "isexe": "^2.0.0"
- },
- "bin": {
- "node-which": "bin/node-which"
- },
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/wrap-ansi": {
- "version": "8.1.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
- "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
- "license": "MIT",
- "dependencies": {
- "ansi-styles": "^6.1.0",
- "string-width": "^5.0.1",
- "strip-ansi": "^7.0.1"
- },
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
- }
- },
- "node_modules/wrap-ansi-cjs": {
- "name": "wrap-ansi",
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
- "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
- "license": "MIT",
- "dependencies": {
- "ansi-styles": "^4.0.0",
- "string-width": "^4.1.0",
- "strip-ansi": "^6.0.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
- }
- },
- "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "license": "MIT",
- "dependencies": {
- "color-convert": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
- "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
- "license": "MIT"
- },
- "node_modules/wrap-ansi-cjs/node_modules/string-width": {
- "version": "4.2.3",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
- "license": "MIT",
- "dependencies": {
- "emoji-regex": "^8.0.0",
- "is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
- "license": "MIT",
- "dependencies": {
- "ansi-regex": "^5.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/xml-naming": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.3.0.tgz",
diff --git a/github-action/package.json b/github-action/package.json
index 027cb119b..25ab624a3 100644
--- a/github-action/package.json
+++ b/github-action/package.json
@@ -31,5 +31,13 @@
"tsx": "4.23.15",
"typescript": "7.0.2",
"yaml": "2.9.1"
+ },
+ "overrides": {
+ "archiver-utils@5": {
+ "glob": "14.0.3"
+ },
+ "readdir-glob@1": {
+ "minimatch": "11.0.2"
+ }
}
}