From 7a29fe8330e43a150f2a3e2c81c5e65555e6d5cb Mon Sep 17 00:00:00 2001 From: Gitea Actions Date: Wed, 30 Apr 2025 14:58:43 +0000 Subject: [PATCH] Deploy version 1.0.1 --- dist/index.js | 9709 +++++-------------------------------------------- 1 file changed, 987 insertions(+), 8722 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2d7b02f..cafc283 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11,14 +11,14 @@ var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { - for (var name2 in all) - __defProp(target, name2, { get: all[name2], enumerable: true }); + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); }; -var __copyProps = (to, from, except, desc2) => { +var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable }); + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; @@ -69,13 +69,13 @@ var require_command = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) { if (k2 === void 0) k2 = k; - var desc2 = Object.getOwnPropertyDescriptor(m2, k); - if (!desc2 || ("get" in desc2 ? !m2.__esModule : desc2.writable || desc2.configurable)) { - desc2 = { enumerable: true, get: function() { + var desc = Object.getOwnPropertyDescriptor(m2, k); + if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m2[k]; } }; } - Object.defineProperty(o, k2, desc2); + Object.defineProperty(o, k2, desc); } : function(o, m2, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m2[k]; @@ -96,15 +96,15 @@ var require_command = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.issue = exports2.issueCommand = void 0; - var os = __importStar(require("os")); + var os2 = __importStar(require("os")); var utils_1 = require_utils(); function issueCommand(command, properties, message) { const cmd = new Command(command, properties, message); - process.stdout.write(cmd.toString() + os.EOL); + process.stdout.write(cmd.toString() + os2.EOL); } exports2.issueCommand = issueCommand; - function issue(name2, message = "") { - issueCommand(name2, {}, message); + function issue(name, message = "") { + issueCommand(name, {}, message); } exports2.issue = issue; var CMD_STRING = "::"; @@ -155,13 +155,13 @@ var require_file_command = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) { if (k2 === void 0) k2 = k; - var desc2 = Object.getOwnPropertyDescriptor(m2, k); - if (!desc2 || ("get" in desc2 ? !m2.__esModule : desc2.writable || desc2.configurable)) { - desc2 = { enumerable: true, get: function() { + var desc = Object.getOwnPropertyDescriptor(m2, k); + if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m2[k]; } }; } - Object.defineProperty(o, k2, desc2); + Object.defineProperty(o, k2, desc); } : function(o, m2, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m2[k]; @@ -183,18 +183,18 @@ var require_file_command = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.prepareKeyValueMessage = exports2.issueFileCommand = void 0; var crypto = __importStar(require("crypto")); - var fs15 = __importStar(require("fs")); - var os = __importStar(require("os")); + var fs6 = __importStar(require("fs")); + var os2 = __importStar(require("os")); var utils_1 = require_utils(); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); } - if (!fs15.existsSync(filePath)) { + if (!fs6.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs15.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os.EOL}`, { + fs6.appendFileSync(filePath, `${(0, utils_1.toCommandValue)(message)}${os2.EOL}`, { encoding: "utf8" }); } @@ -208,7 +208,7 @@ var require_file_command = __commonJS({ if (convertedValue.includes(delimiter)) { throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); } - return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; + return `${key}<<${delimiter}${os2.EOL}${convertedValue}${os2.EOL}${delimiter}`; } exports2.prepareKeyValueMessage = prepareKeyValueMessage; } @@ -305,7 +305,7 @@ var require_tunnel = __commonJS({ var http3 = require("http"); var https2 = require("https"); var events = require("events"); - var assert3 = require("assert"); + var assert = require("assert"); var util = require("util"); exports2.httpOverHttp = httpOverHttp; exports2.httpsOverHttp = httpsOverHttp; @@ -457,11 +457,11 @@ var require_tunnel = __commonJS({ } }; TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos2 = this.sockets.indexOf(socket); - if (pos2 === -1) { + var pos = this.sockets.indexOf(socket); + if (pos === -1) { return; } - this.sockets.splice(pos2, 1); + this.sockets.splice(pos, 1); var pending = this.requests.shift(); if (pending) { this.createSocket(pending, function(socket2) { @@ -763,11 +763,11 @@ var require_errors = __commonJS({ } }; var HTTPParserError = class _HTTPParserError extends Error { - constructor(message, code2, data) { + constructor(message, code, data) { super(message); Error.captureStackTrace(this, _HTTPParserError); this.name = "HTTPParserError"; - this.code = code2 ? `HPE_${code2}` : void 0; + this.code = code ? `HPE_${code}` : void 0; this.data = data ? data.toString() : void 0; } }; @@ -781,13 +781,13 @@ var require_errors = __commonJS({ } }; var RequestRetryError = class _RequestRetryError extends UndiciError { - constructor(message, code2, { headers, data }) { + constructor(message, code, { headers, data }) { super(message); Error.captureStackTrace(this, _RequestRetryError); this.name = "RequestRetryError"; this.message = message || "Request retry error"; this.code = "UND_ERR_REQ_RETRY"; - this.statusCode = code2; + this.statusCode = code; this.data = data; this.headers = headers; } @@ -936,7 +936,7 @@ var require_constants = __commonJS({ var require_util = __commonJS({ "node_modules/undici/lib/core/util.js"(exports2, module2) { "use strict"; - var assert3 = require("assert"); + var assert = require("assert"); var { kDestroyed, kBodyUsed } = require_symbols(); var { IncomingMessage } = require("http"); var stream = require("stream"); @@ -949,7 +949,7 @@ var require_util = __commonJS({ var [nodeMajor, nodeMinor] = process.versions.node.split(".").map((v) => Number(v)); function nop() { } - function isStream4(obj) { + function isStream(obj) { return obj && typeof obj === "object" && typeof obj.pipe === "function" && typeof obj.on === "function"; } function isBlobLike(object) { @@ -997,14 +997,14 @@ var require_util = __commonJS({ } const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80; let origin = url.origin != null ? url.origin : `${url.protocol}//${url.hostname}:${port}`; - let path9 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; + let path2 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; if (origin.endsWith("/")) { origin = origin.substring(0, origin.length - 1); } - if (path9 && !path9.startsWith("/")) { - path9 = `/${path9}`; + if (path2 && !path2.startsWith("/")) { + path2 = `/${path2}`; } - url = new URL(origin + path9); + url = new URL(origin + path2); } return url; } @@ -1018,7 +1018,7 @@ var require_util = __commonJS({ function getHostname(host) { if (host[0] === "[") { const idx2 = host.indexOf("]"); - assert3(idx2 !== -1); + assert(idx2 !== -1); return host.substring(1, idx2); } const idx = host.indexOf(":"); @@ -1029,7 +1029,7 @@ var require_util = __commonJS({ if (!host) { return null; } - assert3.strictEqual(typeof host, "string"); + assert.strictEqual(typeof host, "string"); const servername = getHostname(host); if (net.isIP(servername)) { return ""; @@ -1048,7 +1048,7 @@ var require_util = __commonJS({ function bodyLength(body) { if (body == null) { return 0; - } else if (isStream4(body)) { + } else if (isStream(body)) { const state = body._readableState; return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length) ? state.length : null; } else if (isBlobLike(body)) { @@ -1066,7 +1066,7 @@ var require_util = __commonJS({ return isDestroyed(stream2) && state && !state.endEmitted; } function destroy(stream2, err) { - if (stream2 == null || !isStream4(stream2) || isDestroyed(stream2)) { + if (stream2 == null || !isStream(stream2) || isDestroyed(stream2)) { return; } if (typeof stream2.destroy === "function") { @@ -1176,7 +1176,7 @@ var require_util = __commonJS({ nodeUtil.inspect(body) ))); } - function isReadable4(body) { + function isReadable(body) { return !!(body && (stream.isReadable ? stream.isReadable(body) : /state: 'readable'/.test( nodeUtil.inspect(body) ))); @@ -1281,14 +1281,14 @@ var require_util = __commonJS({ nop, isDisturbed, isErrored, - isReadable: isReadable4, + isReadable, toUSVString, isReadableAborted, isBlobLike, parseOrigin, parseURL, getServerName, - isStream: isStream4, + isStream, isIterable, isAsyncIterable, isDestroyed, @@ -1402,7 +1402,7 @@ var require_timers = __commonJS({ var require_sbmh = __commonJS({ "node_modules/@fastify/busboy/deps/streamsearch/sbmh.js"(exports2, module2) { "use strict"; - var EventEmitter4 = require("node:events").EventEmitter; + var EventEmitter = require("node:events").EventEmitter; var inherits = require("node:util").inherits; function SBMH(needle) { if (typeof needle === "string") { @@ -1429,18 +1429,18 @@ var require_sbmh = __commonJS({ this._occ[needle[i2]] = needleLength - 1 - i2; } } - inherits(SBMH, EventEmitter4); + inherits(SBMH, EventEmitter); SBMH.prototype.reset = function() { this._lookbehind_size = 0; this.matches = 0; this._bufpos = 0; }; - SBMH.prototype.push = function(chunk, pos2) { + SBMH.prototype.push = function(chunk, pos) { if (!Buffer.isBuffer(chunk)) { chunk = Buffer.from(chunk, "binary"); } const chlen = chunk.length; - this._bufpos = pos2 || 0; + this._bufpos = pos || 0; let r2; while (r2 !== chlen && this.matches < this.maxMatches) { r2 = this._sbmh_feed(chunk); @@ -1452,29 +1452,29 @@ var require_sbmh = __commonJS({ const needle = this._needle; const needleLength = needle.length; const lastNeedleChar = needle[needleLength - 1]; - let pos2 = -this._lookbehind_size; + let pos = -this._lookbehind_size; let ch; - if (pos2 < 0) { - while (pos2 < 0 && pos2 <= len - needleLength) { - ch = this._sbmh_lookup_char(data, pos2 + needleLength - 1); - if (ch === lastNeedleChar && this._sbmh_memcmp(data, pos2, needleLength - 1)) { + if (pos < 0) { + while (pos < 0 && pos <= len - needleLength) { + ch = this._sbmh_lookup_char(data, pos + needleLength - 1); + if (ch === lastNeedleChar && this._sbmh_memcmp(data, pos, needleLength - 1)) { this._lookbehind_size = 0; ++this.matches; this.emit("info", true); - return this._bufpos = pos2 + needleLength; + return this._bufpos = pos + needleLength; } - pos2 += this._occ[ch]; + pos += this._occ[ch]; } - if (pos2 < 0) { - while (pos2 < 0 && !this._sbmh_memcmp(data, pos2, len - pos2)) { - ++pos2; + if (pos < 0) { + while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { + ++pos; } } - if (pos2 >= 0) { + if (pos >= 0) { this.emit("info", false, this._lookbehind, 0, this._lookbehind_size); this._lookbehind_size = 0; } else { - const bytesToCutOff = this._lookbehind_size + pos2; + const bytesToCutOff = this._lookbehind_size + pos; if (bytesToCutOff > 0) { this.emit("info", false, this._lookbehind, 0, bytesToCutOff); } @@ -1491,41 +1491,41 @@ var require_sbmh = __commonJS({ return len; } } - pos2 += (pos2 >= 0) * this._bufpos; - if (data.indexOf(needle, pos2) !== -1) { - pos2 = data.indexOf(needle, pos2); + pos += (pos >= 0) * this._bufpos; + if (data.indexOf(needle, pos) !== -1) { + pos = data.indexOf(needle, pos); ++this.matches; - if (pos2 > 0) { - this.emit("info", true, data, this._bufpos, pos2); + if (pos > 0) { + this.emit("info", true, data, this._bufpos, pos); } else { this.emit("info", true); } - return this._bufpos = pos2 + needleLength; + return this._bufpos = pos + needleLength; } else { - pos2 = len - needleLength; + pos = len - needleLength; } - while (pos2 < len && (data[pos2] !== needle[0] || Buffer.compare( - data.subarray(pos2, pos2 + len - pos2), - needle.subarray(0, len - pos2) + while (pos < len && (data[pos] !== needle[0] || Buffer.compare( + data.subarray(pos, pos + len - pos), + needle.subarray(0, len - pos) ) !== 0)) { - ++pos2; + ++pos; } - if (pos2 < len) { - data.copy(this._lookbehind, 0, pos2, pos2 + (len - pos2)); - this._lookbehind_size = len - pos2; + if (pos < len) { + data.copy(this._lookbehind, 0, pos, pos + (len - pos)); + this._lookbehind_size = len - pos; } - if (pos2 > 0) { - this.emit("info", false, data, this._bufpos, pos2 < len ? pos2 : len); + if (pos > 0) { + this.emit("info", false, data, this._bufpos, pos < len ? pos : len); } this._bufpos = len; return len; }; - SBMH.prototype._sbmh_lookup_char = function(data, pos2) { - return pos2 < 0 ? this._lookbehind[this._lookbehind_size + pos2] : data[pos2]; + SBMH.prototype._sbmh_lookup_char = function(data, pos) { + return pos < 0 ? this._lookbehind[this._lookbehind_size + pos] : data[pos]; }; - SBMH.prototype._sbmh_memcmp = function(data, pos2, len) { + SBMH.prototype._sbmh_memcmp = function(data, pos, len) { for (var i2 = 0; i2 < len; ++i2) { - if (this._sbmh_lookup_char(data, pos2 + i2) !== this._needle[i2]) { + if (this._sbmh_lookup_char(data, pos + i2) !== this._needle[i2]) { return false; } } @@ -1555,14 +1555,14 @@ var require_PartStream = __commonJS({ var require_getLimit = __commonJS({ "node_modules/@fastify/busboy/lib/utils/getLimit.js"(exports2, module2) { "use strict"; - module2.exports = function getLimit(limits, name2, defaultLimit) { - if (!limits || limits[name2] === void 0 || limits[name2] === null) { + module2.exports = function getLimit(limits, name, defaultLimit) { + if (!limits || limits[name] === void 0 || limits[name] === null) { return defaultLimit; } - if (typeof limits[name2] !== "number" || isNaN(limits[name2])) { - throw new TypeError("Limit " + name2 + " is not a valid number"); + if (typeof limits[name] !== "number" || isNaN(limits[name])) { + throw new TypeError("Limit " + name + " is not a valid number"); } - return limits[name2]; + return limits[name]; }; } }); @@ -1571,7 +1571,7 @@ var require_getLimit = __commonJS({ var require_HeaderParser = __commonJS({ "node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js"(exports2, module2) { "use strict"; - var EventEmitter4 = require("node:events").EventEmitter; + var EventEmitter = require("node:events").EventEmitter; var inherits = require("node:util").inherits; var getLimit = require_getLimit(); var StreamSearch = require_sbmh(); @@ -1579,7 +1579,7 @@ var require_HeaderParser = __commonJS({ var RE_CRLF = /\r\n/g; var RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/; function HeaderParser(cfg) { - EventEmitter4.call(this); + EventEmitter.call(this); cfg = cfg || {}; const self2 = this; this.nread = 0; @@ -1607,7 +1607,7 @@ var require_HeaderParser = __commonJS({ } }); } - inherits(HeaderParser, EventEmitter4); + inherits(HeaderParser, EventEmitter); HeaderParser.prototype.push = function(data) { const r2 = this.ss.push(data); if (this.finished) { @@ -2618,20 +2618,20 @@ var require_parseParams = __commonJS({ var require_basename = __commonJS({ "node_modules/@fastify/busboy/lib/utils/basename.js"(exports2, module2) { "use strict"; - module2.exports = function basename2(path9) { - if (typeof path9 !== "string") { + module2.exports = function basename(path2) { + if (typeof path2 !== "string") { return ""; } - for (var i2 = path9.length - 1; i2 >= 0; --i2) { - switch (path9.charCodeAt(i2)) { + for (var i2 = path2.length - 1; i2 >= 0; --i2) { + switch (path2.charCodeAt(i2)) { case 47: // '/' case 92: - path9 = path9.slice(i2 + 1); - return path9 === ".." || path9 === "." ? "" : path9; + path2 = path2.slice(i2 + 1); + return path2 === ".." || path2 === "." ? "" : path2; } } - return path9 === ".." || path9 === "." ? "" : path9; + return path2 === ".." || path2 === "." ? "" : path2; }; } }); @@ -2645,7 +2645,7 @@ var require_multipart = __commonJS({ var Dicer = require_Dicer(); var parseParams = require_parseParams(); var decodeText = require_decodeText(); - var basename2 = require_basename(); + var basename = require_basename(); var getLimit = require_getLimit(); var RE_BOUNDARY = /^boundary$/i; var RE_FIELD = /^form-data$/i; @@ -2762,7 +2762,7 @@ var require_multipart = __commonJS({ } else if (RE_FILENAME.test(parsed[i2][0])) { filename = parsed[i2][1]; if (!preservePath) { - filename = basename2(filename); + filename = basename(filename); } } } @@ -3632,7 +3632,7 @@ var require_util2 = __commonJS({ var { getGlobalOrigin } = require_global(); var { performance: performance2 } = require("perf_hooks"); var { isBlobLike, toUSVString, ReadableStreamFrom } = require_util(); - var assert3 = require("assert"); + var assert = require("assert"); var { isUint8Array } = require("util/types"); var supportedHashes = []; var crypto; @@ -3822,7 +3822,7 @@ var require_util2 = __commonJS({ } function determineRequestsReferrer2(request) { const policy = request.referrerPolicy; - assert3(policy); + assert(policy); let referrerSource = null; if (request.referrer === "client") { const globalOrigin = getGlobalOrigin(); @@ -3880,7 +3880,7 @@ var require_util2 = __commonJS({ } } function stripURLForReferrer(url, originOnly) { - assert3(url instanceof URL); + assert(url instanceof URL); if (url.protocol === "file:" || url.protocol === "about:" || url.protocol === "blank:") { return "no-referrer"; } @@ -3987,13 +3987,13 @@ var require_util2 = __commonJS({ if (metadataList.length === 1) { return metadataList; } - let pos2 = 0; + let pos = 0; for (let i2 = 0; i2 < metadataList.length; ++i2) { if (metadataList[i2].algo === algorithm) { - metadataList[pos2++] = metadataList[i2]; + metadataList[pos++] = metadataList[i2]; } } - metadataList.length = pos2; + metadataList.length = pos; return metadataList; } function compareBase64Mixed(actualValue, expectedValue) { @@ -4024,8 +4024,8 @@ var require_util2 = __commonJS({ function createDeferredPromise() { let res; let rej; - const promise = new Promise((resolve2, reject) => { - res = resolve2; + const promise = new Promise((resolve, reject) => { + res = resolve; rej = reject; }); return { promise, resolve: res, reject: rej }; @@ -4059,11 +4059,11 @@ var require_util2 = __commonJS({ if (result === void 0) { throw new TypeError("Value is not JSON serializable"); } - assert3(typeof result === "string"); + assert(typeof result === "string"); return result; } var esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())); - function makeIterator(iterator, name2, kind) { + function makeIterator(iterator, name, kind) { const object = { index: 0, kind, @@ -4073,7 +4073,7 @@ var require_util2 = __commonJS({ next() { if (Object.getPrototypeOf(this) !== i2) { throw new TypeError( - `'next' called on an object that does not implement interface ${name2} Iterator.` + `'next' called on an object that does not implement interface ${name} Iterator.` ); } const { index, kind: kind2, target } = object; @@ -4088,7 +4088,7 @@ var require_util2 = __commonJS({ }, // The class string of an iterator prototype object for a given interface is the // result of concatenating the identifier of the interface and the string " Iterator". - [Symbol.toStringTag]: `${name2} Iterator` + [Symbol.toStringTag]: `${name} Iterator` }; Object.setPrototypeOf(i2, esIteratorPrototype); return Object.setPrototypeOf({}, i2); @@ -4153,7 +4153,7 @@ var require_util2 = __commonJS({ } function isomorphicEncode(input) { for (let i2 = 0; i2 < input.length; i2++) { - assert3(input.charCodeAt(i2) <= 255); + assert(input.charCodeAt(i2) <= 255); } return input; } @@ -4173,7 +4173,7 @@ var require_util2 = __commonJS({ } } function urlIsLocal(url) { - assert3("protocol" in url); + assert("protocol" in url); const protocol = url.protocol; return protocol === "about:" || protocol === "blob:" || protocol === "data:"; } @@ -4184,7 +4184,7 @@ var require_util2 = __commonJS({ return url.protocol === "https:"; } function urlIsHttpHttpsScheme(url) { - assert3("protocol" in url); + assert("protocol" in url); const protocol = url.protocol; return protocol === "http:" || protocol === "https:"; } @@ -4434,8 +4434,8 @@ var require_webidl = __commonJS({ } const keys = Reflect.ownKeys(O); for (const key of keys) { - const desc2 = Reflect.getOwnPropertyDescriptor(O, key); - if (desc2?.enumerable) { + const desc = Reflect.getOwnPropertyDescriptor(O, key); + if (desc?.enumerable) { const typedKey = keyConverter(key); const typedValue = valueConverter(O[key]); result[typedKey] = typedValue; @@ -4626,7 +4626,7 @@ var require_webidl = __commonJS({ // node_modules/undici/lib/fetch/dataURL.js var require_dataURL = __commonJS({ "node_modules/undici/lib/fetch/dataURL.js"(exports2, module2) { - var assert3 = require("assert"); + var assert = require("assert"); var { atob: atob2 } = require("buffer"); var { isomorphicDecode } = require_util2(); var encoder = new TextEncoder(); @@ -4634,7 +4634,7 @@ var require_dataURL = __commonJS({ var HTTP_WHITESPACE_REGEX = /(\u000A|\u000D|\u0009|\u0020)/; var HTTP_QUOTED_STRING_TOKENS = /[\u0009|\u0020-\u007E|\u0080-\u00FF]/; function dataURLProcessor(dataURL) { - assert3(dataURL.protocol === "data:"); + assert(dataURL.protocol === "data:"); let input = URLSerializer(dataURL, true); input = input.slice(5); const position = { position: 0 }; @@ -4820,7 +4820,7 @@ var require_dataURL = __commonJS({ function collectAnHTTPQuotedString(input, position, extractValue) { const positionStart = position.position; let value = ""; - assert3(input[position.position] === '"'); + assert(input[position.position] === '"'); position.position++; while (true) { value += collectASequenceOfCodePoints( @@ -4841,7 +4841,7 @@ var require_dataURL = __commonJS({ value += input[position.position]; position.position++; } else { - assert3(quoteOrBackslash === '"'); + assert(quoteOrBackslash === '"'); break; } } @@ -4851,12 +4851,12 @@ var require_dataURL = __commonJS({ return input.slice(positionStart, position.position); } function serializeAMimeType(mimeType) { - assert3(mimeType !== "failure"); + assert(mimeType !== "failure"); const { parameters, essence } = mimeType; let serialization = essence; - for (let [name2, value] of parameters.entries()) { + for (let [name, value] of parameters.entries()) { serialization += ";"; - serialization += name2; + serialization += name; serialization += "="; if (!HTTP_TOKEN_CODEPOINTS.test(value)) { value = value.replace(/(\\|")/g, "\\$1"); @@ -5115,7 +5115,7 @@ var require_formdata = __commonJS({ } this[kState] = []; } - append(name2, value, filename = void 0) { + append(name, value, filename = void 0) { webidl.brandCheck(this, _FormData); webidl.argumentLengthCheck(arguments, 2, { header: "FormData.append" }); if (arguments.length === 3 && !isBlobLike(value)) { @@ -5123,41 +5123,41 @@ var require_formdata = __commonJS({ "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'" ); } - name2 = webidl.converters.USVString(name2); + name = webidl.converters.USVString(name); value = isBlobLike(value) ? webidl.converters.Blob(value, { strict: false }) : webidl.converters.USVString(value); filename = arguments.length === 3 ? webidl.converters.USVString(filename) : void 0; - const entry = makeEntry(name2, value, filename); + const entry = makeEntry(name, value, filename); this[kState].push(entry); } - delete(name2) { + delete(name) { webidl.brandCheck(this, _FormData); webidl.argumentLengthCheck(arguments, 1, { header: "FormData.delete" }); - name2 = webidl.converters.USVString(name2); - this[kState] = this[kState].filter((entry) => entry.name !== name2); + name = webidl.converters.USVString(name); + this[kState] = this[kState].filter((entry) => entry.name !== name); } - get(name2) { + get(name) { webidl.brandCheck(this, _FormData); webidl.argumentLengthCheck(arguments, 1, { header: "FormData.get" }); - name2 = webidl.converters.USVString(name2); - const idx = this[kState].findIndex((entry) => entry.name === name2); + name = webidl.converters.USVString(name); + const idx = this[kState].findIndex((entry) => entry.name === name); if (idx === -1) { return null; } return this[kState][idx].value; } - getAll(name2) { + getAll(name) { webidl.brandCheck(this, _FormData); webidl.argumentLengthCheck(arguments, 1, { header: "FormData.getAll" }); - name2 = webidl.converters.USVString(name2); - return this[kState].filter((entry) => entry.name === name2).map((entry) => entry.value); + name = webidl.converters.USVString(name); + return this[kState].filter((entry) => entry.name === name).map((entry) => entry.value); } - has(name2) { + has(name) { webidl.brandCheck(this, _FormData); webidl.argumentLengthCheck(arguments, 1, { header: "FormData.has" }); - name2 = webidl.converters.USVString(name2); - return this[kState].findIndex((entry) => entry.name === name2) !== -1; + name = webidl.converters.USVString(name); + return this[kState].findIndex((entry) => entry.name === name) !== -1; } - set(name2, value, filename = void 0) { + set(name, value, filename = void 0) { webidl.brandCheck(this, _FormData); webidl.argumentLengthCheck(arguments, 2, { header: "FormData.set" }); if (arguments.length === 3 && !isBlobLike(value)) { @@ -5165,16 +5165,16 @@ var require_formdata = __commonJS({ "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'" ); } - name2 = webidl.converters.USVString(name2); + name = webidl.converters.USVString(name); value = isBlobLike(value) ? webidl.converters.Blob(value, { strict: false }) : webidl.converters.USVString(value); filename = arguments.length === 3 ? toUSVString(filename) : void 0; - const entry = makeEntry(name2, value, filename); - const idx = this[kState].findIndex((entry2) => entry2.name === name2); + const entry = makeEntry(name, value, filename); + const idx = this[kState].findIndex((entry2) => entry2.name === name); if (idx !== -1) { this[kState] = [ ...this[kState].slice(0, idx), entry, - ...this[kState].slice(idx + 1).filter((entry2) => entry2.name !== name2) + ...this[kState].slice(idx + 1).filter((entry2) => entry2.name !== name) ]; } else { this[kState].push(entry); @@ -5228,8 +5228,8 @@ var require_formdata = __commonJS({ configurable: true } }); - function makeEntry(name2, value, filename) { - name2 = Buffer.from(name2).toString("utf8"); + function makeEntry(name, value, filename) { + name = Buffer.from(name).toString("utf8"); if (typeof value === "string") { value = Buffer.from(value).toString("utf8"); } else { @@ -5244,7 +5244,7 @@ var require_formdata = __commonJS({ value = NativeFile && value instanceof NativeFile || value instanceof UndiciFile ? new File3([value], filename, options) : new FileLike(value, filename, options); } } - return { name: name2, value }; + return { name, value }; } module2.exports = { FormData: FormData3 }; } @@ -5270,7 +5270,7 @@ var require_body = __commonJS({ var { DOMException: DOMException3, structuredClone: structuredClone2 } = require_constants2(); var { Blob: Blob4, File: NativeFile } = require("buffer"); var { kBodyUsed } = require_symbols(); - var assert3 = require("assert"); + var assert = require("assert"); var { isErrored } = require_util(); var { isUint8Array, isArrayBuffer } = require("util/types"); var { File: UndiciFile } = require_file(); @@ -5308,7 +5308,7 @@ var require_body = __commonJS({ type: void 0 }); } - assert3(isReadableStreamLike(stream)); + assert(isReadableStreamLike(stream)); let action = null; let source = null; let length = null; @@ -5333,16 +5333,16 @@ Content-Disposition: form-data`; const rn = new Uint8Array([13, 10]); length = 0; let hasUnknownSizeValue = false; - for (const [name2, value] of object) { + for (const [name, value] of object) { if (typeof value === "string") { - const chunk2 = textEncoder.encode(prefix + `; name="${escape(normalizeLinefeeds(name2))}"\r + const chunk2 = textEncoder.encode(prefix + `; name="${escape(normalizeLinefeeds(name))}"\r \r ${normalizeLinefeeds(value)}\r `); blobParts.push(chunk2); length += chunk2.byteLength; } else { - const chunk2 = textEncoder.encode(`${prefix}; name="${escape(normalizeLinefeeds(name2))}"` + (value.name ? `; filename="${escape(value.name)}"` : "") + `\r + const chunk2 = textEncoder.encode(`${prefix}; name="${escape(normalizeLinefeeds(name))}"` + (value.name ? `; filename="${escape(value.name)}"` : "") + `\r Content-Type: ${value.type || "application/octet-stream"}\r \r `); @@ -5424,8 +5424,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r ReadableStream2 = require("stream/web").ReadableStream; } if (object instanceof ReadableStream2) { - assert3(!util.isDisturbed(object), "The body has already been consumed."); - assert3(!object.locked, "The stream is locked."); + assert(!util.isDisturbed(object), "The body has already been consumed."); + assert(!object.locked, "The stream is locked."); } return extractBody(object, keepalive); } @@ -5503,10 +5503,10 @@ Content-Type: ${value.type || "application/octet-stream"}\r } catch (err) { throw new DOMException3(`${err}`, "AbortError"); } - busboy.on("field", (name2, value) => { - responseFormData.append(name2, value); + busboy.on("field", (name, value) => { + responseFormData.append(name, value); }); - busboy.on("file", (name2, value, filename, encoding, mimeType) => { + busboy.on("file", (name, value, filename, encoding, mimeType) => { const chunks = []; if (encoding === "base64" || encoding.toLowerCase() === "base64") { let base64chunk = ""; @@ -5518,19 +5518,19 @@ Content-Type: ${value.type || "application/octet-stream"}\r }); value.on("end", () => { chunks.push(Buffer.from(base64chunk, "base64")); - responseFormData.append(name2, new File3(chunks, filename, { type: mimeType })); + responseFormData.append(name, new File3(chunks, filename, { type: mimeType })); }); } else { value.on("data", (chunk) => { chunks.push(chunk); }); value.on("end", () => { - responseFormData.append(name2, new File3(chunks, filename, { type: mimeType })); + responseFormData.append(name, new File3(chunks, filename, { type: mimeType })); }); } }); - const busboyResolve = new Promise((resolve2, reject) => { - busboy.on("finish", resolve2); + const busboyResolve = new Promise((resolve, reject) => { + busboy.on("finish", resolve); busboy.on("error", (err) => reject(new TypeError(err))); }); if (this.body !== null) for await (const chunk of consumeBody2(this[kState].body)) busboy.write(chunk); @@ -5554,8 +5554,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r throw Object.assign(new TypeError(), { cause: err }); } const formData = new FormData3(); - for (const [name2, value] of entries) { - formData.append(name2, value); + for (const [name, value] of entries) { + formData.append(name, value); } return formData; } else { @@ -5636,7 +5636,7 @@ var require_request = __commonJS({ InvalidArgumentError, NotSupportedError } = require_errors(); - var assert3 = require("assert"); + var assert = require("assert"); var { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = require_symbols(); var util = require_util(); var tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/; @@ -5661,7 +5661,7 @@ var require_request = __commonJS({ } var Request2 = class _Request { constructor(origin, { - path: path9, + path: path2, method, body, headers, @@ -5675,11 +5675,11 @@ var require_request = __commonJS({ throwOnError, expectContinue }, handler) { - if (typeof path9 !== "string") { + if (typeof path2 !== "string") { throw new InvalidArgumentError("path must be a string"); - } else if (path9[0] !== "/" && !(path9.startsWith("http://") || path9.startsWith("https://")) && method !== "CONNECT") { + } else if (path2[0] !== "/" && !(path2.startsWith("http://") || path2.startsWith("https://")) && method !== "CONNECT") { throw new InvalidArgumentError("path must be an absolute URL or start with a slash"); - } else if (invalidPathRegex.exec(path9) !== null) { + } else if (invalidPathRegex.exec(path2) !== null) { throw new InvalidArgumentError("invalid request path"); } if (typeof method !== "string") { @@ -5742,7 +5742,7 @@ var require_request = __commonJS({ this.completed = false; this.aborted = false; this.upgrade = upgrade || null; - this.path = query ? util.buildURL(path9, query) : path9; + this.path = query ? util.buildURL(path2, query) : path2; this.origin = origin; this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent; this.blocking = blocking == null ? false : blocking; @@ -5817,8 +5817,8 @@ var require_request = __commonJS({ } } onConnect(abort) { - assert3(!this.aborted); - assert3(!this.completed); + assert(!this.aborted); + assert(!this.completed); if (this.error) { abort(this.error); } else { @@ -5827,8 +5827,8 @@ var require_request = __commonJS({ } } onHeaders(statusCode, headers, resume, statusText) { - assert3(!this.aborted); - assert3(!this.completed); + assert(!this.aborted); + assert(!this.completed); if (channels.headers.hasSubscribers) { channels.headers.publish({ request: this, response: { statusCode, headers, statusText } }); } @@ -5839,8 +5839,8 @@ var require_request = __commonJS({ } } onData(chunk) { - assert3(!this.aborted); - assert3(!this.completed); + assert(!this.aborted); + assert(!this.completed); try { return this[kHandler].onData(chunk); } catch (err) { @@ -5849,13 +5849,13 @@ var require_request = __commonJS({ } } onUpgrade(statusCode, headers, socket) { - assert3(!this.aborted); - assert3(!this.completed); + assert(!this.aborted); + assert(!this.completed); return this[kHandler].onUpgrade(statusCode, headers, socket); } onComplete(trailers) { this.onFinally(); - assert3(!this.aborted); + assert(!this.aborted); this.completed = true; if (channels.trailers.hasSubscribers) { channels.trailers.publish({ request: this, trailers }); @@ -5918,8 +5918,8 @@ var require_request = __commonJS({ } return request; } - static [kHTTP2CopyHeaders](raw2) { - const rawHeaders = raw2.split("\r\n"); + static [kHTTP2CopyHeaders](raw) { + const rawHeaders = raw.split("\r\n"); const headers = {}; for (const header of rawHeaders) { const [key, value] = header.split(": "); @@ -6002,8 +6002,8 @@ var require_request = __commonJS({ var require_dispatcher = __commonJS({ "node_modules/undici/lib/dispatcher.js"(exports2, module2) { "use strict"; - var EventEmitter4 = require("events"); - var Dispatcher = class extends EventEmitter4 { + var EventEmitter = require("events"); + var Dispatcher = class extends EventEmitter { dispatch() { throw new Error("not implemented"); } @@ -6064,9 +6064,9 @@ var require_dispatcher_base = __commonJS({ } close(callback) { if (callback === void 0) { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { this.close((err, data) => { - return err ? reject(err) : resolve2(data); + return err ? reject(err) : resolve(data); }); }); } @@ -6104,12 +6104,12 @@ var require_dispatcher_base = __commonJS({ err = null; } if (callback === void 0) { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { this.destroy(err, (err2, data) => { return err2 ? ( /* istanbul ignore next: should never error */ reject(err2) - ) : resolve2(data); + ) : resolve(data); }); }); } @@ -6186,7 +6186,7 @@ var require_connect = __commonJS({ "node_modules/undici/lib/core/connect.js"(exports2, module2) { "use strict"; var net = require("net"); - var assert3 = require("assert"); + var assert = require("assert"); var util = require_util(); var { InvalidArgumentError, ConnectTimeoutError } = require_errors(); var tls; @@ -6256,7 +6256,7 @@ var require_connect = __commonJS({ servername = servername || options.servername || util.getServerName(host) || null; const sessionKey = servername || hostname; const session = sessionCache.get(sessionKey) || null; - assert3(sessionKey); + assert(sessionKey); socket = tls.connect({ highWaterMark: 16384, // TLS in node can't have bigger HWM anyway... @@ -6275,7 +6275,7 @@ var require_connect = __commonJS({ sessionCache.set(sessionKey, session2); }); } else { - assert3(!httpSocket, "httpSocket can only be sent on TLS update"); + assert(!httpSocket, "httpSocket can only be sent on TLS update"); socket = net.connect({ highWaterMark: 64 * 1024, // Same as nodejs fs streams. @@ -6364,34 +6364,34 @@ var require_constants3 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.SPECIAL_HEADERS = exports2.HEADER_STATE = exports2.MINOR = exports2.MAJOR = exports2.CONNECTION_TOKEN_CHARS = exports2.HEADER_CHARS = exports2.TOKEN = exports2.STRICT_TOKEN = exports2.HEX = exports2.URL_CHAR = exports2.STRICT_URL_CHAR = exports2.USERINFO_CHARS = exports2.MARK = exports2.ALPHANUM = exports2.NUM = exports2.HEX_MAP = exports2.NUM_MAP = exports2.ALPHA = exports2.FINISH = exports2.H_METHOD_MAP = exports2.METHOD_MAP = exports2.METHODS_RTSP = exports2.METHODS_ICE = exports2.METHODS_HTTP = exports2.METHODS = exports2.LENIENT_FLAGS = exports2.FLAGS = exports2.TYPE = exports2.ERROR = void 0; var utils_1 = require_utils2(); - var ERROR4; - (function(ERROR5) { - ERROR5[ERROR5["OK"] = 0] = "OK"; - ERROR5[ERROR5["INTERNAL"] = 1] = "INTERNAL"; - ERROR5[ERROR5["STRICT"] = 2] = "STRICT"; - ERROR5[ERROR5["LF_EXPECTED"] = 3] = "LF_EXPECTED"; - ERROR5[ERROR5["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH"; - ERROR5[ERROR5["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION"; - ERROR5[ERROR5["INVALID_METHOD"] = 6] = "INVALID_METHOD"; - ERROR5[ERROR5["INVALID_URL"] = 7] = "INVALID_URL"; - ERROR5[ERROR5["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT"; - ERROR5[ERROR5["INVALID_VERSION"] = 9] = "INVALID_VERSION"; - ERROR5[ERROR5["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN"; - ERROR5[ERROR5["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH"; - ERROR5[ERROR5["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE"; - ERROR5[ERROR5["INVALID_STATUS"] = 13] = "INVALID_STATUS"; - ERROR5[ERROR5["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE"; - ERROR5[ERROR5["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING"; - ERROR5[ERROR5["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN"; - ERROR5[ERROR5["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE"; - ERROR5[ERROR5["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE"; - ERROR5[ERROR5["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER"; - ERROR5[ERROR5["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE"; - ERROR5[ERROR5["PAUSED"] = 21] = "PAUSED"; - ERROR5[ERROR5["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE"; - ERROR5[ERROR5["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE"; - ERROR5[ERROR5["USER"] = 24] = "USER"; - })(ERROR4 = exports2.ERROR || (exports2.ERROR = {})); + var ERROR; + (function(ERROR2) { + ERROR2[ERROR2["OK"] = 0] = "OK"; + ERROR2[ERROR2["INTERNAL"] = 1] = "INTERNAL"; + ERROR2[ERROR2["STRICT"] = 2] = "STRICT"; + ERROR2[ERROR2["LF_EXPECTED"] = 3] = "LF_EXPECTED"; + ERROR2[ERROR2["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH"; + ERROR2[ERROR2["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION"; + ERROR2[ERROR2["INVALID_METHOD"] = 6] = "INVALID_METHOD"; + ERROR2[ERROR2["INVALID_URL"] = 7] = "INVALID_URL"; + ERROR2[ERROR2["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT"; + ERROR2[ERROR2["INVALID_VERSION"] = 9] = "INVALID_VERSION"; + ERROR2[ERROR2["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN"; + ERROR2[ERROR2["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH"; + ERROR2[ERROR2["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE"; + ERROR2[ERROR2["INVALID_STATUS"] = 13] = "INVALID_STATUS"; + ERROR2[ERROR2["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE"; + ERROR2[ERROR2["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING"; + ERROR2[ERROR2["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN"; + ERROR2[ERROR2["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE"; + ERROR2[ERROR2["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE"; + ERROR2[ERROR2["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER"; + ERROR2[ERROR2["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE"; + ERROR2[ERROR2["PAUSED"] = 21] = "PAUSED"; + ERROR2[ERROR2["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE"; + ERROR2[ERROR2["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE"; + ERROR2[ERROR2["USER"] = 24] = "USER"; + })(ERROR = exports2.ERROR || (exports2.ERROR = {})); var TYPE; (function(TYPE2) { TYPE2[TYPE2["BOTH"] = 0] = "BOTH"; @@ -6684,9 +6684,9 @@ var require_RedirectHandler = __commonJS({ "use strict"; var util = require_util(); var { kBodyUsed } = require_symbols(); - var assert3 = require("assert"); + var assert = require("assert"); var { InvalidArgumentError } = require_errors(); - var EE3 = require("events"); + var EE = require("events"); var redirectableStatusCodes = [300, 301, 302, 303, 307, 308]; var kBody = Symbol("body"); var BodyAsyncIterable = class { @@ -6695,7 +6695,7 @@ var require_RedirectHandler = __commonJS({ this[kBodyUsed] = false; } async *[Symbol.asyncIterator]() { - assert3(!this[kBodyUsed], "disturbed"); + assert(!this[kBodyUsed], "disturbed"); this[kBodyUsed] = true; yield* this[kBody]; } @@ -6716,12 +6716,12 @@ var require_RedirectHandler = __commonJS({ if (util.isStream(this.opts.body)) { if (util.bodyLength(this.opts.body) === 0) { this.opts.body.on("data", function() { - assert3(false); + assert(false); }); } if (typeof this.opts.body.readableDidRead !== "boolean") { this.opts.body[kBodyUsed] = false; - EE3.prototype.on.call(this.opts.body, "data", function() { + EE.prototype.on.call(this.opts.body, "data", function() { this[kBodyUsed] = true; }); } @@ -6750,9 +6750,9 @@ var require_RedirectHandler = __commonJS({ return this.handler.onHeaders(statusCode, headers, resume, statusText); } const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))); - const path9 = search ? `${pathname}${search}` : pathname; + const path2 = search ? `${pathname}${search}` : pathname; this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin); - this.opts.path = path9; + this.opts.path = path2; this.opts.origin = origin; this.opts.maxRedirections = 0; this.opts.query = null; @@ -6800,8 +6800,8 @@ var require_RedirectHandler = __commonJS({ return true; } if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { - const name2 = util.headerNameToString(header); - return name2 === "authorization" || name2 === "cookie" || name2 === "proxy-authorization"; + const name = util.headerNameToString(header); + return name === "authorization" || name === "cookie" || name === "proxy-authorization"; } return false; } @@ -6820,7 +6820,7 @@ var require_RedirectHandler = __commonJS({ } } } else { - assert3(headers == null, "headers must be an object or an array"); + assert(headers == null, "headers must be an object or an array"); } return ret; } @@ -6868,7 +6868,7 @@ var require_llhttp_simd_wasm = __commonJS({ var require_client = __commonJS({ "node_modules/undici/lib/client.js"(exports2, module2) { "use strict"; - var assert3 = require("assert"); + var assert = require("assert"); var net = require("net"); var http3 = require("http"); var { pipeline: pipeline3 } = require("stream"); @@ -7169,16 +7169,16 @@ var require_client = __commonJS({ return this[kNeedDrain] < 2; } async [kClose]() { - return new Promise((resolve2) => { + return new Promise((resolve) => { if (!this[kSize]) { - resolve2(null); + resolve(null); } else { - this[kClosedResolve] = resolve2; + this[kClosedResolve] = resolve; } }); } async [kDestroy](err) { - return new Promise((resolve2) => { + return new Promise((resolve) => { const requests = this[kQueue].splice(this[kPendingIdx]); for (let i2 = 0; i2 < requests.length; i2++) { const request = requests[i2]; @@ -7189,7 +7189,7 @@ var require_client = __commonJS({ this[kClosedResolve](); this[kClosedResolve] = null; } - resolve2(); + resolve(); }; if (this[kHTTP2Session] != null) { util.destroy(this[kHTTP2Session], err); @@ -7206,12 +7206,12 @@ var require_client = __commonJS({ } }; function onHttp2SessionError(err) { - assert3(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID"); + assert(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID"); this[kSocket][kError] = err; onError(this[kClient], err); } - function onHttp2FrameError(type, code2, id) { - const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code2}`); + function onHttp2FrameError(type, code, id) { + const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); if (id === 0) { this[kSocket][kError] = err; onError(this[kClient], err); @@ -7221,13 +7221,13 @@ var require_client = __commonJS({ util.destroy(this, new SocketError("other side closed")); util.destroy(this[kSocket], new SocketError("other side closed")); } - function onHTTP2GoAway(code2) { + function onHTTP2GoAway(code) { const client = this[kClient]; - const err = new InformationalError(`HTTP/2: "GOAWAY" frame received with code ${code2}`); + const err = new InformationalError(`HTTP/2: "GOAWAY" frame received with code ${code}`); client[kSocket] = null; client[kHTTP2Session] = null; if (client.destroyed) { - assert3(this[kPending] === 0); + assert(this[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i2 = 0; i2 < requests.length; i2++) { const request = requests[i2]; @@ -7239,7 +7239,7 @@ var require_client = __commonJS({ errorRequest(client, request, err); } client[kPendingIdx] = client[kRunningIdx]; - assert3(client[kRunning] === 0); + assert(client[kRunning] === 0); client.emit( "disconnect", client[kUrl], @@ -7248,7 +7248,7 @@ var require_client = __commonJS({ ); resume(client); } - var constants2 = require_constants3(); + var constants = require_constants3(); var createRedirectInterceptor = require_redirectInterceptor(); var EMPTY_BUF = Buffer.alloc(0); async function lazyllhttp() { @@ -7266,35 +7266,35 @@ var require_client = __commonJS({ return 0; }, wasm_on_status: (p, at, len) => { - assert3.strictEqual(currentParser.ptr, p); + assert.strictEqual(currentParser.ptr, p); const start = at - currentBufferPtr + currentBufferRef.byteOffset; return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0; }, wasm_on_message_begin: (p) => { - assert3.strictEqual(currentParser.ptr, p); + assert.strictEqual(currentParser.ptr, p); return currentParser.onMessageBegin() || 0; }, wasm_on_header_field: (p, at, len) => { - assert3.strictEqual(currentParser.ptr, p); + assert.strictEqual(currentParser.ptr, p); const start = at - currentBufferPtr + currentBufferRef.byteOffset; return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0; }, wasm_on_header_value: (p, at, len) => { - assert3.strictEqual(currentParser.ptr, p); + assert.strictEqual(currentParser.ptr, p); const start = at - currentBufferPtr + currentBufferRef.byteOffset; return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0; }, wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => { - assert3.strictEqual(currentParser.ptr, p); + assert.strictEqual(currentParser.ptr, p); return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0; }, wasm_on_body: (p, at, len) => { - assert3.strictEqual(currentParser.ptr, p); + assert.strictEqual(currentParser.ptr, p); const start = at - currentBufferPtr + currentBufferRef.byteOffset; return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0; }, wasm_on_message_complete: (p) => { - assert3.strictEqual(currentParser.ptr, p); + assert.strictEqual(currentParser.ptr, p); return currentParser.onMessageComplete() || 0; } /* eslint-enable camelcase */ @@ -7311,11 +7311,11 @@ var require_client = __commonJS({ var TIMEOUT_HEADERS = 1; var TIMEOUT_BODY = 2; var TIMEOUT_IDLE = 3; - var Parser2 = class { + var Parser = class { constructor(client, socket, { exports: exports3 }) { - assert3(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0); + assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0); this.llhttp = exports3; - this.ptr = this.llhttp.llhttp_alloc(constants2.TYPE.RESPONSE); + this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE); this.client = client; this.socket = socket; this.timeout = null; @@ -7359,10 +7359,10 @@ var require_client = __commonJS({ if (this.socket.destroyed || !this.paused) { return; } - assert3(this.ptr != null); - assert3(currentParser == null); + assert(this.ptr != null); + assert(currentParser == null); this.llhttp.llhttp_resume(this.ptr); - assert3(this.timeoutType === TIMEOUT_BODY); + assert(this.timeoutType === TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); @@ -7382,9 +7382,9 @@ var require_client = __commonJS({ } } execute(data) { - assert3(this.ptr != null); - assert3(currentParser == null); - assert3(!this.paused); + assert(this.ptr != null); + assert(currentParser == null); + assert(!this.paused); const { socket, llhttp } = this; if (data.length > currentBufferSize) { if (currentBufferPtr) { @@ -7407,27 +7407,27 @@ var require_client = __commonJS({ currentBufferRef = null; } const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr; - if (ret === constants2.ERROR.PAUSED_UPGRADE) { + if (ret === constants.ERROR.PAUSED_UPGRADE) { this.onUpgrade(data.slice(offset)); - } else if (ret === constants2.ERROR.PAUSED) { + } else if (ret === constants.ERROR.PAUSED) { this.paused = true; socket.unshift(data.slice(offset)); - } else if (ret !== constants2.ERROR.OK) { + } else if (ret !== constants.ERROR.OK) { const ptr = llhttp.llhttp_get_error_reason(this.ptr); let message = ""; if (ptr) { const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0); message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")"; } - throw new HTTPParserError(message, constants2.ERROR[ret], data.slice(offset)); + throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset)); } } catch (err) { util.destroy(socket, err); } } destroy() { - assert3(this.ptr != null); - assert3(currentParser == null); + assert(this.ptr != null); + assert(currentParser == null); this.llhttp.llhttp_free(this.ptr); this.ptr = null; timers.clearTimeout(this.timeout); @@ -7484,17 +7484,17 @@ var require_client = __commonJS({ } onUpgrade(head) { const { upgrade, client, socket, headers, statusCode } = this; - assert3(upgrade); + assert(upgrade); const request = client[kQueue][client[kRunningIdx]]; - assert3(request); - assert3(!socket.destroyed); - assert3(socket === client[kSocket]); - assert3(!this.paused); - assert3(request.upgrade || request.method === "CONNECT"); + assert(request); + assert(!socket.destroyed); + assert(socket === client[kSocket]); + assert(!this.paused); + assert(request.upgrade || request.method === "CONNECT"); this.statusCode = null; this.statusText = ""; this.shouldKeepAlive = null; - assert3(this.headers.length % 2 === 0); + assert(this.headers.length % 2 === 0); this.headers = []; this.headersSize = 0; socket.unshift(head); @@ -7522,8 +7522,8 @@ var require_client = __commonJS({ if (!request) { return -1; } - assert3(!this.upgrade); - assert3(this.statusCode < 200); + assert(!this.upgrade); + assert(this.statusCode < 200); if (statusCode === 100) { util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket))); return -1; @@ -7532,7 +7532,7 @@ var require_client = __commonJS({ util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket))); return -1; } - assert3.strictEqual(this.timeoutType, TIMEOUT_HEADERS); + assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS); this.statusCode = statusCode; this.shouldKeepAlive = shouldKeepAlive || // Override llhttp value which does not allow keepAlive for HEAD. request.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive"; @@ -7545,16 +7545,16 @@ var require_client = __commonJS({ } } if (request.method === "CONNECT") { - assert3(client[kRunning] === 1); + assert(client[kRunning] === 1); this.upgrade = true; return 2; } if (upgrade) { - assert3(client[kRunning] === 1); + assert(client[kRunning] === 1); this.upgrade = true; return 2; } - assert3(this.headers.length % 2 === 0); + assert(this.headers.length % 2 === 0); this.headers = []; this.headersSize = 0; if (this.shouldKeepAlive && client[kPipelining]) { @@ -7589,7 +7589,7 @@ var require_client = __commonJS({ socket[kBlocking] = false; resume(client); } - return pause ? constants2.ERROR.PAUSED : 0; + return pause ? constants.ERROR.PAUSED : 0; } onBody(buf) { const { client, socket, statusCode, maxResponseSize } = this; @@ -7597,21 +7597,21 @@ var require_client = __commonJS({ return -1; } const request = client[kQueue][client[kRunningIdx]]; - assert3(request); - assert3.strictEqual(this.timeoutType, TIMEOUT_BODY); + assert(request); + assert.strictEqual(this.timeoutType, TIMEOUT_BODY); if (this.timeout) { if (this.timeout.refresh) { this.timeout.refresh(); } } - assert3(statusCode >= 200); + assert(statusCode >= 200); if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) { util.destroy(socket, new ResponseExceededMaxSizeError()); return -1; } this.bytesRead += buf.length; if (request.onData(buf) === false) { - return constants2.ERROR.PAUSED; + return constants.ERROR.PAUSED; } } onMessageComplete() { @@ -7623,15 +7623,15 @@ var require_client = __commonJS({ return; } const request = client[kQueue][client[kRunningIdx]]; - assert3(request); - assert3(statusCode >= 100); + assert(request); + assert(statusCode >= 100); this.statusCode = null; this.statusText = ""; this.bytesRead = 0; this.contentLength = ""; this.keepAlive = ""; this.connection = ""; - assert3(this.headers.length % 2 === 0); + assert(this.headers.length % 2 === 0); this.headers = []; this.headersSize = 0; if (statusCode < 200) { @@ -7644,15 +7644,15 @@ var require_client = __commonJS({ request.onComplete(headers); client[kQueue][client[kRunningIdx]++] = null; if (socket[kWriting]) { - assert3.strictEqual(client[kRunning], 0); + assert.strictEqual(client[kRunning], 0); util.destroy(socket, new InformationalError("reset")); - return constants2.ERROR.PAUSED; + return constants.ERROR.PAUSED; } else if (!shouldKeepAlive) { util.destroy(socket, new InformationalError("reset")); - return constants2.ERROR.PAUSED; + return constants.ERROR.PAUSED; } else if (socket[kReset] && client[kRunning] === 0) { util.destroy(socket, new InformationalError("reset")); - return constants2.ERROR.PAUSED; + return constants.ERROR.PAUSED; } else if (client[kPipelining] === 1) { setImmediate(resume, client); } else { @@ -7664,7 +7664,7 @@ var require_client = __commonJS({ const { socket, timeoutType, client } = parser; if (timeoutType === TIMEOUT_HEADERS) { if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) { - assert3(!parser.paused, "cannot be paused while waiting for headers"); + assert(!parser.paused, "cannot be paused while waiting for headers"); util.destroy(socket, new HeadersTimeoutError()); } } else if (timeoutType === TIMEOUT_BODY) { @@ -7672,7 +7672,7 @@ var require_client = __commonJS({ util.destroy(socket, new BodyTimeoutError()); } } else if (timeoutType === TIMEOUT_IDLE) { - assert3(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]); + assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]); util.destroy(socket, new InformationalError("socket idle timeout")); } } @@ -7684,7 +7684,7 @@ var require_client = __commonJS({ } function onSocketError(err) { const { [kClient]: client, [kParser]: parser } = this; - assert3(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID"); + assert(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID"); if (client[kHTTPConnVersion] !== "h2") { if (err.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) { parser.onMessageComplete(); @@ -7696,13 +7696,13 @@ var require_client = __commonJS({ } function onError(client, err) { if (client[kRunning] === 0 && err.code !== "UND_ERR_INFO" && err.code !== "UND_ERR_SOCKET") { - assert3(client[kPendingIdx] === client[kRunningIdx]); + assert(client[kPendingIdx] === client[kRunningIdx]); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i2 = 0; i2 < requests.length; i2++) { const request = requests[i2]; errorRequest(client, request, err); } - assert3(client[kSize] === 0); + assert(client[kSize] === 0); } } function onSocketEnd() { @@ -7727,7 +7727,7 @@ var require_client = __commonJS({ const err = this[kError] || new SocketError("closed", util.getSocketInfo(this)); client[kSocket] = null; if (client.destroyed) { - assert3(client[kPending] === 0); + assert(client[kPending] === 0); const requests = client[kQueue].splice(client[kRunningIdx]); for (let i2 = 0; i2 < requests.length; i2++) { const request = requests[i2]; @@ -7739,19 +7739,19 @@ var require_client = __commonJS({ errorRequest(client, request, err); } client[kPendingIdx] = client[kRunningIdx]; - assert3(client[kRunning] === 0); + assert(client[kRunning] === 0); client.emit("disconnect", client[kUrl], [client], err); resume(client); } async function connect(client) { - assert3(!client[kConnecting]); - assert3(!client[kSocket]); + assert(!client[kConnecting]); + assert(!client[kSocket]); let { host, hostname, protocol, port } = client[kUrl]; if (hostname[0] === "[") { const idx = hostname.indexOf("]"); - assert3(idx !== -1); + assert(idx !== -1); const ip = hostname.substring(1, idx); - assert3(net.isIP(ip)); + assert(net.isIP(ip)); hostname = ip; } client[kConnecting] = true; @@ -7769,7 +7769,7 @@ var require_client = __commonJS({ }); } try { - const socket = await new Promise((resolve2, reject) => { + const socket = await new Promise((resolve, reject) => { client[kConnector]({ host, hostname, @@ -7781,7 +7781,7 @@ var require_client = __commonJS({ if (err) { reject(err); } else { - resolve2(socket2); + resolve(socket2); } }); }); @@ -7791,7 +7791,7 @@ var require_client = __commonJS({ return; } client[kConnecting] = false; - assert3(socket); + assert(socket); const isH2 = socket.alpnProtocol === "h2"; if (isH2) { if (!h2ExperimentalWarned) { @@ -7824,7 +7824,7 @@ var require_client = __commonJS({ socket[kWriting] = false; socket[kReset] = false; socket[kBlocking] = false; - socket[kParser] = new Parser2(client, socket, llhttpInstance); + socket[kParser] = new Parser(client, socket, llhttpInstance); } socket[kCounter] = 0; socket[kMaxRequests] = client[kMaxRequests]; @@ -7867,7 +7867,7 @@ var require_client = __commonJS({ }); } if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") { - assert3(client[kRunning] === 0); + assert(client[kRunning] === 0); while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { const request = client[kQueue][client[kPendingIdx]++]; errorRequest(client, request, err); @@ -7899,7 +7899,7 @@ var require_client = __commonJS({ function _resume(client, sync) { while (true) { if (client.destroyed) { - assert3(client[kPending] === 0); + assert(client[kPending] === 0); return; } if (client[kClosedResolve] && !client[kSize]) { @@ -7992,7 +7992,7 @@ var require_client = __commonJS({ writeH2(client, client[kHTTP2Session], request); return; } - const { body, method, path: path9, host, upgrade, headers, blocking, reset } = request; + const { body, method, path: path2, host, upgrade, headers, blocking, reset } = request; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { body.read(0); @@ -8042,7 +8042,7 @@ var require_client = __commonJS({ if (blocking) { socket[kBlocking] = true; } - let header = `${method} ${path9} HTTP/1.1\r + let header = `${method} ${path2} HTTP/1.1\r `; if (typeof host === "string") { header += `host: ${host}\r @@ -8071,13 +8071,13 @@ upgrade: ${upgrade}\r \r `, "latin1"); } else { - assert3(contentLength === null, "no body must not have content length"); + assert(contentLength === null, "no body must not have content length"); socket.write(`${header}\r `, "latin1"); } request.onRequestSent(); } else if (util.isBuffer(body)) { - assert3(contentLength === body.byteLength, "buffer body must have content length"); + assert(contentLength === body.byteLength, "buffer body must have content length"); socket.cork(); socket.write(`${header}content-length: ${contentLength}\r \r @@ -8100,12 +8100,12 @@ upgrade: ${upgrade}\r } else if (util.isIterable(body)) { writeIterable({ body, client, request, socket, contentLength, header, expectsPayload }); } else { - assert3(false); + assert(false); } return true; } function writeH2(client, session, request) { - const { body, method, path: path9, host, upgrade, expectContinue, signal, headers: reqHeaders } = request; + const { body, method, path: path2, host, upgrade, expectContinue, signal, headers: reqHeaders } = request; let headers; if (typeof reqHeaders === "string") headers = Request2[kHTTP2CopyHeaders](reqHeaders.trim()); else headers = reqHeaders; @@ -8148,7 +8148,7 @@ upgrade: ${upgrade}\r }); return true; } - headers[HTTP2_HEADER_PATH] = path9; + headers[HTTP2_HEADER_PATH] = path2; headers[HTTP2_HEADER_SCHEME] = "https"; const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; if (body && typeof body.read === "function") { @@ -8169,7 +8169,7 @@ upgrade: ${upgrade}\r process.emitWarning(new RequestContentLengthMismatchError()); } if (contentLength != null) { - assert3(body, "no body must not have content length"); + assert(body, "no body must not have content length"); headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`; } session.ref(); @@ -8212,8 +8212,8 @@ upgrade: ${upgrade}\r util.destroy(stream, err); } }); - stream.once("frameError", (type, code2) => { - const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code2}`); + stream.once("frameError", (type, code) => { + const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`); errorRequest(client, request, err); if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { h2State.streams -= 1; @@ -8225,7 +8225,7 @@ upgrade: ${upgrade}\r if (!body) { request.onRequestSent(); } else if (util.isBuffer(body)) { - assert3(contentLength === body.byteLength, "buffer body must have content length"); + assert(contentLength === body.byteLength, "buffer body must have content length"); stream.cork(); stream.write(body); stream.uncork(); @@ -8279,12 +8279,12 @@ upgrade: ${upgrade}\r socket: client[kSocket] }); } else { - assert3(false); + assert(false); } } } function writeStream({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { - assert3(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); + assert(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined"); if (client[kHTTPConnVersion] === "h2") { let onPipeData = function(chunk) { request.onBodySent(chunk); @@ -8342,7 +8342,7 @@ upgrade: ${upgrade}\r return; } finished = true; - assert3(socket.destroyed || socket[kWriting] && client[kRunning] <= 1); + assert(socket.destroyed || socket[kWriting] && client[kRunning] <= 1); socket.off("drain", onDrain).off("error", onFinished); body.removeListener("data", onData).removeListener("end", onFinished).removeListener("error", onFinished).removeListener("close", onAbort); if (!err) { @@ -8366,7 +8366,7 @@ upgrade: ${upgrade}\r socket.on("drain", onDrain).on("error", onFinished); } async function writeBlob({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { - assert3(contentLength === body.size, "blob body must have content length"); + assert(contentLength === body.size, "blob body must have content length"); const isH2 = client[kHTTPConnVersion] === "h2"; try { if (contentLength != null && contentLength !== body.size) { @@ -8396,7 +8396,7 @@ upgrade: ${upgrade}\r } } async function writeIterable({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { - assert3(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); + assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); let callback = null; function onDrain() { if (callback) { @@ -8405,12 +8405,12 @@ upgrade: ${upgrade}\r cb(); } } - const waitForDrain = () => new Promise((resolve2, reject) => { - assert3(callback === null); + const waitForDrain = () => new Promise((resolve, reject) => { + assert(callback === null); if (socket[kError]) { reject(socket[kError]); } else { - callback = resolve2; + callback = resolve; } }); if (client[kHTTPConnVersion] === "h2") { @@ -8554,7 +8554,7 @@ ${len.toString(16)}\r const { socket, client } = this; socket[kWriting] = false; if (err) { - assert3(client[kRunning] <= 1, "pipeline should only contain this request"); + assert(client[kRunning] <= 1, "pipeline should only contain this request"); util.destroy(socket, err); } } @@ -8562,7 +8562,7 @@ ${len.toString(16)}\r function errorRequest(client, request, err) { try { request.onError(err); - assert3(request.aborted); + assert(request.aborted); } catch (err2) { client.emit("error", err2); } @@ -8755,8 +8755,8 @@ var require_pool_base = __commonJS({ if (this[kQueue].isEmpty()) { return Promise.all(this[kClients].map((c) => c.close())); } else { - return new Promise((resolve2) => { - this[kClosedResolve] = resolve2; + return new Promise((resolve) => { + this[kClosedResolve] = resolve; }); } } @@ -9204,7 +9204,7 @@ var require_agent = __commonJS({ var require_readable = __commonJS({ "node_modules/undici/lib/api/readable.js"(exports2, module2) { "use strict"; - var assert3 = require("assert"); + var assert = require("assert"); var { Readable } = require("stream"); var { RequestAbortedError, NotSupportedError, InvalidArgumentError } = require_errors(); var util = require_util(); @@ -9215,7 +9215,7 @@ var require_readable = __commonJS({ var kBody = Symbol("kBody"); var kAbort = Symbol("abort"); var kContentType = Symbol("kContentType"); - var noop4 = () => { + var noop2 = () => { }; module2.exports = class BodyReadable extends Readable { constructor({ @@ -9313,7 +9313,7 @@ var require_readable = __commonJS({ this[kBody] = ReadableStreamFrom(this); if (this[kConsume]) { this[kBody].getReader(); - assert3(this[kBody].locked); + assert(this[kBody].locked); } } return this[kBody]; @@ -9334,18 +9334,18 @@ var require_readable = __commonJS({ if (this.closed) { return Promise.resolve(null); } - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { const signalListenerCleanup = signal ? util.addAbortListener(signal, () => { this.destroy(); - }) : noop4; + }) : noop2; this.on("close", function() { signalListenerCleanup(); if (signal && signal.aborted) { reject(signal.reason || Object.assign(new Error("The operation was aborted"), { name: "AbortError" })); } else { - resolve2(null); + resolve(null); } - }).on("error", noop4).on("data", function(chunk) { + }).on("error", noop2).on("data", function(chunk) { limit -= chunk.length; if (limit <= 0) { this.destroy(); @@ -9364,12 +9364,12 @@ var require_readable = __commonJS({ if (isUnusable(stream)) { throw new TypeError("unusable"); } - assert3(!stream[kConsume]); - return new Promise((resolve2, reject) => { + assert(!stream[kConsume]); + return new Promise((resolve, reject) => { stream[kConsume] = { type, stream, - resolve: resolve2, + resolve, reject, length: 0, body: [] @@ -9404,25 +9404,25 @@ var require_readable = __commonJS({ } } function consumeEnd(consume2) { - const { type, body, resolve: resolve2, stream, length } = consume2; + const { type, body, resolve, stream, length } = consume2; try { if (type === "text") { - resolve2(toUSVString(Buffer.concat(body))); + resolve(toUSVString(Buffer.concat(body))); } else if (type === "json") { - resolve2(JSON.parse(Buffer.concat(body))); + resolve(JSON.parse(Buffer.concat(body))); } else if (type === "arrayBuffer") { const dst = new Uint8Array(length); - let pos2 = 0; + let pos = 0; for (const buf of body) { - dst.set(buf, pos2); - pos2 += buf.byteLength; + dst.set(buf, pos); + pos += buf.byteLength; } - resolve2(dst.buffer); + resolve(dst.buffer); } else if (type === "blob") { if (!Blob4) { Blob4 = require("buffer").Blob; } - resolve2(new Blob4(body, { type: stream[kContentType] })); + resolve(new Blob4(body, { type: stream[kContentType] })); } consumeFinish(consume2); } catch (err) { @@ -9455,13 +9455,13 @@ var require_readable = __commonJS({ // node_modules/undici/lib/api/util.js var require_util3 = __commonJS({ "node_modules/undici/lib/api/util.js"(exports2, module2) { - var assert3 = require("assert"); + var assert = require("assert"); var { ResponseStatusCodeError } = require_errors(); var { toUSVString } = require_util(); async function getResolveErrorBodyCallback({ callback, body, contentType, statusCode, statusMessage, headers }) { - assert3(body); + assert(body); let chunks = []; let limit = 0; for await (const chunk of body) { @@ -9677,9 +9677,9 @@ var require_api_request = __commonJS({ }; function request(opts, callback) { if (callback === void 0) { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { request.call(this, opts, (err, data) => { - return err ? reject(err) : resolve2(data); + return err ? reject(err) : resolve(data); }); }); } @@ -9852,9 +9852,9 @@ var require_api_stream = __commonJS({ }; function stream(opts, factory, callback) { if (callback === void 0) { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { stream.call(this, opts, factory, (err, data) => { - return err ? reject(err) : resolve2(data); + return err ? reject(err) : resolve(data); }); }); } @@ -9889,7 +9889,7 @@ var require_api_pipeline = __commonJS({ var util = require_util(); var { AsyncResource } = require("async_hooks"); var { addSignal, removeSignal } = require_abort_signal(); - var assert3 = require("assert"); + var assert = require("assert"); var kResume = Symbol("resume"); var PipelineRequest = class extends Readable { constructor() { @@ -9989,7 +9989,7 @@ var require_api_pipeline = __commonJS({ } onConnect(abort, context) { const { ret, res } = this; - assert3(!res, "pipeline cannot be retried"); + assert(!res, "pipeline cannot be retried"); if (ret.destroyed) { throw new RequestAbortedError(); } @@ -10078,7 +10078,7 @@ var require_api_upgrade = __commonJS({ var { AsyncResource } = require("async_hooks"); var util = require_util(); var { addSignal, removeSignal } = require_abort_signal(); - var assert3 = require("assert"); + var assert = require("assert"); var UpgradeHandler = class extends AsyncResource { constructor(opts, callback) { if (!opts || typeof opts !== "object") { @@ -10111,7 +10111,7 @@ var require_api_upgrade = __commonJS({ } onUpgrade(statusCode, rawHeaders, socket) { const { callback, opaque, context } = this; - assert3.strictEqual(statusCode, 101); + assert.strictEqual(statusCode, 101); removeSignal(this); this.callback = null; const headers = this.responseHeaders === "raw" ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders); @@ -10135,9 +10135,9 @@ var require_api_upgrade = __commonJS({ }; function upgrade(opts, callback) { if (callback === void 0) { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { upgrade.call(this, opts, (err, data) => { - return err ? reject(err) : resolve2(data); + return err ? reject(err) : resolve(data); }); }); } @@ -10226,9 +10226,9 @@ var require_api_connect = __commonJS({ }; function connect(opts, callback) { if (callback === void 0) { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { connect.call(this, opts, (err, data) => { - return err ? reject(err) : resolve2(data); + return err ? reject(err) : resolve(data); }); }); } @@ -10388,20 +10388,20 @@ var require_mock_utils = __commonJS({ } return true; } - function safeUrl(path9) { - if (typeof path9 !== "string") { - return path9; + function safeUrl(path2) { + if (typeof path2 !== "string") { + return path2; } - const pathSegments = path9.split("?"); + const pathSegments = path2.split("?"); if (pathSegments.length !== 2) { - return path9; + return path2; } const qp = new URLSearchParams(pathSegments.pop()); qp.sort(); return [...pathSegments, qp.toString()].join("?"); } - function matchKey(mockDispatch2, { path: path9, method, body, headers }) { - const pathMatch = matchValue(mockDispatch2.path, path9); + function matchKey(mockDispatch2, { path: path2, method, body, headers }) { + const pathMatch = matchValue(mockDispatch2.path, path2); const methodMatch = matchValue(mockDispatch2.method, method); const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true; const headersMatch = matchHeaders(mockDispatch2, headers); @@ -10419,7 +10419,7 @@ var require_mock_utils = __commonJS({ function getMockDispatch(mockDispatches, key) { const basePath = key.query ? buildURL(key.path, key.query) : key.path; const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath; - let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path9 }) => matchValue(safeUrl(path9), resolvedPath)); + let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path2 }) => matchValue(safeUrl(path2), resolvedPath)); if (matchedMockDispatches.length === 0) { throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`); } @@ -10456,9 +10456,9 @@ var require_mock_utils = __commonJS({ } } function buildKey(opts) { - const { path: path9, method, body, headers, query } = opts; + const { path: path2, method, body, headers, query } = opts; return { - path: path9, + path: path2, method, body, headers, @@ -10752,7 +10752,7 @@ var require_mock_interceptor = __commonJS({ var require_mock_client = __commonJS({ "node_modules/undici/lib/mock/mock-client.js"(exports2, module2) { "use strict"; - var { promisify: promisify4 } = require("util"); + var { promisify: promisify3 } = require("util"); var Client = require_client(); var { buildMockDispatch } = require_mock_utils(); var { @@ -10792,7 +10792,7 @@ var require_mock_client = __commonJS({ return new MockInterceptor(opts, this[kDispatches]); } async [kClose]() { - await promisify4(this[kOriginalClose])(); + await promisify3(this[kOriginalClose])(); this[kConnected] = 0; this[kMockAgent][Symbols.kClients].delete(this[kOrigin]); } @@ -10805,7 +10805,7 @@ var require_mock_client = __commonJS({ var require_mock_pool = __commonJS({ "node_modules/undici/lib/mock/mock-pool.js"(exports2, module2) { "use strict"; - var { promisify: promisify4 } = require("util"); + var { promisify: promisify3 } = require("util"); var Pool = require_pool(); var { buildMockDispatch } = require_mock_utils(); var { @@ -10845,7 +10845,7 @@ var require_mock_pool = __commonJS({ return new MockInterceptor(opts, this[kDispatches]); } async [kClose]() { - await promisify4(this[kOriginalClose])(); + await promisify3(this[kOriginalClose])(); this[kConnected] = 0; this[kMockAgent][Symbols.kClients].delete(this[kOrigin]); } @@ -10907,10 +10907,10 @@ var require_pending_interceptors_formatter = __commonJS({ } format(pendingInterceptors) { const withPrettyHeaders = pendingInterceptors.map( - ({ method, path: path9, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ + ({ method, path: path2, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ Method: method, Origin: origin, - Path: path9, + Path: path2, "Status code": statusCode, Persistent: persist ? "\u2705" : "\u274C", Invocations: timesInvoked, @@ -11218,7 +11218,7 @@ var require_proxy_agent = __commonJS({ // node_modules/undici/lib/handler/RetryHandler.js var require_RetryHandler = __commonJS({ "node_modules/undici/lib/handler/RetryHandler.js"(exports2, module2) { - var assert3 = require("assert"); + var assert = require("assert"); var { kRetryHandlerDefaultRetry } = require_symbols(); var { RequestRetryError } = require_errors(); var { isDisturbed, parseHeaders, parseRangeHeader } = require_util(); @@ -11308,7 +11308,7 @@ var require_RetryHandler = __commonJS({ if (this.handler.onBodySent) return this.handler.onBodySent(chunk); } static [kRetryHandlerDefaultRetry](err, { state, opts }, cb) { - const { statusCode, code: code2, headers } = err; + const { statusCode, code, headers } = err; const { method, retryOptions } = opts; const { maxRetries, @@ -11321,7 +11321,7 @@ var require_RetryHandler = __commonJS({ } = retryOptions; let { counter, currentTimeout } = state; currentTimeout = currentTimeout != null && currentTimeout > 0 ? currentTimeout : timeout; - if (code2 && code2 !== "UND_ERR_REQ_RETRY" && code2 !== "UND_ERR_SOCKET" && !errorCodes.includes(code2)) { + if (code && code !== "UND_ERR_REQ_RETRY" && code !== "UND_ERR_SOCKET" && !errorCodes.includes(code)) { cb(err); return; } @@ -11383,8 +11383,8 @@ var require_RetryHandler = __commonJS({ return false; } const { start, size, end = size } = contentRange; - assert3(this.start === start, "content-range mismatch"); - assert3(this.end == null || this.end === end, "content-range mismatch"); + assert(this.start === start, "content-range mismatch"); + assert(this.end == null || this.end === end, "content-range mismatch"); this.resume = resume; return true; } @@ -11400,12 +11400,12 @@ var require_RetryHandler = __commonJS({ ); } const { start, size, end = size } = range; - assert3( + assert( start != null && Number.isFinite(start) && this.start !== start, "content-range mismatch" ); - assert3(Number.isFinite(start)); - assert3( + assert(Number.isFinite(start)); + assert( end != null && Number.isFinite(end) && this.end !== end, "invalid content-length" ); @@ -11416,8 +11416,8 @@ var require_RetryHandler = __commonJS({ const contentLength = headers["content-length"]; this.end = contentLength != null ? Number(contentLength) : null; } - assert3(Number.isFinite(this.start)); - assert3( + assert(Number.isFinite(this.start)); + assert( this.end == null || Number.isFinite(this.end), "invalid content-length" ); @@ -11560,11 +11560,11 @@ var require_headers = __commonJS({ } = require_util2(); var util = require("util"); var { webidl } = require_webidl(); - var assert3 = require("assert"); + var assert = require("assert"); var kHeadersMap = Symbol("headers map"); var kHeadersSortedMap = Symbol("headers map sorted"); - function isHTTPWhiteSpaceCharCode(code2) { - return code2 === 10 || code2 === 13 || code2 === 9 || code2 === 32; + function isHTTPWhiteSpaceCharCode(code) { + return code === 10 || code === 13 || code === 9 || code === 32; } function headerValueNormalize(potentialValue) { let i2 = 0; @@ -11598,12 +11598,12 @@ var require_headers = __commonJS({ }); } } - function appendHeader(headers, name2, value) { + function appendHeader(headers, name, value) { value = headerValueNormalize(value); - if (!isValidHeaderName(name2)) { + if (!isValidHeaderName(name)) { throw webidl.errors.invalidArgument({ prefix: "Headers.append", - value: name2, + value: name, type: "header name" }); } else if (!isValidHeaderValue(value)) { @@ -11617,7 +11617,7 @@ var require_headers = __commonJS({ throw new TypeError("immutable"); } else if (headers[kGuard] === "request-no-cors") { } - return headers[kHeadersList].append(name2, value); + return headers[kHeadersList].append(name, value); } var HeadersList = class _HeadersList { /** @type {[string, string][]|null} */ @@ -11633,9 +11633,9 @@ var require_headers = __commonJS({ } } // https://fetch.spec.whatwg.org/#header-list-contains - contains(name2) { - name2 = name2.toLowerCase(); - return this[kHeadersMap].has(name2); + contains(name) { + name = name.toLowerCase(); + return this[kHeadersMap].has(name); } clear() { this[kHeadersMap].clear(); @@ -11643,9 +11643,9 @@ var require_headers = __commonJS({ this.cookies = null; } // https://fetch.spec.whatwg.org/#concept-header-list-append - append(name2, value) { + append(name, value) { this[kHeadersSortedMap] = null; - const lowercaseName = name2.toLowerCase(); + const lowercaseName = name.toLowerCase(); const exists = this[kHeadersMap].get(lowercaseName); if (exists) { const delimiter = lowercaseName === "cookie" ? "; " : ", "; @@ -11654,7 +11654,7 @@ var require_headers = __commonJS({ value: `${exists.value}${delimiter}${value}` }); } else { - this[kHeadersMap].set(lowercaseName, { name: name2, value }); + this[kHeadersMap].set(lowercaseName, { name, value }); } if (lowercaseName === "set-cookie") { this.cookies ??= []; @@ -11662,38 +11662,38 @@ var require_headers = __commonJS({ } } // https://fetch.spec.whatwg.org/#concept-header-list-set - set(name2, value) { + set(name, value) { this[kHeadersSortedMap] = null; - const lowercaseName = name2.toLowerCase(); + const lowercaseName = name.toLowerCase(); if (lowercaseName === "set-cookie") { this.cookies = [value]; } - this[kHeadersMap].set(lowercaseName, { name: name2, value }); + this[kHeadersMap].set(lowercaseName, { name, value }); } // https://fetch.spec.whatwg.org/#concept-header-list-delete - delete(name2) { + delete(name) { this[kHeadersSortedMap] = null; - name2 = name2.toLowerCase(); - if (name2 === "set-cookie") { + name = name.toLowerCase(); + if (name === "set-cookie") { this.cookies = null; } - this[kHeadersMap].delete(name2); + this[kHeadersMap].delete(name); } // https://fetch.spec.whatwg.org/#concept-header-list-get - get(name2) { - const value = this[kHeadersMap].get(name2.toLowerCase()); + get(name) { + const value = this[kHeadersMap].get(name.toLowerCase()); return value === void 0 ? null : value.value; } *[Symbol.iterator]() { - for (const [name2, { value }] of this[kHeadersMap]) { - yield [name2, value]; + for (const [name, { value }] of this[kHeadersMap]) { + yield [name, value]; } } get entries() { const headers = {}; if (this[kHeadersMap].size) { - for (const { name: name2, value } of this[kHeadersMap].values()) { - headers[name2] = value; + for (const { name, value } of this[kHeadersMap].values()) { + headers[name] = value; } } return headers; @@ -11712,22 +11712,22 @@ var require_headers = __commonJS({ } } // https://fetch.spec.whatwg.org/#dom-headers-append - append(name2, value) { + append(name, value) { webidl.brandCheck(this, _Headers); webidl.argumentLengthCheck(arguments, 2, { header: "Headers.append" }); - name2 = webidl.converters.ByteString(name2); + name = webidl.converters.ByteString(name); value = webidl.converters.ByteString(value); - return appendHeader(this, name2, value); + return appendHeader(this, name, value); } // https://fetch.spec.whatwg.org/#dom-headers-delete - delete(name2) { + delete(name) { webidl.brandCheck(this, _Headers); webidl.argumentLengthCheck(arguments, 1, { header: "Headers.delete" }); - name2 = webidl.converters.ByteString(name2); - if (!isValidHeaderName(name2)) { + name = webidl.converters.ByteString(name); + if (!isValidHeaderName(name)) { throw webidl.errors.invalidArgument({ prefix: "Headers.delete", - value: name2, + value: name, type: "header name" }); } @@ -11735,50 +11735,50 @@ var require_headers = __commonJS({ throw new TypeError("immutable"); } else if (this[kGuard] === "request-no-cors") { } - if (!this[kHeadersList].contains(name2)) { + if (!this[kHeadersList].contains(name)) { return; } - this[kHeadersList].delete(name2); + this[kHeadersList].delete(name); } // https://fetch.spec.whatwg.org/#dom-headers-get - get(name2) { + get(name) { webidl.brandCheck(this, _Headers); webidl.argumentLengthCheck(arguments, 1, { header: "Headers.get" }); - name2 = webidl.converters.ByteString(name2); - if (!isValidHeaderName(name2)) { + name = webidl.converters.ByteString(name); + if (!isValidHeaderName(name)) { throw webidl.errors.invalidArgument({ prefix: "Headers.get", - value: name2, + value: name, type: "header name" }); } - return this[kHeadersList].get(name2); + return this[kHeadersList].get(name); } // https://fetch.spec.whatwg.org/#dom-headers-has - has(name2) { + has(name) { webidl.brandCheck(this, _Headers); webidl.argumentLengthCheck(arguments, 1, { header: "Headers.has" }); - name2 = webidl.converters.ByteString(name2); - if (!isValidHeaderName(name2)) { + name = webidl.converters.ByteString(name); + if (!isValidHeaderName(name)) { throw webidl.errors.invalidArgument({ prefix: "Headers.has", - value: name2, + value: name, type: "header name" }); } - return this[kHeadersList].contains(name2); + return this[kHeadersList].contains(name); } // https://fetch.spec.whatwg.org/#dom-headers-set - set(name2, value) { + set(name, value) { webidl.brandCheck(this, _Headers); webidl.argumentLengthCheck(arguments, 2, { header: "Headers.set" }); - name2 = webidl.converters.ByteString(name2); + name = webidl.converters.ByteString(name); value = webidl.converters.ByteString(value); value = headerValueNormalize(value); - if (!isValidHeaderName(name2)) { + if (!isValidHeaderName(name)) { throw webidl.errors.invalidArgument({ prefix: "Headers.set", - value: name2, + value: name, type: "header name" }); } else if (!isValidHeaderValue(value)) { @@ -11792,14 +11792,14 @@ var require_headers = __commonJS({ throw new TypeError("immutable"); } else if (this[kGuard] === "request-no-cors") { } - this[kHeadersList].set(name2, value); + this[kHeadersList].set(name, value); } // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie getSetCookie() { webidl.brandCheck(this, _Headers); - const list2 = this[kHeadersList].cookies; - if (list2) { - return [...list2]; + const list = this[kHeadersList].cookies; + if (list) { + return [...list]; } return []; } @@ -11812,14 +11812,14 @@ var require_headers = __commonJS({ const names = [...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1); const cookies = this[kHeadersList].cookies; for (let i2 = 0; i2 < names.length; ++i2) { - const [name2, value] = names[i2]; - if (name2 === "set-cookie") { + const [name, value] = names[i2]; + if (name === "set-cookie") { for (let j = 0; j < cookies.length; ++j) { - headers.push([name2, cookies[j]]); + headers.push([name, cookies[j]]); } } else { - assert3(value !== null); - headers.push([name2, value]); + assert(value !== null); + headers.push([name, value]); } } this[kHeadersList][kHeadersSortedMap] = headers; @@ -11964,7 +11964,7 @@ var require_response = __commonJS({ var { getGlobalOrigin } = require_global(); var { URLSerializer } = require_dataURL(); var { kHeadersList, kConstruct } = require_symbols(); - var assert3 = require("assert"); + var assert = require("assert"); var { types: types3 } = require("util"); var ReadableStream2 = globalThis.ReadableStream || require("stream/web").ReadableStream; var textEncoder = new TextEncoder("utf-8"); @@ -12180,7 +12180,7 @@ var require_response = __commonJS({ return p in state ? state[p] : target[p]; }, set(target, p, value) { - assert3(!(p in state)); + assert(!(p in state)); target[p] = value; return true; } @@ -12214,11 +12214,11 @@ var require_response = __commonJS({ body: null }); } else { - assert3(false); + assert(false); } } function makeAppropriateNetworkError(fetchParams, err = null) { - assert3(isCancelled(fetchParams)); + assert(isCancelled(fetchParams)); return isAborted(fetchParams) ? makeNetworkError(Object.assign(new DOMException3("The operation was aborted.", "AbortError"), { cause: err })) : makeNetworkError(Object.assign(new DOMException3("Request was cancelled."), { cause: err })); } function initializeResponse(response, init, body) { @@ -12346,7 +12346,7 @@ var require_request2 = __commonJS({ var { getGlobalOrigin } = require_global(); var { URLSerializer } = require_dataURL(); var { kHeadersList, kConstruct } = require_symbols(); - var assert3 = require("assert"); + var assert = require("assert"); var { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = require("events"); var TransformStream = globalThis.TransformStream; var kAbortController = Symbol("abortController"); @@ -12390,7 +12390,7 @@ var require_request2 = __commonJS({ request = makeRequest({ urlList: [parsedURL] }); fallbackMode = "cors"; } else { - assert3(input instanceof _Request); + assert(input instanceof _Request); request = input[kState]; signal = input[kSignal]; } @@ -12999,7 +12999,7 @@ var require_fetch = __commonJS({ urlHasHttpsScheme } = require_util2(); var { kState, kHeaders, kGuard, kRealm } = require_symbols2(); - var assert3 = require("assert"); + var assert = require("assert"); var { safelyExtractBody } = require_body(); var { redirectStatusSet, @@ -13010,9 +13010,9 @@ var require_fetch = __commonJS({ DOMException: DOMException3 } = require_constants2(); var { kHeadersList } = require_symbols(); - var EE3 = require("events"); + var EE = require("events"); var { Readable, pipeline: pipeline3 } = require("stream"); - var { addAbortListener, isErrored, isReadable: isReadable4, nodeMajor, nodeMinor } = require_util(); + var { addAbortListener, isErrored, isReadable, nodeMajor, nodeMinor } = require_util(); var { dataURLProcessor, serializeAMimeType } = require_dataURL(); var { TransformStream } = require("stream/web"); var { getGlobalDispatcher } = require_global2(); @@ -13021,7 +13021,7 @@ var require_fetch = __commonJS({ var GET_OR_HEAD = ["GET", "HEAD"]; var resolveObjectURL; var ReadableStream2 = globalThis.ReadableStream; - var Fetch = class extends EE3 { + var Fetch = class extends EE { constructor(dispatcher) { super(); this.dispatcher = dispatcher; @@ -13079,7 +13079,7 @@ var require_fetch = __commonJS({ requestObject.signal, () => { locallyAborted = true; - assert3(controller != null); + assert(controller != null); controller.abort(requestObject.signal.reason); abortFetch(p, request, responseObject, requestObject.signal.reason); } @@ -13158,7 +13158,7 @@ var require_fetch = __commonJS({ error = new DOMException3("The operation was aborted.", "AbortError"); } p.reject(error); - if (request.body != null && isReadable4(request.body?.stream)) { + if (request.body != null && isReadable(request.body?.stream)) { request.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; @@ -13170,7 +13170,7 @@ var require_fetch = __commonJS({ return; } const response = responseObject[kState]; - if (response.body != null && isReadable4(response.body?.stream)) { + if (response.body != null && isReadable(response.body?.stream)) { response.body.stream.cancel(error).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; @@ -13212,7 +13212,7 @@ var require_fetch = __commonJS({ taskDestination, crossOriginIsolatedCapability }; - assert3(!request.body || request.body.stream); + assert(!request.body || request.body.stream); if (request.window === "client") { request.window = request.client?.globalObject?.constructor?.name === "Window" ? request.client : "no-window"; } @@ -13305,7 +13305,7 @@ var require_fetch = __commonJS({ } else if (request.responseTainting === "opaque") { response = filterResponse(response, "opaque"); } else { - assert3(false); + assert(false); } } let internalResponse = response.status === 0 ? response : response.internalResponse; @@ -13497,7 +13497,7 @@ var require_fetch = __commonJS({ } else if (request.redirect === "follow") { response = await httpRedirectFetch(fetchParams, response); } else { - assert3(false); + assert(false); } } response.timingInfo = timingInfo; @@ -13550,7 +13550,7 @@ var require_fetch = __commonJS({ request.headersList.delete("host"); } if (request.body != null) { - assert3(request.body.source != null); + assert(request.body.source != null); request.body = safelyExtractBody(request.body.source)[0]; } const timingInfo = fetchParams.timingInfo; @@ -13683,7 +13683,7 @@ var require_fetch = __commonJS({ return response; } async function httpNetworkFetch(fetchParams, includeCredentials = false, forceNewConnection = false) { - assert3(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed); + assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed); fetchParams.controller.connection = { abort: null, destroyed: false, @@ -13832,13 +13832,13 @@ var require_fetch = __commonJS({ function onAborted(reason) { if (isAborted(fetchParams)) { response.aborted = true; - if (isReadable4(stream)) { + if (isReadable(stream)) { fetchParams.controller.controller.error( fetchParams.controller.serializedAbortReason ); } } else { - if (isReadable4(stream)) { + if (isReadable(stream)) { fetchParams.controller.controller.error(new TypeError("terminated", { cause: isErrorLike(reason) ? reason : void 0 })); @@ -13850,7 +13850,7 @@ var require_fetch = __commonJS({ async function dispatch({ body }) { const url = requestCurrentURL(request); const agent = fetchParams.controller.dispatcher; - return new Promise((resolve2, reject) => agent.dispatch( + return new Promise((resolve, reject) => agent.dispatch( { path: url.pathname + url.search, origin: url.origin, @@ -13926,7 +13926,7 @@ var require_fetch = __commonJS({ } } } - resolve2({ + resolve({ status, statusText, headersList: headers[kHeadersList], @@ -13969,7 +13969,7 @@ var require_fetch = __commonJS({ const val = headersList[n + 1].toString("latin1"); headers[kHeadersList].append(key, val); } - resolve2({ + resolve({ status, statusText: STATUS_CODES[status], headersList: headers[kHeadersList], @@ -14375,7 +14375,7 @@ var require_util4 = __commonJS({ var { DOMException: DOMException3 } = require_constants2(); var { serializeAMimeType, parseMIMEType } = require_dataURL(); var { types: types3 } = require("util"); - var { StringDecoder: StringDecoder4 } = require("string_decoder"); + var { StringDecoder } = require("string_decoder"); var { btoa } = require("buffer"); var staticPropertyDescriptors = { enumerable: true, @@ -14466,7 +14466,7 @@ var require_util4 = __commonJS({ dataURL += serializeAMimeType(parsed); } dataURL += ";base64,"; - const decoder = new StringDecoder4("latin1"); + const decoder = new StringDecoder("latin1"); for (const chunk of bytes) { dataURL += btoa(decoder.write(chunk)); } @@ -14487,7 +14487,7 @@ var require_util4 = __commonJS({ if (encoding === "failure") { encoding = "UTF-8"; } - return decode2(bytes, encoding); + return decode(bytes, encoding); } case "ArrayBuffer": { const sequence = combineByteSequences(bytes); @@ -14495,7 +14495,7 @@ var require_util4 = __commonJS({ } case "BinaryString": { let binaryString = ""; - const decoder = new StringDecoder4("latin1"); + const decoder = new StringDecoder("latin1"); for (const chunk of bytes) { binaryString += decoder.write(chunk); } @@ -14504,7 +14504,7 @@ var require_util4 = __commonJS({ } } } - function decode2(ioQueue, encoding) { + function decode(ioQueue, encoding) { const bytes = combineByteSequences(ioQueue); const BOMEncoding = BOMSniffing(bytes); let slice = 0; @@ -14818,7 +14818,7 @@ var require_symbols4 = __commonJS({ var require_util5 = __commonJS({ "node_modules/undici/lib/cache/util.js"(exports2, module2) { "use strict"; - var assert3 = require("assert"); + var assert = require("assert"); var { URLSerializer } = require_dataURL(); var { isValidHeaderName } = require_util2(); function urlEquals(A2, B, excludeFragment = false) { @@ -14827,7 +14827,7 @@ var require_util5 = __commonJS({ return serializedA === serializedB; } function fieldValues(header) { - assert3(header !== null); + assert(header !== null); const values = []; for (let value of header.split(",")) { value = value.trim(); @@ -14861,7 +14861,7 @@ var require_cache = __commonJS({ var { kState, kHeaders, kGuard, kRealm } = require_symbols2(); var { fetching } = require_fetch(); var { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = require_util2(); - var assert3 = require("assert"); + var assert = require("assert"); var { getGlobalDispatcher } = require_global2(); var Cache = class _Cache { /** @@ -15122,7 +15122,7 @@ var require_cache = __commonJS({ return false; } } else { - assert3(typeof request === "string"); + assert(typeof request === "string"); r2 = new Request2(request)[kState]; } const operations = []; @@ -15231,7 +15231,7 @@ var require_cache = __commonJS({ } for (const requestResponse of requestResponses) { const idx = cache.indexOf(requestResponse); - assert3(idx !== -1); + assert(idx !== -1); cache.splice(idx, 1); } } else if (operation.type === "put") { @@ -15263,7 +15263,7 @@ var require_cache = __commonJS({ requestResponses = this.#queryCache(operation.request); for (const requestResponse of requestResponses) { const idx = cache.indexOf(requestResponse); - assert3(idx !== -1); + assert(idx !== -1); cache.splice(idx, 1); } cache.push([operation.request, operation.response]); @@ -15507,33 +15507,33 @@ var require_util6 = __commonJS({ return false; } for (const char of value) { - const code2 = char.charCodeAt(0); - if (code2 >= 0 || code2 <= 8 || (code2 >= 10 || code2 <= 31) || code2 === 127) { + const code = char.charCodeAt(0); + if (code >= 0 || code <= 8 || (code >= 10 || code <= 31) || code === 127) { return false; } } } - function validateCookieName(name2) { - for (const char of name2) { - const code2 = char.charCodeAt(0); - if (code2 <= 32 || code2 > 127 || char === "(" || char === ")" || char === ">" || char === "<" || char === "@" || char === "," || char === ";" || char === ":" || char === "\\" || char === '"' || char === "/" || char === "[" || char === "]" || char === "?" || char === "=" || char === "{" || char === "}") { + function validateCookieName(name) { + for (const char of name) { + const code = char.charCodeAt(0); + if (code <= 32 || code > 127 || char === "(" || char === ")" || char === ">" || char === "<" || char === "@" || char === "," || char === ";" || char === ":" || char === "\\" || char === '"' || char === "/" || char === "[" || char === "]" || char === "?" || char === "=" || char === "{" || char === "}") { throw new Error("Invalid cookie name"); } } } function validateCookieValue(value) { for (const char of value) { - const code2 = char.charCodeAt(0); - if (code2 < 33 || // exclude CTLs (0-31) - code2 === 34 || code2 === 44 || code2 === 59 || code2 === 92 || code2 > 126) { + const code = char.charCodeAt(0); + if (code < 33 || // exclude CTLs (0-31) + code === 34 || code === 44 || code === 59 || code === 92 || code > 126) { throw new Error("Invalid header value"); } } } - function validateCookiePath(path9) { - for (const char of path9) { - const code2 = char.charCodeAt(0); - if (code2 < 33 || char === ";") { + function validateCookiePath(path2) { + for (const char of path2) { + const code = char.charCodeAt(0); + if (code < 33 || char === ";") { throw new Error("Invalid cookie path"); } } @@ -15650,14 +15650,14 @@ var require_parse = __commonJS({ var { maxNameValuePairSize, maxAttributeValueSize } = require_constants4(); var { isCTLExcludingHtab } = require_util6(); var { collectASequenceOfCodePointsFast } = require_dataURL(); - var assert3 = require("assert"); + var assert = require("assert"); function parseSetCookie(header) { if (isCTLExcludingHtab(header)) { return null; } let nameValuePair = ""; let unparsedAttributes = ""; - let name2 = ""; + let name = ""; let value = ""; if (header.includes(";")) { const position = { position: 0 }; @@ -15670,20 +15670,20 @@ var require_parse = __commonJS({ value = nameValuePair; } else { const position = { position: 0 }; - name2 = collectASequenceOfCodePointsFast( + name = collectASequenceOfCodePointsFast( "=", nameValuePair, position ); value = nameValuePair.slice(position.position + 1); } - name2 = name2.trim(); + name = name.trim(); value = value.trim(); - if (name2.length + value.length > maxNameValuePairSize) { + if (name.length + value.length > maxNameValuePairSize) { return null; } return { - name: name2, + name, value, ...parseUnparsedAttributes(unparsedAttributes) }; @@ -15692,7 +15692,7 @@ var require_parse = __commonJS({ if (unparsedAttributes.length === 0) { return cookieAttributeList; } - assert3(unparsedAttributes[0] === ";"); + assert(unparsedAttributes[0] === ";"); unparsedAttributes = unparsedAttributes.slice(1); let cookieAv = ""; if (unparsedAttributes.includes(";")) { @@ -15800,18 +15800,18 @@ var require_cookies = __commonJS({ return out; } for (const piece of cookie.split(";")) { - const [name2, ...value] = piece.split("="); - out[name2.trim()] = value.join("="); + const [name, ...value] = piece.split("="); + out[name.trim()] = value.join("="); } return out; } - function deleteCookie(headers, name2, attributes) { + function deleteCookie(headers, name, attributes) { webidl.argumentLengthCheck(arguments, 2, { header: "deleteCookie" }); webidl.brandCheck(headers, Headers2, { strict: false }); - name2 = webidl.converters.DOMString(name2); + name = webidl.converters.DOMString(name); attributes = webidl.converters.DeleteCookieAttributes(attributes); setCookie(headers, { - name: name2, + name, value: "", expires: /* @__PURE__ */ new Date(0), ...attributes @@ -16264,21 +16264,21 @@ var require_util7 = __commonJS({ return false; } for (const char of protocol) { - const code2 = char.charCodeAt(0); - if (code2 < 33 || code2 > 126 || char === "(" || char === ")" || char === "<" || char === ">" || char === "@" || char === "," || char === ";" || char === ":" || char === "\\" || char === '"' || char === "/" || char === "[" || char === "]" || char === "?" || char === "=" || char === "{" || char === "}" || code2 === 32 || // SP - code2 === 9) { + const code = char.charCodeAt(0); + if (code < 33 || code > 126 || char === "(" || char === ")" || char === "<" || char === ">" || char === "@" || char === "," || char === ";" || char === ":" || char === "\\" || char === '"' || char === "/" || char === "[" || char === "]" || char === "?" || char === "=" || char === "{" || char === "}" || code === 32 || // SP + code === 9) { return false; } } return true; } - function isValidStatusCode(code2) { - if (code2 >= 1e3 && code2 < 1015) { - return code2 !== 1004 && // reserved - code2 !== 1005 && // "MUST NOT be set as a status code" - code2 !== 1006; + function isValidStatusCode(code) { + if (code >= 1e3 && code < 1015) { + return code !== 1004 && // reserved + code !== 1005 && // "MUST NOT be set as a status code" + code !== 1006; } - return code2 >= 3e3 && code2 <= 4999; + return code >= 3e3 && code <= 4999; } function failWebsocketConnection(ws, reason) { const { [kController]: controller, [kResponse]: response } = ws; @@ -16416,25 +16416,25 @@ var require_connection = __commonJS({ function onSocketClose() { const { ws } = this; const wasClean = ws[kSentClose] && ws[kReceivedClose]; - let code2 = 1005; + let code = 1005; let reason = ""; const result = ws[kByteParser].closingInfo; if (result) { - code2 = result.code ?? 1005; + code = result.code ?? 1005; reason = result.reason; } else if (!ws[kSentClose]) { - code2 = 1006; + code = 1006; } ws[kReadyState] = states.CLOSED; fireEvent("close", ws, CloseEvent, { wasClean, - code: code2, + code, reason }); if (channels.close.hasSubscribers) { channels.close.publish({ websocket: ws, - code: code2, + code, reason }); } @@ -16712,21 +16712,21 @@ var require_receiver = __commonJS({ return buffer; } parseCloseBody(onlyCode, data) { - let code2; + let code; if (data.length >= 2) { - code2 = data.readUInt16BE(0); + code = data.readUInt16BE(0); } if (onlyCode) { - if (!isValidStatusCode(code2)) { + if (!isValidStatusCode(code)) { return null; } - return { code: code2 }; + return { code }; } let reason = data.subarray(2); if (reason[0] === 239 && reason[1] === 187 && reason[2] === 191) { reason = reason.subarray(3); } - if (code2 !== void 0 && !isValidStatusCode(code2)) { + if (code !== void 0 && !isValidStatusCode(code)) { return null; } try { @@ -16734,7 +16734,7 @@ var require_receiver = __commonJS({ } catch { return null; } - return { code: code2, reason }; + return { code, reason }; } get closingInfo() { return this.#info.closeInfo; @@ -16844,16 +16844,16 @@ var require_websocket = __commonJS({ * @param {number|undefined} code * @param {string|undefined} reason */ - close(code2 = void 0, reason = void 0) { + close(code = void 0, reason = void 0) { webidl.brandCheck(this, _WebSocket); - if (code2 !== void 0) { - code2 = webidl.converters["unsigned short"](code2, { clamp: true }); + if (code !== void 0) { + code = webidl.converters["unsigned short"](code, { clamp: true }); } if (reason !== void 0) { reason = webidl.converters.USVString(reason); } - if (code2 !== void 0) { - if (code2 !== 1e3 && (code2 < 3e3 || code2 > 4999)) { + if (code !== void 0) { + if (code !== 1e3 && (code < 3e3 || code > 4999)) { throw new DOMException3("invalid code", "InvalidAccessError"); } } @@ -16873,12 +16873,12 @@ var require_websocket = __commonJS({ this[kReadyState] = _WebSocket.CLOSING; } else if (!isClosing(this)) { const frame = new WebsocketFrameSend(); - if (code2 !== void 0 && reason === void 0) { + if (code !== void 0 && reason === void 0) { frame.frameData = Buffer.allocUnsafe(2); - frame.frameData.writeUInt16BE(code2, 0); - } else if (code2 !== void 0 && reason !== void 0) { + frame.frameData.writeUInt16BE(code, 0); + } else if (code !== void 0 && reason !== void 0) { frame.frameData = Buffer.allocUnsafe(2 + reasonByteLength); - frame.frameData.writeUInt16BE(code2, 0); + frame.frameData.writeUInt16BE(code, 0); frame.frameData.write(reason, 2, "utf-8"); } else { frame.frameData = emptyBuffer; @@ -17211,11 +17211,11 @@ var require_undici = __commonJS({ if (typeof opts.path !== "string") { throw new InvalidArgumentError("invalid opts.path"); } - let path9 = opts.path; + let path2 = opts.path; if (!opts.path.startsWith("/")) { - path9 = `/${path9}`; + path2 = `/${path2}`; } - url = new URL(util.parseOrigin(url).origin + path9); + url = new URL(util.parseOrigin(url).origin + path2); } else { if (!opts) { opts = typeof url === "object" ? url : {}; @@ -17296,13 +17296,13 @@ var require_lib = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) { if (k2 === void 0) k2 = k; - var desc2 = Object.getOwnPropertyDescriptor(m2, k); - if (!desc2 || ("get" in desc2 ? !m2.__esModule : desc2.writable || desc2.configurable)) { - desc2 = { enumerable: true, get: function() { + var desc = Object.getOwnPropertyDescriptor(m2, k); + if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m2[k]; } }; } - Object.defineProperty(o, k2, desc2); + Object.defineProperty(o, k2, desc); } : function(o, m2, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m2[k]; @@ -17323,11 +17323,11 @@ var require_lib = __commonJS({ }; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -17343,7 +17343,7 @@ var require_lib = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -17429,26 +17429,26 @@ var require_lib = __commonJS({ } readBody() { return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve2) => __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { let output = Buffer.alloc(0); this.message.on("data", (chunk) => { output = Buffer.concat([output, chunk]); }); this.message.on("end", () => { - resolve2(output.toString()); + resolve(output.toString()); }); })); }); } readBodyBuffer() { return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve2) => __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { const chunks = []; this.message.on("data", (chunk) => { chunks.push(chunk); }); this.message.on("end", () => { - resolve2(Buffer.concat(chunks)); + resolve(Buffer.concat(chunks)); }); })); }); @@ -17657,14 +17657,14 @@ var require_lib = __commonJS({ */ requestRaw(info4, data) { return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { function callbackForResult(err, res) { if (err) { reject(err); } else if (!res) { reject(new Error("Unknown error")); } else { - resolve2(res); + resolve(res); } } this.requestRawWithCallback(info4, data, callbackForResult); @@ -17846,12 +17846,12 @@ var require_lib = __commonJS({ return __awaiter(this, void 0, void 0, function* () { retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); - return new Promise((resolve2) => setTimeout(() => resolve2(), ms)); + return new Promise((resolve) => setTimeout(() => resolve(), ms)); }); } _processResponse(res, options) { return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve2, reject) => __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { const statusCode = res.message.statusCode || 0; const response = { statusCode, @@ -17859,7 +17859,7 @@ var require_lib = __commonJS({ headers: {} }; if (statusCode === HttpCodes.NotFound) { - resolve2(response); + resolve(response); } function dateTimeDeserializer(key, value) { if (typeof value === "string") { @@ -17898,7 +17898,7 @@ var require_lib = __commonJS({ err.result = response.result; reject(err); } else { - resolve2(response); + resolve(response); } })); }); @@ -17915,11 +17915,11 @@ var require_auth = __commonJS({ "use strict"; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -17935,7 +17935,7 @@ var require_auth = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -18019,11 +18019,11 @@ var require_oidc_utils = __commonJS({ "use strict"; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -18039,7 +18039,7 @@ var require_oidc_utils = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -18117,11 +18117,11 @@ var require_summary = __commonJS({ "use strict"; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -18137,7 +18137,7 @@ var require_summary = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -18272,9 +18272,9 @@ var require_summary = __commonJS({ * * @returns {Summary} summary instance */ - addCodeBlock(code2, lang) { + addCodeBlock(code, lang) { const attrs = Object.assign({}, lang && { lang }); - const element = this.wrap("pre", this.wrap("code", code2), attrs); + const element = this.wrap("pre", this.wrap("code", code), attrs); return this.addRaw(element).addEOL(); } /** @@ -18411,13 +18411,13 @@ var require_path_utils = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) { if (k2 === void 0) k2 = k; - var desc2 = Object.getOwnPropertyDescriptor(m2, k); - if (!desc2 || ("get" in desc2 ? !m2.__esModule : desc2.writable || desc2.configurable)) { - desc2 = { enumerable: true, get: function() { + var desc = Object.getOwnPropertyDescriptor(m2, k); + if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m2[k]; } }; } - Object.defineProperty(o, k2, desc2); + Object.defineProperty(o, k2, desc); } : function(o, m2, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m2[k]; @@ -18438,7 +18438,7 @@ var require_path_utils = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = void 0; - var path9 = __importStar(require("path")); + var path2 = __importStar(require("path")); function toPosixPath(pth) { return pth.replace(/[\\]/g, "/"); } @@ -18448,7 +18448,7 @@ var require_path_utils = __commonJS({ } exports2.toWin32Path = toWin32Path; function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path9.sep); + return pth.replace(/[/\\]/g, path2.sep); } exports2.toPlatformPath = toPlatformPath; } @@ -18483,11 +18483,11 @@ var require_io_util = __commonJS({ }; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -18503,7 +18503,7 @@ var require_io_util = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -18511,12 +18511,12 @@ var require_io_util = __commonJS({ var _a; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getCmdPath = exports2.tryGetExecutablePath = exports2.isRooted = exports2.isDirectory = exports2.exists = exports2.READONLY = exports2.UV_FS_O_EXLOCK = exports2.IS_WINDOWS = exports2.unlink = exports2.symlink = exports2.stat = exports2.rmdir = exports2.rm = exports2.rename = exports2.readlink = exports2.readdir = exports2.open = exports2.mkdir = exports2.lstat = exports2.copyFile = exports2.chmod = void 0; - var fs15 = __importStar(require("fs")); - var path9 = __importStar(require("path")); - _a = fs15.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.readlink = _a.readlink, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; + var fs6 = __importStar(require("fs")); + var path2 = __importStar(require("path")); + _a = fs6.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.readlink = _a.readlink, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; exports2.IS_WINDOWS = process.platform === "win32"; exports2.UV_FS_O_EXLOCK = 268435456; - exports2.READONLY = fs15.constants.O_RDONLY; + exports2.READONLY = fs6.constants.O_RDONLY; function exists(fsPath) { return __awaiter(this, void 0, void 0, function* () { try { @@ -18561,7 +18561,7 @@ var require_io_util = __commonJS({ } if (stats && stats.isFile()) { if (exports2.IS_WINDOWS) { - const upperExt = path9.extname(filePath).toUpperCase(); + const upperExt = path2.extname(filePath).toUpperCase(); if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { return filePath; } @@ -18585,11 +18585,11 @@ var require_io_util = __commonJS({ if (stats && stats.isFile()) { if (exports2.IS_WINDOWS) { try { - const directory = path9.dirname(filePath); - const upperName = path9.basename(filePath).toUpperCase(); + const directory = path2.dirname(filePath); + const upperName = path2.basename(filePath).toUpperCase(); for (const actualName of yield exports2.readdir(directory)) { if (upperName === actualName.toUpperCase()) { - filePath = path9.join(directory, actualName); + filePath = path2.join(directory, actualName); break; } } @@ -18656,11 +18656,11 @@ var require_io = __commonJS({ }; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -18676,7 +18676,7 @@ var require_io = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -18684,7 +18684,7 @@ var require_io = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.findInPath = exports2.which = exports2.mkdirP = exports2.rmRF = exports2.mv = exports2.cp = void 0; var assert_1 = require("assert"); - var path9 = __importStar(require("path")); + var path2 = __importStar(require("path")); var ioUtil = __importStar(require_io_util()); function cp(source, dest, options = {}) { return __awaiter(this, void 0, void 0, function* () { @@ -18693,7 +18693,7 @@ var require_io = __commonJS({ if (destStat && destStat.isFile() && !force) { return; } - const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path9.join(dest, path9.basename(source)) : dest; + const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path2.join(dest, path2.basename(source)) : dest; if (!(yield ioUtil.exists(source))) { throw new Error(`no such file or directory: ${source}`); } @@ -18705,7 +18705,7 @@ var require_io = __commonJS({ yield cpDirRecursive(source, newDest, 0, force); } } else { - if (path9.relative(source, newDest) === "") { + if (path2.relative(source, newDest) === "") { throw new Error(`'${newDest}' and '${source}' are the same file`); } yield copyFile(source, newDest, force); @@ -18718,7 +18718,7 @@ var require_io = __commonJS({ if (yield ioUtil.exists(dest)) { let destExists = true; if (yield ioUtil.isDirectory(dest)) { - dest = path9.join(dest, path9.basename(source)); + dest = path2.join(dest, path2.basename(source)); destExists = yield ioUtil.exists(dest); } if (destExists) { @@ -18729,7 +18729,7 @@ var require_io = __commonJS({ } } } - yield mkdirP(path9.dirname(dest)); + yield mkdirP(path2.dirname(dest)); yield ioUtil.rename(source, dest); }); } @@ -18792,7 +18792,7 @@ var require_io = __commonJS({ } const extensions = []; if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { - for (const extension of process.env["PATHEXT"].split(path9.delimiter)) { + for (const extension of process.env["PATHEXT"].split(path2.delimiter)) { if (extension) { extensions.push(extension); } @@ -18805,12 +18805,12 @@ var require_io = __commonJS({ } return []; } - if (tool.includes(path9.sep)) { + if (tool.includes(path2.sep)) { return []; } const directories = []; if (process.env.PATH) { - for (const p of process.env.PATH.split(path9.delimiter)) { + for (const p of process.env.PATH.split(path2.delimiter)) { if (p) { directories.push(p); } @@ -18818,7 +18818,7 @@ var require_io = __commonJS({ } const matches = []; for (const directory of directories) { - const filePath = yield ioUtil.tryGetExecutablePath(path9.join(directory, tool), extensions); + const filePath = yield ioUtil.tryGetExecutablePath(path2.join(directory, tool), extensions); if (filePath) { matches.push(filePath); } @@ -18904,11 +18904,11 @@ var require_toolrunner = __commonJS({ }; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -18924,17 +18924,17 @@ var require_toolrunner = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.argStringToArray = exports2.ToolRunner = void 0; - var os = __importStar(require("os")); + var os2 = __importStar(require("os")); var events = __importStar(require("events")); var child = __importStar(require("child_process")); - var path9 = __importStar(require("path")); + var path2 = __importStar(require("path")); var io = __importStar(require_io()); var ioUtil = __importStar(require_io_util()); var timers_1 = require("timers"); @@ -18986,12 +18986,12 @@ var require_toolrunner = __commonJS({ _processLineBuffer(data, strBuffer, onLine) { try { let s2 = strBuffer + data.toString(); - let n = s2.indexOf(os.EOL); + let n = s2.indexOf(os2.EOL); while (n > -1) { const line = s2.substring(0, n); onLine(line); - s2 = s2.substring(n + os.EOL.length); - n = s2.indexOf(os.EOL); + s2 = s2.substring(n + os2.EOL.length); + n = s2.indexOf(os2.EOL); } return s2; } catch (err) { @@ -19149,10 +19149,10 @@ var require_toolrunner = __commonJS({ exec() { return __awaiter(this, void 0, void 0, function* () { if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { - this.toolPath = path9.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); + this.toolPath = path2.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); } this.toolPath = yield io.which(this.toolPath, true); - return new Promise((resolve2, reject) => __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { this._debug(`exec tool: ${this.toolPath}`); this._debug("arguments:"); for (const arg of this.args) { @@ -19160,7 +19160,7 @@ var require_toolrunner = __commonJS({ } const optionsNonNull = this._cloneExecOptions(this.options); if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); + optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os2.EOL); } const state = new ExecState(optionsNonNull, this.toolPath); state.on("debug", (message) => { @@ -19211,14 +19211,14 @@ var require_toolrunner = __commonJS({ state.processClosed = true; state.CheckComplete(); }); - cp.on("exit", (code2) => { - state.processExitCode = code2; + cp.on("exit", (code) => { + state.processExitCode = code; state.processExited = true; - this._debug(`Exit code ${code2} received from tool '${this.toolPath}'`); + this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); state.CheckComplete(); }); - cp.on("close", (code2) => { - state.processExitCode = code2; + cp.on("close", (code) => { + state.processExitCode = code; state.processExited = true; state.processClosed = true; this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); @@ -19235,7 +19235,7 @@ var require_toolrunner = __commonJS({ if (error) { reject(error); } else { - resolve2(exitCode); + resolve(exitCode); } }); if (this.options.input) { @@ -19388,11 +19388,11 @@ var require_exec = __commonJS({ }; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -19408,7 +19408,7 @@ var require_exec = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -19417,7 +19417,7 @@ var require_exec = __commonJS({ exports2.getExecOutput = exports2.exec = void 0; var string_decoder_1 = require("string_decoder"); var tr = __importStar(require_toolrunner()); - function exec(commandLine, args, options) { + function exec2(commandLine, args, options) { return __awaiter(this, void 0, void 0, function* () { const commandArgs = tr.argStringToArray(commandLine); if (commandArgs.length === 0) { @@ -19429,7 +19429,7 @@ var require_exec = __commonJS({ return runner.exec(); }); } - exports2.exec = exec; + exports2.exec = exec2; function getExecOutput(commandLine, args, options) { var _a, _b; return __awaiter(this, void 0, void 0, function* () { @@ -19452,7 +19452,7 @@ var require_exec = __commonJS({ } }; const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); - const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); + const exitCode = yield exec2(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); stdout += stdoutDecoder.end(); stderr += stderrDecoder.end(); return { @@ -19472,13 +19472,13 @@ var require_platform = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) { if (k2 === void 0) k2 = k; - var desc2 = Object.getOwnPropertyDescriptor(m2, k); - if (!desc2 || ("get" in desc2 ? !m2.__esModule : desc2.writable || desc2.configurable)) { - desc2 = { enumerable: true, get: function() { + var desc = Object.getOwnPropertyDescriptor(m2, k); + if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m2[k]; } }; } - Object.defineProperty(o, k2, desc2); + Object.defineProperty(o, k2, desc); } : function(o, m2, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m2[k]; @@ -19499,11 +19499,11 @@ var require_platform = __commonJS({ }; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -19519,7 +19519,7 @@ var require_platform = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -19530,39 +19530,39 @@ var require_platform = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getDetails = exports2.isLinux = exports2.isMacOS = exports2.isWindows = exports2.arch = exports2.platform = void 0; var os_1 = __importDefault(require("os")); - var exec = __importStar(require_exec()); + var exec2 = __importStar(require_exec()); var getWindowsInfo = () => __awaiter(void 0, void 0, void 0, function* () { - const { stdout: version2 } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', void 0, { + const { stdout: version } = yield exec2.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', void 0, { silent: true }); - const { stdout: name2 } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', void 0, { + const { stdout: name } = yield exec2.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', void 0, { silent: true }); return { - name: name2.trim(), - version: version2.trim() + name: name.trim(), + version: version.trim() }; }); var getMacOsInfo = () => __awaiter(void 0, void 0, void 0, function* () { var _a, _b, _c, _d; - const { stdout } = yield exec.getExecOutput("sw_vers", void 0, { + const { stdout } = yield exec2.getExecOutput("sw_vers", void 0, { silent: true }); - const version2 = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : ""; - const name2 = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : ""; + const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : ""; + const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : ""; return { - name: name2, - version: version2 + name, + version }; }); var getLinuxInfo = () => __awaiter(void 0, void 0, void 0, function* () { - const { stdout } = yield exec.getExecOutput("lsb_release", ["-i", "-r", "-s"], { + const { stdout } = yield exec2.getExecOutput("lsb_release", ["-i", "-r", "-s"], { silent: true }); - const [name2, version2] = stdout.trim().split("\n"); + const [name, version] = stdout.trim().split("\n"); return { - name: name2, - version: version2 + name, + version }; }); exports2.platform = os_1.default.platform(); @@ -19591,13 +19591,13 @@ var require_core = __commonJS({ "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) { if (k2 === void 0) k2 = k; - var desc2 = Object.getOwnPropertyDescriptor(m2, k); - if (!desc2 || ("get" in desc2 ? !m2.__esModule : desc2.writable || desc2.configurable)) { - desc2 = { enumerable: true, get: function() { + var desc = Object.getOwnPropertyDescriptor(m2, k); + if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m2[k]; } }; } - Object.defineProperty(o, k2, desc2); + Object.defineProperty(o, k2, desc); } : function(o, m2, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m2[k]; @@ -19618,11 +19618,11 @@ var require_core = __commonJS({ }; var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve2) { - resolve2(value); + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); } - return new (P || (P = Promise))(function(resolve2, reject) { + return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); @@ -19638,7 +19638,7 @@ var require_core = __commonJS({ } } function step(result) { - result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -19648,22 +19648,22 @@ var require_core = __commonJS({ var command_1 = require_command(); var file_command_1 = require_file_command(); var utils_1 = require_utils(); - var os = __importStar(require("os")); - var path9 = __importStar(require("path")); + var os2 = __importStar(require("os")); + var path2 = __importStar(require("path")); var oidc_utils_1 = require_oidc_utils(); var ExitCode; (function(ExitCode2) { ExitCode2[ExitCode2["Success"] = 0] = "Success"; ExitCode2[ExitCode2["Failure"] = 1] = "Failure"; })(ExitCode || (exports2.ExitCode = ExitCode = {})); - function exportVariable(name2, val) { + function exportVariable(name, val) { const convertedVal = (0, utils_1.toCommandValue)(val); - process.env[name2] = convertedVal; + process.env[name] = convertedVal; const filePath = process.env["GITHUB_ENV"] || ""; if (filePath) { - return (0, file_command_1.issueFileCommand)("ENV", (0, file_command_1.prepareKeyValueMessage)(name2, val)); + return (0, file_command_1.issueFileCommand)("ENV", (0, file_command_1.prepareKeyValueMessage)(name, val)); } - (0, command_1.issueCommand)("set-env", { name: name2 }, convertedVal); + (0, command_1.issueCommand)("set-env", { name }, convertedVal); } exports2.exportVariable = exportVariable; function setSecret(secret) { @@ -19677,13 +19677,13 @@ var require_core = __commonJS({ } else { (0, command_1.issueCommand)("add-path", {}, inputPath); } - process.env["PATH"] = `${inputPath}${path9.delimiter}${process.env["PATH"]}`; + process.env["PATH"] = `${inputPath}${path2.delimiter}${process.env["PATH"]}`; } exports2.addPath = addPath; - function getInput2(name2, options) { - const val = process.env[`INPUT_${name2.replace(/ /g, "_").toUpperCase()}`] || ""; + function getInput2(name, options) { + const val = process.env[`INPUT_${name.replace(/ /g, "_").toUpperCase()}`] || ""; if (options && options.required && !val) { - throw new Error(`Input required and not supplied: ${name2}`); + throw new Error(`Input required and not supplied: ${name}`); } if (options && options.trimWhitespace === false) { return val; @@ -19691,33 +19691,33 @@ var require_core = __commonJS({ return val.trim(); } exports2.getInput = getInput2; - function getMultilineInput2(name2, options) { - const inputs = getInput2(name2, options).split("\n").filter((x2) => x2 !== ""); + function getMultilineInput2(name, options) { + const inputs = getInput2(name, options).split("\n").filter((x2) => x2 !== ""); if (options && options.trimWhitespace === false) { return inputs; } return inputs.map((input) => input.trim()); } exports2.getMultilineInput = getMultilineInput2; - function getBooleanInput(name2, options) { + function getBooleanInput(name, options) { const trueValue = ["true", "True", "TRUE"]; const falseValue = ["false", "False", "FALSE"]; - const val = getInput2(name2, options); + const val = getInput2(name, options); if (trueValue.includes(val)) return true; if (falseValue.includes(val)) return false; - throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name2} + throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.getBooleanInput = getBooleanInput; - function setOutput2(name2, value) { + function setOutput2(name, value) { const filePath = process.env["GITHUB_OUTPUT"] || ""; if (filePath) { - return (0, file_command_1.issueFileCommand)("OUTPUT", (0, file_command_1.prepareKeyValueMessage)(name2, value)); + return (0, file_command_1.issueFileCommand)("OUTPUT", (0, file_command_1.prepareKeyValueMessage)(name, value)); } - process.stdout.write(os.EOL); - (0, command_1.issueCommand)("set-output", { name: name2 }, (0, utils_1.toCommandValue)(value)); + process.stdout.write(os2.EOL); + (0, command_1.issueCommand)("set-output", { name }, (0, utils_1.toCommandValue)(value)); } exports2.setOutput = setOutput2; function setCommandEcho(enabled) { @@ -19750,20 +19750,20 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.notice = notice; function info4(message) { - process.stdout.write(message + os.EOL); + process.stdout.write(message + os2.EOL); } exports2.info = info4; - function startGroup(name2) { - (0, command_1.issue)("group", name2); + function startGroup(name) { + (0, command_1.issue)("group", name); } exports2.startGroup = startGroup; function endGroup() { (0, command_1.issue)("endgroup"); } exports2.endGroup = endGroup; - function group(name2, fn) { + function group(name, fn) { return __awaiter(this, void 0, void 0, function* () { - startGroup(name2); + startGroup(name); let result; try { result = yield fn(); @@ -19774,16 +19774,16 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); }); } exports2.group = group; - function saveState2(name2, value) { + function saveState2(name, value) { const filePath = process.env["GITHUB_STATE"] || ""; if (filePath) { - return (0, file_command_1.issueFileCommand)("STATE", (0, file_command_1.prepareKeyValueMessage)(name2, value)); + return (0, file_command_1.issueFileCommand)("STATE", (0, file_command_1.prepareKeyValueMessage)(name, value)); } - (0, command_1.issueCommand)("save-state", { name: name2 }, (0, utils_1.toCommandValue)(value)); + (0, command_1.issueCommand)("save-state", { name }, (0, utils_1.toCommandValue)(value)); } exports2.saveState = saveState2; - function getState2(name2) { - return process.env[`STATE_${name2}`] || ""; + function getState2(name) { + return process.env[`STATE_${name}`] || ""; } exports2.getState = getState2; function getIDToken(aud) { @@ -19821,17 +19821,17 @@ var require_ponyfill_es2018 = __commonJS({ 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.WebStreamsPolyfill = {})); })(exports2, function(exports3) { "use strict"; - function noop4() { + function noop2() { return void 0; } function typeIsObject(x2) { return typeof x2 === "object" && x2 !== null || typeof x2 === "function"; } - const rethrowAssertionErrorRejection = noop4; - function setFunctionName(fn, name2) { + const rethrowAssertionErrorRejection = noop2; + function setFunctionName(fn, name) { try { Object.defineProperty(fn, "name", { - value: name2, + value: name, configurable: true }); } catch (_a2) { @@ -19844,7 +19844,7 @@ var require_ponyfill_es2018 = __commonJS({ return new originalPromise(executor); } function promiseResolvedWith(value) { - return newPromise((resolve2) => resolve2(value)); + return newPromise((resolve) => resolve(value)); } function promiseRejectedWith(reason) { return originalPromiseReject(reason); @@ -20010,12 +20010,12 @@ var require_ponyfill_es2018 = __commonJS({ stream._reader = void 0; reader._ownerReadableStream = void 0; } - function readerLockException(name2) { - return new TypeError("Cannot " + name2 + " a stream using a released reader"); + function readerLockException(name) { + return new TypeError("Cannot " + name + " a stream using a released reader"); } function defaultReaderClosedPromiseInitialize(reader) { - reader._closedPromise = newPromise((resolve2, reject) => { - reader._closedPromise_resolve = resolve2; + reader._closedPromise = newPromise((resolve, reject) => { + reader._closedPromise_resolve = resolve; reader._closedPromise_reject = reject; }); } @@ -20189,8 +20189,8 @@ var require_ponyfill_es2018 = __commonJS({ } let resolvePromise; let rejectPromise; - const promise = newPromise((resolve2, reject) => { - resolvePromise = resolve2; + const promise = newPromise((resolve, reject) => { + resolvePromise = resolve; rejectPromise = reject; }); const readRequest = { @@ -20267,8 +20267,8 @@ var require_ponyfill_es2018 = __commonJS({ readRequest._errorSteps(e2); }); } - function defaultReaderBrandCheckException(name2) { - return new TypeError(`ReadableStreamDefaultReader.prototype.${name2} can only be used on a ReadableStreamDefaultReader`); + function defaultReaderBrandCheckException(name) { + return new TypeError(`ReadableStreamDefaultReader.prototype.${name} can only be used on a ReadableStreamDefaultReader`); } const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () { }).prototype); @@ -20295,8 +20295,8 @@ var require_ponyfill_es2018 = __commonJS({ const reader = this._reader; let resolvePromise; let rejectPromise; - const promise = newPromise((resolve2, reject) => { - resolvePromise = resolve2; + const promise = newPromise((resolve, reject) => { + resolvePromise = resolve; rejectPromise = reject; }); const readRequest = { @@ -20370,8 +20370,8 @@ var require_ponyfill_es2018 = __commonJS({ return false; } } - function streamAsyncIteratorBrandCheckException(name2) { - return new TypeError(`ReadableStreamAsyncIterator.${name2} can only be used on a ReadableSteamAsyncIterator`); + function streamAsyncIteratorBrandCheckException(name) { + return new TypeError(`ReadableStreamAsyncIterator.${name} can only be used on a ReadableSteamAsyncIterator`); } const NumberIsNaN = Number.isNaN || function(x2) { return x2 !== x2; @@ -21186,11 +21186,11 @@ var require_ponyfill_es2018 = __commonJS({ request._associatedReadableByteStreamController = controller; request._view = view; } - function byobRequestBrandCheckException(name2) { - return new TypeError(`ReadableStreamBYOBRequest.prototype.${name2} can only be used on a ReadableStreamBYOBRequest`); + function byobRequestBrandCheckException(name) { + return new TypeError(`ReadableStreamBYOBRequest.prototype.${name} can only be used on a ReadableStreamBYOBRequest`); } - function byteStreamControllerBrandCheckException(name2) { - return new TypeError(`ReadableByteStreamController.prototype.${name2} can only be used on a ReadableByteStreamController`); + function byteStreamControllerBrandCheckException(name) { + return new TypeError(`ReadableByteStreamController.prototype.${name} can only be used on a ReadableByteStreamController`); } function convertReaderOptions(options, context) { assertDictionary(options, context); @@ -21315,8 +21315,8 @@ var require_ponyfill_es2018 = __commonJS({ } let resolvePromise; let rejectPromise; - const promise = newPromise((resolve2, reject) => { - resolvePromise = resolve2; + const promise = newPromise((resolve, reject) => { + resolvePromise = resolve; rejectPromise = reject; }); const readIntoRequest = { @@ -21391,8 +21391,8 @@ var require_ponyfill_es2018 = __commonJS({ readIntoRequest._errorSteps(e2); }); } - function byobReaderBrandCheckException(name2) { - return new TypeError(`ReadableStreamBYOBReader.prototype.${name2} can only be used on a ReadableStreamBYOBReader`); + function byobReaderBrandCheckException(name) { + return new TypeError(`ReadableStreamBYOBReader.prototype.${name} can only be used on a ReadableStreamBYOBReader`); } function ExtractHighWaterMark(strategy, defaultHWM) { const { highWaterMark } = strategy; @@ -21628,10 +21628,10 @@ var require_ponyfill_es2018 = __commonJS({ wasAlreadyErroring = true; reason = void 0; } - const promise = newPromise((resolve2, reject) => { + const promise = newPromise((resolve, reject) => { stream._pendingAbortRequest = { _promise: void 0, - _resolve: resolve2, + _resolve: resolve, _reject: reject, _reason: reason, _wasAlreadyErroring: wasAlreadyErroring @@ -21648,9 +21648,9 @@ var require_ponyfill_es2018 = __commonJS({ if (state === "closed" || state === "errored") { return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`)); } - const promise = newPromise((resolve2, reject) => { + const promise = newPromise((resolve, reject) => { const closeRequest = { - _resolve: resolve2, + _resolve: resolve, _reject: reject }; stream._closeRequest = closeRequest; @@ -21663,9 +21663,9 @@ var require_ponyfill_es2018 = __commonJS({ return promise; } function WritableStreamAddWriteRequest(stream) { - const promise = newPromise((resolve2, reject) => { + const promise = newPromise((resolve, reject) => { const writeRequest = { - _resolve: resolve2, + _resolve: resolve, _reject: reject }; stream._writeRequests.push(writeRequest); @@ -22268,21 +22268,21 @@ var require_ponyfill_es2018 = __commonJS({ WritableStreamDefaultControllerClearAlgorithms(controller); WritableStreamStartErroring(stream, error); } - function streamBrandCheckException$2(name2) { - return new TypeError(`WritableStream.prototype.${name2} can only be used on a WritableStream`); + function streamBrandCheckException$2(name) { + return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`); } - function defaultControllerBrandCheckException$2(name2) { - return new TypeError(`WritableStreamDefaultController.prototype.${name2} can only be used on a WritableStreamDefaultController`); + function defaultControllerBrandCheckException$2(name) { + return new TypeError(`WritableStreamDefaultController.prototype.${name} can only be used on a WritableStreamDefaultController`); } - function defaultWriterBrandCheckException(name2) { - return new TypeError(`WritableStreamDefaultWriter.prototype.${name2} can only be used on a WritableStreamDefaultWriter`); + function defaultWriterBrandCheckException(name) { + return new TypeError(`WritableStreamDefaultWriter.prototype.${name} can only be used on a WritableStreamDefaultWriter`); } - function defaultWriterLockException(name2) { - return new TypeError("Cannot " + name2 + " a stream using a released writer"); + function defaultWriterLockException(name) { + return new TypeError("Cannot " + name + " a stream using a released writer"); } function defaultWriterClosedPromiseInitialize(writer) { - writer._closedPromise = newPromise((resolve2, reject) => { - writer._closedPromise_resolve = resolve2; + writer._closedPromise = newPromise((resolve, reject) => { + writer._closedPromise_resolve = resolve; writer._closedPromise_reject = reject; writer._closedPromiseState = "pending"; }); @@ -22318,8 +22318,8 @@ var require_ponyfill_es2018 = __commonJS({ writer._closedPromiseState = "resolved"; } function defaultWriterReadyPromiseInitialize(writer) { - writer._readyPromise = newPromise((resolve2, reject) => { - writer._readyPromise_resolve = resolve2; + writer._readyPromise = newPromise((resolve, reject) => { + writer._readyPromise_resolve = resolve; writer._readyPromise_reject = reject; }); writer._readyPromiseState = "pending"; @@ -22387,9 +22387,9 @@ var require_ponyfill_es2018 = __commonJS({ return isDOMExceptionConstructor(ctor) ? ctor : void 0; } function createPolyfill() { - const ctor = function DOMException4(message, name2) { + const ctor = function DOMException4(message, name) { this.message = message || ""; - this.name = name2 || "Error"; + this.name = name || "Error"; if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); } @@ -22406,7 +22406,7 @@ var require_ponyfill_es2018 = __commonJS({ source._disturbed = true; let shuttingDown = false; let currentWrite = promiseResolvedWith(void 0); - return newPromise((resolve2, reject) => { + return newPromise((resolve, reject) => { let abortAlgorithm; if (signal !== void 0) { abortAlgorithm = () => { @@ -22456,7 +22456,7 @@ var require_ponyfill_es2018 = __commonJS({ return newPromise((resolveRead, rejectRead) => { ReadableStreamDefaultReaderRead(reader, { _chunkSteps: (chunk) => { - currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, chunk), void 0, noop4); + currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, chunk), void 0, noop2); resolveRead(false); }, _closeSteps: () => resolveRead(true), @@ -22551,7 +22551,7 @@ var require_ponyfill_es2018 = __commonJS({ if (isError) { reject(error); } else { - resolve2(void 0); + resolve(void 0); } return null; } @@ -22812,8 +22812,8 @@ var require_ponyfill_es2018 = __commonJS({ } SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm); } - function defaultControllerBrandCheckException$1(name2) { - return new TypeError(`ReadableStreamDefaultController.prototype.${name2} can only be used on a ReadableStreamDefaultController`); + function defaultControllerBrandCheckException$1(name) { + return new TypeError(`ReadableStreamDefaultController.prototype.${name} can only be used on a ReadableStreamDefaultController`); } function ReadableStreamTee(stream, cloneForBranch2) { if (IsReadableByteStreamController(stream._readableStreamController)) { @@ -22832,8 +22832,8 @@ var require_ponyfill_es2018 = __commonJS({ let branch1; let branch2; let resolveCancelPromise; - const cancelPromise = newPromise((resolve2) => { - resolveCancelPromise = resolve2; + const cancelPromise = newPromise((resolve) => { + resolveCancelPromise = resolve; }); function pullAlgorithm() { if (reading) { @@ -22924,8 +22924,8 @@ var require_ponyfill_es2018 = __commonJS({ let branch1; let branch2; let resolveCancelPromise; - const cancelPromise = newPromise((resolve2) => { - resolveCancelPromise = resolve2; + const cancelPromise = newPromise((resolve) => { + resolveCancelPromise = resolve; }); function forwardReaderError(thisReader) { uponRejection(thisReader._closedPromise, (r2) => { @@ -23137,7 +23137,7 @@ var require_ponyfill_es2018 = __commonJS({ function ReadableStreamFromIterable(asyncIterable) { let stream; const iteratorRecord = GetIterator(asyncIterable, "async"); - const startAlgorithm = noop4; + const startAlgorithm = noop2; function pullAlgorithm() { let nextResult; try { @@ -23189,7 +23189,7 @@ var require_ponyfill_es2018 = __commonJS({ } function ReadableStreamFromDefaultReader(reader) { let stream; - const startAlgorithm = noop4; + const startAlgorithm = noop2; function pullAlgorithm() { let readPromise; try { @@ -23508,7 +23508,7 @@ var require_ponyfill_es2018 = __commonJS({ }); } const sourceCancelPromise = stream._readableStreamController[CancelSteps](reason); - return transformPromiseWith(sourceCancelPromise, noop4); + return transformPromiseWith(sourceCancelPromise, noop2); } function ReadableStreamClose(stream) { stream._state = "closed"; @@ -23539,8 +23539,8 @@ var require_ponyfill_es2018 = __commonJS({ ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e2); } } - function streamBrandCheckException$1(name2) { - return new TypeError(`ReadableStream.prototype.${name2} can only be used on a ReadableStream`); + function streamBrandCheckException$1(name) { + return new TypeError(`ReadableStream.prototype.${name} can only be used on a ReadableStream`); } function convertQueuingStrategyInit(init, context) { assertDictionary(init, context); @@ -23589,8 +23589,8 @@ var require_ponyfill_es2018 = __commonJS({ configurable: true }); } - function byteLengthBrandCheckException(name2) { - return new TypeError(`ByteLengthQueuingStrategy.prototype.${name2} can only be used on a ByteLengthQueuingStrategy`); + function byteLengthBrandCheckException(name) { + return new TypeError(`ByteLengthQueuingStrategy.prototype.${name} can only be used on a ByteLengthQueuingStrategy`); } function IsByteLengthQueuingStrategy(x2) { if (!typeIsObject(x2)) { @@ -23641,8 +23641,8 @@ var require_ponyfill_es2018 = __commonJS({ configurable: true }); } - function countBrandCheckException(name2) { - return new TypeError(`CountQueuingStrategy.prototype.${name2} can only be used on a CountQueuingStrategy`); + function countBrandCheckException(name) { + return new TypeError(`CountQueuingStrategy.prototype.${name} can only be used on a CountQueuingStrategy`); } function IsCountQueuingStrategy(x2) { if (!typeIsObject(x2)) { @@ -23705,8 +23705,8 @@ var require_ponyfill_es2018 = __commonJS({ const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1); const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy); let startPromise_resolve; - const startPromise = newPromise((resolve2) => { - startPromise_resolve = resolve2; + const startPromise = newPromise((resolve) => { + startPromise_resolve = resolve; }); InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm); SetUpTransformStreamDefaultControllerFromTransformer(this, transformer); @@ -23799,8 +23799,8 @@ var require_ponyfill_es2018 = __commonJS({ if (stream._backpressureChangePromise !== void 0) { stream._backpressureChangePromise_resolve(); } - stream._backpressureChangePromise = newPromise((resolve2) => { - stream._backpressureChangePromise_resolve = resolve2; + stream._backpressureChangePromise = newPromise((resolve) => { + stream._backpressureChangePromise_resolve = resolve; }); stream._backpressure = backpressure; } @@ -23968,8 +23968,8 @@ var require_ponyfill_es2018 = __commonJS({ return controller._finishPromise; } const readable = stream._readable; - controller._finishPromise = newPromise((resolve2, reject) => { - controller._finishPromise_resolve = resolve2; + controller._finishPromise = newPromise((resolve, reject) => { + controller._finishPromise_resolve = resolve; controller._finishPromise_reject = reject; }); const cancelPromise = controller._cancelAlgorithm(reason); @@ -23995,8 +23995,8 @@ var require_ponyfill_es2018 = __commonJS({ return controller._finishPromise; } const readable = stream._readable; - controller._finishPromise = newPromise((resolve2, reject) => { - controller._finishPromise_resolve = resolve2; + controller._finishPromise = newPromise((resolve, reject) => { + controller._finishPromise_resolve = resolve; controller._finishPromise_reject = reject; }); const flushPromise = controller._flushAlgorithm(); @@ -24026,8 +24026,8 @@ var require_ponyfill_es2018 = __commonJS({ return controller._finishPromise; } const writable = stream._writable; - controller._finishPromise = newPromise((resolve2, reject) => { - controller._finishPromise_resolve = resolve2; + controller._finishPromise = newPromise((resolve, reject) => { + controller._finishPromise_resolve = resolve; controller._finishPromise_reject = reject; }); const cancelPromise = controller._cancelAlgorithm(reason); @@ -24049,8 +24049,8 @@ var require_ponyfill_es2018 = __commonJS({ }); return controller._finishPromise; } - function defaultControllerBrandCheckException(name2) { - return new TypeError(`TransformStreamDefaultController.prototype.${name2} can only be used on a TransformStreamDefaultController`); + function defaultControllerBrandCheckException(name) { + return new TypeError(`TransformStreamDefaultController.prototype.${name} can only be used on a TransformStreamDefaultController`); } function defaultControllerFinishPromiseResolve(controller) { if (controller._finishPromise_resolve === void 0) { @@ -24069,8 +24069,8 @@ var require_ponyfill_es2018 = __commonJS({ controller._finishPromise_resolve = void 0; controller._finishPromise_reject = void 0; } - function streamBrandCheckException(name2) { - return new TypeError(`TransformStream.prototype.${name2} can only be used on a TransformStream`); + function streamBrandCheckException(name) { + return new TypeError(`TransformStream.prototype.${name} can only be used on a TransformStream`); } exports3.ByteLengthQueuingStrategy = ByteLengthQueuingStrategy; exports3.CountQueuingStrategy = CountQueuingStrategy; @@ -24113,7 +24113,7 @@ var require_streams = __commonJS({ try { const { Blob: Blob4 } = require("buffer"); if (Blob4 && !Blob4.prototype.stream) { - Blob4.prototype.stream = function name2(params) { + Blob4.prototype.stream = function name(params) { let position = 0; const blob = this; return new ReadableStream({ @@ -24496,14 +24496,14 @@ var require_node_domexception = __commonJS({ }); // node_modules/fetch-blob/from.js -var import_node_fs6, import_node_domexception, stat2; +var import_node_fs, import_node_domexception, stat; var init_from = __esm({ "node_modules/fetch-blob/from.js"() { - import_node_fs6 = require("node:fs"); + import_node_fs = require("node:fs"); import_node_domexception = __toESM(require_node_domexception(), 1); init_file(); init_fetch_blob(); - ({ stat: stat2 } = import_node_fs6.promises); + ({ stat } = import_node_fs.promises); } }); @@ -24520,8 +24520,8 @@ function _fileName(headerValue) { const match = m2[2] || m2[3] || ""; let filename = match.slice(match.lastIndexOf("\\") + 1); filename = filename.replace(/%22/g, '"'); - filename = filename.replace(/&#(\d{4});/g, (m3, code2) => { - return String.fromCharCode(code2); + filename = filename.replace(/&#(\d{4});/g, (m3, code) => { + return String.fromCharCode(code); }); return filename; } @@ -24599,7 +24599,7 @@ async function toFormData(Body2, ct) { parser.end(); return formData; } -var s, S, f2, F, LF, CR, SPACE, HYPHEN, COLON, A, Z, lower, noop3, MultipartParser; +var s, S, f2, F, LF, CR, SPACE, HYPHEN, COLON, A, Z, lower, noop, MultipartParser; var init_multipart_parser = __esm({ "node_modules/node-fetch/src/utils/multipart-parser.js"() { init_from(); @@ -24630,7 +24630,7 @@ var init_multipart_parser = __esm({ A = 97; Z = 122; lower = (c) => c | 32; - noop3 = () => { + noop = () => { }; MultipartParser = class { /** @@ -24639,13 +24639,13 @@ var init_multipart_parser = __esm({ constructor(boundary) { this.index = 0; this.flags = 0; - this.onHeaderEnd = noop3; - this.onHeaderField = noop3; - this.onHeadersEnd = noop3; - this.onHeaderValue = noop3; - this.onPartBegin = noop3; - this.onPartData = noop3; - this.onPartEnd = noop3; + this.onHeaderEnd = noop; + this.onHeaderField = noop; + this.onHeadersEnd = noop; + this.onHeaderValue = noop; + this.onPartBegin = noop; + this.onPartData = noop; + this.onPartEnd = noop; this.boundaryChars = {}; boundary = "\r\n--" + boundary; const ui8a = new Uint8Array(boundary.length); @@ -24670,27 +24670,27 @@ var init_multipart_parser = __esm({ const bufferLength = data.length; let c; let cl; - const mark = (name2) => { - this[name2 + "Mark"] = i2; + const mark = (name) => { + this[name + "Mark"] = i2; }; - const clear = (name2) => { - delete this[name2 + "Mark"]; + const clear = (name) => { + delete this[name + "Mark"]; }; const callback = (callbackSymbol, start, end, ui8a) => { if (start === void 0 || start !== end) { this[callbackSymbol](ui8a && ui8a.subarray(start, end)); } }; - const dataCallback = (name2, clear2) => { - const markSymbol = name2 + "Mark"; + const dataCallback = (name, clear2) => { + const markSymbol = name + "Mark"; if (!(markSymbol in this)) { return; } if (clear2) { - callback(name2, this[markSymbol], i2, data); + callback(name, this[markSymbol], i2, data); delete this[markSymbol]; } else { - callback(name2, this[markSymbol], data.length, data); + callback(name, this[markSymbol], data.length, data); this[markSymbol] = 0; } }; @@ -24874,7759 +24874,7 @@ var core3 = __toESM(require_core()); // src/save.ts var core = __toESM(require_core()); -var fs13 = __toESM(require("fs")); -var path8 = __toESM(require("path")); - -// node_modules/@isaacs/fs-minipass/dist/esm/index.js -var import_events = __toESM(require("events"), 1); -var import_fs = __toESM(require("fs"), 1); - -// node_modules/@isaacs/fs-minipass/node_modules/minipass/dist/esm/index.js -var import_node_events = require("node:events"); -var import_node_stream = __toESM(require("node:stream"), 1); -var import_node_string_decoder = require("node:string_decoder"); -var proc = typeof process === "object" && process ? process : { - stdout: null, - stderr: null -}; -var isStream = (s2) => !!s2 && typeof s2 === "object" && (s2 instanceof Minipass || s2 instanceof import_node_stream.default || isReadable(s2) || isWritable(s2)); -var isReadable = (s2) => !!s2 && typeof s2 === "object" && s2 instanceof import_node_events.EventEmitter && typeof s2.pipe === "function" && // node core Writable streams have a pipe() method, but it throws -s2.pipe !== import_node_stream.default.Writable.prototype.pipe; -var isWritable = (s2) => !!s2 && typeof s2 === "object" && s2 instanceof import_node_events.EventEmitter && typeof s2.write === "function" && typeof s2.end === "function"; -var EOF = Symbol("EOF"); -var MAYBE_EMIT_END = Symbol("maybeEmitEnd"); -var EMITTED_END = Symbol("emittedEnd"); -var EMITTING_END = Symbol("emittingEnd"); -var EMITTED_ERROR = Symbol("emittedError"); -var CLOSED = Symbol("closed"); -var READ = Symbol("read"); -var FLUSH = Symbol("flush"); -var FLUSHCHUNK = Symbol("flushChunk"); -var ENCODING = Symbol("encoding"); -var DECODER = Symbol("decoder"); -var FLOWING = Symbol("flowing"); -var PAUSED = Symbol("paused"); -var RESUME = Symbol("resume"); -var BUFFER = Symbol("buffer"); -var PIPES = Symbol("pipes"); -var BUFFERLENGTH = Symbol("bufferLength"); -var BUFFERPUSH = Symbol("bufferPush"); -var BUFFERSHIFT = Symbol("bufferShift"); -var OBJECTMODE = Symbol("objectMode"); -var DESTROYED = Symbol("destroyed"); -var ERROR = Symbol("error"); -var EMITDATA = Symbol("emitData"); -var EMITEND = Symbol("emitEnd"); -var EMITEND2 = Symbol("emitEnd2"); -var ASYNC = Symbol("async"); -var ABORT = Symbol("abort"); -var ABORTED = Symbol("aborted"); -var SIGNAL = Symbol("signal"); -var DATALISTENERS = Symbol("dataListeners"); -var DISCARDED = 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) => 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 import_node_events.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 import_node_string_decoder.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(_) { - } - 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]; - } - /** - * 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]) - ]; - } - 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]; - } - [BUFFERPUSH](chunk) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] += 1; - else - this[BUFFERLENGTH] += chunk.length; - this[BUFFER].push(chunk); - } - [BUFFERSHIFT]() { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] -= 1; - else - this[BUFFERLENGTH] -= this[BUFFER][0].length; - return this[BUFFER].shift(); - } - [FLUSH](noDrain = false) { - do { - } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length); - if (!noDrain && !this[BUFFER].length && !this[EOF]) - this.emit("drain"); - } - [FLUSHCHUNK](chunk) { - this.emit("data", chunk); - return this[FLOWING]; - } - /** - * 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](); - } - 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(); - } - } - /** - * Alias for {@link Minipass#on} - */ - addListener(ev, handler) { - return this.on(ev, handler); - } - /** - * 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, handler) { - const ret = super.on(ev, handler); - 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 h2 = handler; - if (this[ASYNC]) - defer(() => h2.call(this, this[EMITTED_ERROR])); - else - h2.call(this, this[EMITTED_ERROR]); - } - return ret; - } - /** - * Alias for {@link Minipass#off} - */ - removeListener(ev, handler) { - return this.off(ev, handler); - } - /** - * 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, handler) { - const ret = super.off(ev, handler); - if (ev === "data") { - this[DATALISTENERS] = this.listeners("data").length; - if (this[DATALISTENERS] === 0 && !this[DISCARDED] && !this[PIPES].length) { - this[FLOWING] = false; - } - } - return ret; - } - /** - * 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; - } - /** - * true if the 'end' event has been emitted - */ - get emittedEnd() { - return this[EMITTED_END]; - } - [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; - } - } - /** - * 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(); - } - const ret = this[DISCARDED] ? false : super.emit("data", data); - this[MAYBE_EMIT_END](); - return ret; - } - [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); - } - 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((resolve2, reject) => { - this.on(DESTROYED, () => reject(new Error("stream destroyed"))); - this.on("error", (er) => reject(er)); - this.on("end", () => resolve2()); - }); - } - /** - * 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 resolve2; - 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(); - resolve2({ value, done: !!this[EOF] }); - }; - const onend = () => { - this.off("error", onerr); - this.off("data", ondata); - this.off(DESTROYED, ondestroy); - stop(); - resolve2({ done: true, value: void 0 }); - }; - const ondestroy = () => onerr(new Error("stream destroyed")); - return new Promise((res2, rej) => { - reject = rej; - resolve2 = 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; - } - }; - } - /** - * 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; - } - }; - } - /** - * 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 isStream; - } -}; - -// node_modules/@isaacs/fs-minipass/dist/esm/index.js -var writev = import_fs.default.writev; -var _autoClose = Symbol("_autoClose"); -var _close = Symbol("_close"); -var _ended = Symbol("_ended"); -var _fd = Symbol("_fd"); -var _finished = Symbol("_finished"); -var _flags = Symbol("_flags"); -var _flush = Symbol("_flush"); -var _handleChunk = Symbol("_handleChunk"); -var _makeBuf = Symbol("_makeBuf"); -var _mode = Symbol("_mode"); -var _needDrain = Symbol("_needDrain"); -var _onerror = Symbol("_onerror"); -var _onopen = Symbol("_onopen"); -var _onread = Symbol("_onread"); -var _onwrite = Symbol("_onwrite"); -var _open = Symbol("_open"); -var _path = Symbol("_path"); -var _pos = Symbol("_pos"); -var _queue = Symbol("_queue"); -var _read = Symbol("_read"); -var _readSize = Symbol("_readSize"); -var _reading = Symbol("_reading"); -var _remain = Symbol("_remain"); -var _size = Symbol("_size"); -var _write = Symbol("_write"); -var _writing = Symbol("_writing"); -var _defaultFlag = Symbol("_defaultFlag"); -var _errored = Symbol("_errored"); -var ReadStream = class extends Minipass { - [_errored] = false; - [_fd]; - [_path]; - [_readSize]; - [_reading] = false; - [_size]; - [_remain]; - [_autoClose]; - constructor(path9, opt) { - opt = opt || {}; - super(opt); - this.readable = true; - this.writable = false; - if (typeof path9 !== "string") { - throw new TypeError("path must be a string"); - } - this[_errored] = false; - this[_fd] = typeof opt.fd === "number" ? opt.fd : void 0; - this[_path] = path9; - this[_readSize] = opt.readSize || 16 * 1024 * 1024; - this[_reading] = false; - this[_size] = typeof opt.size === "number" ? opt.size : Infinity; - this[_remain] = this[_size]; - this[_autoClose] = typeof opt.autoClose === "boolean" ? opt.autoClose : true; - if (typeof this[_fd] === "number") { - this[_read](); - } else { - this[_open](); - } - } - get fd() { - return this[_fd]; - } - get path() { - return this[_path]; - } - //@ts-ignore - write() { - throw new TypeError("this is a readable stream"); - } - //@ts-ignore - end() { - throw new TypeError("this is a readable stream"); - } - [_open]() { - import_fs.default.open(this[_path], "r", (er, fd) => this[_onopen](er, fd)); - } - [_onopen](er, fd) { - if (er) { - this[_onerror](er); - } else { - this[_fd] = fd; - this.emit("open", fd); - this[_read](); - } - } - [_makeBuf]() { - return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])); - } - [_read]() { - if (!this[_reading]) { - this[_reading] = true; - const buf = this[_makeBuf](); - if (buf.length === 0) { - return process.nextTick(() => this[_onread](null, 0, buf)); - } - import_fs.default.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b)); - } - } - [_onread](er, br, buf) { - this[_reading] = false; - if (er) { - this[_onerror](er); - } else if (this[_handleChunk](br, buf)) { - this[_read](); - } - } - [_close]() { - if (this[_autoClose] && typeof this[_fd] === "number") { - const fd = this[_fd]; - this[_fd] = void 0; - import_fs.default.close(fd, (er) => er ? this.emit("error", er) : this.emit("close")); - } - } - [_onerror](er) { - this[_reading] = true; - this[_close](); - this.emit("error", er); - } - [_handleChunk](br, buf) { - let ret = false; - this[_remain] -= br; - if (br > 0) { - ret = super.write(br < buf.length ? buf.subarray(0, br) : buf); - } - if (br === 0 || this[_remain] <= 0) { - ret = false; - this[_close](); - super.end(); - } - return ret; - } - emit(ev, ...args) { - switch (ev) { - case "prefinish": - case "finish": - return false; - case "drain": - if (typeof this[_fd] === "number") { - this[_read](); - } - return false; - case "error": - if (this[_errored]) { - return false; - } - this[_errored] = true; - return super.emit(ev, ...args); - default: - return super.emit(ev, ...args); - } - } -}; -var ReadStreamSync = class extends ReadStream { - [_open]() { - let threw = true; - try { - this[_onopen](null, import_fs.default.openSync(this[_path], "r")); - threw = false; - } finally { - if (threw) { - this[_close](); - } - } - } - [_read]() { - let threw = true; - try { - if (!this[_reading]) { - this[_reading] = true; - do { - const buf = this[_makeBuf](); - const br = buf.length === 0 ? 0 : import_fs.default.readSync(this[_fd], buf, 0, buf.length, null); - if (!this[_handleChunk](br, buf)) { - break; - } - } while (true); - this[_reading] = false; - } - threw = false; - } finally { - if (threw) { - this[_close](); - } - } - } - [_close]() { - if (this[_autoClose] && typeof this[_fd] === "number") { - const fd = this[_fd]; - this[_fd] = void 0; - import_fs.default.closeSync(fd); - this.emit("close"); - } - } -}; -var WriteStream = class extends import_events.default { - readable = false; - writable = true; - [_errored] = false; - [_writing] = false; - [_ended] = false; - [_queue] = []; - [_needDrain] = false; - [_path]; - [_mode]; - [_autoClose]; - [_fd]; - [_defaultFlag]; - [_flags]; - [_finished] = false; - [_pos]; - constructor(path9, opt) { - opt = opt || {}; - super(opt); - this[_path] = path9; - this[_fd] = typeof opt.fd === "number" ? opt.fd : void 0; - this[_mode] = opt.mode === void 0 ? 438 : opt.mode; - this[_pos] = typeof opt.start === "number" ? opt.start : void 0; - this[_autoClose] = typeof opt.autoClose === "boolean" ? opt.autoClose : true; - const defaultFlag = this[_pos] !== void 0 ? "r+" : "w"; - this[_defaultFlag] = opt.flags === void 0; - this[_flags] = opt.flags === void 0 ? defaultFlag : opt.flags; - if (this[_fd] === void 0) { - this[_open](); - } - } - emit(ev, ...args) { - if (ev === "error") { - if (this[_errored]) { - return false; - } - this[_errored] = true; - } - return super.emit(ev, ...args); - } - get fd() { - return this[_fd]; - } - get path() { - return this[_path]; - } - [_onerror](er) { - this[_close](); - this[_writing] = true; - this.emit("error", er); - } - [_open]() { - import_fs.default.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd)); - } - [_onopen](er, fd) { - if (this[_defaultFlag] && this[_flags] === "r+" && er && er.code === "ENOENT") { - this[_flags] = "w"; - this[_open](); - } else if (er) { - this[_onerror](er); - } else { - this[_fd] = fd; - this.emit("open", fd); - if (!this[_writing]) { - this[_flush](); - } - } - } - end(buf, enc) { - if (buf) { - this.write(buf, enc); - } - this[_ended] = true; - if (!this[_writing] && !this[_queue].length && typeof this[_fd] === "number") { - this[_onwrite](null, 0); - } - return this; - } - write(buf, enc) { - if (typeof buf === "string") { - buf = Buffer.from(buf, enc); - } - if (this[_ended]) { - this.emit("error", new Error("write() after end()")); - return false; - } - if (this[_fd] === void 0 || this[_writing] || this[_queue].length) { - this[_queue].push(buf); - this[_needDrain] = true; - return false; - } - this[_writing] = true; - this[_write](buf); - return true; - } - [_write](buf) { - import_fs.default.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw)); - } - [_onwrite](er, bw) { - if (er) { - this[_onerror](er); - } else { - if (this[_pos] !== void 0 && typeof bw === "number") { - this[_pos] += bw; - } - if (this[_queue].length) { - this[_flush](); - } else { - this[_writing] = false; - if (this[_ended] && !this[_finished]) { - this[_finished] = true; - this[_close](); - this.emit("finish"); - } else if (this[_needDrain]) { - this[_needDrain] = false; - this.emit("drain"); - } - } - } - } - [_flush]() { - if (this[_queue].length === 0) { - if (this[_ended]) { - this[_onwrite](null, 0); - } - } else if (this[_queue].length === 1) { - this[_write](this[_queue].pop()); - } else { - const iovec = this[_queue]; - this[_queue] = []; - writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw)); - } - } - [_close]() { - if (this[_autoClose] && typeof this[_fd] === "number") { - const fd = this[_fd]; - this[_fd] = void 0; - import_fs.default.close(fd, (er) => er ? this.emit("error", er) : this.emit("close")); - } - } -}; -var WriteStreamSync = class extends WriteStream { - [_open]() { - let fd; - if (this[_defaultFlag] && this[_flags] === "r+") { - try { - fd = import_fs.default.openSync(this[_path], this[_flags], this[_mode]); - } catch (er) { - if (er?.code === "ENOENT") { - this[_flags] = "w"; - return this[_open](); - } else { - throw er; - } - } - } else { - fd = import_fs.default.openSync(this[_path], this[_flags], this[_mode]); - } - this[_onopen](null, fd); - } - [_close]() { - if (this[_autoClose] && typeof this[_fd] === "number") { - const fd = this[_fd]; - this[_fd] = void 0; - import_fs.default.closeSync(fd); - this.emit("close"); - } - } - [_write](buf) { - let threw = true; - try { - this[_onwrite](null, import_fs.default.writeSync(this[_fd], buf, 0, buf.length, this[_pos])); - threw = false; - } finally { - if (threw) { - try { - this[_close](); - } catch { - } - } - } - } -}; - -// node_modules/tar/dist/esm/create.js -var import_node_path4 = __toESM(require("node:path"), 1); - -// node_modules/tar/dist/esm/list.js -var import_node_fs = __toESM(require("node:fs"), 1); -var import_path = require("path"); - -// node_modules/tar/dist/esm/options.js -var argmap = /* @__PURE__ */ new Map([ - ["C", "cwd"], - ["f", "file"], - ["z", "gzip"], - ["P", "preservePaths"], - ["U", "unlink"], - ["strip-components", "strip"], - ["stripComponents", "strip"], - ["keep-newer", "newer"], - ["keepNewer", "newer"], - ["keep-newer-files", "newer"], - ["keepNewerFiles", "newer"], - ["k", "keep"], - ["keep-existing", "keep"], - ["keepExisting", "keep"], - ["m", "noMtime"], - ["no-mtime", "noMtime"], - ["p", "preserveOwner"], - ["L", "follow"], - ["h", "follow"], - ["onentry", "onReadEntry"] -]); -var isSyncFile = (o) => !!o.sync && !!o.file; -var isAsyncFile = (o) => !o.sync && !!o.file; -var isSyncNoFile = (o) => !!o.sync && !o.file; -var isAsyncNoFile = (o) => !o.sync && !o.file; -var isFile = (o) => !!o.file; -var dealiasKey = (k) => { - const d = argmap.get(k); - if (d) - return d; - return k; -}; -var dealias = (opt = {}) => { - if (!opt) - return {}; - const result = {}; - for (const [key, v] of Object.entries(opt)) { - const k = dealiasKey(key); - result[k] = v; - } - if (result.chmod === void 0 && result.noChmod === false) { - result.chmod = true; - } - delete result.noChmod; - return result; -}; - -// node_modules/tar/dist/esm/make-command.js -var makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { - return Object.assign((opt_ = [], entries, cb) => { - if (Array.isArray(opt_)) { - entries = opt_; - opt_ = {}; - } - if (typeof entries === "function") { - cb = entries; - entries = void 0; - } - if (!entries) { - entries = []; - } else { - entries = Array.from(entries); - } - const opt = dealias(opt_); - validate?.(opt, entries); - if (isSyncFile(opt)) { - if (typeof cb === "function") { - throw new TypeError("callback not supported for sync tar functions"); - } - return syncFile(opt, entries); - } else if (isAsyncFile(opt)) { - const p = asyncFile(opt, entries); - const c = cb ? cb : void 0; - return c ? p.then(() => c(), c) : p; - } else if (isSyncNoFile(opt)) { - if (typeof cb === "function") { - throw new TypeError("callback not supported for sync tar functions"); - } - return syncNoFile(opt, entries); - } else if (isAsyncNoFile(opt)) { - if (typeof cb === "function") { - throw new TypeError("callback only supported with file option"); - } - return asyncNoFile(opt, entries); - } else { - throw new Error("impossible options??"); - } - }, { - syncFile, - asyncFile, - syncNoFile, - asyncNoFile, - validate - }); -}; - -// node_modules/tar/dist/esm/parse.js -var import_events2 = require("events"); - -// node_modules/minizlib/dist/esm/index.js -var import_assert = __toESM(require("assert"), 1); -var import_buffer = require("buffer"); - -// node_modules/minizlib/node_modules/minipass/dist/esm/index.js -var import_node_events2 = require("node:events"); -var import_node_stream2 = __toESM(require("node:stream"), 1); -var import_node_string_decoder2 = require("node:string_decoder"); -var proc2 = typeof process === "object" && process ? process : { - stdout: null, - stderr: null -}; -var isStream2 = (s2) => !!s2 && typeof s2 === "object" && (s2 instanceof Minipass2 || s2 instanceof import_node_stream2.default || isReadable2(s2) || isWritable2(s2)); -var isReadable2 = (s2) => !!s2 && typeof s2 === "object" && s2 instanceof import_node_events2.EventEmitter && typeof s2.pipe === "function" && // node core Writable streams have a pipe() method, but it throws -s2.pipe !== import_node_stream2.default.Writable.prototype.pipe; -var isWritable2 = (s2) => !!s2 && typeof s2 === "object" && s2 instanceof import_node_events2.EventEmitter && typeof s2.write === "function" && typeof s2.end === "function"; -var EOF2 = Symbol("EOF"); -var MAYBE_EMIT_END2 = Symbol("maybeEmitEnd"); -var EMITTED_END2 = Symbol("emittedEnd"); -var EMITTING_END2 = Symbol("emittingEnd"); -var EMITTED_ERROR2 = Symbol("emittedError"); -var CLOSED2 = Symbol("closed"); -var READ2 = Symbol("read"); -var FLUSH2 = Symbol("flush"); -var FLUSHCHUNK2 = Symbol("flushChunk"); -var ENCODING2 = Symbol("encoding"); -var DECODER2 = Symbol("decoder"); -var FLOWING2 = Symbol("flowing"); -var PAUSED2 = Symbol("paused"); -var RESUME2 = Symbol("resume"); -var BUFFER2 = Symbol("buffer"); -var PIPES2 = Symbol("pipes"); -var BUFFERLENGTH2 = Symbol("bufferLength"); -var BUFFERPUSH2 = Symbol("bufferPush"); -var BUFFERSHIFT2 = Symbol("bufferShift"); -var OBJECTMODE2 = Symbol("objectMode"); -var DESTROYED2 = Symbol("destroyed"); -var ERROR2 = Symbol("error"); -var EMITDATA2 = Symbol("emitData"); -var EMITEND3 = Symbol("emitEnd"); -var EMITEND22 = Symbol("emitEnd2"); -var ASYNC2 = Symbol("async"); -var ABORT2 = Symbol("abort"); -var ABORTED2 = Symbol("aborted"); -var SIGNAL2 = Symbol("signal"); -var DATALISTENERS2 = Symbol("dataListeners"); -var DISCARDED2 = Symbol("discarded"); -var defer2 = (fn) => Promise.resolve().then(fn); -var nodefer2 = (fn) => fn(); -var isEndish2 = (ev) => ev === "end" || ev === "finish" || ev === "prefinish"; -var isArrayBufferLike2 = (b) => b instanceof ArrayBuffer || !!b && typeof b === "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0; -var isArrayBufferView2 = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); -var Pipe2 = class { - src; - dest; - opts; - ondrain; - constructor(src, dest, opts) { - this.src = src; - this.dest = dest; - this.opts = opts; - this.ondrain = () => src[RESUME2](); - 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 PipeProxyErrors2 = class extends Pipe2 { - unpipe() { - this.src.removeListener("error", this.proxyErrors); - super.unpipe(); - } - constructor(src, dest, opts) { - super(src, dest, opts); - this.proxyErrors = (er) => dest.emit("error", er); - src.on("error", this.proxyErrors); - } -}; -var isObjectModeOptions2 = (o) => !!o.objectMode; -var isEncodingOptions2 = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer"; -var Minipass2 = class extends import_node_events2.EventEmitter { - [FLOWING2] = false; - [PAUSED2] = false; - [PIPES2] = []; - [BUFFER2] = []; - [OBJECTMODE2]; - [ENCODING2]; - [ASYNC2]; - [DECODER2]; - [EOF2] = false; - [EMITTED_END2] = false; - [EMITTING_END2] = false; - [CLOSED2] = false; - [EMITTED_ERROR2] = null; - [BUFFERLENGTH2] = 0; - [DESTROYED2] = false; - [SIGNAL2]; - [ABORTED2] = false; - [DATALISTENERS2] = 0; - [DISCARDED2] = 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 (isObjectModeOptions2(options)) { - this[OBJECTMODE2] = true; - this[ENCODING2] = null; - } else if (isEncodingOptions2(options)) { - this[ENCODING2] = options.encoding; - this[OBJECTMODE2] = false; - } else { - this[OBJECTMODE2] = false; - this[ENCODING2] = null; - } - this[ASYNC2] = !!options.async; - this[DECODER2] = this[ENCODING2] ? new import_node_string_decoder2.StringDecoder(this[ENCODING2]) : null; - if (options && options.debugExposeBuffer === true) { - Object.defineProperty(this, "buffer", { get: () => this[BUFFER2] }); - } - if (options && options.debugExposePipes === true) { - Object.defineProperty(this, "pipes", { get: () => this[PIPES2] }); - } - const { signal } = options; - if (signal) { - this[SIGNAL2] = signal; - if (signal.aborted) { - this[ABORT2](); - } else { - signal.addEventListener("abort", () => this[ABORT2]()); - } - } - } - /** - * 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[BUFFERLENGTH2]; - } - /** - * The `BufferEncoding` currently in use, or `null` - */ - get encoding() { - return this[ENCODING2]; - } - /** - * @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[OBJECTMODE2]; - } - /** - * @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[ASYNC2]; - } - /** - * 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[ASYNC2] = this[ASYNC2] || !!a; - } - // drop everything and get out of the flow completely - [ABORT2]() { - this[ABORTED2] = true; - this.emit("abort", this[SIGNAL2]?.reason); - this.destroy(this[SIGNAL2]?.reason); - } - /** - * True if the stream has been aborted. - */ - get aborted() { - return this[ABORTED2]; - } - /** - * No-op setter. Stream aborted status is set via the AbortSignal provided - * in the constructor options. - */ - set aborted(_) { - } - write(chunk, encoding, cb) { - if (this[ABORTED2]) - return false; - if (this[EOF2]) - throw new Error("write after end"); - if (this[DESTROYED2]) { - 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[ASYNC2] ? defer2 : nodefer2; - if (!this[OBJECTMODE2] && !Buffer.isBuffer(chunk)) { - if (isArrayBufferView2(chunk)) { - chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); - } else if (isArrayBufferLike2(chunk)) { - chunk = Buffer.from(chunk); - } else if (typeof chunk !== "string") { - throw new Error("Non-contiguous data written to non-objectMode stream"); - } - } - if (this[OBJECTMODE2]) { - if (this[FLOWING2] && this[BUFFERLENGTH2] !== 0) - this[FLUSH2](true); - if (this[FLOWING2]) - this.emit("data", chunk); - else - this[BUFFERPUSH2](chunk); - if (this[BUFFERLENGTH2] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING2]; - } - if (!chunk.length) { - if (this[BUFFERLENGTH2] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING2]; - } - if (typeof chunk === "string" && // unless it is a string already ready for us to use - !(encoding === this[ENCODING2] && !this[DECODER2]?.lastNeed)) { - chunk = Buffer.from(chunk, encoding); - } - if (Buffer.isBuffer(chunk) && this[ENCODING2]) { - chunk = this[DECODER2].write(chunk); - } - if (this[FLOWING2] && this[BUFFERLENGTH2] !== 0) - this[FLUSH2](true); - if (this[FLOWING2]) - this.emit("data", chunk); - else - this[BUFFERPUSH2](chunk); - if (this[BUFFERLENGTH2] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING2]; - } - /** - * 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[DESTROYED2]) - return null; - this[DISCARDED2] = false; - if (this[BUFFERLENGTH2] === 0 || n === 0 || n && n > this[BUFFERLENGTH2]) { - this[MAYBE_EMIT_END2](); - return null; - } - if (this[OBJECTMODE2]) - n = null; - if (this[BUFFER2].length > 1 && !this[OBJECTMODE2]) { - this[BUFFER2] = [ - this[ENCODING2] ? this[BUFFER2].join("") : Buffer.concat(this[BUFFER2], this[BUFFERLENGTH2]) - ]; - } - const ret = this[READ2](n || null, this[BUFFER2][0]); - this[MAYBE_EMIT_END2](); - return ret; - } - [READ2](n, chunk) { - if (this[OBJECTMODE2]) - this[BUFFERSHIFT2](); - else { - const c = chunk; - if (n === c.length || n === null) - this[BUFFERSHIFT2](); - else if (typeof c === "string") { - this[BUFFER2][0] = c.slice(n); - chunk = c.slice(0, n); - this[BUFFERLENGTH2] -= n; - } else { - this[BUFFER2][0] = c.subarray(n); - chunk = c.subarray(0, n); - this[BUFFERLENGTH2] -= n; - } - } - this.emit("data", chunk); - if (!this[BUFFER2].length && !this[EOF2]) - 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[EOF2] = true; - this.writable = false; - if (this[FLOWING2] || !this[PAUSED2]) - this[MAYBE_EMIT_END2](); - return this; - } - // don't let the internal resume be overwritten - [RESUME2]() { - if (this[DESTROYED2]) - return; - if (!this[DATALISTENERS2] && !this[PIPES2].length) { - this[DISCARDED2] = true; - } - this[PAUSED2] = false; - this[FLOWING2] = true; - this.emit("resume"); - if (this[BUFFER2].length) - this[FLUSH2](); - else if (this[EOF2]) - this[MAYBE_EMIT_END2](); - 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[RESUME2](); - } - /** - * Pause the stream - */ - pause() { - this[FLOWING2] = false; - this[PAUSED2] = true; - this[DISCARDED2] = false; - } - /** - * true if the stream has been forcibly destroyed - */ - get destroyed() { - return this[DESTROYED2]; - } - /** - * true if the stream is currently in a flowing state, meaning that - * any writes will be immediately emitted. - */ - get flowing() { - return this[FLOWING2]; - } - /** - * true if the stream is currently in a paused state - */ - get paused() { - return this[PAUSED2]; - } - [BUFFERPUSH2](chunk) { - if (this[OBJECTMODE2]) - this[BUFFERLENGTH2] += 1; - else - this[BUFFERLENGTH2] += chunk.length; - this[BUFFER2].push(chunk); - } - [BUFFERSHIFT2]() { - if (this[OBJECTMODE2]) - this[BUFFERLENGTH2] -= 1; - else - this[BUFFERLENGTH2] -= this[BUFFER2][0].length; - return this[BUFFER2].shift(); - } - [FLUSH2](noDrain = false) { - do { - } while (this[FLUSHCHUNK2](this[BUFFERSHIFT2]()) && this[BUFFER2].length); - if (!noDrain && !this[BUFFER2].length && !this[EOF2]) - this.emit("drain"); - } - [FLUSHCHUNK2](chunk) { - this.emit("data", chunk); - return this[FLOWING2]; - } - /** - * Pipe all data emitted by this stream into the destination provided. - * - * Triggers the flow of data. - */ - pipe(dest, opts) { - if (this[DESTROYED2]) - return dest; - this[DISCARDED2] = false; - const ended = this[EMITTED_END2]; - opts = opts || {}; - if (dest === proc2.stdout || dest === proc2.stderr) - opts.end = false; - else - opts.end = opts.end !== false; - opts.proxyErrors = !!opts.proxyErrors; - if (ended) { - if (opts.end) - dest.end(); - } else { - this[PIPES2].push(!opts.proxyErrors ? new Pipe2(this, dest, opts) : new PipeProxyErrors2(this, dest, opts)); - if (this[ASYNC2]) - defer2(() => this[RESUME2]()); - else - this[RESUME2](); - } - 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[PIPES2].find((p2) => p2.dest === dest); - if (p) { - if (this[PIPES2].length === 1) { - if (this[FLOWING2] && this[DATALISTENERS2] === 0) { - this[FLOWING2] = false; - } - this[PIPES2] = []; - } else - this[PIPES2].splice(this[PIPES2].indexOf(p), 1); - p.unpipe(); - } - } - /** - * Alias for {@link Minipass#on} - */ - addListener(ev, handler) { - return this.on(ev, handler); - } - /** - * 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, handler) { - const ret = super.on(ev, handler); - if (ev === "data") { - this[DISCARDED2] = false; - this[DATALISTENERS2]++; - if (!this[PIPES2].length && !this[FLOWING2]) { - this[RESUME2](); - } - } else if (ev === "readable" && this[BUFFERLENGTH2] !== 0) { - super.emit("readable"); - } else if (isEndish2(ev) && this[EMITTED_END2]) { - super.emit(ev); - this.removeAllListeners(ev); - } else if (ev === "error" && this[EMITTED_ERROR2]) { - const h2 = handler; - if (this[ASYNC2]) - defer2(() => h2.call(this, this[EMITTED_ERROR2])); - else - h2.call(this, this[EMITTED_ERROR2]); - } - return ret; - } - /** - * Alias for {@link Minipass#off} - */ - removeListener(ev, handler) { - return this.off(ev, handler); - } - /** - * 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, handler) { - const ret = super.off(ev, handler); - if (ev === "data") { - this[DATALISTENERS2] = this.listeners("data").length; - if (this[DATALISTENERS2] === 0 && !this[DISCARDED2] && !this[PIPES2].length) { - this[FLOWING2] = false; - } - } - return ret; - } - /** - * 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[DATALISTENERS2] = 0; - if (!this[DISCARDED2] && !this[PIPES2].length) { - this[FLOWING2] = false; - } - } - return ret; - } - /** - * true if the 'end' event has been emitted - */ - get emittedEnd() { - return this[EMITTED_END2]; - } - [MAYBE_EMIT_END2]() { - if (!this[EMITTING_END2] && !this[EMITTED_END2] && !this[DESTROYED2] && this[BUFFER2].length === 0 && this[EOF2]) { - this[EMITTING_END2] = true; - this.emit("end"); - this.emit("prefinish"); - this.emit("finish"); - if (this[CLOSED2]) - this.emit("close"); - this[EMITTING_END2] = false; - } - } - /** - * 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 !== DESTROYED2 && this[DESTROYED2]) { - return false; - } else if (ev === "data") { - return !this[OBJECTMODE2] && !data ? false : this[ASYNC2] ? (defer2(() => this[EMITDATA2](data)), true) : this[EMITDATA2](data); - } else if (ev === "end") { - return this[EMITEND3](); - } else if (ev === "close") { - this[CLOSED2] = true; - if (!this[EMITTED_END2] && !this[DESTROYED2]) - return false; - const ret2 = super.emit("close"); - this.removeAllListeners("close"); - return ret2; - } else if (ev === "error") { - this[EMITTED_ERROR2] = data; - super.emit(ERROR2, data); - const ret2 = !this[SIGNAL2] || this.listeners("error").length ? super.emit("error", data) : false; - this[MAYBE_EMIT_END2](); - return ret2; - } else if (ev === "resume") { - const ret2 = super.emit("resume"); - this[MAYBE_EMIT_END2](); - 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_END2](); - return ret; - } - [EMITDATA2](data) { - for (const p of this[PIPES2]) { - if (p.dest.write(data) === false) - this.pause(); - } - const ret = this[DISCARDED2] ? false : super.emit("data", data); - this[MAYBE_EMIT_END2](); - return ret; - } - [EMITEND3]() { - if (this[EMITTED_END2]) - return false; - this[EMITTED_END2] = true; - this.readable = false; - return this[ASYNC2] ? (defer2(() => this[EMITEND22]()), true) : this[EMITEND22](); - } - [EMITEND22]() { - if (this[DECODER2]) { - const data = this[DECODER2].end(); - if (data) { - for (const p of this[PIPES2]) { - p.dest.write(data); - } - if (!this[DISCARDED2]) - super.emit("data", data); - } - } - for (const p of this[PIPES2]) { - 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[OBJECTMODE2]) - buf.dataLength = 0; - const p = this.promise(); - this.on("data", (c) => { - buf.push(c); - if (!this[OBJECTMODE2]) - 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[OBJECTMODE2]) { - throw new Error("cannot concat in objectMode"); - } - const buf = await this.collect(); - return this[ENCODING2] ? buf.join("") : Buffer.concat(buf, buf.dataLength); - } - /** - * Return a void Promise that resolves once the stream ends. - */ - async promise() { - return new Promise((resolve2, reject) => { - this.on(DESTROYED2, () => reject(new Error("stream destroyed"))); - this.on("error", (er) => reject(er)); - this.on("end", () => resolve2()); - }); - } - /** - * Asynchronous `for await of` iteration. - * - * This will continue emitting all chunks until the stream terminates. - */ - [Symbol.asyncIterator]() { - this[DISCARDED2] = 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[EOF2]) - return stop(); - let resolve2; - let reject; - const onerr = (er) => { - this.off("data", ondata); - this.off("end", onend); - this.off(DESTROYED2, ondestroy); - stop(); - reject(er); - }; - const ondata = (value) => { - this.off("error", onerr); - this.off("end", onend); - this.off(DESTROYED2, ondestroy); - this.pause(); - resolve2({ value, done: !!this[EOF2] }); - }; - const onend = () => { - this.off("error", onerr); - this.off("data", ondata); - this.off(DESTROYED2, ondestroy); - stop(); - resolve2({ done: true, value: void 0 }); - }; - const ondestroy = () => onerr(new Error("stream destroyed")); - return new Promise((res2, rej) => { - reject = rej; - resolve2 = res2; - this.once(DESTROYED2, ondestroy); - this.once("error", onerr); - this.once("end", onend); - this.once("data", ondata); - }); - }; - return { - next, - throw: stop, - return: stop, - [Symbol.asyncIterator]() { - return this; - } - }; - } - /** - * 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[DISCARDED2] = false; - let stopped = false; - const stop = () => { - this.pause(); - this.off(ERROR2, stop); - this.off(DESTROYED2, 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(ERROR2, stop); - this.once(DESTROYED2, stop); - return { - next, - throw: stop, - return: stop, - [Symbol.iterator]() { - return this; - } - }; - } - /** - * 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[DESTROYED2]) { - if (er) - this.emit("error", er); - else - this.emit(DESTROYED2); - return this; - } - this[DESTROYED2] = true; - this[DISCARDED2] = true; - this[BUFFER2].length = 0; - this[BUFFERLENGTH2] = 0; - const wc = this; - if (typeof wc.close === "function" && !this[CLOSED2]) - wc.close(); - if (er) - this.emit("error", er); - else - this.emit(DESTROYED2); - return this; - } - /** - * Alias for {@link isStream} - * - * Former export location, maintained for backwards compatibility. - * - * @deprecated - */ - static get isStream() { - return isStream2; - } -}; - -// node_modules/minizlib/dist/esm/index.js -var realZlib2 = __toESM(require("zlib"), 1); - -// node_modules/minizlib/dist/esm/constants.js -var import_zlib = __toESM(require("zlib"), 1); -var realZlibConstants = import_zlib.default.constants || { ZLIB_VERNUM: 4736 }; -var constants = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), { - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - Z_VERSION_ERROR: -6, - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - DEFLATE: 1, - INFLATE: 2, - GZIP: 3, - GUNZIP: 4, - DEFLATERAW: 5, - INFLATERAW: 6, - UNZIP: 7, - BROTLI_DECODE: 8, - BROTLI_ENCODE: 9, - Z_MIN_WINDOWBITS: 8, - Z_MAX_WINDOWBITS: 15, - Z_DEFAULT_WINDOWBITS: 15, - Z_MIN_CHUNK: 64, - Z_MAX_CHUNK: Infinity, - Z_DEFAULT_CHUNK: 16384, - Z_MIN_MEMLEVEL: 1, - Z_MAX_MEMLEVEL: 9, - Z_DEFAULT_MEMLEVEL: 8, - Z_MIN_LEVEL: -1, - Z_MAX_LEVEL: 9, - Z_DEFAULT_LEVEL: -1, - BROTLI_OPERATION_PROCESS: 0, - BROTLI_OPERATION_FLUSH: 1, - BROTLI_OPERATION_FINISH: 2, - BROTLI_OPERATION_EMIT_METADATA: 3, - BROTLI_MODE_GENERIC: 0, - BROTLI_MODE_TEXT: 1, - BROTLI_MODE_FONT: 2, - BROTLI_DEFAULT_MODE: 0, - BROTLI_MIN_QUALITY: 0, - BROTLI_MAX_QUALITY: 11, - BROTLI_DEFAULT_QUALITY: 11, - BROTLI_MIN_WINDOW_BITS: 10, - BROTLI_MAX_WINDOW_BITS: 24, - BROTLI_LARGE_MAX_WINDOW_BITS: 30, - BROTLI_DEFAULT_WINDOW: 22, - BROTLI_MIN_INPUT_BLOCK_BITS: 16, - BROTLI_MAX_INPUT_BLOCK_BITS: 24, - BROTLI_PARAM_MODE: 0, - BROTLI_PARAM_QUALITY: 1, - BROTLI_PARAM_LGWIN: 2, - BROTLI_PARAM_LGBLOCK: 3, - BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, - BROTLI_PARAM_SIZE_HINT: 5, - BROTLI_PARAM_LARGE_WINDOW: 6, - BROTLI_PARAM_NPOSTFIX: 7, - BROTLI_PARAM_NDIRECT: 8, - BROTLI_DECODER_RESULT_ERROR: 0, - BROTLI_DECODER_RESULT_SUCCESS: 1, - BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, - BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, - BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, - BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, - BROTLI_DECODER_NO_ERROR: 0, - BROTLI_DECODER_SUCCESS: 1, - BROTLI_DECODER_NEEDS_MORE_INPUT: 2, - BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, - BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, - BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, - BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, - BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, - BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, - BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, - BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, - BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, - BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, - BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, - BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, - BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, - BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, - BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, - BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, - BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, - BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, - BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, - BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, - BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, - BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, - BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, - BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, - BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, - BROTLI_DECODER_ERROR_UNREACHABLE: -31 -}, realZlibConstants)); - -// node_modules/minizlib/dist/esm/index.js -var OriginalBufferConcat = import_buffer.Buffer.concat; -var desc = Object.getOwnPropertyDescriptor(import_buffer.Buffer, "concat"); -var noop = (args) => args; -var passthroughBufferConcat = desc?.writable === true || desc?.set !== void 0 ? (makeNoOp) => { - import_buffer.Buffer.concat = makeNoOp ? noop : OriginalBufferConcat; -} : (_) => { -}; -var _superWrite = Symbol("_superWrite"); -var ZlibError = class extends Error { - code; - errno; - constructor(err) { - super("zlib: " + err.message); - this.code = err.code; - this.errno = err.errno; - if (!this.code) - this.code = "ZLIB_ERROR"; - this.message = "zlib: " + err.message; - Error.captureStackTrace(this, this.constructor); - } - get name() { - return "ZlibError"; - } -}; -var _flushFlag = Symbol("flushFlag"); -var ZlibBase = class extends Minipass2 { - #sawError = false; - #ended = false; - #flushFlag; - #finishFlushFlag; - #fullFlushFlag; - #handle; - #onError; - get sawError() { - return this.#sawError; - } - get handle() { - return this.#handle; - } - /* c8 ignore start */ - get flushFlag() { - return this.#flushFlag; - } - /* c8 ignore stop */ - constructor(opts, mode) { - if (!opts || typeof opts !== "object") - throw new TypeError("invalid options for ZlibBase constructor"); - super(opts); - this.#flushFlag = opts.flush ?? 0; - this.#finishFlushFlag = opts.finishFlush ?? 0; - this.#fullFlushFlag = opts.fullFlushFlag ?? 0; - try { - this.#handle = new realZlib2[mode](opts); - } catch (er) { - throw new ZlibError(er); - } - this.#onError = (err) => { - if (this.#sawError) - return; - this.#sawError = true; - this.close(); - this.emit("error", err); - }; - this.#handle?.on("error", (er) => this.#onError(new ZlibError(er))); - this.once("end", () => this.close); - } - close() { - if (this.#handle) { - this.#handle.close(); - this.#handle = void 0; - this.emit("close"); - } - } - reset() { - if (!this.#sawError) { - (0, import_assert.default)(this.#handle, "zlib binding closed"); - return this.#handle.reset?.(); - } - } - flush(flushFlag) { - if (this.ended) - return; - if (typeof flushFlag !== "number") - flushFlag = this.#fullFlushFlag; - this.write(Object.assign(import_buffer.Buffer.alloc(0), { [_flushFlag]: flushFlag })); - } - end(chunk, encoding, cb) { - if (typeof chunk === "function") { - cb = chunk; - encoding = void 0; - chunk = void 0; - } - if (typeof encoding === "function") { - cb = encoding; - encoding = void 0; - } - if (chunk) { - if (encoding) - this.write(chunk, encoding); - else - this.write(chunk); - } - this.flush(this.#finishFlushFlag); - this.#ended = true; - return super.end(cb); - } - get ended() { - return this.#ended; - } - // overridden in the gzip classes to do portable writes - [_superWrite](data) { - return super.write(data); - } - write(chunk, encoding, cb) { - if (typeof encoding === "function") - cb = encoding, encoding = "utf8"; - if (typeof chunk === "string") - chunk = import_buffer.Buffer.from(chunk, encoding); - if (this.#sawError) - return; - (0, import_assert.default)(this.#handle, "zlib binding closed"); - const nativeHandle = this.#handle._handle; - const originalNativeClose = nativeHandle.close; - nativeHandle.close = () => { - }; - const originalClose = this.#handle.close; - this.#handle.close = () => { - }; - passthroughBufferConcat(true); - let result = void 0; - try { - const flushFlag = typeof chunk[_flushFlag] === "number" ? chunk[_flushFlag] : this.#flushFlag; - result = this.#handle._processChunk(chunk, flushFlag); - passthroughBufferConcat(false); - } catch (err) { - passthroughBufferConcat(false); - this.#onError(new ZlibError(err)); - } finally { - if (this.#handle) { - ; - this.#handle._handle = nativeHandle; - nativeHandle.close = originalNativeClose; - this.#handle.close = originalClose; - this.#handle.removeAllListeners("error"); - } - } - if (this.#handle) - this.#handle.on("error", (er) => this.#onError(new ZlibError(er))); - let writeReturn; - if (result) { - if (Array.isArray(result) && result.length > 0) { - const r2 = result[0]; - writeReturn = this[_superWrite](import_buffer.Buffer.from(r2)); - for (let i2 = 1; i2 < result.length; i2++) { - writeReturn = this[_superWrite](result[i2]); - } - } else { - writeReturn = this[_superWrite](import_buffer.Buffer.from(result)); - } - } - if (cb) - cb(); - return writeReturn; - } -}; -var Zlib = class extends ZlibBase { - #level; - #strategy; - constructor(opts, mode) { - opts = opts || {}; - opts.flush = opts.flush || constants.Z_NO_FLUSH; - opts.finishFlush = opts.finishFlush || constants.Z_FINISH; - opts.fullFlushFlag = constants.Z_FULL_FLUSH; - super(opts, mode); - this.#level = opts.level; - this.#strategy = opts.strategy; - } - params(level, strategy) { - if (this.sawError) - return; - if (!this.handle) - throw new Error("cannot switch params when binding is closed"); - if (!this.handle.params) - throw new Error("not supported in this implementation"); - if (this.#level !== level || this.#strategy !== strategy) { - this.flush(constants.Z_SYNC_FLUSH); - (0, import_assert.default)(this.handle, "zlib binding closed"); - const origFlush = this.handle.flush; - this.handle.flush = (flushFlag, cb) => { - if (typeof flushFlag === "function") { - cb = flushFlag; - flushFlag = this.flushFlag; - } - this.flush(flushFlag); - cb?.(); - }; - try { - ; - this.handle.params(level, strategy); - } finally { - this.handle.flush = origFlush; - } - if (this.handle) { - this.#level = level; - this.#strategy = strategy; - } - } - } -}; -var Gzip = class extends Zlib { - #portable; - constructor(opts) { - super(opts, "Gzip"); - this.#portable = opts && !!opts.portable; - } - [_superWrite](data) { - if (!this.#portable) - return super[_superWrite](data); - this.#portable = false; - data[9] = 255; - return super[_superWrite](data); - } -}; -var Unzip = class extends Zlib { - constructor(opts) { - super(opts, "Unzip"); - } -}; -var Brotli = class extends ZlibBase { - constructor(opts, mode) { - opts = opts || {}; - opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS; - opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH; - opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH; - super(opts, mode); - } -}; -var BrotliCompress = class extends Brotli { - constructor(opts) { - super(opts, "BrotliCompress"); - } -}; -var BrotliDecompress = class extends Brotli { - constructor(opts) { - super(opts, "BrotliDecompress"); - } -}; - -// node_modules/yallist/dist/esm/index.js -var Yallist = class _Yallist { - tail; - head; - length = 0; - static create(list2 = []) { - return new _Yallist(list2); - } - constructor(list2 = []) { - for (const item of list2) { - this.push(item); - } - } - *[Symbol.iterator]() { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value; - } - } - removeNode(node) { - if (node.list !== this) { - throw new Error("removing node which does not belong to this list"); - } - const next = node.next; - const prev = node.prev; - if (next) { - next.prev = prev; - } - if (prev) { - prev.next = next; - } - if (node === this.head) { - this.head = next; - } - if (node === this.tail) { - this.tail = prev; - } - this.length--; - node.next = void 0; - node.prev = void 0; - node.list = void 0; - return next; - } - unshiftNode(node) { - if (node === this.head) { - return; - } - if (node.list) { - node.list.removeNode(node); - } - const head = this.head; - node.list = this; - node.next = head; - if (head) { - head.prev = node; - } - this.head = node; - if (!this.tail) { - this.tail = node; - } - this.length++; - } - pushNode(node) { - if (node === this.tail) { - return; - } - if (node.list) { - node.list.removeNode(node); - } - const tail = this.tail; - node.list = this; - node.prev = tail; - if (tail) { - tail.next = node; - } - this.tail = node; - if (!this.head) { - this.head = node; - } - this.length++; - } - push(...args) { - for (let i2 = 0, l = args.length; i2 < l; i2++) { - push(this, args[i2]); - } - return this.length; - } - unshift(...args) { - for (var i2 = 0, l = args.length; i2 < l; i2++) { - unshift(this, args[i2]); - } - return this.length; - } - pop() { - if (!this.tail) { - return void 0; - } - const res = this.tail.value; - const t2 = this.tail; - this.tail = this.tail.prev; - if (this.tail) { - this.tail.next = void 0; - } else { - this.head = void 0; - } - t2.list = void 0; - this.length--; - return res; - } - shift() { - if (!this.head) { - return void 0; - } - const res = this.head.value; - const h2 = this.head; - this.head = this.head.next; - if (this.head) { - this.head.prev = void 0; - } else { - this.tail = void 0; - } - h2.list = void 0; - this.length--; - return res; - } - forEach(fn, thisp) { - thisp = thisp || this; - for (let walker = this.head, i2 = 0; !!walker; i2++) { - fn.call(thisp, walker.value, i2, this); - walker = walker.next; - } - } - forEachReverse(fn, thisp) { - thisp = thisp || this; - for (let walker = this.tail, i2 = this.length - 1; !!walker; i2--) { - fn.call(thisp, walker.value, i2, this); - walker = walker.prev; - } - } - get(n) { - let i2 = 0; - let walker = this.head; - for (; !!walker && i2 < n; i2++) { - walker = walker.next; - } - if (i2 === n && !!walker) { - return walker.value; - } - } - getReverse(n) { - let i2 = 0; - let walker = this.tail; - for (; !!walker && i2 < n; i2++) { - walker = walker.prev; - } - if (i2 === n && !!walker) { - return walker.value; - } - } - map(fn, thisp) { - thisp = thisp || this; - const res = new _Yallist(); - for (let walker = this.head; !!walker; ) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.next; - } - return res; - } - mapReverse(fn, thisp) { - thisp = thisp || this; - var res = new _Yallist(); - for (let walker = this.tail; !!walker; ) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.prev; - } - return res; - } - reduce(fn, initial) { - let acc; - let walker = this.head; - if (arguments.length > 1) { - acc = initial; - } else if (this.head) { - walker = this.head.next; - acc = this.head.value; - } else { - throw new TypeError("Reduce of empty list with no initial value"); - } - for (var i2 = 0; !!walker; i2++) { - acc = fn(acc, walker.value, i2); - walker = walker.next; - } - return acc; - } - reduceReverse(fn, initial) { - let acc; - let walker = this.tail; - if (arguments.length > 1) { - acc = initial; - } else if (this.tail) { - walker = this.tail.prev; - acc = this.tail.value; - } else { - throw new TypeError("Reduce of empty list with no initial value"); - } - for (let i2 = this.length - 1; !!walker; i2--) { - acc = fn(acc, walker.value, i2); - walker = walker.prev; - } - return acc; - } - toArray() { - const arr = new Array(this.length); - for (let i2 = 0, walker = this.head; !!walker; i2++) { - arr[i2] = walker.value; - walker = walker.next; - } - return arr; - } - toArrayReverse() { - const arr = new Array(this.length); - for (let i2 = 0, walker = this.tail; !!walker; i2++) { - arr[i2] = walker.value; - walker = walker.prev; - } - return arr; - } - slice(from = 0, to = this.length) { - if (to < 0) { - to += this.length; - } - if (from < 0) { - from += this.length; - } - const ret = new _Yallist(); - if (to < from || to < 0) { - return ret; - } - if (from < 0) { - from = 0; - } - if (to > this.length) { - to = this.length; - } - let walker = this.head; - let i2 = 0; - for (i2 = 0; !!walker && i2 < from; i2++) { - walker = walker.next; - } - for (; !!walker && i2 < to; i2++, walker = walker.next) { - ret.push(walker.value); - } - return ret; - } - sliceReverse(from = 0, to = this.length) { - if (to < 0) { - to += this.length; - } - if (from < 0) { - from += this.length; - } - const ret = new _Yallist(); - if (to < from || to < 0) { - return ret; - } - if (from < 0) { - from = 0; - } - if (to > this.length) { - to = this.length; - } - let i2 = this.length; - let walker = this.tail; - for (; !!walker && i2 > to; i2--) { - walker = walker.prev; - } - for (; !!walker && i2 > from; i2--, walker = walker.prev) { - ret.push(walker.value); - } - return ret; - } - splice(start, deleteCount = 0, ...nodes) { - if (start > this.length) { - start = this.length - 1; - } - if (start < 0) { - start = this.length + start; - } - let walker = this.head; - for (let i2 = 0; !!walker && i2 < start; i2++) { - walker = walker.next; - } - const ret = []; - for (let i2 = 0; !!walker && i2 < deleteCount; i2++) { - ret.push(walker.value); - walker = this.removeNode(walker); - } - if (!walker) { - walker = this.tail; - } else if (walker !== this.tail) { - walker = walker.prev; - } - for (const v of nodes) { - walker = insertAfter(this, walker, v); - } - return ret; - } - reverse() { - const head = this.head; - const tail = this.tail; - for (let walker = head; !!walker; walker = walker.prev) { - const p = walker.prev; - walker.prev = walker.next; - walker.next = p; - } - this.head = tail; - this.tail = head; - return this; - } -}; -function insertAfter(self2, node, value) { - const prev = node; - const next = node ? node.next : self2.head; - const inserted = new Node(value, prev, next, self2); - if (inserted.next === void 0) { - self2.tail = inserted; - } - if (inserted.prev === void 0) { - self2.head = inserted; - } - self2.length++; - return inserted; -} -function push(self2, item) { - self2.tail = new Node(item, self2.tail, void 0, self2); - if (!self2.head) { - self2.head = self2.tail; - } - self2.length++; -} -function unshift(self2, item) { - self2.head = new Node(item, void 0, self2.head, self2); - if (!self2.tail) { - self2.tail = self2.head; - } - self2.length++; -} -var Node = class { - list; - next; - prev; - value; - constructor(value, prev, next, list2) { - this.list = list2; - this.value = value; - if (prev) { - prev.next = this; - this.prev = prev; - } else { - this.prev = void 0; - } - if (next) { - next.prev = this; - this.next = next; - } else { - this.next = void 0; - } - } -}; - -// node_modules/tar/dist/esm/header.js -var import_node_path = require("node:path"); - -// node_modules/tar/dist/esm/large-numbers.js -var encode = (num, buf) => { - if (!Number.isSafeInteger(num)) { - throw Error("cannot encode number outside of javascript safe integer range"); - } else if (num < 0) { - encodeNegative(num, buf); - } else { - encodePositive(num, buf); - } - return buf; -}; -var encodePositive = (num, buf) => { - buf[0] = 128; - for (var i2 = buf.length; i2 > 1; i2--) { - buf[i2 - 1] = num & 255; - num = Math.floor(num / 256); - } -}; -var encodeNegative = (num, buf) => { - buf[0] = 255; - var flipped = false; - num = num * -1; - for (var i2 = buf.length; i2 > 1; i2--) { - var byte = num & 255; - num = Math.floor(num / 256); - if (flipped) { - buf[i2 - 1] = onesComp(byte); - } else if (byte === 0) { - buf[i2 - 1] = 0; - } else { - flipped = true; - buf[i2 - 1] = twosComp(byte); - } - } -}; -var parse = (buf) => { - const pre = buf[0]; - const value = pre === 128 ? pos(buf.subarray(1, buf.length)) : pre === 255 ? twos(buf) : null; - if (value === null) { - throw Error("invalid base256 encoding"); - } - if (!Number.isSafeInteger(value)) { - throw Error("parsed number outside of javascript safe integer range"); - } - return value; -}; -var twos = (buf) => { - var len = buf.length; - var sum = 0; - var flipped = false; - for (var i2 = len - 1; i2 > -1; i2--) { - var byte = Number(buf[i2]); - var f3; - if (flipped) { - f3 = onesComp(byte); - } else if (byte === 0) { - f3 = byte; - } else { - flipped = true; - f3 = twosComp(byte); - } - if (f3 !== 0) { - sum -= f3 * Math.pow(256, len - i2 - 1); - } - } - return sum; -}; -var pos = (buf) => { - var len = buf.length; - var sum = 0; - for (var i2 = len - 1; i2 > -1; i2--) { - var byte = Number(buf[i2]); - if (byte !== 0) { - sum += byte * Math.pow(256, len - i2 - 1); - } - } - return sum; -}; -var onesComp = (byte) => (255 ^ byte) & 255; -var twosComp = (byte) => (255 ^ byte) + 1 & 255; - -// node_modules/tar/dist/esm/types.js -var isCode = (c) => name.has(c); -var name = /* @__PURE__ */ new Map([ - ["0", "File"], - // same as File - ["", "OldFile"], - ["1", "Link"], - ["2", "SymbolicLink"], - // Devices and FIFOs aren't fully supported - // they are parsed, but skipped when unpacking - ["3", "CharacterDevice"], - ["4", "BlockDevice"], - ["5", "Directory"], - ["6", "FIFO"], - // same as File - ["7", "ContiguousFile"], - // pax headers - ["g", "GlobalExtendedHeader"], - ["x", "ExtendedHeader"], - // vendor-specific stuff - // skip - ["A", "SolarisACL"], - // like 5, but with data, which should be skipped - ["D", "GNUDumpDir"], - // metadata only, skip - ["I", "Inode"], - // data = link path of next file - ["K", "NextFileHasLongLinkpath"], - // data = path of next file - ["L", "NextFileHasLongPath"], - // skip - ["M", "ContinuationFile"], - // like L - ["N", "OldGnuLongPath"], - // skip - ["S", "SparseFile"], - // skip - ["V", "TapeVolumeHeader"], - // like x - ["X", "OldExtendedHeader"] -]); -var code = new Map(Array.from(name).map((kv) => [kv[1], kv[0]])); - -// node_modules/tar/dist/esm/header.js -var Header = class { - cksumValid = false; - needPax = false; - nullBlock = false; - block; - path; - mode; - uid; - gid; - size; - cksum; - #type = "Unsupported"; - linkpath; - uname; - gname; - devmaj = 0; - devmin = 0; - atime; - ctime; - mtime; - charset; - comment; - constructor(data, off = 0, ex, gex) { - if (Buffer.isBuffer(data)) { - this.decode(data, off || 0, ex, gex); - } else if (data) { - this.#slurp(data); - } - } - decode(buf, off, ex, gex) { - if (!off) { - off = 0; - } - if (!buf || !(buf.length >= off + 512)) { - throw new Error("need 512 bytes for header"); - } - this.path = decString(buf, off, 100); - this.mode = decNumber(buf, off + 100, 8); - this.uid = decNumber(buf, off + 108, 8); - this.gid = decNumber(buf, off + 116, 8); - this.size = decNumber(buf, off + 124, 12); - this.mtime = decDate(buf, off + 136, 12); - this.cksum = decNumber(buf, off + 148, 12); - if (gex) - this.#slurp(gex, true); - if (ex) - this.#slurp(ex); - const t2 = decString(buf, off + 156, 1); - if (isCode(t2)) { - this.#type = t2 || "0"; - } - if (this.#type === "0" && this.path.slice(-1) === "/") { - this.#type = "5"; - } - if (this.#type === "5") { - this.size = 0; - } - this.linkpath = decString(buf, off + 157, 100); - if (buf.subarray(off + 257, off + 265).toString() === "ustar\x0000") { - this.uname = decString(buf, off + 265, 32); - this.gname = decString(buf, off + 297, 32); - this.devmaj = decNumber(buf, off + 329, 8) ?? 0; - this.devmin = decNumber(buf, off + 337, 8) ?? 0; - if (buf[off + 475] !== 0) { - const prefix = decString(buf, off + 345, 155); - this.path = prefix + "/" + this.path; - } else { - const prefix = decString(buf, off + 345, 130); - if (prefix) { - this.path = prefix + "/" + this.path; - } - this.atime = decDate(buf, off + 476, 12); - this.ctime = decDate(buf, off + 488, 12); - } - } - let sum = 8 * 32; - for (let i2 = off; i2 < off + 148; i2++) { - sum += buf[i2]; - } - for (let i2 = off + 156; i2 < off + 512; i2++) { - sum += buf[i2]; - } - this.cksumValid = sum === this.cksum; - if (this.cksum === void 0 && sum === 8 * 32) { - this.nullBlock = true; - } - } - #slurp(ex, gex = false) { - Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { - return !(v === null || v === void 0 || k === "path" && gex || k === "linkpath" && gex || k === "global"); - }))); - } - encode(buf, off = 0) { - if (!buf) { - buf = this.block = Buffer.alloc(512); - } - if (this.#type === "Unsupported") { - this.#type = "0"; - } - if (!(buf.length >= off + 512)) { - throw new Error("need 512 bytes for header"); - } - const prefixSize = this.ctime || this.atime ? 130 : 155; - const split = splitPrefix(this.path || "", prefixSize); - const path9 = split[0]; - const prefix = split[1]; - this.needPax = !!split[2]; - this.needPax = encString(buf, off, 100, path9) || this.needPax; - this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax; - this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax; - this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax; - this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax; - this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax; - buf[off + 156] = this.#type.charCodeAt(0); - this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax; - buf.write("ustar\x0000", off + 257, 8); - this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax; - this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax; - this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax; - this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax; - this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax; - if (buf[off + 475] !== 0) { - this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax; - } else { - this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax; - this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax; - this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax; - } - let sum = 8 * 32; - for (let i2 = off; i2 < off + 148; i2++) { - sum += buf[i2]; - } - for (let i2 = off + 156; i2 < off + 512; i2++) { - sum += buf[i2]; - } - this.cksum = sum; - encNumber(buf, off + 148, 8, this.cksum); - this.cksumValid = true; - return this.needPax; - } - get type() { - return this.#type === "Unsupported" ? this.#type : name.get(this.#type); - } - get typeKey() { - return this.#type; - } - set type(type) { - const c = String(code.get(type)); - if (isCode(c) || c === "Unsupported") { - this.#type = c; - } else if (isCode(type)) { - this.#type = type; - } else { - throw new TypeError("invalid entry type: " + type); - } - } -}; -var splitPrefix = (p, prefixSize) => { - const pathSize = 100; - let pp = p; - let prefix = ""; - let ret = void 0; - const root = import_node_path.posix.parse(p).root || "."; - if (Buffer.byteLength(pp) < pathSize) { - ret = [pp, prefix, false]; - } else { - prefix = import_node_path.posix.dirname(pp); - pp = import_node_path.posix.basename(pp); - do { - if (Buffer.byteLength(pp) <= pathSize && Buffer.byteLength(prefix) <= prefixSize) { - ret = [pp, prefix, false]; - } else if (Buffer.byteLength(pp) > pathSize && Buffer.byteLength(prefix) <= prefixSize) { - ret = [pp.slice(0, pathSize - 1), prefix, true]; - } else { - pp = import_node_path.posix.join(import_node_path.posix.basename(prefix), pp); - prefix = import_node_path.posix.dirname(prefix); - } - } while (prefix !== root && ret === void 0); - if (!ret) { - ret = [p.slice(0, pathSize - 1), "", true]; - } - } - return ret; -}; -var decString = (buf, off, size) => buf.subarray(off, off + size).toString("utf8").replace(/\0.*/, ""); -var decDate = (buf, off, size) => numToDate(decNumber(buf, off, size)); -var numToDate = (num) => num === void 0 ? void 0 : new Date(num * 1e3); -var decNumber = (buf, off, size) => Number(buf[off]) & 128 ? parse(buf.subarray(off, off + size)) : decSmallNumber(buf, off, size); -var nanUndef = (value) => isNaN(value) ? void 0 : value; -var decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf.subarray(off, off + size).toString("utf8").replace(/\0.*$/, "").trim(), 8)); -var MAXNUM = { - 12: 8589934591, - 8: 2097151 -}; -var encNumber = (buf, off, size, num) => num === void 0 ? false : num > MAXNUM[size] || num < 0 ? (encode(num, buf.subarray(off, off + size)), true) : (encSmallNumber(buf, off, size, num), false); -var encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, "ascii"); -var octalString = (num, size) => padOctal(Math.floor(num).toString(8), size); -var padOctal = (str, size) => (str.length === size - 1 ? str : new Array(size - str.length - 1).join("0") + str + " ") + "\0"; -var encDate = (buf, off, size, date) => date === void 0 ? false : encNumber(buf, off, size, date.getTime() / 1e3); -var NULLS = new Array(156).join("\0"); -var encString = (buf, off, size, str) => str === void 0 ? false : (buf.write(str + NULLS, off, size, "utf8"), str.length !== Buffer.byteLength(str) || str.length > size); - -// node_modules/tar/dist/esm/pax.js -var import_node_path2 = require("node:path"); -var Pax = class _Pax { - atime; - mtime; - ctime; - charset; - comment; - gid; - uid; - gname; - uname; - linkpath; - dev; - ino; - nlink; - path; - size; - mode; - global; - constructor(obj, global2 = false) { - this.atime = obj.atime; - this.charset = obj.charset; - this.comment = obj.comment; - this.ctime = obj.ctime; - this.dev = obj.dev; - this.gid = obj.gid; - this.global = global2; - this.gname = obj.gname; - this.ino = obj.ino; - this.linkpath = obj.linkpath; - this.mtime = obj.mtime; - this.nlink = obj.nlink; - this.path = obj.path; - this.size = obj.size; - this.uid = obj.uid; - this.uname = obj.uname; - } - encode() { - const body = this.encodeBody(); - if (body === "") { - return Buffer.allocUnsafe(0); - } - const bodyLen = Buffer.byteLength(body); - const bufLen = 512 * Math.ceil(1 + bodyLen / 512); - const buf = Buffer.allocUnsafe(bufLen); - for (let i2 = 0; i2 < 512; i2++) { - buf[i2] = 0; - } - new Header({ - // XXX split the path - // then the path should be PaxHeader + basename, but less than 99, - // prepend with the dirname - /* c8 ignore start */ - path: ("PaxHeader/" + (0, import_node_path2.basename)(this.path ?? "")).slice(0, 99), - /* c8 ignore stop */ - mode: this.mode || 420, - uid: this.uid, - gid: this.gid, - size: bodyLen, - mtime: this.mtime, - type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader", - linkpath: "", - uname: this.uname || "", - gname: this.gname || "", - devmaj: 0, - devmin: 0, - atime: this.atime, - ctime: this.ctime - }).encode(buf); - buf.write(body, 512, bodyLen, "utf8"); - for (let i2 = bodyLen + 512; i2 < buf.length; i2++) { - buf[i2] = 0; - } - return buf; - } - encodeBody() { - return this.encodeField("path") + this.encodeField("ctime") + this.encodeField("atime") + this.encodeField("dev") + this.encodeField("ino") + this.encodeField("nlink") + this.encodeField("charset") + this.encodeField("comment") + this.encodeField("gid") + this.encodeField("gname") + this.encodeField("linkpath") + this.encodeField("mtime") + this.encodeField("size") + this.encodeField("uid") + this.encodeField("uname"); - } - encodeField(field) { - if (this[field] === void 0) { - return ""; - } - const r2 = this[field]; - const v = r2 instanceof Date ? r2.getTime() / 1e3 : r2; - const s2 = " " + (field === "dev" || field === "ino" || field === "nlink" ? "SCHILY." : "") + field + "=" + v + "\n"; - const byteLen = Buffer.byteLength(s2); - let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1; - if (byteLen + digits >= Math.pow(10, digits)) { - digits += 1; - } - const len = digits + byteLen; - return len + s2; - } - static parse(str, ex, g = false) { - return new _Pax(merge(parseKV(str), ex), g); - } -}; -var merge = (a, b) => b ? Object.assign({}, b, a) : a; -var parseKV = (str) => str.replace(/\n$/, "").split("\n").reduce(parseKVLine, /* @__PURE__ */ Object.create(null)); -var parseKVLine = (set, line) => { - const n = parseInt(line, 10); - if (n !== Buffer.byteLength(line) + 1) { - return set; - } - line = line.slice((n + " ").length); - const kv = line.split("="); - const r2 = kv.shift(); - if (!r2) { - return set; - } - const k = r2.replace(/^SCHILY\.(dev|ino|nlink)/, "$1"); - const v = kv.join("="); - set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? new Date(Number(v) * 1e3) : /^[0-9]+$/.test(v) ? +v : v; - return set; -}; - -// node_modules/tar/node_modules/minipass/dist/esm/index.js -var import_node_events3 = require("node:events"); -var import_node_stream3 = __toESM(require("node:stream"), 1); -var import_node_string_decoder3 = require("node:string_decoder"); -var proc3 = typeof process === "object" && process ? process : { - stdout: null, - stderr: null -}; -var isStream3 = (s2) => !!s2 && typeof s2 === "object" && (s2 instanceof Minipass3 || s2 instanceof import_node_stream3.default || isReadable3(s2) || isWritable3(s2)); -var isReadable3 = (s2) => !!s2 && typeof s2 === "object" && s2 instanceof import_node_events3.EventEmitter && typeof s2.pipe === "function" && // node core Writable streams have a pipe() method, but it throws -s2.pipe !== import_node_stream3.default.Writable.prototype.pipe; -var isWritable3 = (s2) => !!s2 && typeof s2 === "object" && s2 instanceof import_node_events3.EventEmitter && typeof s2.write === "function" && typeof s2.end === "function"; -var EOF3 = Symbol("EOF"); -var MAYBE_EMIT_END3 = Symbol("maybeEmitEnd"); -var EMITTED_END3 = Symbol("emittedEnd"); -var EMITTING_END3 = Symbol("emittingEnd"); -var EMITTED_ERROR3 = Symbol("emittedError"); -var CLOSED3 = Symbol("closed"); -var READ3 = Symbol("read"); -var FLUSH3 = Symbol("flush"); -var FLUSHCHUNK3 = Symbol("flushChunk"); -var ENCODING3 = Symbol("encoding"); -var DECODER3 = Symbol("decoder"); -var FLOWING3 = Symbol("flowing"); -var PAUSED3 = Symbol("paused"); -var RESUME3 = Symbol("resume"); -var BUFFER3 = Symbol("buffer"); -var PIPES3 = Symbol("pipes"); -var BUFFERLENGTH3 = Symbol("bufferLength"); -var BUFFERPUSH3 = Symbol("bufferPush"); -var BUFFERSHIFT3 = Symbol("bufferShift"); -var OBJECTMODE3 = Symbol("objectMode"); -var DESTROYED3 = Symbol("destroyed"); -var ERROR3 = Symbol("error"); -var EMITDATA3 = Symbol("emitData"); -var EMITEND4 = Symbol("emitEnd"); -var EMITEND23 = Symbol("emitEnd2"); -var ASYNC3 = Symbol("async"); -var ABORT3 = Symbol("abort"); -var ABORTED3 = Symbol("aborted"); -var SIGNAL3 = Symbol("signal"); -var DATALISTENERS3 = Symbol("dataListeners"); -var DISCARDED3 = Symbol("discarded"); -var defer3 = (fn) => Promise.resolve().then(fn); -var nodefer3 = (fn) => fn(); -var isEndish3 = (ev) => ev === "end" || ev === "finish" || ev === "prefinish"; -var isArrayBufferLike3 = (b) => b instanceof ArrayBuffer || !!b && typeof b === "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0; -var isArrayBufferView3 = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); -var Pipe3 = class { - src; - dest; - opts; - ondrain; - constructor(src, dest, opts) { - this.src = src; - this.dest = dest; - this.opts = opts; - this.ondrain = () => src[RESUME3](); - 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 PipeProxyErrors3 = class extends Pipe3 { - unpipe() { - this.src.removeListener("error", this.proxyErrors); - super.unpipe(); - } - constructor(src, dest, opts) { - super(src, dest, opts); - this.proxyErrors = (er) => dest.emit("error", er); - src.on("error", this.proxyErrors); - } -}; -var isObjectModeOptions3 = (o) => !!o.objectMode; -var isEncodingOptions3 = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer"; -var Minipass3 = class extends import_node_events3.EventEmitter { - [FLOWING3] = false; - [PAUSED3] = false; - [PIPES3] = []; - [BUFFER3] = []; - [OBJECTMODE3]; - [ENCODING3]; - [ASYNC3]; - [DECODER3]; - [EOF3] = false; - [EMITTED_END3] = false; - [EMITTING_END3] = false; - [CLOSED3] = false; - [EMITTED_ERROR3] = null; - [BUFFERLENGTH3] = 0; - [DESTROYED3] = false; - [SIGNAL3]; - [ABORTED3] = false; - [DATALISTENERS3] = 0; - [DISCARDED3] = 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 (isObjectModeOptions3(options)) { - this[OBJECTMODE3] = true; - this[ENCODING3] = null; - } else if (isEncodingOptions3(options)) { - this[ENCODING3] = options.encoding; - this[OBJECTMODE3] = false; - } else { - this[OBJECTMODE3] = false; - this[ENCODING3] = null; - } - this[ASYNC3] = !!options.async; - this[DECODER3] = this[ENCODING3] ? new import_node_string_decoder3.StringDecoder(this[ENCODING3]) : null; - if (options && options.debugExposeBuffer === true) { - Object.defineProperty(this, "buffer", { get: () => this[BUFFER3] }); - } - if (options && options.debugExposePipes === true) { - Object.defineProperty(this, "pipes", { get: () => this[PIPES3] }); - } - const { signal } = options; - if (signal) { - this[SIGNAL3] = signal; - if (signal.aborted) { - this[ABORT3](); - } else { - signal.addEventListener("abort", () => this[ABORT3]()); - } - } - } - /** - * 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[BUFFERLENGTH3]; - } - /** - * The `BufferEncoding` currently in use, or `null` - */ - get encoding() { - return this[ENCODING3]; - } - /** - * @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[OBJECTMODE3]; - } - /** - * @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[ASYNC3]; - } - /** - * 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[ASYNC3] = this[ASYNC3] || !!a; - } - // drop everything and get out of the flow completely - [ABORT3]() { - this[ABORTED3] = true; - this.emit("abort", this[SIGNAL3]?.reason); - this.destroy(this[SIGNAL3]?.reason); - } - /** - * True if the stream has been aborted. - */ - get aborted() { - return this[ABORTED3]; - } - /** - * No-op setter. Stream aborted status is set via the AbortSignal provided - * in the constructor options. - */ - set aborted(_) { - } - write(chunk, encoding, cb) { - if (this[ABORTED3]) - return false; - if (this[EOF3]) - throw new Error("write after end"); - if (this[DESTROYED3]) { - 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[ASYNC3] ? defer3 : nodefer3; - if (!this[OBJECTMODE3] && !Buffer.isBuffer(chunk)) { - if (isArrayBufferView3(chunk)) { - chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); - } else if (isArrayBufferLike3(chunk)) { - chunk = Buffer.from(chunk); - } else if (typeof chunk !== "string") { - throw new Error("Non-contiguous data written to non-objectMode stream"); - } - } - if (this[OBJECTMODE3]) { - if (this[FLOWING3] && this[BUFFERLENGTH3] !== 0) - this[FLUSH3](true); - if (this[FLOWING3]) - this.emit("data", chunk); - else - this[BUFFERPUSH3](chunk); - if (this[BUFFERLENGTH3] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING3]; - } - if (!chunk.length) { - if (this[BUFFERLENGTH3] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING3]; - } - if (typeof chunk === "string" && // unless it is a string already ready for us to use - !(encoding === this[ENCODING3] && !this[DECODER3]?.lastNeed)) { - chunk = Buffer.from(chunk, encoding); - } - if (Buffer.isBuffer(chunk) && this[ENCODING3]) { - chunk = this[DECODER3].write(chunk); - } - if (this[FLOWING3] && this[BUFFERLENGTH3] !== 0) - this[FLUSH3](true); - if (this[FLOWING3]) - this.emit("data", chunk); - else - this[BUFFERPUSH3](chunk); - if (this[BUFFERLENGTH3] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING3]; - } - /** - * 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[DESTROYED3]) - return null; - this[DISCARDED3] = false; - if (this[BUFFERLENGTH3] === 0 || n === 0 || n && n > this[BUFFERLENGTH3]) { - this[MAYBE_EMIT_END3](); - return null; - } - if (this[OBJECTMODE3]) - n = null; - if (this[BUFFER3].length > 1 && !this[OBJECTMODE3]) { - this[BUFFER3] = [ - this[ENCODING3] ? this[BUFFER3].join("") : Buffer.concat(this[BUFFER3], this[BUFFERLENGTH3]) - ]; - } - const ret = this[READ3](n || null, this[BUFFER3][0]); - this[MAYBE_EMIT_END3](); - return ret; - } - [READ3](n, chunk) { - if (this[OBJECTMODE3]) - this[BUFFERSHIFT3](); - else { - const c = chunk; - if (n === c.length || n === null) - this[BUFFERSHIFT3](); - else if (typeof c === "string") { - this[BUFFER3][0] = c.slice(n); - chunk = c.slice(0, n); - this[BUFFERLENGTH3] -= n; - } else { - this[BUFFER3][0] = c.subarray(n); - chunk = c.subarray(0, n); - this[BUFFERLENGTH3] -= n; - } - } - this.emit("data", chunk); - if (!this[BUFFER3].length && !this[EOF3]) - 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[EOF3] = true; - this.writable = false; - if (this[FLOWING3] || !this[PAUSED3]) - this[MAYBE_EMIT_END3](); - return this; - } - // don't let the internal resume be overwritten - [RESUME3]() { - if (this[DESTROYED3]) - return; - if (!this[DATALISTENERS3] && !this[PIPES3].length) { - this[DISCARDED3] = true; - } - this[PAUSED3] = false; - this[FLOWING3] = true; - this.emit("resume"); - if (this[BUFFER3].length) - this[FLUSH3](); - else if (this[EOF3]) - this[MAYBE_EMIT_END3](); - 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[RESUME3](); - } - /** - * Pause the stream - */ - pause() { - this[FLOWING3] = false; - this[PAUSED3] = true; - this[DISCARDED3] = false; - } - /** - * true if the stream has been forcibly destroyed - */ - get destroyed() { - return this[DESTROYED3]; - } - /** - * true if the stream is currently in a flowing state, meaning that - * any writes will be immediately emitted. - */ - get flowing() { - return this[FLOWING3]; - } - /** - * true if the stream is currently in a paused state - */ - get paused() { - return this[PAUSED3]; - } - [BUFFERPUSH3](chunk) { - if (this[OBJECTMODE3]) - this[BUFFERLENGTH3] += 1; - else - this[BUFFERLENGTH3] += chunk.length; - this[BUFFER3].push(chunk); - } - [BUFFERSHIFT3]() { - if (this[OBJECTMODE3]) - this[BUFFERLENGTH3] -= 1; - else - this[BUFFERLENGTH3] -= this[BUFFER3][0].length; - return this[BUFFER3].shift(); - } - [FLUSH3](noDrain = false) { - do { - } while (this[FLUSHCHUNK3](this[BUFFERSHIFT3]()) && this[BUFFER3].length); - if (!noDrain && !this[BUFFER3].length && !this[EOF3]) - this.emit("drain"); - } - [FLUSHCHUNK3](chunk) { - this.emit("data", chunk); - return this[FLOWING3]; - } - /** - * Pipe all data emitted by this stream into the destination provided. - * - * Triggers the flow of data. - */ - pipe(dest, opts) { - if (this[DESTROYED3]) - return dest; - this[DISCARDED3] = false; - const ended = this[EMITTED_END3]; - opts = opts || {}; - if (dest === proc3.stdout || dest === proc3.stderr) - opts.end = false; - else - opts.end = opts.end !== false; - opts.proxyErrors = !!opts.proxyErrors; - if (ended) { - if (opts.end) - dest.end(); - } else { - this[PIPES3].push(!opts.proxyErrors ? new Pipe3(this, dest, opts) : new PipeProxyErrors3(this, dest, opts)); - if (this[ASYNC3]) - defer3(() => this[RESUME3]()); - else - this[RESUME3](); - } - 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[PIPES3].find((p2) => p2.dest === dest); - if (p) { - if (this[PIPES3].length === 1) { - if (this[FLOWING3] && this[DATALISTENERS3] === 0) { - this[FLOWING3] = false; - } - this[PIPES3] = []; - } else - this[PIPES3].splice(this[PIPES3].indexOf(p), 1); - p.unpipe(); - } - } - /** - * Alias for {@link Minipass#on} - */ - addListener(ev, handler) { - return this.on(ev, handler); - } - /** - * 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, handler) { - const ret = super.on(ev, handler); - if (ev === "data") { - this[DISCARDED3] = false; - this[DATALISTENERS3]++; - if (!this[PIPES3].length && !this[FLOWING3]) { - this[RESUME3](); - } - } else if (ev === "readable" && this[BUFFERLENGTH3] !== 0) { - super.emit("readable"); - } else if (isEndish3(ev) && this[EMITTED_END3]) { - super.emit(ev); - this.removeAllListeners(ev); - } else if (ev === "error" && this[EMITTED_ERROR3]) { - const h2 = handler; - if (this[ASYNC3]) - defer3(() => h2.call(this, this[EMITTED_ERROR3])); - else - h2.call(this, this[EMITTED_ERROR3]); - } - return ret; - } - /** - * Alias for {@link Minipass#off} - */ - removeListener(ev, handler) { - return this.off(ev, handler); - } - /** - * 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, handler) { - const ret = super.off(ev, handler); - if (ev === "data") { - this[DATALISTENERS3] = this.listeners("data").length; - if (this[DATALISTENERS3] === 0 && !this[DISCARDED3] && !this[PIPES3].length) { - this[FLOWING3] = false; - } - } - return ret; - } - /** - * 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[DATALISTENERS3] = 0; - if (!this[DISCARDED3] && !this[PIPES3].length) { - this[FLOWING3] = false; - } - } - return ret; - } - /** - * true if the 'end' event has been emitted - */ - get emittedEnd() { - return this[EMITTED_END3]; - } - [MAYBE_EMIT_END3]() { - if (!this[EMITTING_END3] && !this[EMITTED_END3] && !this[DESTROYED3] && this[BUFFER3].length === 0 && this[EOF3]) { - this[EMITTING_END3] = true; - this.emit("end"); - this.emit("prefinish"); - this.emit("finish"); - if (this[CLOSED3]) - this.emit("close"); - this[EMITTING_END3] = false; - } - } - /** - * 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 !== DESTROYED3 && this[DESTROYED3]) { - return false; - } else if (ev === "data") { - return !this[OBJECTMODE3] && !data ? false : this[ASYNC3] ? (defer3(() => this[EMITDATA3](data)), true) : this[EMITDATA3](data); - } else if (ev === "end") { - return this[EMITEND4](); - } else if (ev === "close") { - this[CLOSED3] = true; - if (!this[EMITTED_END3] && !this[DESTROYED3]) - return false; - const ret2 = super.emit("close"); - this.removeAllListeners("close"); - return ret2; - } else if (ev === "error") { - this[EMITTED_ERROR3] = data; - super.emit(ERROR3, data); - const ret2 = !this[SIGNAL3] || this.listeners("error").length ? super.emit("error", data) : false; - this[MAYBE_EMIT_END3](); - return ret2; - } else if (ev === "resume") { - const ret2 = super.emit("resume"); - this[MAYBE_EMIT_END3](); - 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_END3](); - return ret; - } - [EMITDATA3](data) { - for (const p of this[PIPES3]) { - if (p.dest.write(data) === false) - this.pause(); - } - const ret = this[DISCARDED3] ? false : super.emit("data", data); - this[MAYBE_EMIT_END3](); - return ret; - } - [EMITEND4]() { - if (this[EMITTED_END3]) - return false; - this[EMITTED_END3] = true; - this.readable = false; - return this[ASYNC3] ? (defer3(() => this[EMITEND23]()), true) : this[EMITEND23](); - } - [EMITEND23]() { - if (this[DECODER3]) { - const data = this[DECODER3].end(); - if (data) { - for (const p of this[PIPES3]) { - p.dest.write(data); - } - if (!this[DISCARDED3]) - super.emit("data", data); - } - } - for (const p of this[PIPES3]) { - 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[OBJECTMODE3]) - buf.dataLength = 0; - const p = this.promise(); - this.on("data", (c) => { - buf.push(c); - if (!this[OBJECTMODE3]) - 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[OBJECTMODE3]) { - throw new Error("cannot concat in objectMode"); - } - const buf = await this.collect(); - return this[ENCODING3] ? buf.join("") : Buffer.concat(buf, buf.dataLength); - } - /** - * Return a void Promise that resolves once the stream ends. - */ - async promise() { - return new Promise((resolve2, reject) => { - this.on(DESTROYED3, () => reject(new Error("stream destroyed"))); - this.on("error", (er) => reject(er)); - this.on("end", () => resolve2()); - }); - } - /** - * Asynchronous `for await of` iteration. - * - * This will continue emitting all chunks until the stream terminates. - */ - [Symbol.asyncIterator]() { - this[DISCARDED3] = 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[EOF3]) - return stop(); - let resolve2; - let reject; - const onerr = (er) => { - this.off("data", ondata); - this.off("end", onend); - this.off(DESTROYED3, ondestroy); - stop(); - reject(er); - }; - const ondata = (value) => { - this.off("error", onerr); - this.off("end", onend); - this.off(DESTROYED3, ondestroy); - this.pause(); - resolve2({ value, done: !!this[EOF3] }); - }; - const onend = () => { - this.off("error", onerr); - this.off("data", ondata); - this.off(DESTROYED3, ondestroy); - stop(); - resolve2({ done: true, value: void 0 }); - }; - const ondestroy = () => onerr(new Error("stream destroyed")); - return new Promise((res2, rej) => { - reject = rej; - resolve2 = res2; - this.once(DESTROYED3, ondestroy); - this.once("error", onerr); - this.once("end", onend); - this.once("data", ondata); - }); - }; - return { - next, - throw: stop, - return: stop, - [Symbol.asyncIterator]() { - return this; - } - }; - } - /** - * 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[DISCARDED3] = false; - let stopped = false; - const stop = () => { - this.pause(); - this.off(ERROR3, stop); - this.off(DESTROYED3, 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(ERROR3, stop); - this.once(DESTROYED3, stop); - return { - next, - throw: stop, - return: stop, - [Symbol.iterator]() { - return this; - } - }; - } - /** - * 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[DESTROYED3]) { - if (er) - this.emit("error", er); - else - this.emit(DESTROYED3); - return this; - } - this[DESTROYED3] = true; - this[DISCARDED3] = true; - this[BUFFER3].length = 0; - this[BUFFERLENGTH3] = 0; - const wc = this; - if (typeof wc.close === "function" && !this[CLOSED3]) - wc.close(); - if (er) - this.emit("error", er); - else - this.emit(DESTROYED3); - return this; - } - /** - * Alias for {@link isStream} - * - * Former export location, maintained for backwards compatibility. - * - * @deprecated - */ - static get isStream() { - return isStream3; - } -}; - -// node_modules/tar/dist/esm/normalize-windows-path.js -var platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -var normalizeWindowsPath = platform !== "win32" ? (p) => p : (p) => p && p.replace(/\\/g, "/"); - -// node_modules/tar/dist/esm/read-entry.js -var ReadEntry = class extends Minipass3 { - extended; - globalExtended; - header; - startBlockSize; - blockRemain; - remain; - type; - meta = false; - ignore = false; - path; - mode; - uid; - gid; - uname; - gname; - size = 0; - mtime; - atime; - ctime; - linkpath; - dev; - ino; - nlink; - invalid = false; - absolute; - unsupported = false; - constructor(header, ex, gex) { - super({}); - this.pause(); - this.extended = ex; - this.globalExtended = gex; - this.header = header; - this.remain = header.size ?? 0; - this.startBlockSize = 512 * Math.ceil(this.remain / 512); - this.blockRemain = this.startBlockSize; - this.type = header.type; - switch (this.type) { - case "File": - case "OldFile": - case "Link": - case "SymbolicLink": - case "CharacterDevice": - case "BlockDevice": - case "Directory": - case "FIFO": - case "ContiguousFile": - case "GNUDumpDir": - break; - case "NextFileHasLongLinkpath": - case "NextFileHasLongPath": - case "OldGnuLongPath": - case "GlobalExtendedHeader": - case "ExtendedHeader": - case "OldExtendedHeader": - this.meta = true; - break; - // NOTE: gnutar and bsdtar treat unrecognized types as 'File' - // it may be worth doing the same, but with a warning. - default: - this.ignore = true; - } - if (!header.path) { - throw new Error("no path provided for tar.ReadEntry"); - } - this.path = normalizeWindowsPath(header.path); - this.mode = header.mode; - if (this.mode) { - this.mode = this.mode & 4095; - } - this.uid = header.uid; - this.gid = header.gid; - this.uname = header.uname; - this.gname = header.gname; - this.size = this.remain; - this.mtime = header.mtime; - this.atime = header.atime; - this.ctime = header.ctime; - this.linkpath = header.linkpath ? normalizeWindowsPath(header.linkpath) : void 0; - this.uname = header.uname; - this.gname = header.gname; - if (ex) { - this.#slurp(ex); - } - if (gex) { - this.#slurp(gex, true); - } - } - write(data) { - const writeLen = data.length; - if (writeLen > this.blockRemain) { - throw new Error("writing more to entry than is appropriate"); - } - const r2 = this.remain; - const br = this.blockRemain; - this.remain = Math.max(0, r2 - writeLen); - this.blockRemain = Math.max(0, br - writeLen); - if (this.ignore) { - return true; - } - if (r2 >= writeLen) { - return super.write(data); - } - return super.write(data.subarray(0, r2)); - } - #slurp(ex, gex = false) { - if (ex.path) - ex.path = normalizeWindowsPath(ex.path); - if (ex.linkpath) - ex.linkpath = normalizeWindowsPath(ex.linkpath); - Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { - return !(v === null || v === void 0 || k === "path" && gex); - }))); - } -}; - -// node_modules/tar/dist/esm/warn-method.js -var warnMethod = (self2, code2, message, data = {}) => { - if (self2.file) { - data.file = self2.file; - } - if (self2.cwd) { - data.cwd = self2.cwd; - } - data.code = message instanceof Error && message.code || code2; - data.tarCode = code2; - if (!self2.strict && data.recoverable !== false) { - if (message instanceof Error) { - data = Object.assign(message, data); - message = message.message; - } - self2.emit("warn", code2, message, data); - } else if (message instanceof Error) { - self2.emit("error", Object.assign(message, data)); - } else { - self2.emit("error", Object.assign(new Error(`${code2}: ${message}`), data)); - } -}; - -// node_modules/tar/dist/esm/parse.js -var maxMetaEntrySize = 1024 * 1024; -var gzipHeader = Buffer.from([31, 139]); -var STATE = Symbol("state"); -var WRITEENTRY = Symbol("writeEntry"); -var READENTRY = Symbol("readEntry"); -var NEXTENTRY = Symbol("nextEntry"); -var PROCESSENTRY = Symbol("processEntry"); -var EX = Symbol("extendedHeader"); -var GEX = Symbol("globalExtendedHeader"); -var META = Symbol("meta"); -var EMITMETA = Symbol("emitMeta"); -var BUFFER4 = Symbol("buffer"); -var QUEUE = Symbol("queue"); -var ENDED = Symbol("ended"); -var EMITTEDEND = Symbol("emittedEnd"); -var EMIT = Symbol("emit"); -var UNZIP = Symbol("unzip"); -var CONSUMECHUNK = Symbol("consumeChunk"); -var CONSUMECHUNKSUB = Symbol("consumeChunkSub"); -var CONSUMEBODY = Symbol("consumeBody"); -var CONSUMEMETA = Symbol("consumeMeta"); -var CONSUMEHEADER = Symbol("consumeHeader"); -var CONSUMING = Symbol("consuming"); -var BUFFERCONCAT = Symbol("bufferConcat"); -var MAYBEEND = Symbol("maybeEnd"); -var WRITING = Symbol("writing"); -var ABORTED4 = Symbol("aborted"); -var DONE = Symbol("onDone"); -var SAW_VALID_ENTRY = Symbol("sawValidEntry"); -var SAW_NULL_BLOCK = Symbol("sawNullBlock"); -var SAW_EOF = Symbol("sawEOF"); -var CLOSESTREAM = Symbol("closeStream"); -var noop2 = () => true; -var Parser = class extends import_events2.EventEmitter { - file; - strict; - maxMetaEntrySize; - filter; - brotli; - writable = true; - readable = false; - [QUEUE] = new Yallist(); - [BUFFER4]; - [READENTRY]; - [WRITEENTRY]; - [STATE] = "begin"; - [META] = ""; - [EX]; - [GEX]; - [ENDED] = false; - [UNZIP]; - [ABORTED4] = false; - [SAW_VALID_ENTRY]; - [SAW_NULL_BLOCK] = false; - [SAW_EOF] = false; - [WRITING] = false; - [CONSUMING] = false; - [EMITTEDEND] = false; - constructor(opt = {}) { - super(); - this.file = opt.file || ""; - this.on(DONE, () => { - if (this[STATE] === "begin" || this[SAW_VALID_ENTRY] === false) { - this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format"); - } - }); - if (opt.ondone) { - this.on(DONE, opt.ondone); - } else { - this.on(DONE, () => { - this.emit("prefinish"); - this.emit("finish"); - this.emit("end"); - }); - } - this.strict = !!opt.strict; - this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize; - this.filter = typeof opt.filter === "function" ? opt.filter : noop2; - const isTBR = opt.file && (opt.file.endsWith(".tar.br") || opt.file.endsWith(".tbr")); - this.brotli = !opt.gzip && opt.brotli !== void 0 ? opt.brotli : isTBR ? void 0 : false; - this.on("end", () => this[CLOSESTREAM]()); - if (typeof opt.onwarn === "function") { - this.on("warn", opt.onwarn); - } - if (typeof opt.onReadEntry === "function") { - this.on("entry", opt.onReadEntry); - } - } - warn(code2, message, data = {}) { - warnMethod(this, code2, message, data); - } - [CONSUMEHEADER](chunk, position) { - if (this[SAW_VALID_ENTRY] === void 0) { - this[SAW_VALID_ENTRY] = false; - } - let header; - try { - header = new Header(chunk, position, this[EX], this[GEX]); - } catch (er) { - return this.warn("TAR_ENTRY_INVALID", er); - } - if (header.nullBlock) { - if (this[SAW_NULL_BLOCK]) { - this[SAW_EOF] = true; - if (this[STATE] === "begin") { - this[STATE] = "header"; - } - this[EMIT]("eof"); - } else { - this[SAW_NULL_BLOCK] = true; - this[EMIT]("nullBlock"); - } - } else { - this[SAW_NULL_BLOCK] = false; - if (!header.cksumValid) { - this.warn("TAR_ENTRY_INVALID", "checksum failure", { header }); - } else if (!header.path) { - this.warn("TAR_ENTRY_INVALID", "path is required", { header }); - } else { - const type = header.type; - if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { - this.warn("TAR_ENTRY_INVALID", "linkpath required", { - header - }); - } else if (!/^(Symbolic)?Link$/.test(type) && !/^(Global)?ExtendedHeader$/.test(type) && header.linkpath) { - this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { - header - }); - } else { - const entry = this[WRITEENTRY] = new ReadEntry(header, this[EX], this[GEX]); - if (!this[SAW_VALID_ENTRY]) { - if (entry.remain) { - const onend = () => { - if (!entry.invalid) { - this[SAW_VALID_ENTRY] = true; - } - }; - entry.on("end", onend); - } else { - this[SAW_VALID_ENTRY] = true; - } - } - if (entry.meta) { - if (entry.size > this.maxMetaEntrySize) { - entry.ignore = true; - this[EMIT]("ignoredEntry", entry); - this[STATE] = "ignore"; - entry.resume(); - } else if (entry.size > 0) { - this[META] = ""; - entry.on("data", (c) => this[META] += c); - this[STATE] = "meta"; - } - } else { - this[EX] = void 0; - entry.ignore = entry.ignore || !this.filter(entry.path, entry); - if (entry.ignore) { - this[EMIT]("ignoredEntry", entry); - this[STATE] = entry.remain ? "ignore" : "header"; - entry.resume(); - } else { - if (entry.remain) { - this[STATE] = "body"; - } else { - this[STATE] = "header"; - entry.end(); - } - if (!this[READENTRY]) { - this[QUEUE].push(entry); - this[NEXTENTRY](); - } else { - this[QUEUE].push(entry); - } - } - } - } - } - } - } - [CLOSESTREAM]() { - queueMicrotask(() => this.emit("close")); - } - [PROCESSENTRY](entry) { - let go = true; - if (!entry) { - this[READENTRY] = void 0; - go = false; - } else if (Array.isArray(entry)) { - const [ev, ...args] = entry; - this.emit(ev, ...args); - } else { - this[READENTRY] = entry; - this.emit("entry", entry); - if (!entry.emittedEnd) { - entry.on("end", () => this[NEXTENTRY]()); - go = false; - } - } - return go; - } - [NEXTENTRY]() { - do { - } while (this[PROCESSENTRY](this[QUEUE].shift())); - if (!this[QUEUE].length) { - const re = this[READENTRY]; - const drainNow = !re || re.flowing || re.size === re.remain; - if (drainNow) { - if (!this[WRITING]) { - this.emit("drain"); - } - } else { - re.once("drain", () => this.emit("drain")); - } - } - } - [CONSUMEBODY](chunk, position) { - const entry = this[WRITEENTRY]; - if (!entry) { - throw new Error("attempt to consume body without entry??"); - } - const br = entry.blockRemain ?? 0; - const c = br >= chunk.length && position === 0 ? chunk : chunk.subarray(position, position + br); - entry.write(c); - if (!entry.blockRemain) { - this[STATE] = "header"; - this[WRITEENTRY] = void 0; - entry.end(); - } - return c.length; - } - [CONSUMEMETA](chunk, position) { - const entry = this[WRITEENTRY]; - const ret = this[CONSUMEBODY](chunk, position); - if (!this[WRITEENTRY] && entry) { - this[EMITMETA](entry); - } - return ret; - } - [EMIT](ev, data, extra) { - if (!this[QUEUE].length && !this[READENTRY]) { - this.emit(ev, data, extra); - } else { - this[QUEUE].push([ev, data, extra]); - } - } - [EMITMETA](entry) { - this[EMIT]("meta", this[META]); - switch (entry.type) { - case "ExtendedHeader": - case "OldExtendedHeader": - this[EX] = Pax.parse(this[META], this[EX], false); - break; - case "GlobalExtendedHeader": - this[GEX] = Pax.parse(this[META], this[GEX], true); - break; - case "NextFileHasLongPath": - case "OldGnuLongPath": { - const ex = this[EX] ?? /* @__PURE__ */ Object.create(null); - this[EX] = ex; - ex.path = this[META].replace(/\0.*/, ""); - break; - } - case "NextFileHasLongLinkpath": { - const ex = this[EX] || /* @__PURE__ */ Object.create(null); - this[EX] = ex; - ex.linkpath = this[META].replace(/\0.*/, ""); - break; - } - /* c8 ignore start */ - default: - throw new Error("unknown meta: " + entry.type); - } - } - abort(error) { - this[ABORTED4] = true; - this.emit("abort", error); - this.warn("TAR_ABORT", error, { recoverable: false }); - } - write(chunk, encoding, cb) { - if (typeof encoding === "function") { - cb = encoding; - encoding = void 0; - } - if (typeof chunk === "string") { - chunk = Buffer.from( - chunk, - /* c8 ignore next */ - typeof encoding === "string" ? encoding : "utf8" - ); - } - if (this[ABORTED4]) { - cb?.(); - return false; - } - const needSniff = this[UNZIP] === void 0 || this.brotli === void 0 && this[UNZIP] === false; - if (needSniff && chunk) { - if (this[BUFFER4]) { - chunk = Buffer.concat([this[BUFFER4], chunk]); - this[BUFFER4] = void 0; - } - if (chunk.length < gzipHeader.length) { - this[BUFFER4] = chunk; - cb?.(); - return true; - } - for (let i2 = 0; this[UNZIP] === void 0 && i2 < gzipHeader.length; i2++) { - if (chunk[i2] !== gzipHeader[i2]) { - this[UNZIP] = false; - } - } - const maybeBrotli = this.brotli === void 0; - if (this[UNZIP] === false && maybeBrotli) { - if (chunk.length < 512) { - if (this[ENDED]) { - this.brotli = true; - } else { - this[BUFFER4] = chunk; - cb?.(); - return true; - } - } else { - try { - new Header(chunk.subarray(0, 512)); - this.brotli = false; - } catch (_) { - this.brotli = true; - } - } - } - if (this[UNZIP] === void 0 || this[UNZIP] === false && this.brotli) { - const ended = this[ENDED]; - this[ENDED] = false; - this[UNZIP] = this[UNZIP] === void 0 ? new Unzip({}) : new BrotliDecompress({}); - this[UNZIP].on("data", (chunk2) => this[CONSUMECHUNK](chunk2)); - this[UNZIP].on("error", (er) => this.abort(er)); - this[UNZIP].on("end", () => { - this[ENDED] = true; - this[CONSUMECHUNK](); - }); - this[WRITING] = true; - const ret2 = !!this[UNZIP][ended ? "end" : "write"](chunk); - this[WRITING] = false; - cb?.(); - return ret2; - } - } - this[WRITING] = true; - if (this[UNZIP]) { - this[UNZIP].write(chunk); - } else { - this[CONSUMECHUNK](chunk); - } - this[WRITING] = false; - const ret = this[QUEUE].length ? false : this[READENTRY] ? this[READENTRY].flowing : true; - if (!ret && !this[QUEUE].length) { - this[READENTRY]?.once("drain", () => this.emit("drain")); - } - cb?.(); - return ret; - } - [BUFFERCONCAT](c) { - if (c && !this[ABORTED4]) { - this[BUFFER4] = this[BUFFER4] ? Buffer.concat([this[BUFFER4], c]) : c; - } - } - [MAYBEEND]() { - if (this[ENDED] && !this[EMITTEDEND] && !this[ABORTED4] && !this[CONSUMING]) { - this[EMITTEDEND] = true; - const entry = this[WRITEENTRY]; - if (entry && entry.blockRemain) { - const have = this[BUFFER4] ? this[BUFFER4].length : 0; - this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry }); - if (this[BUFFER4]) { - entry.write(this[BUFFER4]); - } - entry.end(); - } - this[EMIT](DONE); - } - } - [CONSUMECHUNK](chunk) { - if (this[CONSUMING] && chunk) { - this[BUFFERCONCAT](chunk); - } else if (!chunk && !this[BUFFER4]) { - this[MAYBEEND](); - } else if (chunk) { - this[CONSUMING] = true; - if (this[BUFFER4]) { - this[BUFFERCONCAT](chunk); - const c = this[BUFFER4]; - this[BUFFER4] = void 0; - this[CONSUMECHUNKSUB](c); - } else { - this[CONSUMECHUNKSUB](chunk); - } - while (this[BUFFER4] && this[BUFFER4]?.length >= 512 && !this[ABORTED4] && !this[SAW_EOF]) { - const c = this[BUFFER4]; - this[BUFFER4] = void 0; - this[CONSUMECHUNKSUB](c); - } - this[CONSUMING] = false; - } - if (!this[BUFFER4] || this[ENDED]) { - this[MAYBEEND](); - } - } - [CONSUMECHUNKSUB](chunk) { - let position = 0; - const length = chunk.length; - while (position + 512 <= length && !this[ABORTED4] && !this[SAW_EOF]) { - switch (this[STATE]) { - case "begin": - case "header": - this[CONSUMEHEADER](chunk, position); - position += 512; - break; - case "ignore": - case "body": - position += this[CONSUMEBODY](chunk, position); - break; - case "meta": - position += this[CONSUMEMETA](chunk, position); - break; - /* c8 ignore start */ - default: - throw new Error("invalid state: " + this[STATE]); - } - } - if (position < length) { - if (this[BUFFER4]) { - this[BUFFER4] = Buffer.concat([ - chunk.subarray(position), - this[BUFFER4] - ]); - } else { - this[BUFFER4] = chunk.subarray(position); - } - } - } - end(chunk, encoding, cb) { - if (typeof chunk === "function") { - cb = chunk; - encoding = void 0; - chunk = void 0; - } - if (typeof encoding === "function") { - cb = encoding; - encoding = void 0; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding); - } - if (cb) - this.once("finish", cb); - if (!this[ABORTED4]) { - if (this[UNZIP]) { - if (chunk) - this[UNZIP].write(chunk); - this[UNZIP].end(); - } else { - this[ENDED] = true; - if (this.brotli === void 0) - chunk = chunk || Buffer.alloc(0); - if (chunk) - this.write(chunk); - this[MAYBEEND](); - } - } - return this; - } -}; - -// node_modules/tar/dist/esm/strip-trailing-slashes.js -var stripTrailingSlashes = (str) => { - let i2 = str.length - 1; - let slashesStart = -1; - while (i2 > -1 && str.charAt(i2) === "/") { - slashesStart = i2; - i2--; - } - return slashesStart === -1 ? str : str.slice(0, slashesStart); -}; - -// node_modules/tar/dist/esm/list.js -var onReadEntryFunction = (opt) => { - const onReadEntry = opt.onReadEntry; - opt.onReadEntry = onReadEntry ? (e2) => { - onReadEntry(e2); - e2.resume(); - } : (e2) => e2.resume(); -}; -var filesFilter = (opt, files) => { - const map = new Map(files.map((f3) => [stripTrailingSlashes(f3), true])); - const filter = opt.filter; - const mapHas = (file, r2 = "") => { - const root = r2 || (0, import_path.parse)(file).root || "."; - let ret; - if (file === root) - ret = false; - else { - const m2 = map.get(file); - if (m2 !== void 0) { - ret = m2; - } else { - ret = mapHas((0, import_path.dirname)(file), root); - } - } - map.set(file, ret); - return ret; - }; - opt.filter = filter ? (file, entry) => filter(file, entry) && mapHas(stripTrailingSlashes(file)) : (file) => mapHas(stripTrailingSlashes(file)); -}; -var listFileSync = (opt) => { - const p = new Parser(opt); - const file = opt.file; - let fd; - try { - const stat3 = import_node_fs.default.statSync(file); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - if (stat3.size < readSize) { - p.end(import_node_fs.default.readFileSync(file)); - } else { - let pos2 = 0; - const buf = Buffer.allocUnsafe(readSize); - fd = import_node_fs.default.openSync(file, "r"); - while (pos2 < stat3.size) { - const bytesRead = import_node_fs.default.readSync(fd, buf, 0, readSize, pos2); - pos2 += bytesRead; - p.write(buf.subarray(0, bytesRead)); - } - p.end(); - } - } finally { - if (typeof fd === "number") { - try { - import_node_fs.default.closeSync(fd); - } catch (er) { - } - } - } -}; -var listFile = (opt, _files) => { - const parse5 = new Parser(opt); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const file = opt.file; - const p = new Promise((resolve2, reject) => { - parse5.on("error", reject); - parse5.on("end", resolve2); - import_node_fs.default.stat(file, (er, stat3) => { - if (er) { - reject(er); - } else { - const stream = new ReadStream(file, { - readSize, - size: stat3.size - }); - stream.on("error", reject); - stream.pipe(parse5); - } - }); - }); - return p; -}; -var list = makeCommand(listFileSync, listFile, (opt) => new Parser(opt), (opt) => new Parser(opt), (opt, files) => { - if (files?.length) - filesFilter(opt, files); - if (!opt.noResume) - onReadEntryFunction(opt); -}); - -// node_modules/tar/dist/esm/pack.js -var import_fs3 = __toESM(require("fs"), 1); - -// node_modules/tar/dist/esm/write-entry.js -var import_fs2 = __toESM(require("fs"), 1); -var import_path2 = __toESM(require("path"), 1); - -// node_modules/tar/dist/esm/mode-fix.js -var modeFix = (mode, isDir, portable) => { - mode &= 4095; - if (portable) { - mode = (mode | 384) & ~18; - } - if (isDir) { - if (mode & 256) { - mode |= 64; - } - if (mode & 32) { - mode |= 8; - } - if (mode & 4) { - mode |= 1; - } - } - return mode; -}; - -// node_modules/tar/dist/esm/strip-absolute-path.js -var import_node_path3 = require("node:path"); -var { isAbsolute, parse: parse3 } = import_node_path3.win32; -var stripAbsolutePath = (path9) => { - let r2 = ""; - let parsed = parse3(path9); - while (isAbsolute(path9) || parsed.root) { - const root = path9.charAt(0) === "/" && path9.slice(0, 4) !== "//?/" ? "/" : parsed.root; - path9 = path9.slice(root.length); - r2 += root; - parsed = parse3(path9); - } - return [r2, path9]; -}; - -// node_modules/tar/dist/esm/winchars.js -var raw = ["|", "<", ">", "?", ":"]; -var win = raw.map((char) => String.fromCharCode(61440 + char.charCodeAt(0))); -var toWin = new Map(raw.map((char, i2) => [char, win[i2]])); -var toRaw = new Map(win.map((char, i2) => [char, raw[i2]])); -var encode2 = (s2) => raw.reduce((s3, c) => s3.split(c).join(toWin.get(c)), s2); -var decode = (s2) => win.reduce((s3, c) => s3.split(c).join(toRaw.get(c)), s2); - -// node_modules/tar/dist/esm/write-entry.js -var prefixPath = (path9, prefix) => { - if (!prefix) { - return normalizeWindowsPath(path9); - } - path9 = normalizeWindowsPath(path9).replace(/^\.(\/|$)/, ""); - return stripTrailingSlashes(prefix) + "/" + path9; -}; -var maxReadSize = 16 * 1024 * 1024; -var PROCESS = Symbol("process"); -var FILE = Symbol("file"); -var DIRECTORY = Symbol("directory"); -var SYMLINK = Symbol("symlink"); -var HARDLINK = Symbol("hardlink"); -var HEADER = Symbol("header"); -var READ4 = Symbol("read"); -var LSTAT = Symbol("lstat"); -var ONLSTAT = Symbol("onlstat"); -var ONREAD = Symbol("onread"); -var ONREADLINK = Symbol("onreadlink"); -var OPENFILE = Symbol("openfile"); -var ONOPENFILE = Symbol("onopenfile"); -var CLOSE = Symbol("close"); -var MODE = Symbol("mode"); -var AWAITDRAIN = Symbol("awaitDrain"); -var ONDRAIN = Symbol("ondrain"); -var PREFIX = Symbol("prefix"); -var WriteEntry = class extends Minipass3 { - path; - portable; - myuid = process.getuid && process.getuid() || 0; - // until node has builtin pwnam functions, this'll have to do - myuser = process.env.USER || ""; - maxReadSize; - linkCache; - statCache; - preservePaths; - cwd; - strict; - mtime; - noPax; - noMtime; - prefix; - fd; - blockLen = 0; - blockRemain = 0; - buf; - pos = 0; - remain = 0; - length = 0; - offset = 0; - win32; - absolute; - header; - type; - linkpath; - stat; - onWriteEntry; - #hadError = false; - constructor(p, opt_ = {}) { - const opt = dealias(opt_); - super(); - this.path = normalizeWindowsPath(p); - this.portable = !!opt.portable; - this.maxReadSize = opt.maxReadSize || maxReadSize; - this.linkCache = opt.linkCache || /* @__PURE__ */ new Map(); - this.statCache = opt.statCache || /* @__PURE__ */ new Map(); - this.preservePaths = !!opt.preservePaths; - this.cwd = normalizeWindowsPath(opt.cwd || process.cwd()); - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.noMtime = !!opt.noMtime; - this.mtime = opt.mtime; - this.prefix = opt.prefix ? normalizeWindowsPath(opt.prefix) : void 0; - this.onWriteEntry = opt.onWriteEntry; - if (typeof opt.onwarn === "function") { - this.on("warn", opt.onwarn); - } - let pathWarn = false; - if (!this.preservePaths) { - const [root, stripped] = stripAbsolutePath(this.path); - if (root && typeof stripped === "string") { - this.path = stripped; - pathWarn = root; - } - } - this.win32 = !!opt.win32 || process.platform === "win32"; - if (this.win32) { - this.path = decode(this.path.replace(/\\/g, "/")); - p = p.replace(/\\/g, "/"); - } - this.absolute = normalizeWindowsPath(opt.absolute || import_path2.default.resolve(this.cwd, p)); - if (this.path === "") { - this.path = "./"; - } - if (pathWarn) { - this.warn("TAR_ENTRY_INFO", `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path - }); - } - const cs = this.statCache.get(this.absolute); - if (cs) { - this[ONLSTAT](cs); - } else { - this[LSTAT](); - } - } - warn(code2, message, data = {}) { - return warnMethod(this, code2, message, data); - } - emit(ev, ...data) { - if (ev === "error") { - this.#hadError = true; - } - return super.emit(ev, ...data); - } - [LSTAT]() { - import_fs2.default.lstat(this.absolute, (er, stat3) => { - if (er) { - return this.emit("error", er); - } - this[ONLSTAT](stat3); - }); - } - [ONLSTAT](stat3) { - this.statCache.set(this.absolute, stat3); - this.stat = stat3; - if (!stat3.isFile()) { - stat3.size = 0; - } - this.type = getType(stat3); - this.emit("stat", stat3); - this[PROCESS](); - } - [PROCESS]() { - switch (this.type) { - case "File": - return this[FILE](); - case "Directory": - return this[DIRECTORY](); - case "SymbolicLink": - return this[SYMLINK](); - // unsupported types are ignored. - default: - return this.end(); - } - } - [MODE](mode) { - return modeFix(mode, this.type === "Directory", this.portable); - } - [PREFIX](path9) { - return prefixPath(path9, this.prefix); - } - [HEADER]() { - if (!this.stat) { - throw new Error("cannot write header before stat"); - } - if (this.type === "Directory" && this.portable) { - this.noMtime = true; - } - this.onWriteEntry?.(this); - this.header = new Header({ - path: this[PREFIX](this.path), - // only apply the prefix to hard links. - linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[PREFIX](this.linkpath) : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this[MODE](this.stat.mode), - uid: this.portable ? void 0 : this.stat.uid, - gid: this.portable ? void 0 : this.stat.gid, - size: this.stat.size, - mtime: this.noMtime ? void 0 : this.mtime || this.stat.mtime, - /* c8 ignore next */ - type: this.type === "Unsupported" ? void 0 : this.type, - uname: this.portable ? void 0 : this.stat.uid === this.myuid ? this.myuser : "", - atime: this.portable ? void 0 : this.stat.atime, - ctime: this.portable ? void 0 : this.stat.ctime - }); - if (this.header.encode() && !this.noPax) { - super.write(new Pax({ - atime: this.portable ? void 0 : this.header.atime, - ctime: this.portable ? void 0 : this.header.ctime, - gid: this.portable ? void 0 : this.header.gid, - mtime: this.noMtime ? void 0 : this.mtime || this.header.mtime, - path: this[PREFIX](this.path), - linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[PREFIX](this.linkpath) : this.linkpath, - size: this.header.size, - uid: this.portable ? void 0 : this.header.uid, - uname: this.portable ? void 0 : this.header.uname, - dev: this.portable ? void 0 : this.stat.dev, - ino: this.portable ? void 0 : this.stat.ino, - nlink: this.portable ? void 0 : this.stat.nlink - }).encode()); - } - const block = this.header?.block; - if (!block) { - throw new Error("failed to encode header"); - } - super.write(block); - } - [DIRECTORY]() { - if (!this.stat) { - throw new Error("cannot create directory entry without stat"); - } - if (this.path.slice(-1) !== "/") { - this.path += "/"; - } - this.stat.size = 0; - this[HEADER](); - this.end(); - } - [SYMLINK]() { - import_fs2.default.readlink(this.absolute, (er, linkpath) => { - if (er) { - return this.emit("error", er); - } - this[ONREADLINK](linkpath); - }); - } - [ONREADLINK](linkpath) { - this.linkpath = normalizeWindowsPath(linkpath); - this[HEADER](); - this.end(); - } - [HARDLINK](linkpath) { - if (!this.stat) { - throw new Error("cannot create link entry without stat"); - } - this.type = "Link"; - this.linkpath = normalizeWindowsPath(import_path2.default.relative(this.cwd, linkpath)); - this.stat.size = 0; - this[HEADER](); - this.end(); - } - [FILE]() { - if (!this.stat) { - throw new Error("cannot create file entry without stat"); - } - if (this.stat.nlink > 1) { - const linkKey = `${this.stat.dev}:${this.stat.ino}`; - const linkpath = this.linkCache.get(linkKey); - if (linkpath?.indexOf(this.cwd) === 0) { - return this[HARDLINK](linkpath); - } - this.linkCache.set(linkKey, this.absolute); - } - this[HEADER](); - if (this.stat.size === 0) { - return this.end(); - } - this[OPENFILE](); - } - [OPENFILE]() { - import_fs2.default.open(this.absolute, "r", (er, fd) => { - if (er) { - return this.emit("error", er); - } - this[ONOPENFILE](fd); - }); - } - [ONOPENFILE](fd) { - this.fd = fd; - if (this.#hadError) { - return this[CLOSE](); - } - if (!this.stat) { - throw new Error("should stat before calling onopenfile"); - } - this.blockLen = 512 * Math.ceil(this.stat.size / 512); - this.blockRemain = this.blockLen; - const bufLen = Math.min(this.blockLen, this.maxReadSize); - this.buf = Buffer.allocUnsafe(bufLen); - this.offset = 0; - this.pos = 0; - this.remain = this.stat.size; - this.length = this.buf.length; - this[READ4](); - } - [READ4]() { - const { fd, buf, offset, length, pos: pos2 } = this; - if (fd === void 0 || buf === void 0) { - throw new Error("cannot read file without first opening"); - } - import_fs2.default.read(fd, buf, offset, length, pos2, (er, bytesRead) => { - if (er) { - return this[CLOSE](() => this.emit("error", er)); - } - this[ONREAD](bytesRead); - }); - } - /* c8 ignore start */ - [CLOSE](cb = () => { - }) { - if (this.fd !== void 0) - import_fs2.default.close(this.fd, cb); - } - [ONREAD](bytesRead) { - if (bytesRead <= 0 && this.remain > 0) { - const er = Object.assign(new Error("encountered unexpected EOF"), { - path: this.absolute, - syscall: "read", - code: "EOF" - }); - return this[CLOSE](() => this.emit("error", er)); - } - if (bytesRead > this.remain) { - const er = Object.assign(new Error("did not encounter expected EOF"), { - path: this.absolute, - syscall: "read", - code: "EOF" - }); - return this[CLOSE](() => this.emit("error", er)); - } - if (!this.buf) { - throw new Error("should have created buffer prior to reading"); - } - if (bytesRead === this.remain) { - for (let i2 = bytesRead; i2 < this.length && bytesRead < this.blockRemain; i2++) { - this.buf[i2 + this.offset] = 0; - bytesRead++; - this.remain++; - } - } - const chunk = this.offset === 0 && bytesRead === this.buf.length ? this.buf : this.buf.subarray(this.offset, this.offset + bytesRead); - const flushed = this.write(chunk); - if (!flushed) { - this[AWAITDRAIN](() => this[ONDRAIN]()); - } else { - this[ONDRAIN](); - } - } - [AWAITDRAIN](cb) { - this.once("drain", cb); - } - write(chunk, encoding, cb) { - if (typeof encoding === "function") { - cb = encoding; - encoding = void 0; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, typeof encoding === "string" ? encoding : "utf8"); - } - if (this.blockRemain < chunk.length) { - const er = Object.assign(new Error("writing more data than expected"), { - path: this.absolute - }); - return this.emit("error", er); - } - this.remain -= chunk.length; - this.blockRemain -= chunk.length; - this.pos += chunk.length; - this.offset += chunk.length; - return super.write(chunk, null, cb); - } - [ONDRAIN]() { - if (!this.remain) { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)); - } - return this[CLOSE]((er) => er ? this.emit("error", er) : this.end()); - } - if (!this.buf) { - throw new Error("buffer lost somehow in ONDRAIN"); - } - if (this.offset >= this.length) { - this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)); - this.offset = 0; - } - this.length = this.buf.length - this.offset; - this[READ4](); - } -}; -var WriteEntrySync = class extends WriteEntry { - sync = true; - [LSTAT]() { - this[ONLSTAT](import_fs2.default.lstatSync(this.absolute)); - } - [SYMLINK]() { - this[ONREADLINK](import_fs2.default.readlinkSync(this.absolute)); - } - [OPENFILE]() { - this[ONOPENFILE](import_fs2.default.openSync(this.absolute, "r")); - } - [READ4]() { - let threw = true; - try { - const { fd, buf, offset, length, pos: pos2 } = this; - if (fd === void 0 || buf === void 0) { - throw new Error("fd and buf must be set in READ method"); - } - const bytesRead = import_fs2.default.readSync(fd, buf, offset, length, pos2); - this[ONREAD](bytesRead); - threw = false; - } finally { - if (threw) { - try { - this[CLOSE](() => { - }); - } catch (er) { - } - } - } - } - [AWAITDRAIN](cb) { - cb(); - } - /* c8 ignore start */ - [CLOSE](cb = () => { - }) { - if (this.fd !== void 0) - import_fs2.default.closeSync(this.fd); - cb(); - } -}; -var WriteEntryTar = class extends Minipass3 { - blockLen = 0; - blockRemain = 0; - buf = 0; - pos = 0; - remain = 0; - length = 0; - preservePaths; - portable; - strict; - noPax; - noMtime; - readEntry; - type; - prefix; - path; - mode; - uid; - gid; - uname; - gname; - header; - mtime; - atime; - ctime; - linkpath; - size; - onWriteEntry; - warn(code2, message, data = {}) { - return warnMethod(this, code2, message, data); - } - constructor(readEntry, opt_ = {}) { - const opt = dealias(opt_); - super(); - this.preservePaths = !!opt.preservePaths; - this.portable = !!opt.portable; - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.noMtime = !!opt.noMtime; - this.onWriteEntry = opt.onWriteEntry; - this.readEntry = readEntry; - const { type } = readEntry; - if (type === "Unsupported") { - throw new Error("writing entry that should be ignored"); - } - this.type = type; - if (this.type === "Directory" && this.portable) { - this.noMtime = true; - } - this.prefix = opt.prefix; - this.path = normalizeWindowsPath(readEntry.path); - this.mode = readEntry.mode !== void 0 ? this[MODE](readEntry.mode) : void 0; - this.uid = this.portable ? void 0 : readEntry.uid; - this.gid = this.portable ? void 0 : readEntry.gid; - this.uname = this.portable ? void 0 : readEntry.uname; - this.gname = this.portable ? void 0 : readEntry.gname; - this.size = readEntry.size; - this.mtime = this.noMtime ? void 0 : opt.mtime || readEntry.mtime; - this.atime = this.portable ? void 0 : readEntry.atime; - this.ctime = this.portable ? void 0 : readEntry.ctime; - this.linkpath = readEntry.linkpath !== void 0 ? normalizeWindowsPath(readEntry.linkpath) : void 0; - if (typeof opt.onwarn === "function") { - this.on("warn", opt.onwarn); - } - let pathWarn = false; - if (!this.preservePaths) { - const [root, stripped] = stripAbsolutePath(this.path); - if (root && typeof stripped === "string") { - this.path = stripped; - pathWarn = root; - } - } - this.remain = readEntry.size; - this.blockRemain = readEntry.startBlockSize; - this.onWriteEntry?.(this); - this.header = new Header({ - path: this[PREFIX](this.path), - linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[PREFIX](this.linkpath) : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this.mode, - uid: this.portable ? void 0 : this.uid, - gid: this.portable ? void 0 : this.gid, - size: this.size, - mtime: this.noMtime ? void 0 : this.mtime, - type: this.type, - uname: this.portable ? void 0 : this.uname, - atime: this.portable ? void 0 : this.atime, - ctime: this.portable ? void 0 : this.ctime - }); - if (pathWarn) { - this.warn("TAR_ENTRY_INFO", `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path - }); - } - if (this.header.encode() && !this.noPax) { - super.write(new Pax({ - atime: this.portable ? void 0 : this.atime, - ctime: this.portable ? void 0 : this.ctime, - gid: this.portable ? void 0 : this.gid, - mtime: this.noMtime ? void 0 : this.mtime, - path: this[PREFIX](this.path), - linkpath: this.type === "Link" && this.linkpath !== void 0 ? this[PREFIX](this.linkpath) : this.linkpath, - size: this.size, - uid: this.portable ? void 0 : this.uid, - uname: this.portable ? void 0 : this.uname, - dev: this.portable ? void 0 : this.readEntry.dev, - ino: this.portable ? void 0 : this.readEntry.ino, - nlink: this.portable ? void 0 : this.readEntry.nlink - }).encode()); - } - const b = this.header?.block; - if (!b) - throw new Error("failed to encode header"); - super.write(b); - readEntry.pipe(this); - } - [PREFIX](path9) { - return prefixPath(path9, this.prefix); - } - [MODE](mode) { - return modeFix(mode, this.type === "Directory", this.portable); - } - write(chunk, encoding, cb) { - if (typeof encoding === "function") { - cb = encoding; - encoding = void 0; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, typeof encoding === "string" ? encoding : "utf8"); - } - const writeLen = chunk.length; - if (writeLen > this.blockRemain) { - throw new Error("writing more to entry than is appropriate"); - } - this.blockRemain -= writeLen; - return super.write(chunk, cb); - } - end(chunk, encoding, cb) { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)); - } - if (typeof chunk === "function") { - cb = chunk; - encoding = void 0; - chunk = void 0; - } - if (typeof encoding === "function") { - cb = encoding; - encoding = void 0; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding ?? "utf8"); - } - if (cb) - this.once("finish", cb); - chunk ? super.end(chunk, cb) : super.end(cb); - return this; - } -}; -var getType = (stat3) => stat3.isFile() ? "File" : stat3.isDirectory() ? "Directory" : stat3.isSymbolicLink() ? "SymbolicLink" : "Unsupported"; - -// node_modules/tar/dist/esm/pack.js -var import_path3 = __toESM(require("path"), 1); -var PackJob = class { - path; - absolute; - entry; - stat; - readdir; - pending = false; - ignore = false; - piped = false; - constructor(path9, absolute) { - this.path = path9 || "./"; - this.absolute = absolute; - } -}; -var EOF4 = Buffer.alloc(1024); -var ONSTAT = Symbol("onStat"); -var ENDED2 = Symbol("ended"); -var QUEUE2 = Symbol("queue"); -var CURRENT = Symbol("current"); -var PROCESS2 = Symbol("process"); -var PROCESSING = Symbol("processing"); -var PROCESSJOB = Symbol("processJob"); -var JOBS = Symbol("jobs"); -var JOBDONE = Symbol("jobDone"); -var ADDFSENTRY = Symbol("addFSEntry"); -var ADDTARENTRY = Symbol("addTarEntry"); -var STAT = Symbol("stat"); -var READDIR = Symbol("readdir"); -var ONREADDIR = Symbol("onreaddir"); -var PIPE = Symbol("pipe"); -var ENTRY = Symbol("entry"); -var ENTRYOPT = Symbol("entryOpt"); -var WRITEENTRYCLASS = Symbol("writeEntryClass"); -var WRITE = Symbol("write"); -var ONDRAIN2 = Symbol("ondrain"); -var Pack = class extends Minipass3 { - opt; - cwd; - maxReadSize; - preservePaths; - strict; - noPax; - prefix; - linkCache; - statCache; - file; - portable; - zip; - readdirCache; - noDirRecurse; - follow; - noMtime; - mtime; - filter; - jobs; - [WRITEENTRYCLASS]; - onWriteEntry; - [QUEUE2]; - [JOBS] = 0; - [PROCESSING] = false; - [ENDED2] = false; - constructor(opt = {}) { - super(); - this.opt = opt; - this.file = opt.file || ""; - this.cwd = opt.cwd || process.cwd(); - this.maxReadSize = opt.maxReadSize; - this.preservePaths = !!opt.preservePaths; - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.prefix = normalizeWindowsPath(opt.prefix || ""); - this.linkCache = opt.linkCache || /* @__PURE__ */ new Map(); - this.statCache = opt.statCache || /* @__PURE__ */ new Map(); - this.readdirCache = opt.readdirCache || /* @__PURE__ */ new Map(); - this.onWriteEntry = opt.onWriteEntry; - this[WRITEENTRYCLASS] = WriteEntry; - if (typeof opt.onwarn === "function") { - this.on("warn", opt.onwarn); - } - this.portable = !!opt.portable; - if (opt.gzip || opt.brotli) { - if (opt.gzip && opt.brotli) { - throw new TypeError("gzip and brotli are mutually exclusive"); - } - if (opt.gzip) { - if (typeof opt.gzip !== "object") { - opt.gzip = {}; - } - if (this.portable) { - opt.gzip.portable = true; - } - this.zip = new Gzip(opt.gzip); - } - if (opt.brotli) { - if (typeof opt.brotli !== "object") { - opt.brotli = {}; - } - this.zip = new BrotliCompress(opt.brotli); - } - if (!this.zip) - throw new Error("impossible"); - const zip = this.zip; - zip.on("data", (chunk) => super.write(chunk)); - zip.on("end", () => super.end()); - zip.on("drain", () => this[ONDRAIN2]()); - this.on("resume", () => zip.resume()); - } else { - this.on("drain", this[ONDRAIN2]); - } - this.noDirRecurse = !!opt.noDirRecurse; - this.follow = !!opt.follow; - this.noMtime = !!opt.noMtime; - if (opt.mtime) - this.mtime = opt.mtime; - this.filter = typeof opt.filter === "function" ? opt.filter : () => true; - this[QUEUE2] = new Yallist(); - this[JOBS] = 0; - this.jobs = Number(opt.jobs) || 4; - this[PROCESSING] = false; - this[ENDED2] = false; - } - [WRITE](chunk) { - return super.write(chunk); - } - add(path9) { - this.write(path9); - return this; - } - end(path9, encoding, cb) { - if (typeof path9 === "function") { - cb = path9; - path9 = void 0; - } - if (typeof encoding === "function") { - cb = encoding; - encoding = void 0; - } - if (path9) { - this.add(path9); - } - this[ENDED2] = true; - this[PROCESS2](); - if (cb) - cb(); - return this; - } - write(path9) { - if (this[ENDED2]) { - throw new Error("write after end"); - } - if (path9 instanceof ReadEntry) { - this[ADDTARENTRY](path9); - } else { - this[ADDFSENTRY](path9); - } - return this.flowing; - } - [ADDTARENTRY](p) { - const absolute = normalizeWindowsPath(import_path3.default.resolve(this.cwd, p.path)); - if (!this.filter(p.path, p)) { - p.resume(); - } else { - const job = new PackJob(p.path, absolute); - job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)); - job.entry.on("end", () => this[JOBDONE](job)); - this[JOBS] += 1; - this[QUEUE2].push(job); - } - this[PROCESS2](); - } - [ADDFSENTRY](p) { - const absolute = normalizeWindowsPath(import_path3.default.resolve(this.cwd, p)); - this[QUEUE2].push(new PackJob(p, absolute)); - this[PROCESS2](); - } - [STAT](job) { - job.pending = true; - this[JOBS] += 1; - const stat3 = this.follow ? "stat" : "lstat"; - import_fs3.default[stat3](job.absolute, (er, stat4) => { - job.pending = false; - this[JOBS] -= 1; - if (er) { - this.emit("error", er); - } else { - this[ONSTAT](job, stat4); - } - }); - } - [ONSTAT](job, stat3) { - this.statCache.set(job.absolute, stat3); - job.stat = stat3; - if (!this.filter(job.path, stat3)) { - job.ignore = true; - } - this[PROCESS2](); - } - [READDIR](job) { - job.pending = true; - this[JOBS] += 1; - import_fs3.default.readdir(job.absolute, (er, entries) => { - job.pending = false; - this[JOBS] -= 1; - if (er) { - return this.emit("error", er); - } - this[ONREADDIR](job, entries); - }); - } - [ONREADDIR](job, entries) { - this.readdirCache.set(job.absolute, entries); - job.readdir = entries; - this[PROCESS2](); - } - [PROCESS2]() { - if (this[PROCESSING]) { - return; - } - this[PROCESSING] = true; - for (let w = this[QUEUE2].head; !!w && this[JOBS] < this.jobs; w = w.next) { - this[PROCESSJOB](w.value); - if (w.value.ignore) { - const p = w.next; - this[QUEUE2].removeNode(w); - w.next = p; - } - } - this[PROCESSING] = false; - if (this[ENDED2] && !this[QUEUE2].length && this[JOBS] === 0) { - if (this.zip) { - this.zip.end(EOF4); - } else { - super.write(EOF4); - super.end(); - } - } - } - get [CURRENT]() { - return this[QUEUE2] && this[QUEUE2].head && this[QUEUE2].head.value; - } - [JOBDONE](_job) { - this[QUEUE2].shift(); - this[JOBS] -= 1; - this[PROCESS2](); - } - [PROCESSJOB](job) { - if (job.pending) { - return; - } - if (job.entry) { - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job); - } - return; - } - if (!job.stat) { - const sc = this.statCache.get(job.absolute); - if (sc) { - this[ONSTAT](job, sc); - } else { - this[STAT](job); - } - } - if (!job.stat) { - return; - } - if (job.ignore) { - return; - } - if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) { - const rc = this.readdirCache.get(job.absolute); - if (rc) { - this[ONREADDIR](job, rc); - } else { - this[READDIR](job); - } - if (!job.readdir) { - return; - } - } - job.entry = this[ENTRY](job); - if (!job.entry) { - job.ignore = true; - return; - } - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job); - } - } - [ENTRYOPT](job) { - return { - onwarn: (code2, msg, data) => this.warn(code2, msg, data), - noPax: this.noPax, - cwd: this.cwd, - absolute: job.absolute, - preservePaths: this.preservePaths, - maxReadSize: this.maxReadSize, - strict: this.strict, - portable: this.portable, - linkCache: this.linkCache, - statCache: this.statCache, - noMtime: this.noMtime, - mtime: this.mtime, - prefix: this.prefix, - onWriteEntry: this.onWriteEntry - }; - } - [ENTRY](job) { - this[JOBS] += 1; - try { - const e2 = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)); - return e2.on("end", () => this[JOBDONE](job)).on("error", (er) => this.emit("error", er)); - } catch (er) { - this.emit("error", er); - } - } - [ONDRAIN2]() { - if (this[CURRENT] && this[CURRENT].entry) { - this[CURRENT].entry.resume(); - } - } - // like .pipe() but using super, because our write() is special - [PIPE](job) { - job.piped = true; - if (job.readdir) { - job.readdir.forEach((entry) => { - const p = job.path; - const base = p === "./" ? "" : p.replace(/\/*$/, "/"); - this[ADDFSENTRY](base + entry); - }); - } - const source = job.entry; - const zip = this.zip; - if (!source) - throw new Error("cannot pipe without source"); - if (zip) { - source.on("data", (chunk) => { - if (!zip.write(chunk)) { - source.pause(); - } - }); - } else { - source.on("data", (chunk) => { - if (!super.write(chunk)) { - source.pause(); - } - }); - } - } - pause() { - if (this.zip) { - this.zip.pause(); - } - return super.pause(); - } - warn(code2, message, data = {}) { - warnMethod(this, code2, message, data); - } -}; -var PackSync = class extends Pack { - sync = true; - constructor(opt) { - super(opt); - this[WRITEENTRYCLASS] = WriteEntrySync; - } - // pause/resume are no-ops in sync streams. - pause() { - } - resume() { - } - [STAT](job) { - const stat3 = this.follow ? "statSync" : "lstatSync"; - this[ONSTAT](job, import_fs3.default[stat3](job.absolute)); - } - [READDIR](job) { - this[ONREADDIR](job, import_fs3.default.readdirSync(job.absolute)); - } - // gotta get it all in this tick - [PIPE](job) { - const source = job.entry; - const zip = this.zip; - if (job.readdir) { - job.readdir.forEach((entry) => { - const p = job.path; - const base = p === "./" ? "" : p.replace(/\/*$/, "/"); - this[ADDFSENTRY](base + entry); - }); - } - if (!source) - throw new Error("Cannot pipe without source"); - if (zip) { - source.on("data", (chunk) => { - zip.write(chunk); - }); - } else { - source.on("data", (chunk) => { - super[WRITE](chunk); - }); - } - } -}; - -// node_modules/tar/dist/esm/create.js -var createFileSync = (opt, files) => { - const p = new PackSync(opt); - const stream = new WriteStreamSync(opt.file, { - mode: opt.mode || 438 - }); - p.pipe(stream); - addFilesSync(p, files); -}; -var createFile = (opt, files) => { - const p = new Pack(opt); - const stream = new WriteStream(opt.file, { - mode: opt.mode || 438 - }); - p.pipe(stream); - const promise = new Promise((res, rej) => { - stream.on("error", rej); - stream.on("close", res); - p.on("error", rej); - }); - addFilesAsync(p, files); - return promise; -}; -var addFilesSync = (p, files) => { - files.forEach((file) => { - if (file.charAt(0) === "@") { - list({ - file: import_node_path4.default.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onReadEntry: (entry) => p.add(entry) - }); - } else { - p.add(file); - } - }); - p.end(); -}; -var addFilesAsync = async (p, files) => { - for (let i2 = 0; i2 < files.length; i2++) { - const file = String(files[i2]); - if (file.charAt(0) === "@") { - await list({ - file: import_node_path4.default.resolve(String(p.cwd), file.slice(1)), - noResume: true, - onReadEntry: (entry) => { - p.add(entry); - } - }); - } else { - p.add(file); - } - } - p.end(); -}; -var createSync = (opt, files) => { - const p = new PackSync(opt); - addFilesSync(p, files); - return p; -}; -var createAsync = (opt, files) => { - const p = new Pack(opt); - addFilesAsync(p, files); - return p; -}; -var create = makeCommand(createFileSync, createFile, createSync, createAsync, (_opt, files) => { - if (!files?.length) { - throw new TypeError("no paths specified to add to archive"); - } -}); - -// node_modules/tar/dist/esm/extract.js -var import_node_fs4 = __toESM(require("node:fs"), 1); - -// node_modules/tar/dist/esm/unpack.js -var import_node_assert = __toESM(require("node:assert"), 1); -var import_node_crypto = require("node:crypto"); -var import_node_fs3 = __toESM(require("node:fs"), 1); -var import_node_path8 = __toESM(require("node:path"), 1); - -// node_modules/tar/dist/esm/get-write-flag.js -var import_fs4 = __toESM(require("fs"), 1); -var platform2 = process.env.__FAKE_PLATFORM__ || process.platform; -var isWindows = platform2 === "win32"; -var { O_CREAT, O_TRUNC, O_WRONLY } = import_fs4.default.constants; -var UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || import_fs4.default.constants.UV_FS_O_FILEMAP || 0; -var fMapEnabled = isWindows && !!UV_FS_O_FILEMAP; -var fMapLimit = 512 * 1024; -var fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY; -var getWriteFlag = !fMapEnabled ? () => "w" : (size) => size < fMapLimit ? fMapFlag : "w"; - -// node_modules/chownr/dist/esm/index.js -var import_node_fs2 = __toESM(require("node:fs"), 1); -var import_node_path5 = __toESM(require("node:path"), 1); -var lchownSync = (path9, uid, gid) => { - try { - return import_node_fs2.default.lchownSync(path9, uid, gid); - } catch (er) { - if (er?.code !== "ENOENT") - throw er; - } -}; -var chown = (cpath, uid, gid, cb) => { - import_node_fs2.default.lchown(cpath, uid, gid, (er) => { - cb(er && er?.code !== "ENOENT" ? er : null); - }); -}; -var chownrKid = (p, child, uid, gid, cb) => { - if (child.isDirectory()) { - chownr(import_node_path5.default.resolve(p, child.name), uid, gid, (er) => { - if (er) - return cb(er); - const cpath = import_node_path5.default.resolve(p, child.name); - chown(cpath, uid, gid, cb); - }); - } else { - const cpath = import_node_path5.default.resolve(p, child.name); - chown(cpath, uid, gid, cb); - } -}; -var chownr = (p, uid, gid, cb) => { - import_node_fs2.default.readdir(p, { withFileTypes: true }, (er, children) => { - if (er) { - if (er.code === "ENOENT") - return cb(); - else if (er.code !== "ENOTDIR" && er.code !== "ENOTSUP") - return cb(er); - } - if (er || !children.length) - return chown(p, uid, gid, cb); - let len = children.length; - let errState = null; - const then = (er2) => { - if (errState) - return; - if (er2) - return cb(errState = er2); - if (--len === 0) - return chown(p, uid, gid, cb); - }; - for (const child of children) { - chownrKid(p, child, uid, gid, then); - } - }); -}; -var chownrKidSync = (p, child, uid, gid) => { - if (child.isDirectory()) - chownrSync(import_node_path5.default.resolve(p, child.name), uid, gid); - lchownSync(import_node_path5.default.resolve(p, child.name), uid, gid); -}; -var chownrSync = (p, uid, gid) => { - let children; - try { - children = import_node_fs2.default.readdirSync(p, { withFileTypes: true }); - } catch (er) { - const e2 = er; - if (e2?.code === "ENOENT") - return; - else if (e2?.code === "ENOTDIR" || e2?.code === "ENOTSUP") - return lchownSync(p, uid, gid); - else - throw e2; - } - for (const child of children) { - chownrKidSync(p, child, uid, gid); - } - return lchownSync(p, uid, gid); -}; - -// node_modules/tar/dist/esm/mkdir.js -var import_fs7 = __toESM(require("fs"), 1); - -// node_modules/mkdirp/dist/mjs/mkdirp-manual.js -var import_path4 = require("path"); - -// node_modules/mkdirp/dist/mjs/opts-arg.js -var import_fs5 = require("fs"); -var optsArg = (opts) => { - if (!opts) { - opts = { mode: 511 }; - } else if (typeof opts === "object") { - opts = { mode: 511, ...opts }; - } else if (typeof opts === "number") { - opts = { mode: opts }; - } else if (typeof opts === "string") { - opts = { mode: parseInt(opts, 8) }; - } else { - throw new TypeError("invalid options argument"); - } - const resolved = opts; - const optsFs = opts.fs || {}; - opts.mkdir = opts.mkdir || optsFs.mkdir || import_fs5.mkdir; - opts.mkdirAsync = opts.mkdirAsync ? opts.mkdirAsync : async (path9, options) => { - return new Promise((res, rej) => resolved.mkdir(path9, options, (er, made) => er ? rej(er) : res(made))); - }; - opts.stat = opts.stat || optsFs.stat || import_fs5.stat; - opts.statAsync = opts.statAsync ? opts.statAsync : async (path9) => new Promise((res, rej) => resolved.stat(path9, (err, stats) => err ? rej(err) : res(stats))); - opts.statSync = opts.statSync || optsFs.statSync || import_fs5.statSync; - opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || import_fs5.mkdirSync; - return resolved; -}; - -// node_modules/mkdirp/dist/mjs/mkdirp-manual.js -var mkdirpManualSync = (path9, options, made) => { - const parent = (0, import_path4.dirname)(path9); - const opts = { ...optsArg(options), recursive: false }; - if (parent === path9) { - try { - return opts.mkdirSync(path9, opts); - } catch (er) { - const fer = er; - if (fer && fer.code !== "EISDIR") { - throw er; - } - return; - } - } - try { - opts.mkdirSync(path9, opts); - return made || path9; - } catch (er) { - const fer = er; - if (fer && fer.code === "ENOENT") { - return mkdirpManualSync(path9, opts, mkdirpManualSync(parent, opts, made)); - } - if (fer && fer.code !== "EEXIST" && fer && fer.code !== "EROFS") { - throw er; - } - try { - if (!opts.statSync(path9).isDirectory()) - throw er; - } catch (_) { - throw er; - } - } -}; -var mkdirpManual = Object.assign(async (path9, options, made) => { - const opts = optsArg(options); - opts.recursive = false; - const parent = (0, import_path4.dirname)(path9); - if (parent === path9) { - return opts.mkdirAsync(path9, opts).catch((er) => { - const fer = er; - if (fer && fer.code !== "EISDIR") { - throw er; - } - }); - } - return opts.mkdirAsync(path9, opts).then(() => made || path9, async (er) => { - const fer = er; - if (fer && fer.code === "ENOENT") { - return mkdirpManual(parent, opts).then((made2) => mkdirpManual(path9, opts, made2)); - } - if (fer && fer.code !== "EEXIST" && fer.code !== "EROFS") { - throw er; - } - return opts.statAsync(path9).then((st) => { - if (st.isDirectory()) { - return made; - } else { - throw er; - } - }, () => { - throw er; - }); - }); -}, { sync: mkdirpManualSync }); - -// node_modules/mkdirp/dist/mjs/mkdirp-native.js -var import_path6 = require("path"); - -// node_modules/mkdirp/dist/mjs/find-made.js -var import_path5 = require("path"); -var findMade = async (opts, parent, path9) => { - if (path9 === parent) { - return; - } - return opts.statAsync(parent).then( - (st) => st.isDirectory() ? path9 : void 0, - // will fail later - // will fail later - (er) => { - const fer = er; - return fer && fer.code === "ENOENT" ? findMade(opts, (0, import_path5.dirname)(parent), parent) : void 0; - } - ); -}; -var findMadeSync = (opts, parent, path9) => { - if (path9 === parent) { - return void 0; - } - try { - return opts.statSync(parent).isDirectory() ? path9 : void 0; - } catch (er) { - const fer = er; - return fer && fer.code === "ENOENT" ? findMadeSync(opts, (0, import_path5.dirname)(parent), parent) : void 0; - } -}; - -// node_modules/mkdirp/dist/mjs/mkdirp-native.js -var mkdirpNativeSync = (path9, options) => { - const opts = optsArg(options); - opts.recursive = true; - const parent = (0, import_path6.dirname)(path9); - if (parent === path9) { - return opts.mkdirSync(path9, opts); - } - const made = findMadeSync(opts, path9); - try { - opts.mkdirSync(path9, opts); - return made; - } catch (er) { - const fer = er; - if (fer && fer.code === "ENOENT") { - return mkdirpManualSync(path9, opts); - } else { - throw er; - } - } -}; -var mkdirpNative = Object.assign(async (path9, options) => { - const opts = { ...optsArg(options), recursive: true }; - const parent = (0, import_path6.dirname)(path9); - if (parent === path9) { - return await opts.mkdirAsync(path9, opts); - } - return findMade(opts, path9).then((made) => opts.mkdirAsync(path9, opts).then((m2) => made || m2).catch((er) => { - const fer = er; - if (fer && fer.code === "ENOENT") { - return mkdirpManual(path9, opts); - } else { - throw er; - } - })); -}, { sync: mkdirpNativeSync }); - -// node_modules/mkdirp/dist/mjs/path-arg.js -var import_path7 = require("path"); -var platform3 = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform; -var pathArg = (path9) => { - if (/\0/.test(path9)) { - throw Object.assign(new TypeError("path must be a string without null bytes"), { - path: path9, - code: "ERR_INVALID_ARG_VALUE" - }); - } - path9 = (0, import_path7.resolve)(path9); - if (platform3 === "win32") { - const badWinChars = /[*|"<>?:]/; - const { root } = (0, import_path7.parse)(path9); - if (badWinChars.test(path9.substring(root.length))) { - throw Object.assign(new Error("Illegal characters in path."), { - path: path9, - code: "EINVAL" - }); - } - } - return path9; -}; - -// node_modules/mkdirp/dist/mjs/use-native.js -var import_fs6 = require("fs"); -var version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version; -var versArr = version.replace(/^v/, "").split("."); -var hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12; -var useNativeSync = !hasNative ? () => false : (opts) => optsArg(opts).mkdirSync === import_fs6.mkdirSync; -var useNative = Object.assign(!hasNative ? () => false : (opts) => optsArg(opts).mkdir === import_fs6.mkdir, { - sync: useNativeSync -}); - -// node_modules/mkdirp/dist/mjs/index.js -var mkdirpSync = (path9, opts) => { - path9 = pathArg(path9); - const resolved = optsArg(opts); - return useNativeSync(resolved) ? mkdirpNativeSync(path9, resolved) : mkdirpManualSync(path9, resolved); -}; -var mkdirp = Object.assign(async (path9, opts) => { - path9 = pathArg(path9); - const resolved = optsArg(opts); - return useNative(resolved) ? mkdirpNative(path9, resolved) : mkdirpManual(path9, resolved); -}, { - mkdirpSync, - mkdirpNative, - mkdirpNativeSync, - mkdirpManual, - mkdirpManualSync, - sync: mkdirpSync, - native: mkdirpNative, - nativeSync: mkdirpNativeSync, - manual: mkdirpManual, - manualSync: mkdirpManualSync, - useNative, - useNativeSync -}); - -// node_modules/tar/dist/esm/mkdir.js -var import_node_path6 = __toESM(require("node:path"), 1); - -// node_modules/tar/dist/esm/cwd-error.js -var CwdError = class extends Error { - path; - code; - syscall = "chdir"; - constructor(path9, code2) { - super(`${code2}: Cannot cd into '${path9}'`); - this.path = path9; - this.code = code2; - } - get name() { - return "CwdError"; - } -}; - -// node_modules/tar/dist/esm/symlink-error.js -var SymlinkError = class extends Error { - path; - symlink; - syscall = "symlink"; - code = "TAR_SYMLINK_ERROR"; - constructor(symlink, path9) { - super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"); - this.symlink = symlink; - this.path = path9; - } - get name() { - return "SymlinkError"; - } -}; - -// node_modules/tar/dist/esm/mkdir.js -var cGet = (cache, key) => cache.get(normalizeWindowsPath(key)); -var cSet = (cache, key, val) => cache.set(normalizeWindowsPath(key), val); -var checkCwd = (dir, cb) => { - import_fs7.default.stat(dir, (er, st) => { - if (er || !st.isDirectory()) { - er = new CwdError(dir, er?.code || "ENOTDIR"); - } - cb(er); - }); -}; -var mkdir3 = (dir, opt, cb) => { - dir = normalizeWindowsPath(dir); - const umask = opt.umask ?? 18; - const mode = opt.mode | 448; - const needChmod = (mode & umask) !== 0; - const uid = opt.uid; - const gid = opt.gid; - const doChown = typeof uid === "number" && typeof gid === "number" && (uid !== opt.processUid || gid !== opt.processGid); - const preserve = opt.preserve; - const unlink = opt.unlink; - const cache = opt.cache; - const cwd = normalizeWindowsPath(opt.cwd); - const done = (er, created) => { - if (er) { - cb(er); - } else { - cSet(cache, dir, true); - if (created && doChown) { - chownr(created, uid, gid, (er2) => done(er2)); - } else if (needChmod) { - import_fs7.default.chmod(dir, mode, cb); - } else { - cb(); - } - } - }; - if (cache && cGet(cache, dir) === true) { - return done(); - } - if (dir === cwd) { - return checkCwd(dir, done); - } - if (preserve) { - return mkdirp(dir, { mode }).then( - (made) => done(null, made ?? void 0), - // oh, ts - done - ); - } - const sub = normalizeWindowsPath(import_node_path6.default.relative(cwd, dir)); - const parts = sub.split("/"); - mkdir_(cwd, parts, mode, cache, unlink, cwd, void 0, done); -}; -var mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { - if (!parts.length) { - return cb(null, created); - } - const p = parts.shift(); - const part = normalizeWindowsPath(import_node_path6.default.resolve(base + "/" + p)); - if (cGet(cache, part)) { - return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } - import_fs7.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); -}; -var onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => { - if (er) { - import_fs7.default.lstat(part, (statEr, st) => { - if (statEr) { - statEr.path = statEr.path && normalizeWindowsPath(statEr.path); - cb(statEr); - } else if (st.isDirectory()) { - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } else if (unlink) { - import_fs7.default.unlink(part, (er2) => { - if (er2) { - return cb(er2); - } - import_fs7.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); - }); - } else if (st.isSymbolicLink()) { - return cb(new SymlinkError(part, part + "/" + parts.join("/"))); - } else { - cb(er); - } - }); - } else { - created = created || part; - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } -}; -var checkCwdSync = (dir) => { - let ok = false; - let code2 = void 0; - try { - ok = import_fs7.default.statSync(dir).isDirectory(); - } catch (er) { - code2 = er?.code; - } finally { - if (!ok) { - throw new CwdError(dir, code2 ?? "ENOTDIR"); - } - } -}; -var mkdirSync3 = (dir, opt) => { - dir = normalizeWindowsPath(dir); - const umask = opt.umask ?? 18; - const mode = opt.mode | 448; - const needChmod = (mode & umask) !== 0; - const uid = opt.uid; - const gid = opt.gid; - const doChown = typeof uid === "number" && typeof gid === "number" && (uid !== opt.processUid || gid !== opt.processGid); - const preserve = opt.preserve; - const unlink = opt.unlink; - const cache = opt.cache; - const cwd = normalizeWindowsPath(opt.cwd); - const done = (created2) => { - cSet(cache, dir, true); - if (created2 && doChown) { - chownrSync(created2, uid, gid); - } - if (needChmod) { - import_fs7.default.chmodSync(dir, mode); - } - }; - if (cache && cGet(cache, dir) === true) { - return done(); - } - if (dir === cwd) { - checkCwdSync(cwd); - return done(); - } - if (preserve) { - return done(mkdirpSync(dir, mode) ?? void 0); - } - const sub = normalizeWindowsPath(import_node_path6.default.relative(cwd, dir)); - const parts = sub.split("/"); - let created = void 0; - for (let p = parts.shift(), part = cwd; p && (part += "/" + p); p = parts.shift()) { - part = normalizeWindowsPath(import_node_path6.default.resolve(part)); - if (cGet(cache, part)) { - continue; - } - try { - import_fs7.default.mkdirSync(part, mode); - created = created || part; - cSet(cache, part, true); - } catch (er) { - const st = import_fs7.default.lstatSync(part); - if (st.isDirectory()) { - cSet(cache, part, true); - continue; - } else if (unlink) { - import_fs7.default.unlinkSync(part); - import_fs7.default.mkdirSync(part, mode); - created = created || part; - cSet(cache, part, true); - continue; - } else if (st.isSymbolicLink()) { - return new SymlinkError(part, part + "/" + parts.join("/")); - } - } - } - return done(created); -}; - -// node_modules/tar/dist/esm/normalize-unicode.js -var normalizeCache = /* @__PURE__ */ Object.create(null); -var { hasOwnProperty } = Object.prototype; -var normalizeUnicode = (s2) => { - if (!hasOwnProperty.call(normalizeCache, s2)) { - normalizeCache[s2] = s2.normalize("NFD"); - } - return normalizeCache[s2]; -}; - -// node_modules/tar/dist/esm/path-reservations.js -var import_node_path7 = require("node:path"); -var platform4 = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -var isWindows2 = platform4 === "win32"; -var getDirs = (path9) => { - const dirs = path9.split("/").slice(0, -1).reduce((set, path10) => { - const s2 = set[set.length - 1]; - if (s2 !== void 0) { - path10 = (0, import_node_path7.join)(s2, path10); - } - set.push(path10 || "/"); - return set; - }, []); - return dirs; -}; -var PathReservations = class { - // path => [function or Set] - // A Set object means a directory reservation - // A fn is a direct reservation on that path - #queues = /* @__PURE__ */ new Map(); - // fn => {paths:[path,...], dirs:[path, ...]} - #reservations = /* @__PURE__ */ new Map(); - // functions currently running - #running = /* @__PURE__ */ new Set(); - reserve(paths, fn) { - paths = isWindows2 ? ["win32 parallelization disabled"] : paths.map((p) => { - return stripTrailingSlashes((0, import_node_path7.join)(normalizeUnicode(p))).toLowerCase(); - }); - const dirs = new Set(paths.map((path9) => getDirs(path9)).reduce((a, b) => a.concat(b))); - this.#reservations.set(fn, { dirs, paths }); - for (const p of paths) { - const q = this.#queues.get(p); - if (!q) { - this.#queues.set(p, [fn]); - } else { - q.push(fn); - } - } - for (const dir of dirs) { - const q = this.#queues.get(dir); - if (!q) { - this.#queues.set(dir, [/* @__PURE__ */ new Set([fn])]); - } else { - const l = q[q.length - 1]; - if (l instanceof Set) { - l.add(fn); - } else { - q.push(/* @__PURE__ */ new Set([fn])); - } - } - } - return this.#run(fn); - } - // return the queues for each path the function cares about - // fn => {paths, dirs} - #getQueues(fn) { - const res = this.#reservations.get(fn); - if (!res) { - throw new Error("function does not have any path reservations"); - } - return { - paths: res.paths.map((path9) => this.#queues.get(path9)), - dirs: [...res.dirs].map((path9) => this.#queues.get(path9)) - }; - } - // check if fn is first in line for all its paths, and is - // included in the first set for all its dir queues - check(fn) { - const { paths, dirs } = this.#getQueues(fn); - return paths.every((q) => q && q[0] === fn) && dirs.every((q) => q && q[0] instanceof Set && q[0].has(fn)); - } - // run the function if it's first in line and not already running - #run(fn) { - if (this.#running.has(fn) || !this.check(fn)) { - return false; - } - this.#running.add(fn); - fn(() => this.#clear(fn)); - return true; - } - #clear(fn) { - if (!this.#running.has(fn)) { - return false; - } - const res = this.#reservations.get(fn); - if (!res) { - throw new Error("invalid reservation"); - } - const { paths, dirs } = res; - const next = /* @__PURE__ */ new Set(); - for (const path9 of paths) { - const q = this.#queues.get(path9); - if (!q || q?.[0] !== fn) { - continue; - } - const q0 = q[1]; - if (!q0) { - this.#queues.delete(path9); - continue; - } - q.shift(); - if (typeof q0 === "function") { - next.add(q0); - } else { - for (const f3 of q0) { - next.add(f3); - } - } - } - for (const dir of dirs) { - const q = this.#queues.get(dir); - const q0 = q?.[0]; - if (!q || !(q0 instanceof Set)) - continue; - if (q0.size === 1 && q.length === 1) { - this.#queues.delete(dir); - continue; - } else if (q0.size === 1) { - q.shift(); - const n = q[0]; - if (typeof n === "function") { - next.add(n); - } - } else { - q0.delete(fn); - } - } - this.#running.delete(fn); - next.forEach((fn2) => this.#run(fn2)); - return true; - } -}; - -// node_modules/tar/dist/esm/unpack.js -var ONENTRY = Symbol("onEntry"); -var CHECKFS = Symbol("checkFs"); -var CHECKFS2 = Symbol("checkFs2"); -var PRUNECACHE = Symbol("pruneCache"); -var ISREUSABLE = Symbol("isReusable"); -var MAKEFS = Symbol("makeFs"); -var FILE2 = Symbol("file"); -var DIRECTORY2 = Symbol("directory"); -var LINK = Symbol("link"); -var SYMLINK2 = Symbol("symlink"); -var HARDLINK2 = Symbol("hardlink"); -var UNSUPPORTED = Symbol("unsupported"); -var CHECKPATH = Symbol("checkPath"); -var MKDIR = Symbol("mkdir"); -var ONERROR = Symbol("onError"); -var PENDING = Symbol("pending"); -var PEND = Symbol("pend"); -var UNPEND = Symbol("unpend"); -var ENDED3 = Symbol("ended"); -var MAYBECLOSE = Symbol("maybeClose"); -var SKIP = Symbol("skip"); -var DOCHOWN = Symbol("doChown"); -var UID = Symbol("uid"); -var GID = Symbol("gid"); -var CHECKED_CWD = Symbol("checkedCwd"); -var platform5 = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -var isWindows3 = platform5 === "win32"; -var DEFAULT_MAX_DEPTH = 1024; -var unlinkFile = (path9, cb) => { - if (!isWindows3) { - return import_node_fs3.default.unlink(path9, cb); - } - const name2 = path9 + ".DELETE." + (0, import_node_crypto.randomBytes)(16).toString("hex"); - import_node_fs3.default.rename(path9, name2, (er) => { - if (er) { - return cb(er); - } - import_node_fs3.default.unlink(name2, cb); - }); -}; -var unlinkFileSync = (path9) => { - if (!isWindows3) { - return import_node_fs3.default.unlinkSync(path9); - } - const name2 = path9 + ".DELETE." + (0, import_node_crypto.randomBytes)(16).toString("hex"); - import_node_fs3.default.renameSync(path9, name2); - import_node_fs3.default.unlinkSync(name2); -}; -var uint32 = (a, b, c) => a !== void 0 && a === a >>> 0 ? a : b !== void 0 && b === b >>> 0 ? b : c; -var cacheKeyNormalize = (path9) => stripTrailingSlashes(normalizeWindowsPath(normalizeUnicode(path9))).toLowerCase(); -var pruneCache = (cache, abs) => { - abs = cacheKeyNormalize(abs); - for (const path9 of cache.keys()) { - const pnorm = cacheKeyNormalize(path9); - if (pnorm === abs || pnorm.indexOf(abs + "/") === 0) { - cache.delete(path9); - } - } -}; -var dropCache = (cache) => { - for (const key of cache.keys()) { - cache.delete(key); - } -}; -var Unpack = class extends Parser { - [ENDED3] = false; - [CHECKED_CWD] = false; - [PENDING] = 0; - reservations = new PathReservations(); - transform; - writable = true; - readable = false; - dirCache; - uid; - gid; - setOwner; - preserveOwner; - processGid; - processUid; - maxDepth; - forceChown; - win32; - newer; - keep; - noMtime; - preservePaths; - unlink; - cwd; - strip; - processUmask; - umask; - dmode; - fmode; - chmod; - constructor(opt = {}) { - opt.ondone = () => { - this[ENDED3] = true; - this[MAYBECLOSE](); - }; - super(opt); - this.transform = opt.transform; - this.dirCache = opt.dirCache || /* @__PURE__ */ new Map(); - this.chmod = !!opt.chmod; - if (typeof opt.uid === "number" || typeof opt.gid === "number") { - if (typeof opt.uid !== "number" || typeof opt.gid !== "number") { - throw new TypeError("cannot set owner without number uid and gid"); - } - if (opt.preserveOwner) { - throw new TypeError("cannot preserve owner in archive and also set owner explicitly"); - } - this.uid = opt.uid; - this.gid = opt.gid; - this.setOwner = true; - } else { - this.uid = void 0; - this.gid = void 0; - this.setOwner = false; - } - if (opt.preserveOwner === void 0 && typeof opt.uid !== "number") { - this.preserveOwner = !!(process.getuid && process.getuid() === 0); - } else { - this.preserveOwner = !!opt.preserveOwner; - } - this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0; - this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0; - this.maxDepth = typeof opt.maxDepth === "number" ? opt.maxDepth : DEFAULT_MAX_DEPTH; - this.forceChown = opt.forceChown === true; - this.win32 = !!opt.win32 || isWindows3; - this.newer = !!opt.newer; - this.keep = !!opt.keep; - this.noMtime = !!opt.noMtime; - this.preservePaths = !!opt.preservePaths; - this.unlink = !!opt.unlink; - this.cwd = normalizeWindowsPath(import_node_path8.default.resolve(opt.cwd || process.cwd())); - this.strip = Number(opt.strip) || 0; - this.processUmask = !this.chmod ? 0 : typeof opt.processUmask === "number" ? opt.processUmask : process.umask(); - this.umask = typeof opt.umask === "number" ? opt.umask : this.processUmask; - this.dmode = opt.dmode || 511 & ~this.umask; - this.fmode = opt.fmode || 438 & ~this.umask; - this.on("entry", (entry) => this[ONENTRY](entry)); - } - // a bad or damaged archive is a warning for Parser, but an error - // when extracting. Mark those errors as unrecoverable, because - // the Unpack contract cannot be met. - warn(code2, msg, data = {}) { - if (code2 === "TAR_BAD_ARCHIVE" || code2 === "TAR_ABORT") { - data.recoverable = false; - } - return super.warn(code2, msg, data); - } - [MAYBECLOSE]() { - if (this[ENDED3] && this[PENDING] === 0) { - this.emit("prefinish"); - this.emit("finish"); - this.emit("end"); - } - } - [CHECKPATH](entry) { - const p = normalizeWindowsPath(entry.path); - const parts = p.split("/"); - if (this.strip) { - if (parts.length < this.strip) { - return false; - } - if (entry.type === "Link") { - const linkparts = normalizeWindowsPath(String(entry.linkpath)).split("/"); - if (linkparts.length >= this.strip) { - entry.linkpath = linkparts.slice(this.strip).join("/"); - } else { - return false; - } - } - parts.splice(0, this.strip); - entry.path = parts.join("/"); - } - if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { - this.warn("TAR_ENTRY_ERROR", "path excessively deep", { - entry, - path: p, - depth: parts.length, - maxDepth: this.maxDepth - }); - return false; - } - if (!this.preservePaths) { - if (parts.includes("..") || /* c8 ignore next */ - isWindows3 && /^[a-z]:\.\.$/i.test(parts[0] ?? "")) { - this.warn("TAR_ENTRY_ERROR", `path contains '..'`, { - entry, - path: p - }); - return false; - } - const [root, stripped] = stripAbsolutePath(p); - if (root) { - entry.path = String(stripped); - this.warn("TAR_ENTRY_INFO", `stripping ${root} from absolute path`, { - entry, - path: p - }); - } - } - if (import_node_path8.default.isAbsolute(entry.path)) { - entry.absolute = normalizeWindowsPath(import_node_path8.default.resolve(entry.path)); - } else { - entry.absolute = normalizeWindowsPath(import_node_path8.default.resolve(this.cwd, entry.path)); - } - if (!this.preservePaths && typeof entry.absolute === "string" && entry.absolute.indexOf(this.cwd + "/") !== 0 && entry.absolute !== this.cwd) { - this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", { - entry, - path: normalizeWindowsPath(entry.path), - resolvedPath: entry.absolute, - cwd: this.cwd - }); - return false; - } - if (entry.absolute === this.cwd && entry.type !== "Directory" && entry.type !== "GNUDumpDir") { - return false; - } - if (this.win32) { - const { root: aRoot } = import_node_path8.default.win32.parse(String(entry.absolute)); - entry.absolute = aRoot + encode2(String(entry.absolute).slice(aRoot.length)); - const { root: pRoot } = import_node_path8.default.win32.parse(entry.path); - entry.path = pRoot + encode2(entry.path.slice(pRoot.length)); - } - return true; - } - [ONENTRY](entry) { - if (!this[CHECKPATH](entry)) { - return entry.resume(); - } - import_node_assert.default.equal(typeof entry.absolute, "string"); - switch (entry.type) { - case "Directory": - case "GNUDumpDir": - if (entry.mode) { - entry.mode = entry.mode | 448; - } - // eslint-disable-next-line no-fallthrough - case "File": - case "OldFile": - case "ContiguousFile": - case "Link": - case "SymbolicLink": - return this[CHECKFS](entry); - case "CharacterDevice": - case "BlockDevice": - case "FIFO": - default: - return this[UNSUPPORTED](entry); - } - } - [ONERROR](er, entry) { - if (er.name === "CwdError") { - this.emit("error", er); - } else { - this.warn("TAR_ENTRY_ERROR", er, { entry }); - this[UNPEND](); - entry.resume(); - } - } - [MKDIR](dir, mode, cb) { - mkdir3(normalizeWindowsPath(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode - }, cb); - } - [DOCHOWN](entry) { - return this.forceChown || this.preserveOwner && (typeof entry.uid === "number" && entry.uid !== this.processUid || typeof entry.gid === "number" && entry.gid !== this.processGid) || typeof this.uid === "number" && this.uid !== this.processUid || typeof this.gid === "number" && this.gid !== this.processGid; - } - [UID](entry) { - return uint32(this.uid, entry.uid, this.processUid); - } - [GID](entry) { - return uint32(this.gid, entry.gid, this.processGid); - } - [FILE2](entry, fullyDone) { - const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.fmode; - const stream = new WriteStream(String(entry.absolute), { - // slight lie, but it can be numeric flags - flags: getWriteFlag(entry.size), - mode, - autoClose: false - }); - stream.on("error", (er) => { - if (stream.fd) { - import_node_fs3.default.close(stream.fd, () => { - }); - } - stream.write = () => true; - this[ONERROR](er, entry); - fullyDone(); - }); - let actions = 1; - const done = (er) => { - if (er) { - if (stream.fd) { - import_node_fs3.default.close(stream.fd, () => { - }); - } - this[ONERROR](er, entry); - fullyDone(); - return; - } - if (--actions === 0) { - if (stream.fd !== void 0) { - import_node_fs3.default.close(stream.fd, (er2) => { - if (er2) { - this[ONERROR](er2, entry); - } else { - this[UNPEND](); - } - fullyDone(); - }); - } - } - }; - stream.on("finish", () => { - const abs = String(entry.absolute); - const fd = stream.fd; - if (typeof fd === "number" && entry.mtime && !this.noMtime) { - actions++; - const atime = entry.atime || /* @__PURE__ */ new Date(); - const mtime = entry.mtime; - import_node_fs3.default.futimes(fd, atime, mtime, (er) => er ? import_node_fs3.default.utimes(abs, atime, mtime, (er2) => done(er2 && er)) : done()); - } - if (typeof fd === "number" && this[DOCHOWN](entry)) { - actions++; - const uid = this[UID](entry); - const gid = this[GID](entry); - if (typeof uid === "number" && typeof gid === "number") { - import_node_fs3.default.fchown(fd, uid, gid, (er) => er ? import_node_fs3.default.chown(abs, uid, gid, (er2) => done(er2 && er)) : done()); - } - } - done(); - }); - const tx = this.transform ? this.transform(entry) || entry : entry; - if (tx !== entry) { - tx.on("error", (er) => { - this[ONERROR](er, entry); - fullyDone(); - }); - entry.pipe(tx); - } - tx.pipe(stream); - } - [DIRECTORY2](entry, fullyDone) { - const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.dmode; - this[MKDIR](String(entry.absolute), mode, (er) => { - if (er) { - this[ONERROR](er, entry); - fullyDone(); - return; - } - let actions = 1; - const done = () => { - if (--actions === 0) { - fullyDone(); - this[UNPEND](); - entry.resume(); - } - }; - if (entry.mtime && !this.noMtime) { - actions++; - import_node_fs3.default.utimes(String(entry.absolute), entry.atime || /* @__PURE__ */ new Date(), entry.mtime, done); - } - if (this[DOCHOWN](entry)) { - actions++; - import_node_fs3.default.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done); - } - done(); - }); - } - [UNSUPPORTED](entry) { - entry.unsupported = true; - this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${entry.type}`, { entry }); - entry.resume(); - } - [SYMLINK2](entry, done) { - this[LINK](entry, String(entry.linkpath), "symlink", done); - } - [HARDLINK2](entry, done) { - const linkpath = normalizeWindowsPath(import_node_path8.default.resolve(this.cwd, String(entry.linkpath))); - this[LINK](entry, linkpath, "link", done); - } - [PEND]() { - this[PENDING]++; - } - [UNPEND]() { - this[PENDING]--; - this[MAYBECLOSE](); - } - [SKIP](entry) { - this[UNPEND](); - entry.resume(); - } - // Check if we can reuse an existing filesystem entry safely and - // overwrite it, rather than unlinking and recreating - // Windows doesn't report a useful nlink, so we just never reuse entries - [ISREUSABLE](entry, st) { - return entry.type === "File" && !this.unlink && st.isFile() && st.nlink <= 1 && !isWindows3; - } - // check if a thing is there, and if so, try to clobber it - [CHECKFS](entry) { - this[PEND](); - const paths = [entry.path]; - if (entry.linkpath) { - paths.push(entry.linkpath); - } - this.reservations.reserve(paths, (done) => this[CHECKFS2](entry, done)); - } - [PRUNECACHE](entry) { - if (entry.type === "SymbolicLink") { - dropCache(this.dirCache); - } else if (entry.type !== "Directory") { - pruneCache(this.dirCache, String(entry.absolute)); - } - } - [CHECKFS2](entry, fullyDone) { - this[PRUNECACHE](entry); - const done = (er) => { - this[PRUNECACHE](entry); - fullyDone(er); - }; - const checkCwd2 = () => { - this[MKDIR](this.cwd, this.dmode, (er) => { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - this[CHECKED_CWD] = true; - start(); - }); - }; - const start = () => { - if (entry.absolute !== this.cwd) { - const parent = normalizeWindowsPath(import_node_path8.default.dirname(String(entry.absolute))); - if (parent !== this.cwd) { - return this[MKDIR](parent, this.dmode, (er) => { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - afterMakeParent(); - }); - } - } - afterMakeParent(); - }; - const afterMakeParent = () => { - import_node_fs3.default.lstat(String(entry.absolute), (lstatEr, st) => { - if (st && (this.keep || /* c8 ignore next */ - this.newer && st.mtime > (entry.mtime ?? st.mtime))) { - this[SKIP](entry); - done(); - return; - } - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry, done); - } - if (st.isDirectory()) { - if (entry.type === "Directory") { - const needChmod = this.chmod && entry.mode && (st.mode & 4095) !== entry.mode; - const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done); - if (!needChmod) { - return afterChmod(); - } - return import_node_fs3.default.chmod(String(entry.absolute), Number(entry.mode), afterChmod); - } - if (entry.absolute !== this.cwd) { - return import_node_fs3.default.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); - } - } - if (entry.absolute === this.cwd) { - return this[MAKEFS](null, entry, done); - } - unlinkFile(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); - }); - }; - if (this[CHECKED_CWD]) { - start(); - } else { - checkCwd2(); - } - } - [MAKEFS](er, entry, done) { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - switch (entry.type) { - case "File": - case "OldFile": - case "ContiguousFile": - return this[FILE2](entry, done); - case "Link": - return this[HARDLINK2](entry, done); - case "SymbolicLink": - return this[SYMLINK2](entry, done); - case "Directory": - case "GNUDumpDir": - return this[DIRECTORY2](entry, done); - } - } - [LINK](entry, linkpath, link, done) { - import_node_fs3.default[link](linkpath, String(entry.absolute), (er) => { - if (er) { - this[ONERROR](er, entry); - } else { - this[UNPEND](); - entry.resume(); - } - done(); - }); - } -}; -var callSync = (fn) => { - try { - return [null, fn()]; - } catch (er) { - return [er, null]; - } -}; -var UnpackSync = class extends Unpack { - sync = true; - [MAKEFS](er, entry) { - return super[MAKEFS](er, entry, () => { - }); - } - [CHECKFS](entry) { - this[PRUNECACHE](entry); - if (!this[CHECKED_CWD]) { - const er2 = this[MKDIR](this.cwd, this.dmode); - if (er2) { - return this[ONERROR](er2, entry); - } - this[CHECKED_CWD] = true; - } - if (entry.absolute !== this.cwd) { - const parent = normalizeWindowsPath(import_node_path8.default.dirname(String(entry.absolute))); - if (parent !== this.cwd) { - const mkParent = this[MKDIR](parent, this.dmode); - if (mkParent) { - return this[ONERROR](mkParent, entry); - } - } - } - const [lstatEr, st] = callSync(() => import_node_fs3.default.lstatSync(String(entry.absolute))); - if (st && (this.keep || /* c8 ignore next */ - this.newer && st.mtime > (entry.mtime ?? st.mtime))) { - return this[SKIP](entry); - } - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry); - } - if (st.isDirectory()) { - if (entry.type === "Directory") { - const needChmod = this.chmod && entry.mode && (st.mode & 4095) !== entry.mode; - const [er3] = needChmod ? callSync(() => { - import_node_fs3.default.chmodSync(String(entry.absolute), Number(entry.mode)); - }) : []; - return this[MAKEFS](er3, entry); - } - const [er2] = callSync(() => import_node_fs3.default.rmdirSync(String(entry.absolute))); - this[MAKEFS](er2, entry); - } - const [er] = entry.absolute === this.cwd ? [] : callSync(() => unlinkFileSync(String(entry.absolute))); - this[MAKEFS](er, entry); - } - [FILE2](entry, done) { - const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.fmode; - const oner = (er) => { - let closeError; - try { - import_node_fs3.default.closeSync(fd); - } catch (e2) { - closeError = e2; - } - if (er || closeError) { - this[ONERROR](er || closeError, entry); - } - done(); - }; - let fd; - try { - fd = import_node_fs3.default.openSync(String(entry.absolute), getWriteFlag(entry.size), mode); - } catch (er) { - return oner(er); - } - const tx = this.transform ? this.transform(entry) || entry : entry; - if (tx !== entry) { - tx.on("error", (er) => this[ONERROR](er, entry)); - entry.pipe(tx); - } - tx.on("data", (chunk) => { - try { - import_node_fs3.default.writeSync(fd, chunk, 0, chunk.length); - } catch (er) { - oner(er); - } - }); - tx.on("end", () => { - let er = null; - if (entry.mtime && !this.noMtime) { - const atime = entry.atime || /* @__PURE__ */ new Date(); - const mtime = entry.mtime; - try { - import_node_fs3.default.futimesSync(fd, atime, mtime); - } catch (futimeser) { - try { - import_node_fs3.default.utimesSync(String(entry.absolute), atime, mtime); - } catch (utimeser) { - er = futimeser; - } - } - } - if (this[DOCHOWN](entry)) { - const uid = this[UID](entry); - const gid = this[GID](entry); - try { - import_node_fs3.default.fchownSync(fd, Number(uid), Number(gid)); - } catch (fchowner) { - try { - import_node_fs3.default.chownSync(String(entry.absolute), Number(uid), Number(gid)); - } catch (chowner) { - er = er || fchowner; - } - } - } - oner(er); - }); - } - [DIRECTORY2](entry, done) { - const mode = typeof entry.mode === "number" ? entry.mode & 4095 : this.dmode; - const er = this[MKDIR](String(entry.absolute), mode); - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - if (entry.mtime && !this.noMtime) { - try { - import_node_fs3.default.utimesSync(String(entry.absolute), entry.atime || /* @__PURE__ */ new Date(), entry.mtime); - } catch (er2) { - } - } - if (this[DOCHOWN](entry)) { - try { - import_node_fs3.default.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry))); - } catch (er2) { - } - } - done(); - entry.resume(); - } - [MKDIR](dir, mode) { - try { - return mkdirSync3(normalizeWindowsPath(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode - }); - } catch (er) { - return er; - } - } - [LINK](entry, linkpath, link, done) { - const ls = `${link}Sync`; - try { - import_node_fs3.default[ls](linkpath, String(entry.absolute)); - done(); - entry.resume(); - } catch (er) { - return this[ONERROR](er, entry); - } - } -}; - -// node_modules/tar/dist/esm/extract.js -var extractFileSync = (opt) => { - const u = new UnpackSync(opt); - const file = opt.file; - const stat3 = import_node_fs4.default.statSync(file); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const stream = new ReadStreamSync(file, { - readSize, - size: stat3.size - }); - stream.pipe(u); -}; -var extractFile = (opt, _) => { - const u = new Unpack(opt); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const file = opt.file; - const p = new Promise((resolve2, reject) => { - u.on("error", reject); - u.on("close", resolve2); - import_node_fs4.default.stat(file, (er, stat3) => { - if (er) { - reject(er); - } else { - const stream = new ReadStream(file, { - readSize, - size: stat3.size - }); - stream.on("error", reject); - stream.pipe(u); - } - }); - }); - return p; -}; -var extract = makeCommand(extractFileSync, extractFile, (opt) => new UnpackSync(opt), (opt) => new Unpack(opt), (opt, files) => { - if (files?.length) - filesFilter(opt, files); -}); - -// node_modules/tar/dist/esm/replace.js -var import_node_fs5 = __toESM(require("node:fs"), 1); -var import_node_path9 = __toESM(require("node:path"), 1); -var replaceSync = (opt, files) => { - const p = new PackSync(opt); - let threw = true; - let fd; - let position; - try { - try { - fd = import_node_fs5.default.openSync(opt.file, "r+"); - } catch (er) { - if (er?.code === "ENOENT") { - fd = import_node_fs5.default.openSync(opt.file, "w+"); - } else { - throw er; - } - } - const st = import_node_fs5.default.fstatSync(fd); - const headBuf = Buffer.alloc(512); - POSITION: for (position = 0; position < st.size; position += 512) { - for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { - bytes = import_node_fs5.default.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos); - if (position === 0 && headBuf[0] === 31 && headBuf[1] === 139) { - throw new Error("cannot append to compressed archives"); - } - if (!bytes) { - break POSITION; - } - } - const h2 = new Header(headBuf); - if (!h2.cksumValid) { - break; - } - const entryBlockSize = 512 * Math.ceil((h2.size || 0) / 512); - if (position + entryBlockSize + 512 > st.size) { - break; - } - position += entryBlockSize; - if (opt.mtimeCache && h2.mtime) { - opt.mtimeCache.set(String(h2.path), h2.mtime); - } - } - threw = false; - streamSync(opt, p, position, fd, files); - } finally { - if (threw) { - try { - import_node_fs5.default.closeSync(fd); - } catch (er) { - } - } - } -}; -var streamSync = (opt, p, position, fd, files) => { - const stream = new WriteStreamSync(opt.file, { - fd, - start: position - }); - p.pipe(stream); - addFilesSync2(p, files); -}; -var replaceAsync = (opt, files) => { - files = Array.from(files); - const p = new Pack(opt); - const getPos = (fd, size, cb_) => { - const cb = (er, pos2) => { - if (er) { - import_node_fs5.default.close(fd, (_) => cb_(er)); - } else { - cb_(null, pos2); - } - }; - let position = 0; - if (size === 0) { - return cb(null, 0); - } - let bufPos = 0; - const headBuf = Buffer.alloc(512); - const onread = (er, bytes) => { - if (er || typeof bytes === "undefined") { - return cb(er); - } - bufPos += bytes; - if (bufPos < 512 && bytes) { - return import_node_fs5.default.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread); - } - if (position === 0 && headBuf[0] === 31 && headBuf[1] === 139) { - return cb(new Error("cannot append to compressed archives")); - } - if (bufPos < 512) { - return cb(null, position); - } - const h2 = new Header(headBuf); - if (!h2.cksumValid) { - return cb(null, position); - } - const entryBlockSize = 512 * Math.ceil((h2.size ?? 0) / 512); - if (position + entryBlockSize + 512 > size) { - return cb(null, position); - } - position += entryBlockSize + 512; - if (position >= size) { - return cb(null, position); - } - if (opt.mtimeCache && h2.mtime) { - opt.mtimeCache.set(String(h2.path), h2.mtime); - } - bufPos = 0; - import_node_fs5.default.read(fd, headBuf, 0, 512, position, onread); - }; - import_node_fs5.default.read(fd, headBuf, 0, 512, position, onread); - }; - const promise = new Promise((resolve2, reject) => { - p.on("error", reject); - let flag = "r+"; - const onopen = (er, fd) => { - if (er && er.code === "ENOENT" && flag === "r+") { - flag = "w+"; - return import_node_fs5.default.open(opt.file, flag, onopen); - } - if (er || !fd) { - return reject(er); - } - import_node_fs5.default.fstat(fd, (er2, st) => { - if (er2) { - return import_node_fs5.default.close(fd, () => reject(er2)); - } - getPos(fd, st.size, (er3, position) => { - if (er3) { - return reject(er3); - } - const stream = new WriteStream(opt.file, { - fd, - start: position - }); - p.pipe(stream); - stream.on("error", reject); - stream.on("close", resolve2); - addFilesAsync2(p, files); - }); - }); - }; - import_node_fs5.default.open(opt.file, flag, onopen); - }); - return promise; -}; -var addFilesSync2 = (p, files) => { - files.forEach((file) => { - if (file.charAt(0) === "@") { - list({ - file: import_node_path9.default.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onReadEntry: (entry) => p.add(entry) - }); - } else { - p.add(file); - } - }); - p.end(); -}; -var addFilesAsync2 = async (p, files) => { - for (let i2 = 0; i2 < files.length; i2++) { - const file = String(files[i2]); - if (file.charAt(0) === "@") { - await list({ - file: import_node_path9.default.resolve(String(p.cwd), file.slice(1)), - noResume: true, - onReadEntry: (entry) => p.add(entry) - }); - } else { - p.add(file); - } - } - p.end(); -}; -var replace = makeCommand( - replaceSync, - replaceAsync, - /* c8 ignore start */ - () => { - throw new TypeError("file is required"); - }, - () => { - throw new TypeError("file is required"); - }, - /* c8 ignore stop */ - (opt, entries) => { - if (!isFile(opt)) { - throw new TypeError("file is required"); - } - if (opt.gzip || opt.brotli || opt.file.endsWith(".br") || opt.file.endsWith(".tbr")) { - throw new TypeError("cannot append to compressed archives"); - } - if (!entries?.length) { - throw new TypeError("no paths specified to add/replace"); - } - } -); - -// node_modules/tar/dist/esm/update.js -var update = makeCommand(replace.syncFile, replace.asyncFile, replace.syncNoFile, replace.asyncNoFile, (opt, entries = []) => { - replace.validate?.(opt, entries); - mtimeFilter(opt); -}); -var mtimeFilter = (opt) => { - const filter = opt.filter; - if (!opt.mtimeCache) { - opt.mtimeCache = /* @__PURE__ */ new Map(); - } - opt.filter = filter ? (path9, stat3) => filter(path9, stat3) && !/* c8 ignore start */ - ((opt.mtimeCache?.get(path9) ?? stat3.mtime ?? 0) > (stat3.mtime ?? 0)) : (path9, stat3) => !/* c8 ignore start */ - ((opt.mtimeCache?.get(path9) ?? stat3.mtime ?? 0) > (stat3.mtime ?? 0)); -}; - -// src/save.ts -var import_child_process = require("child_process"); -var import_util = require("util"); +var fs4 = __toESM(require("fs")); // src/env.ts function getServerUrl() { @@ -32653,13 +24901,13 @@ function getRepoInfo() { } // src/cache.ts -var fs12 = __toESM(require("fs")); +var fs2 = __toESM(require("fs")); // node_modules/node-fetch/src/index.js var import_node_http2 = __toESM(require("node:http"), 1); var import_node_https = __toESM(require("node:https"), 1); var import_node_zlib = __toESM(require("node:zlib"), 1); -var import_node_stream5 = __toESM(require("node:stream"), 1); +var import_node_stream2 = __toESM(require("node:stream"), 1); var import_node_buffer2 = require("node:buffer"); // node_modules/data-uri-to-buffer/dist/index.js @@ -32702,7 +24950,7 @@ function dataUriToBuffer(uri) { var dist_default = dataUriToBuffer; // node_modules/node-fetch/src/body.js -var import_node_stream4 = __toESM(require("node:stream"), 1); +var import_node_stream = __toESM(require("node:stream"), 1); var import_node_util = require("node:util"); var import_node_buffer = require("node:buffer"); init_fetch_blob(); @@ -32762,7 +25010,7 @@ var isSameProtocol = (destination, original) => { }; // node_modules/node-fetch/src/body.js -var pipeline = (0, import_node_util.promisify)(import_node_stream4.default.pipeline); +var pipeline = (0, import_node_util.promisify)(import_node_stream.default.pipeline); var INTERNALS = Symbol("Body internals"); var Body = class { constructor(body, { @@ -32779,7 +25027,7 @@ var Body = class { body = import_node_buffer.Buffer.from(body); } else if (ArrayBuffer.isView(body)) { body = import_node_buffer.Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof import_node_stream4.default) { + } else if (body instanceof import_node_stream.default) { } else if (body instanceof FormData) { body = formDataToBlob(body); boundary = body.type.split("=")[1]; @@ -32788,9 +25036,9 @@ var Body = class { } let stream = body; if (import_node_buffer.Buffer.isBuffer(body)) { - stream = import_node_stream4.default.Readable.from(body); + stream = import_node_stream.default.Readable.from(body); } else if (isBlob(body)) { - stream = import_node_stream4.default.Readable.from(body.stream()); + stream = import_node_stream.default.Readable.from(body.stream()); } this[INTERNALS] = { body, @@ -32800,7 +25048,7 @@ var Body = class { error: null }; this.size = size; - if (body instanceof import_node_stream4.default) { + if (body instanceof import_node_stream.default) { body.on("error", (error_) => { const error = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_); this[INTERNALS].error = error; @@ -32827,8 +25075,8 @@ var Body = class { if (ct.startsWith("application/x-www-form-urlencoded")) { const formData = new FormData(); const parameters = new URLSearchParams(await this.text()); - for (const [name2, value] of parameters) { - formData.append(name2, value); + for (const [name, value] of parameters) { + formData.append(name, value); } return formData; } @@ -32901,7 +25149,7 @@ async function consumeBody(data) { if (body === null) { return import_node_buffer.Buffer.alloc(0); } - if (!(body instanceof import_node_stream4.default)) { + if (!(body instanceof import_node_stream.default)) { return import_node_buffer.Buffer.alloc(0); } const accum = []; @@ -32940,9 +25188,9 @@ var clone = (instance, highWaterMark) => { if (instance.bodyUsed) { throw new Error("cannot clone body after it is used"); } - if (body instanceof import_node_stream4.default && typeof body.getBoundary !== "function") { - p1 = new import_node_stream4.PassThrough({ highWaterMark }); - p2 = new import_node_stream4.PassThrough({ highWaterMark }); + if (body instanceof import_node_stream.default && typeof body.getBoundary !== "function") { + p1 = new import_node_stream.PassThrough({ highWaterMark }); + p2 = new import_node_stream.PassThrough({ highWaterMark }); body.pipe(p1); body.pipe(p2); instance[INTERNALS].stream = p1; @@ -32977,7 +25225,7 @@ var extractContentType = (body, request) => { if (body && typeof body.getBoundary === "function") { return `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`; } - if (body instanceof import_node_stream4.default) { + if (body instanceof import_node_stream.default) { return null; } return "text/plain;charset=UTF-8"; @@ -33009,16 +25257,16 @@ var writeToStream = async (dest, { body }) => { // node_modules/node-fetch/src/headers.js var import_node_util2 = require("node:util"); var import_node_http = __toESM(require("node:http"), 1); -var validateHeaderName = typeof import_node_http.default.validateHeaderName === "function" ? import_node_http.default.validateHeaderName : (name2) => { - if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name2)) { - const error = new TypeError(`Header name must be a valid HTTP token [${name2}]`); +var validateHeaderName = typeof import_node_http.default.validateHeaderName === "function" ? import_node_http.default.validateHeaderName : (name) => { + if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) { + const error = new TypeError(`Header name must be a valid HTTP token [${name}]`); Object.defineProperty(error, "code", { value: "ERR_INVALID_HTTP_TOKEN" }); throw error; } }; -var validateHeaderValue = typeof import_node_http.default.validateHeaderValue === "function" ? import_node_http.default.validateHeaderValue : (name2, value) => { +var validateHeaderValue = typeof import_node_http.default.validateHeaderValue === "function" ? import_node_http.default.validateHeaderValue : (name, value) => { if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) { - const error = new TypeError(`Invalid character in header content ["${name2}"]`); + const error = new TypeError(`Invalid character in header content ["${name}"]`); Object.defineProperty(error, "code", { value: "ERR_INVALID_CHAR" }); throw error; } @@ -33033,9 +25281,9 @@ var Headers = class _Headers extends URLSearchParams { constructor(init) { let result = []; if (init instanceof _Headers) { - const raw2 = init.raw(); - for (const [name2, values] of Object.entries(raw2)) { - result.push(...values.map((value) => [name2, value])); + const raw = init.raw(); + for (const [name, values] of Object.entries(raw)) { + result.push(...values.map((value) => [name, value])); } } else if (init == null) { } else if (typeof init === "object" && !import_node_util2.types.isBoxedPrimitive(init)) { @@ -33061,10 +25309,10 @@ var Headers = class _Headers extends URLSearchParams { } else { throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence> or record)"); } - result = result.length > 0 ? result.map(([name2, value]) => { - validateHeaderName(name2); - validateHeaderValue(name2, String(value)); - return [String(name2).toLowerCase(), String(value)]; + result = result.length > 0 ? result.map(([name, value]) => { + validateHeaderName(name); + validateHeaderValue(name, String(value)); + return [String(name).toLowerCase(), String(value)]; }) : void 0; super(result); return new Proxy(this, { @@ -33072,23 +25320,23 @@ var Headers = class _Headers extends URLSearchParams { switch (p) { case "append": case "set": - return (name2, value) => { - validateHeaderName(name2); - validateHeaderValue(name2, String(value)); + return (name, value) => { + validateHeaderName(name); + validateHeaderValue(name, String(value)); return URLSearchParams.prototype[p].call( target, - String(name2).toLowerCase(), + String(name).toLowerCase(), String(value) ); }; case "delete": case "has": case "getAll": - return (name2) => { - validateHeaderName(name2); + return (name) => { + validateHeaderName(name); return URLSearchParams.prototype[p].call( target, - String(name2).toLowerCase() + String(name).toLowerCase() ); }; case "keys": @@ -33108,33 +25356,33 @@ var Headers = class _Headers extends URLSearchParams { toString() { return Object.prototype.toString.call(this); } - get(name2) { - const values = this.getAll(name2); + get(name) { + const values = this.getAll(name); if (values.length === 0) { return null; } let value = values.join(", "); - if (/^content-encoding$/i.test(name2)) { + if (/^content-encoding$/i.test(name)) { value = value.toLowerCase(); } return value; } forEach(callback, thisArg = void 0) { - for (const name2 of this.keys()) { - Reflect.apply(callback, thisArg, [this.get(name2), name2, this]); + for (const name of this.keys()) { + Reflect.apply(callback, thisArg, [this.get(name), name, this]); } } *values() { - for (const name2 of this.keys()) { - yield this.get(name2); + for (const name of this.keys()) { + yield this.get(name); } } /** * @type {() => IterableIterator<[string, string]>} */ *entries() { - for (const name2 of this.keys()) { - yield [name2, this.get(name2)]; + for (const name of this.keys()) { + yield [name, this.get(name)]; } } [Symbol.iterator]() { @@ -33180,10 +25428,10 @@ function fromRawHeaders(headers = []) { result.push(array.slice(index, index + 2)); } return result; - }, []).filter(([name2, value]) => { + }, []).filter(([name, value]) => { try { - validateHeaderName(name2); - validateHeaderValue(name2, String(value)); + validateHeaderName(name); + validateHeaderValue(name, String(value)); return true; } catch { return false; @@ -33194,8 +25442,8 @@ function fromRawHeaders(headers = []) { // node_modules/node-fetch/src/utils/is-redirect.js var redirectStatus = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]); -var isRedirect = (code2) => { - return redirectStatus.has(code2); +var isRedirect = (code) => { + return redirectStatus.has(code); }; // node_modules/node-fetch/src/response.js @@ -33675,7 +25923,7 @@ init_esm_min(); init_from(); var supportedSchemas = /* @__PURE__ */ new Set(["data:", "http:", "https:"]); async function fetch(url, options_) { - return new Promise((resolve2, reject) => { + return new Promise((resolve, reject) => { const request = new Request(url, options_); const { parsedURL, options } = getNodeRequestOptions(request); if (!supportedSchemas.has(parsedURL.protocol)) { @@ -33684,7 +25932,7 @@ async function fetch(url, options_) { if (parsedURL.protocol === "data:") { const data = dist_default(request.url); const response2 = new Response(data, { headers: { "Content-Type": data.typeFull } }); - resolve2(response2); + resolve(response2); return; } const send = (parsedURL.protocol === "https:" ? import_node_https.default : import_node_http2.default).request; @@ -33693,7 +25941,7 @@ async function fetch(url, options_) { const abort = () => { const error = new AbortError("The operation was aborted."); reject(error); - if (request.body && request.body instanceof import_node_stream5.default.Readable) { + if (request.body && request.body instanceof import_node_stream2.default.Readable) { request.body.destroy(error); } if (!response || !response.body) { @@ -33788,11 +26036,11 @@ async function fetch(url, options_) { referrerPolicy: request.referrerPolicy }; if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) { - for (const name2 of ["authorization", "www-authenticate", "cookie", "cookie2"]) { - requestOptions.headers.delete(name2); + for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) { + requestOptions.headers.delete(name); } } - if (response_.statusCode !== 303 && request.body && options_.body instanceof import_node_stream5.default.Readable) { + if (response_.statusCode !== 303 && request.body && options_.body instanceof import_node_stream2.default.Readable) { reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect")); finalize(); return; @@ -33806,7 +26054,7 @@ async function fetch(url, options_) { if (responseReferrerPolicy) { requestOptions.referrerPolicy = responseReferrerPolicy; } - resolve2(fetch(new Request(locationURL, requestOptions))); + resolve(fetch(new Request(locationURL, requestOptions))); finalize(); return; } @@ -33819,7 +26067,7 @@ async function fetch(url, options_) { signal.removeEventListener("abort", abortAndFinalize); }); } - let body = (0, import_node_stream5.pipeline)(response_, new import_node_stream5.PassThrough(), (error) => { + let body = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error) => { if (error) { reject(error); } @@ -33839,7 +26087,7 @@ async function fetch(url, options_) { const codings = headers.get("Content-Encoding"); if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) { response = new Response(body, responseOptions); - resolve2(response); + resolve(response); return; } const zlibOptions = { @@ -33847,58 +26095,58 @@ async function fetch(url, options_) { finishFlush: import_node_zlib.default.Z_SYNC_FLUSH }; if (codings === "gzip" || codings === "x-gzip") { - body = (0, import_node_stream5.pipeline)(body, import_node_zlib.default.createGunzip(zlibOptions), (error) => { + body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createGunzip(zlibOptions), (error) => { if (error) { reject(error); } }); response = new Response(body, responseOptions); - resolve2(response); + resolve(response); return; } if (codings === "deflate" || codings === "x-deflate") { - const raw2 = (0, import_node_stream5.pipeline)(response_, new import_node_stream5.PassThrough(), (error) => { + const raw = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error) => { if (error) { reject(error); } }); - raw2.once("data", (chunk) => { + raw.once("data", (chunk) => { if ((chunk[0] & 15) === 8) { - body = (0, import_node_stream5.pipeline)(body, import_node_zlib.default.createInflate(), (error) => { + body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflate(), (error) => { if (error) { reject(error); } }); } else { - body = (0, import_node_stream5.pipeline)(body, import_node_zlib.default.createInflateRaw(), (error) => { + body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflateRaw(), (error) => { if (error) { reject(error); } }); } response = new Response(body, responseOptions); - resolve2(response); + resolve(response); }); - raw2.once("end", () => { + raw.once("end", () => { if (!response) { response = new Response(body, responseOptions); - resolve2(response); + resolve(response); } }); return; } if (codings === "br") { - body = (0, import_node_stream5.pipeline)(body, import_node_zlib.default.createBrotliDecompress(), (error) => { + body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createBrotliDecompress(), (error) => { if (error) { reject(error); } }); response = new Response(body, responseOptions); - resolve2(response); + resolve(response); return; } response = new Response(body, responseOptions); - resolve2(response); + resolve(response); }); writeToStream(request_, request).catch(reject); }); @@ -33938,49 +26186,7 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) { // src/cache.ts var import_promises = require("stream/promises"); -var import_fs8 = require("fs"); -async function uploadCache(options, owner, repo, key, filePath) { - const url = `${options.serverUrl}/cache/${owner}/${repo}/${key}`; - const fileStats = await fs12.promises.stat(filePath); - const stream = (0, import_fs8.createReadStream)(filePath); - const res = await fetch(url, { - method: "PUT", - headers: { - "Authorization": `Bearer ${options.token}`, - "Content-Type": "application/gzip", - "Content-Length": fileStats.size.toString() - }, - body: stream - }); - if (!res.ok) { - throw new Error( - `Failed to upload cache: ${res.status} ${res.statusText}` - ); - } - console.log(`\u2705 Uploaded cache for ${owner}/${repo}/${key}`); -} -async function downloadCache(options, owner, repo, key, destinationPath) { - const url = `${options.serverUrl}/cache/${owner}/${repo}/${key}`; - const res = await fetch(url, { - method: "GET", - headers: { - "Authorization": `Bearer ${options.token}` - } - }); - if (res.status === 404) { - console.warn("\u26A0\uFE0F Cache not found."); - return false; - } - if (!res.ok || !res.body) { - throw new Error( - `Failed to download cache: ${res.status} ${res.statusText}` - ); - } - const destStream = (0, import_fs8.createWriteStream)(destinationPath); - await (0, import_promises.pipeline)(res.body, destStream); - console.log(`\u2705 Downloaded cache to ${destinationPath}`); - return true; -} +var import_fs = require("fs"); // src/util.ts function formatSize(bytes) { @@ -33993,76 +26199,155 @@ function formatSize(bytes) { } } -// src/save.ts -var execFileAsync = (0, import_util.promisify)(import_child_process.execFile); -async function saveCache(key, paths, cmprss_lvl = 3) { - const tempDir = await fs13.promises.mkdtemp("/tmp/cache-save-"); - const tarPath = path8.join(tempDir, "cache.tar"); - const zstPath = path8.join(tempDir, "cache.tar.zst"); - let startTime = Date.now(); - core.info(`Creating tar archive: ${tarPath}`); - await create( - { - file: tarPath, - cwd: "/", - portable: true, - gzip: false - // No gzip compression +// src/cache.ts +async function uploadCache(options, owner, repo, key, filePath) { + const url = `${options.serverUrl}/cache/${owner}/${repo}/${key}`; + const fileStats = await fs2.promises.stat(filePath); + console.log(` +\u2B06\uFE0F Uploading cache: ${filePath}`); + const startTime = Date.now(); + const stream = (0, import_fs.createReadStream)(filePath); + const res = await fetch(url, { + method: "PUT", + headers: { + "Authorization": `Bearer ${options.token}`, + "Content-Type": "application/gzip", + "Content-Length": fileStats.size.toString() }, - paths - ); - const tarSize = fs13.statSync(tarPath).size; - let endTime = Date.now(); - let duration = endTime - startTime; - let durationInSeconds = (duration / 1e3).toFixed(2); - core.info( - `Tar archive created in ${durationInSeconds} seconds (${formatSize(tarSize)})` - ); - core.info(`Compressing archive to zstd (Level: ${cmprss_lvl}): ${zstPath}`); - startTime = Date.now(); - await execFileAsync("zstd", [ - "-" + cmprss_lvl.toString(), - "-o", - zstPath, - tarPath - ]); - endTime = Date.now(); - duration = endTime - startTime; - durationInSeconds = (duration / 1e3).toFixed(2); - const zstSize = fs13.statSync(zstPath).size; - core.info( - `Compression completed in ${durationInSeconds} seconds (${formatSize(tarSize)} -> ${formatSize(zstSize)})` - ); - core.info("Uploading archive to Cache Server..."); - startTime = Date.now(); + body: stream + }); + const endTime = Date.now(); + const duration = (endTime - startTime) / 1e3; + const speedMBs = fileStats.size / 1024 / 1024 / duration; + if (!res.ok) { + throw new Error( + `\u274C Failed to upload cache: ${res.status} ${res.statusText}` + ); + } + console.log(`\u2705 Upload completed`); + console.log(`\u{1F4E6} Size: ${formatSize(fileStats.size)}`); + console.log(`\u23F1 Duration: ${duration.toFixed(2)} s`); + console.log(`\u26A1 Speed: ${speedMBs.toFixed(2)} MB/s +`); +} +async function downloadCache(options, owner, repo, key, destinationPath) { + const url = `${options.serverUrl}/cache/${owner}/${repo}/${key}`; + console.log(` +\u2B07\uFE0F Downloading cache to: ${destinationPath}`); + const startTime = Date.now(); + const res = await fetch(url, { + method: "GET", + headers: { + "Authorization": `Bearer ${options.token}` + } + }); + if (res.status === 404) { + console.warn("\u26A0\uFE0F Cache not found."); + return false; + } + if (!res.ok || !res.body) { + throw new Error( + `\u274C Failed to download cache: ${res.status} ${res.statusText}` + ); + } + const destStream = (0, import_fs.createWriteStream)(destinationPath); + await (0, import_promises.pipeline)(res.body, destStream); + const endTime = Date.now(); + const duration = (endTime - startTime) / 1e3; + const size = fs2.statSync(destinationPath).size; + const speedMBs = size / 1024 / 1024 / duration; + console.log(`\u2705 Download completed`); + console.log(`\u{1F4E6} Size: ${formatSize(size)}`); + console.log(`\u23F1 Duration: ${duration.toFixed(2)} s`); + console.log(`\u26A1 Speed: ${speedMBs.toFixed(2)} MB/s +`); + return true; +} + +// src/compress.ts +var import_child_process = require("child_process"); +var import_util2 = require("util"); +var fs3 = __toESM(require("fs")); +var path = __toESM(require("path")); +var os = __toESM(require("os")); +var execAsync = (0, import_util2.promisify)(import_child_process.exec); +async function createCompressedTar(key, paths, cmprss_lvl = 3) { + if (!paths || paths.length === 0) { + throw new Error("No paths specified for archiving."); + } + const tempDir = await fs3.promises.mkdtemp(path.join(os.tmpdir(), "cache-")); + const archivePath = path.join(tempDir, `${key}.tar.zst`); + const quotedPaths = paths.map((p) => `"${p}"`).join(" "); + const cmd = `tar -cf - ${quotedPaths} | zstd -${cmprss_lvl} -o "${archivePath}"`; + console.log(` +\u{1F504} Compressing with zstd (Level: ${cmprss_lvl})...`); + const startTime = Date.now(); + await execAsync(cmd, { + cwd: "/", + // Required for absolute paths + shell: "/bin/bash" + }); + const endTime = Date.now(); + const duration = (endTime - startTime) / 1e3; + const size = fs3.statSync(archivePath).size; + const speedMBs = size / 1024 / 1024 / duration; + console.log(`\u2705 Archive created: ${archivePath}`); + console.log(`\u23F1 Duration: ${duration.toFixed(2)} s`); + console.log(`\u{1F4E6} Size: ${formatSize(size)}`); + console.log(`\u26A1 Speed: ${speedMBs.toFixed(2)} MB/s`); + console.log(); + return archivePath; +} +async function extractCompressedTar(archivePath, extractTo = "/") { + if (!fs3.existsSync(archivePath)) { + throw new Error(`Archive not found: ${archivePath}`); + } + const cmd = `zstd -dc "${archivePath}" | tar -xf - -C "${extractTo}"`; + console.log(` +\u{1F4C2} Extracting archive: ${archivePath}`); + const startTime = Date.now(); + await execAsync(cmd, { + shell: "/bin/bash" + }); + const endTime = Date.now(); + const duration = (endTime - startTime) / 1e3; + const size = fs3.statSync(archivePath).size; + const speedMBs = size / 1024 / 1024 / duration; + console.log(`\u2705 Extraction completed`); + console.log(`\u23F1 Duration: ${duration.toFixed(2)} s`); + console.log(`\u{1F4E6} Archive size: ${formatSize(size)}`); + console.log(`\u26A1 Speed: ${speedMBs.toFixed(2)} MB/s`); + console.log(); +} + +// src/save.ts +async function saveCache(key, paths, cmprss_lvl = 3) { + core.info(`Starting cache save for key: ${key}`); + const startTime = Date.now(); + const archivePath = await createCompressedTar(key, paths, cmprss_lvl); + const archiveSize = fs4.statSync(archivePath).size; const { owner, repo } = getRepoInfo(); await uploadCache( { serverUrl: getServerUrl(), token: getToken() }, owner, repo, key, - zstPath + archivePath ); - endTime = Date.now(); - duration = endTime - startTime; - durationInSeconds = (duration / 1e3).toFixed(2); + const endTime = Date.now(); + const durationSeconds = ((endTime - startTime) / 1e3).toFixed(2); core.info( - `Upload completed in ${durationInSeconds} seconds (${formatSize(zstSize)})` + `\u2705 Cache saved successfully (${formatSize(archiveSize)}, ${durationSeconds} s)` ); - core.info("Cache successfully saved!"); } // src/restore.ts var core2 = __toESM(require_core()); -var fs14 = __toESM(require("fs")); -var import_child_process2 = require("child_process"); -var import_util3 = require("util"); -var execFileAsync2 = (0, import_util3.promisify)(import_child_process2.execFile); +var fs5 = __toESM(require("fs")); async function restoreCache(key) { + core2.info(`Starting cache restore for key: ${key}`); + const startTime = Date.now(); const zstPath = `/tmp/${key}.tar.zst`; - const tarPath = `/tmp/${key}.tar`; - core2.info(`Downloading cache for key ${key}...`); - let startTime = Date.now(); const { owner, repo } = getRepoInfo(); const downloaded = await downloadCache( { serverUrl: getServerUrl(), token: getToken() }, @@ -34072,36 +26357,16 @@ async function restoreCache(key) { zstPath ); if (!downloaded) { - core2.warning("Cache archive not found, skipping restore."); + core2.warning("\u26A0\uFE0F Cache archive not found, skipping restore."); return false; } - let endTime = Date.now(); - let duration = endTime - startTime; - let durationInSeconds = (duration / 1e3).toFixed(2); - const zstSize = fs14.statSync(zstPath).size; + const archiveSize = fs5.statSync(zstPath).size; + await extractCompressedTar(zstPath); + const endTime = Date.now(); + const durationSeconds = ((endTime - startTime) / 1e3).toFixed(2); core2.info( - `Download completed in ${durationInSeconds} seconds (${formatSize(zstSize)})` + `\u2705 Cache restored successfully (${formatSize(archiveSize)}, ${durationSeconds} s)` ); - core2.info("Decompressing zstd archive..."); - startTime = Date.now(); - await execFileAsync2("zstd", ["-d", "-o", tarPath, zstPath]); - endTime = Date.now(); - duration = endTime - startTime; - durationInSeconds = (duration / 1e3).toFixed(2); - const tarSize = fs14.statSync(tarPath).size; - core2.info( - `Decompression completed in ${durationInSeconds} seconds (${formatSize(zstSize)} -> ${formatSize(tarSize)})` - ); - core2.info("Extracting tar archive with system tar..."); - startTime = Date.now(); - await execFileAsync2("tar", ["-xf", tarPath, "-C", "/"]); - endTime = Date.now(); - duration = endTime - startTime; - durationInSeconds = (duration / 1e3).toFixed(2); - core2.info( - `Extraction completed in ${durationInSeconds} seconds (${formatSize(tarSize)})` - ); - core2.info("Cache successfully restored!"); return true; }