UNPKG

github-action-readme-generator

Version:

This is a CLI tool and GitHub Action that reads in the details from a GitHub Action's `action.yml` file and updates the `README.md` file with the `name`, `description`, `usage`, `inputs`, `outputs`, and examples of the action. Configuration can be provid

1,390 lines (1,364 loc) 30.9 MB
await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await import("url");if(typeof globalThis.__filename>"u"&&(globalThis.__filename=i(import.meta.url)),typeof globalThis.__dirname>"u"&&(globalThis.__dirname=e(globalThis.__filename)),typeof globalThis.require>"u"){let{default:a}=await import("module");globalThis.require=a.createRequire(import.meta.url)}})(); var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __require = /* @__PURE__ */ ((x7) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x7, { get: (a, b5) => (typeof require !== "undefined" ? require : a)[b5] }) : x7)(function(x7) { if (typeof require !== "undefined") return require.apply(this, arguments); throw Error('Dynamic require of "' + x7 + '" is not supported'); }); var __esm = (fn6, res) => function __init() { return fn6 && (res = (0, fn6[__getOwnPropNames(fn6)[0]])(fn6 = 0)), res; }; var __commonJS = (cb, mod) => function __require4() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to3, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to3, key) && key !== except) __defProp(to3, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to3; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/@actions/core/lib/utils.js var require_utils = __commonJS({ "node_modules/@actions/core/lib/utils.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toCommandProperties = exports.toCommandValue = void 0; function toCommandValue(input) { if (input === null || input === void 0) { return ""; } else if (typeof input === "string" || input instanceof String) { return input; } return JSON.stringify(input); } exports.toCommandValue = toCommandValue; function toCommandProperties(annotationProperties) { if (!Object.keys(annotationProperties).length) { return {}; } return { title: annotationProperties.title, file: annotationProperties.file, line: annotationProperties.startLine, endLine: annotationProperties.endLine, col: annotationProperties.startColumn, endColumn: annotationProperties.endColumn }; } exports.toCommandProperties = toCommandProperties; } }); // node_modules/@actions/core/lib/command.js var require_command = __commonJS({ "node_modules/@actions/core/lib/command.js"(exports) { "use strict"; var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m3, k4, k23) { if (k23 === void 0) k23 = k4; Object.defineProperty(o2, k23, { enumerable: true, get: function() { return m3[k4]; } }); } : function(o2, m3, k4, k23) { if (k23 === void 0) k23 = k4; o2[k23] = m3[k4]; }); var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v7) { Object.defineProperty(o2, "default", { enumerable: true, value: v7 }); } : function(o2, v7) { o2["default"] = v7; }); var __importStar = exports && exports.__importStar || function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { for (var k4 in mod) if (k4 !== "default" && Object.hasOwnProperty.call(mod, k4)) __createBinding(result, mod, k4); } __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.issue = exports.issueCommand = void 0; var os10 = __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() + os10.EOL); } exports.issueCommand = issueCommand; function issue(name, message = "") { issueCommand(name, {}, message); } exports.issue = issue; var CMD_STRING = "::"; var Command = class { constructor(command, properties, message) { if (!command) { command = "missing.command"; } this.command = command; this.properties = properties; this.message = message; } toString() { let cmdStr = CMD_STRING + this.command; if (this.properties && Object.keys(this.properties).length > 0) { cmdStr += " "; let first = true; for (const key in this.properties) { if (this.properties.hasOwnProperty(key)) { const val = this.properties[key]; if (val) { if (first) { first = false; } else { cmdStr += ","; } cmdStr += `${key}=${escapeProperty(val)}`; } } } } cmdStr += `${CMD_STRING}${escapeData(this.message)}`; return cmdStr; } }; function escapeData(s3) { return utils_1.toCommandValue(s3).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); } function escapeProperty(s3) { return utils_1.toCommandValue(s3).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); } } }); // node_modules/uuid/dist/esm-node/rng.js import crypto from "crypto"; function rng() { if (poolPtr > rnds8Pool.length - 16) { crypto.randomFillSync(rnds8Pool); poolPtr = 0; } return rnds8Pool.slice(poolPtr, poolPtr += 16); } var rnds8Pool, poolPtr; var init_rng = __esm({ "node_modules/uuid/dist/esm-node/rng.js"() { rnds8Pool = new Uint8Array(256); poolPtr = rnds8Pool.length; } }); // node_modules/uuid/dist/esm-node/regex.js var regex_default; var init_regex = __esm({ "node_modules/uuid/dist/esm-node/regex.js"() { regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; } }); // node_modules/uuid/dist/esm-node/validate.js function validate(uuid) { return typeof uuid === "string" && regex_default.test(uuid); } var validate_default; var init_validate = __esm({ "node_modules/uuid/dist/esm-node/validate.js"() { init_regex(); validate_default = validate; } }); // node_modules/uuid/dist/esm-node/stringify.js function stringify(arr2, offset = 0) { const uuid = (byteToHex[arr2[offset + 0]] + byteToHex[arr2[offset + 1]] + byteToHex[arr2[offset + 2]] + byteToHex[arr2[offset + 3]] + "-" + byteToHex[arr2[offset + 4]] + byteToHex[arr2[offset + 5]] + "-" + byteToHex[arr2[offset + 6]] + byteToHex[arr2[offset + 7]] + "-" + byteToHex[arr2[offset + 8]] + byteToHex[arr2[offset + 9]] + "-" + byteToHex[arr2[offset + 10]] + byteToHex[arr2[offset + 11]] + byteToHex[arr2[offset + 12]] + byteToHex[arr2[offset + 13]] + byteToHex[arr2[offset + 14]] + byteToHex[arr2[offset + 15]]).toLowerCase(); if (!validate_default(uuid)) { throw TypeError("Stringified UUID is invalid"); } return uuid; } var byteToHex, stringify_default; var init_stringify = __esm({ "node_modules/uuid/dist/esm-node/stringify.js"() { init_validate(); byteToHex = []; for (let i3 = 0; i3 < 256; ++i3) { byteToHex.push((i3 + 256).toString(16).substr(1)); } stringify_default = stringify; } }); // node_modules/uuid/dist/esm-node/v1.js function v1(options8, buf, offset) { let i3 = buf && offset || 0; const b5 = buf || new Array(16); options8 = options8 || {}; let node2 = options8.node || _nodeId; let clockseq = options8.clockseq !== void 0 ? options8.clockseq : _clockseq; if (node2 == null || clockseq == null) { const seedBytes = options8.random || (options8.rng || rng)(); if (node2 == null) { node2 = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; } if (clockseq == null) { clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; } } let msecs = options8.msecs !== void 0 ? options8.msecs : Date.now(); let nsecs = options8.nsecs !== void 0 ? options8.nsecs : _lastNSecs + 1; const dt7 = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; if (dt7 < 0 && options8.clockseq === void 0) { clockseq = clockseq + 1 & 16383; } if ((dt7 < 0 || msecs > _lastMSecs) && options8.nsecs === void 0) { nsecs = 0; } if (nsecs >= 1e4) { throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); } _lastMSecs = msecs; _lastNSecs = nsecs; _clockseq = clockseq; msecs += 122192928e5; const tl2 = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; b5[i3++] = tl2 >>> 24 & 255; b5[i3++] = tl2 >>> 16 & 255; b5[i3++] = tl2 >>> 8 & 255; b5[i3++] = tl2 & 255; const tmh = msecs / 4294967296 * 1e4 & 268435455; b5[i3++] = tmh >>> 8 & 255; b5[i3++] = tmh & 255; b5[i3++] = tmh >>> 24 & 15 | 16; b5[i3++] = tmh >>> 16 & 255; b5[i3++] = clockseq >>> 8 | 128; b5[i3++] = clockseq & 255; for (let n3 = 0; n3 < 6; ++n3) { b5[i3 + n3] = node2[n3]; } return buf || stringify_default(b5); } var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default; var init_v1 = __esm({ "node_modules/uuid/dist/esm-node/v1.js"() { init_rng(); init_stringify(); _lastMSecs = 0; _lastNSecs = 0; v1_default = v1; } }); // node_modules/uuid/dist/esm-node/parse.js function parse(uuid) { if (!validate_default(uuid)) { throw TypeError("Invalid UUID"); } let v7; const arr2 = new Uint8Array(16); arr2[0] = (v7 = parseInt(uuid.slice(0, 8), 16)) >>> 24; arr2[1] = v7 >>> 16 & 255; arr2[2] = v7 >>> 8 & 255; arr2[3] = v7 & 255; arr2[4] = (v7 = parseInt(uuid.slice(9, 13), 16)) >>> 8; arr2[5] = v7 & 255; arr2[6] = (v7 = parseInt(uuid.slice(14, 18), 16)) >>> 8; arr2[7] = v7 & 255; arr2[8] = (v7 = parseInt(uuid.slice(19, 23), 16)) >>> 8; arr2[9] = v7 & 255; arr2[10] = (v7 = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; arr2[11] = v7 / 4294967296 & 255; arr2[12] = v7 >>> 24 & 255; arr2[13] = v7 >>> 16 & 255; arr2[14] = v7 >>> 8 & 255; arr2[15] = v7 & 255; return arr2; } var parse_default; var init_parse = __esm({ "node_modules/uuid/dist/esm-node/parse.js"() { init_validate(); parse_default = parse; } }); // node_modules/uuid/dist/esm-node/v35.js function stringToBytes(str) { str = unescape(encodeURIComponent(str)); const bytes = []; for (let i3 = 0; i3 < str.length; ++i3) { bytes.push(str.charCodeAt(i3)); } return bytes; } function v35_default(name, version2, hashfunc) { function generateUUID(value, namespace, buf, offset) { if (typeof value === "string") { value = stringToBytes(value); } if (typeof namespace === "string") { namespace = parse_default(namespace); } if (namespace.length !== 16) { throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); } let bytes = new Uint8Array(16 + value.length); bytes.set(namespace); bytes.set(value, namespace.length); bytes = hashfunc(bytes); bytes[6] = bytes[6] & 15 | version2; bytes[8] = bytes[8] & 63 | 128; if (buf) { offset = offset || 0; for (let i3 = 0; i3 < 16; ++i3) { buf[offset + i3] = bytes[i3]; } return buf; } return stringify_default(bytes); } try { generateUUID.name = name; } catch (err) { } generateUUID.DNS = DNS; generateUUID.URL = URL2; return generateUUID; } var DNS, URL2; var init_v35 = __esm({ "node_modules/uuid/dist/esm-node/v35.js"() { init_stringify(); init_parse(); DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; } }); // node_modules/uuid/dist/esm-node/md5.js import crypto2 from "crypto"; function md5(bytes) { if (Array.isArray(bytes)) { bytes = Buffer.from(bytes); } else if (typeof bytes === "string") { bytes = Buffer.from(bytes, "utf8"); } return crypto2.createHash("md5").update(bytes).digest(); } var md5_default; var init_md5 = __esm({ "node_modules/uuid/dist/esm-node/md5.js"() { md5_default = md5; } }); // node_modules/uuid/dist/esm-node/v3.js var v3, v3_default; var init_v3 = __esm({ "node_modules/uuid/dist/esm-node/v3.js"() { init_v35(); init_md5(); v3 = v35_default("v3", 48, md5_default); v3_default = v3; } }); // node_modules/uuid/dist/esm-node/v4.js function v4(options8, buf, offset) { options8 = options8 || {}; const rnds = options8.random || (options8.rng || rng)(); rnds[6] = rnds[6] & 15 | 64; rnds[8] = rnds[8] & 63 | 128; if (buf) { offset = offset || 0; for (let i3 = 0; i3 < 16; ++i3) { buf[offset + i3] = rnds[i3]; } return buf; } return stringify_default(rnds); } var v4_default; var init_v4 = __esm({ "node_modules/uuid/dist/esm-node/v4.js"() { init_rng(); init_stringify(); v4_default = v4; } }); // node_modules/uuid/dist/esm-node/sha1.js import crypto3 from "crypto"; function sha1(bytes) { if (Array.isArray(bytes)) { bytes = Buffer.from(bytes); } else if (typeof bytes === "string") { bytes = Buffer.from(bytes, "utf8"); } return crypto3.createHash("sha1").update(bytes).digest(); } var sha1_default; var init_sha1 = __esm({ "node_modules/uuid/dist/esm-node/sha1.js"() { sha1_default = sha1; } }); // node_modules/uuid/dist/esm-node/v5.js var v5, v5_default; var init_v5 = __esm({ "node_modules/uuid/dist/esm-node/v5.js"() { init_v35(); init_sha1(); v5 = v35_default("v5", 80, sha1_default); v5_default = v5; } }); // node_modules/uuid/dist/esm-node/nil.js var nil_default; var init_nil = __esm({ "node_modules/uuid/dist/esm-node/nil.js"() { nil_default = "00000000-0000-0000-0000-000000000000"; } }); // node_modules/uuid/dist/esm-node/version.js function version(uuid) { if (!validate_default(uuid)) { throw TypeError("Invalid UUID"); } return parseInt(uuid.substr(14, 1), 16); } var version_default; var init_version = __esm({ "node_modules/uuid/dist/esm-node/version.js"() { init_validate(); version_default = version; } }); // node_modules/uuid/dist/esm-node/index.js var esm_node_exports = {}; __export(esm_node_exports, { NIL: () => nil_default, parse: () => parse_default, stringify: () => stringify_default, v1: () => v1_default, v3: () => v3_default, v4: () => v4_default, v5: () => v5_default, validate: () => validate_default, version: () => version_default }); var init_esm_node = __esm({ "node_modules/uuid/dist/esm-node/index.js"() { init_v1(); init_v3(); init_v4(); init_v5(); init_nil(); init_version(); init_validate(); init_stringify(); init_parse(); } }); // node_modules/@actions/core/lib/file-command.js var require_file_command = __commonJS({ "node_modules/@actions/core/lib/file-command.js"(exports) { "use strict"; var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m3, k4, k23) { if (k23 === void 0) k23 = k4; Object.defineProperty(o2, k23, { enumerable: true, get: function() { return m3[k4]; } }); } : function(o2, m3, k4, k23) { if (k23 === void 0) k23 = k4; o2[k23] = m3[k4]; }); var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v7) { Object.defineProperty(o2, "default", { enumerable: true, value: v7 }); } : function(o2, v7) { o2["default"] = v7; }); var __importStar = exports && exports.__importStar || function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { for (var k4 in mod) if (k4 !== "default" && Object.hasOwnProperty.call(mod, k4)) __createBinding(result, mod, k4); } __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; var fs12 = __importStar(__require("fs")); var os10 = __importStar(__require("os")); var uuid_1 = (init_esm_node(), __toCommonJS(esm_node_exports)); 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 (!fs12.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } fs12.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os10.EOL}`, { encoding: "utf8" }); } exports.issueFileCommand = issueFileCommand; function prepareKeyValueMessage(key, value) { const delimiter2 = `ghadelimiter_${uuid_1.v4()}`; const convertedValue = utils_1.toCommandValue(value); if (key.includes(delimiter2)) { throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter2}"`); } if (convertedValue.includes(delimiter2)) { throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter2}"`); } return `${key}<<${delimiter2}${os10.EOL}${convertedValue}${os10.EOL}${delimiter2}`; } exports.prepareKeyValueMessage = prepareKeyValueMessage; } }); // node_modules/@actions/http-client/lib/proxy.js var require_proxy = __commonJS({ "node_modules/@actions/http-client/lib/proxy.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkBypass = exports.getProxyUrl = void 0; function getProxyUrl(reqUrl) { const usingSsl = reqUrl.protocol === "https:"; if (checkBypass(reqUrl)) { return void 0; } const proxyVar = (() => { if (usingSsl) { return process.env["https_proxy"] || process.env["HTTPS_PROXY"]; } else { return process.env["http_proxy"] || process.env["HTTP_PROXY"]; } })(); if (proxyVar) { try { return new URL(proxyVar); } catch (_a3) { if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://")) return new URL(`http://${proxyVar}`); } } else { return void 0; } } exports.getProxyUrl = getProxyUrl; function checkBypass(reqUrl) { if (!reqUrl.hostname) { return false; } const reqHost = reqUrl.hostname; if (isLoopbackAddress(reqHost)) { return true; } const noProxy = process.env["no_proxy"] || process.env["NO_PROXY"] || ""; if (!noProxy) { return false; } let reqPort; if (reqUrl.port) { reqPort = Number(reqUrl.port); } else if (reqUrl.protocol === "http:") { reqPort = 80; } else if (reqUrl.protocol === "https:") { reqPort = 443; } const upperReqHosts = [reqUrl.hostname.toUpperCase()]; if (typeof reqPort === "number") { upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); } for (const upperNoProxyItem of noProxy.split(",").map((x7) => x7.trim().toUpperCase()).filter((x7) => x7)) { if (upperNoProxyItem === "*" || upperReqHosts.some((x7) => x7 === upperNoProxyItem || x7.endsWith(`.${upperNoProxyItem}`) || upperNoProxyItem.startsWith(".") && x7.endsWith(`${upperNoProxyItem}`))) { return true; } } return false; } exports.checkBypass = checkBypass; function isLoopbackAddress(host) { const hostLower = host.toLowerCase(); return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]"); } } }); // node_modules/tunnel/lib/tunnel.js var require_tunnel = __commonJS({ "node_modules/tunnel/lib/tunnel.js"(exports) { "use strict"; var net = __require("net"); var tls = __require("tls"); var http = __require("http"); var https = __require("https"); var events = __require("events"); var assert6 = __require("assert"); var util = __require("util"); exports.httpOverHttp = httpOverHttp; exports.httpsOverHttp = httpsOverHttp; exports.httpOverHttps = httpOverHttps; exports.httpsOverHttps = httpsOverHttps; function httpOverHttp(options8) { var agent = new TunnelingAgent(options8); agent.request = http.request; return agent; } function httpsOverHttp(options8) { var agent = new TunnelingAgent(options8); agent.request = http.request; agent.createSocket = createSecureSocket; agent.defaultPort = 443; return agent; } function httpOverHttps(options8) { var agent = new TunnelingAgent(options8); agent.request = https.request; return agent; } function httpsOverHttps(options8) { var agent = new TunnelingAgent(options8); agent.request = https.request; agent.createSocket = createSecureSocket; agent.defaultPort = 443; return agent; } function TunnelingAgent(options8) { var self2 = this; self2.options = options8 || {}; self2.proxyOptions = self2.options.proxy || {}; self2.maxSockets = self2.options.maxSockets || http.Agent.defaultMaxSockets; self2.requests = []; self2.sockets = []; self2.on("free", function onFree(socket, host, port, localAddress) { var options9 = toOptions(host, port, localAddress); for (var i3 = 0, len = self2.requests.length; i3 < len; ++i3) { var pending = self2.requests[i3]; if (pending.host === options9.host && pending.port === options9.port) { self2.requests.splice(i3, 1); pending.request.onSocket(socket); return; } } socket.destroy(); self2.removeSocket(socket); }); } util.inherits(TunnelingAgent, events.EventEmitter); TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { var self2 = this; var options8 = mergeOptions({ request: req }, self2.options, toOptions(host, port, localAddress)); if (self2.sockets.length >= this.maxSockets) { self2.requests.push(options8); return; } self2.createSocket(options8, function(socket) { socket.on("free", onFree); socket.on("close", onCloseOrRemove); socket.on("agentRemove", onCloseOrRemove); req.onSocket(socket); function onFree() { self2.emit("free", socket, options8); } function onCloseOrRemove(err) { self2.removeSocket(socket); socket.removeListener("free", onFree); socket.removeListener("close", onCloseOrRemove); socket.removeListener("agentRemove", onCloseOrRemove); } }); }; TunnelingAgent.prototype.createSocket = function createSocket(options8, cb) { var self2 = this; var placeholder = {}; self2.sockets.push(placeholder); var connectOptions = mergeOptions({}, self2.proxyOptions, { method: "CONNECT", path: options8.host + ":" + options8.port, agent: false, headers: { host: options8.host + ":" + options8.port } }); if (options8.localAddress) { connectOptions.localAddress = options8.localAddress; } if (connectOptions.proxyAuth) { connectOptions.headers = connectOptions.headers || {}; connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64"); } debug("making CONNECT request"); var connectReq = self2.request(connectOptions); connectReq.useChunkedEncodingByDefault = false; connectReq.once("response", onResponse); connectReq.once("upgrade", onUpgrade); connectReq.once("connect", onConnect); connectReq.once("error", onError); connectReq.end(); function onResponse(res) { res.upgrade = true; } function onUpgrade(res, socket, head) { process.nextTick(function() { onConnect(res, socket, head); }); } function onConnect(res, socket, head) { connectReq.removeAllListeners(); socket.removeAllListeners(); if (res.statusCode !== 200) { debug( "tunneling socket could not be established, statusCode=%d", res.statusCode ); socket.destroy(); var error2 = new Error("tunneling socket could not be established, statusCode=" + res.statusCode); error2.code = "ECONNRESET"; options8.request.emit("error", error2); self2.removeSocket(placeholder); return; } if (head.length > 0) { debug("got illegal response body from proxy"); socket.destroy(); var error2 = new Error("got illegal response body from proxy"); error2.code = "ECONNRESET"; options8.request.emit("error", error2); self2.removeSocket(placeholder); return; } debug("tunneling connection has established"); self2.sockets[self2.sockets.indexOf(placeholder)] = socket; return cb(socket); } function onError(cause) { connectReq.removeAllListeners(); debug( "tunneling socket could not be established, cause=%s\n", cause.message, cause.stack ); var error2 = new Error("tunneling socket could not be established, cause=" + cause.message); error2.code = "ECONNRESET"; options8.request.emit("error", error2); self2.removeSocket(placeholder); } }; TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { var pos = this.sockets.indexOf(socket); if (pos === -1) { return; } this.sockets.splice(pos, 1); var pending = this.requests.shift(); if (pending) { this.createSocket(pending, function(socket2) { pending.request.onSocket(socket2); }); } }; function createSecureSocket(options8, cb) { var self2 = this; TunnelingAgent.prototype.createSocket.call(self2, options8, function(socket) { var hostHeader = options8.request.getHeader("host"); var tlsOptions = mergeOptions({}, self2.options, { socket, servername: hostHeader ? hostHeader.replace(/:.*$/, "") : options8.host }); var secureSocket = tls.connect(0, tlsOptions); self2.sockets[self2.sockets.indexOf(socket)] = secureSocket; cb(secureSocket); }); } function toOptions(host, port, localAddress) { if (typeof host === "string") { return { host, port, localAddress }; } return host; } function mergeOptions(target) { for (var i3 = 1, len = arguments.length; i3 < len; ++i3) { var overrides = arguments[i3]; if (typeof overrides === "object") { var keys = Object.keys(overrides); for (var j8 = 0, keyLen = keys.length; j8 < keyLen; ++j8) { var k4 = keys[j8]; if (overrides[k4] !== void 0) { target[k4] = overrides[k4]; } } } } return target; } var debug; if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { debug = function() { var args = Array.prototype.slice.call(arguments); if (typeof args[0] === "string") { args[0] = "TUNNEL: " + args[0]; } else { args.unshift("TUNNEL:"); } console.error.apply(console, args); }; } else { debug = function() { }; } exports.debug = debug; } }); // node_modules/tunnel/index.js var require_tunnel2 = __commonJS({ "node_modules/tunnel/index.js"(exports, module) { module.exports = require_tunnel(); } }); // node_modules/undici/lib/core/symbols.js var require_symbols = __commonJS({ "node_modules/undici/lib/core/symbols.js"(exports, module) { module.exports = { kClose: Symbol("close"), kDestroy: Symbol("destroy"), kDispatch: Symbol("dispatch"), kUrl: Symbol("url"), kWriting: Symbol("writing"), kResuming: Symbol("resuming"), kQueue: Symbol("queue"), kConnect: Symbol("connect"), kConnecting: Symbol("connecting"), kHeadersList: Symbol("headers list"), kKeepAliveDefaultTimeout: Symbol("default keep alive timeout"), kKeepAliveMaxTimeout: Symbol("max keep alive timeout"), kKeepAliveTimeoutThreshold: Symbol("keep alive timeout threshold"), kKeepAliveTimeoutValue: Symbol("keep alive timeout"), kKeepAlive: Symbol("keep alive"), kHeadersTimeout: Symbol("headers timeout"), kBodyTimeout: Symbol("body timeout"), kServerName: Symbol("server name"), kLocalAddress: Symbol("local address"), kHost: Symbol("host"), kNoRef: Symbol("no ref"), kBodyUsed: Symbol("used"), kRunning: Symbol("running"), kBlocking: Symbol("blocking"), kPending: Symbol("pending"), kSize: Symbol("size"), kBusy: Symbol("busy"), kQueued: Symbol("queued"), kFree: Symbol("free"), kConnected: Symbol("connected"), kClosed: Symbol("closed"), kNeedDrain: Symbol("need drain"), kReset: Symbol("reset"), kDestroyed: Symbol.for("nodejs.stream.destroyed"), kMaxHeadersSize: Symbol("max headers size"), kRunningIdx: Symbol("running index"), kPendingIdx: Symbol("pending index"), kError: Symbol("error"), kClients: Symbol("clients"), kClient: Symbol("client"), kParser: Symbol("parser"), kOnDestroyed: Symbol("destroy callbacks"), kPipelining: Symbol("pipelining"), kSocket: Symbol("socket"), kHostHeader: Symbol("host header"), kConnector: Symbol("connector"), kStrictContentLength: Symbol("strict content length"), kMaxRedirections: Symbol("maxRedirections"), kMaxRequests: Symbol("maxRequestsPerClient"), kProxy: Symbol("proxy agent options"), kCounter: Symbol("socket request counter"), kInterceptors: Symbol("dispatch interceptors"), kMaxResponseSize: Symbol("max response size"), kHTTP2Session: Symbol("http2Session"), kHTTP2SessionState: Symbol("http2Session state"), kHTTP2BuildRequest: Symbol("http2 build request"), kHTTP1BuildRequest: Symbol("http1 build request"), kHTTP2CopyHeaders: Symbol("http2 copy headers"), kHTTPConnVersion: Symbol("http connection version") }; } }); // node_modules/undici/lib/core/errors.js var require_errors = __commonJS({ "node_modules/undici/lib/core/errors.js"(exports, module) { "use strict"; var UndiciError = class extends Error { constructor(message) { super(message); this.name = "UndiciError"; this.code = "UND_ERR"; } }; var ConnectTimeoutError = class _ConnectTimeoutError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _ConnectTimeoutError); this.name = "ConnectTimeoutError"; this.message = message || "Connect Timeout Error"; this.code = "UND_ERR_CONNECT_TIMEOUT"; } }; var HeadersTimeoutError = class _HeadersTimeoutError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _HeadersTimeoutError); this.name = "HeadersTimeoutError"; this.message = message || "Headers Timeout Error"; this.code = "UND_ERR_HEADERS_TIMEOUT"; } }; var HeadersOverflowError = class _HeadersOverflowError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _HeadersOverflowError); this.name = "HeadersOverflowError"; this.message = message || "Headers Overflow Error"; this.code = "UND_ERR_HEADERS_OVERFLOW"; } }; var BodyTimeoutError = class _BodyTimeoutError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _BodyTimeoutError); this.name = "BodyTimeoutError"; this.message = message || "Body Timeout Error"; this.code = "UND_ERR_BODY_TIMEOUT"; } }; var ResponseStatusCodeError = class _ResponseStatusCodeError extends UndiciError { constructor(message, statusCode, headers, body) { super(message); Error.captureStackTrace(this, _ResponseStatusCodeError); this.name = "ResponseStatusCodeError"; this.message = message || "Response Status Code Error"; this.code = "UND_ERR_RESPONSE_STATUS_CODE"; this.body = body; this.status = statusCode; this.statusCode = statusCode; this.headers = headers; } }; var InvalidArgumentError = class _InvalidArgumentError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _InvalidArgumentError); this.name = "InvalidArgumentError"; this.message = message || "Invalid Argument Error"; this.code = "UND_ERR_INVALID_ARG"; } }; var InvalidReturnValueError = class _InvalidReturnValueError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _InvalidReturnValueError); this.name = "InvalidReturnValueError"; this.message = message || "Invalid Return Value Error"; this.code = "UND_ERR_INVALID_RETURN_VALUE"; } }; var RequestAbortedError = class _RequestAbortedError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _RequestAbortedError); this.name = "AbortError"; this.message = message || "Request aborted"; this.code = "UND_ERR_ABORTED"; } }; var InformationalError = class _InformationalError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _InformationalError); this.name = "InformationalError"; this.message = message || "Request information"; this.code = "UND_ERR_INFO"; } }; var RequestContentLengthMismatchError = class _RequestContentLengthMismatchError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _RequestContentLengthMismatchError); this.name = "RequestContentLengthMismatchError"; this.message = message || "Request body length does not match content-length header"; this.code = "UND_ERR_REQ_CONTENT_LENGTH_MISMATCH"; } }; var ResponseContentLengthMismatchError = class _ResponseContentLengthMismatchError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _ResponseContentLengthMismatchError); this.name = "ResponseContentLengthMismatchError"; this.message = message || "Response body length does not match content-length header"; this.code = "UND_ERR_RES_CONTENT_LENGTH_MISMATCH"; } }; var ClientDestroyedError = class _ClientDestroyedError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _ClientDestroyedError); this.name = "ClientDestroyedError"; this.message = message || "The client is destroyed"; this.code = "UND_ERR_DESTROYED"; } }; var ClientClosedError = class _ClientClosedError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _ClientClosedError); this.name = "ClientClosedError"; this.message = message || "The client is closed"; this.code = "UND_ERR_CLOSED"; } }; var SocketError = class _SocketError extends UndiciError { constructor(message, socket) { super(message); Error.captureStackTrace(this, _SocketError); this.name = "SocketError"; this.message = message || "Socket error"; this.code = "UND_ERR_SOCKET"; this.socket = socket; } }; var NotSupportedError = class _NotSupportedError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _NotSupportedError); this.name = "NotSupportedError"; this.message = message || "Not supported error"; this.code = "UND_ERR_NOT_SUPPORTED"; } }; var BalancedPoolMissingUpstreamError = class extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, NotSupportedError); this.name = "MissingUpstreamError"; this.message = message || "No upstream has been added to the BalancedPool"; this.code = "UND_ERR_BPL_MISSING_UPSTREAM"; } }; var HTTPParserError = class _HTTPParserError extends Error { constructor(message, code, data) { super(message); Error.captureStackTrace(this, _HTTPParserError); this.name = "HTTPParserError"; this.code = code ? `HPE_${code}` : void 0; this.data = data ? data.toString() : void 0; } }; var ResponseExceededMaxSizeError = class _ResponseExceededMaxSizeError extends UndiciError { constructor(message) { super(message); Error.captureStackTrace(this, _ResponseExceededMaxSizeError); this.name = "ResponseExceededMaxSizeError"; this.message = message || "Response content exceeded max size"; this.code = "UND_ERR_RES_EXCEEDED_MAX_SIZE"; } }; module.exports = { HTTPParserError, UndiciError, HeadersTimeoutError, HeadersOverflowError, BodyTimeoutError, RequestContentLengthMismatchError, ConnectTimeoutError, ResponseStatusCodeError, InvalidArgumentError, InvalidReturnValueError, RequestAbortedError, ClientDestroyedError, ClientClosedError, InformationalError, SocketError, NotSupportedError, ResponseContentLengthMismatchError, BalancedPoolMissingUpstreamError, ResponseExceededMaxSizeError }; } }); // node_modules/undici/lib/core/util.js var require_util = __commonJS({ "node_modules/undici/lib/core/util.js"(exports, module) { "use strict"; var assert6 = __require("assert"); var { kDestroyed, kBodyUsed } = require_symbols(); var { IncomingMessage } = __require("http"); var stream = __require("stream"); var net = __require("net"); var { InvalidArgumentError } = require_errors(); var { Blob: Blob2 } = __require("buffer"); var nodeUtil = __require("util"); var { stringify: stringify2 } = __require("querystring"); var [nodeMajor, nodeMinor] = process.versions.node.split(".").map((v7) => Number(v7)); function nop() { } function isStream(obj) { return obj && typeof obj === "object" && typeof obj.pipe === "function" && typeof obj.on === "function"; } function isBlobLike(object) { return Blob2 && object instanceof Blob2 || object && typeof object === "object" && (typeof object.stream === "function" || typeof object.arrayBuffer === "function") && /^(Blob|File)$/.test(object[Symbol.toStringTag]); } function buildURL(url, queryParams) { if (url.includes("?") || url.includes("#")) { throw new Error('Query params cannot be passed when url already contains "?" or "#".'); } const stringified = stringify2(queryParams); if (stringified) { url += "?" + stringified; } return url; } function parseURL(url) { if (typeof url === "string") { url = new URL(url); if (!/^https?:/.test(url.origin || url.protocol)) { throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`."); } return url; } if (!url || typeof url !== "object") { throw new InvalidArgumentError("Invalid URL: The URL argument must be a non-null object."); } if (!/^https?:/.test(url.origin || url.protocol)) { throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`."); } if (!(url instanceof URL)) { if (url.port != null && url.port !== "" && !Number.isFinite(parseInt(url.port))) { throw new InvalidArgumentError("Invalid URL: port must be a valid integer or a string representation of an integer."); } if (url.path != null && typeof url.path !== "string") { throw new InvalidArgumentError("Invalid URL path: the path must be a string or null/undefined."); } if (url.pathname != null && typeof url.pathname !== "string") { throw new InvalidArgumentError("Invalid URL pathname: the pathname must be a string or null/undefined."); } if (url.hostname != null && typeof url.hostname !== "string") { throw new InvalidArgumentError("Invalid URL hostname: the hostname must be a string or null/undefined."); } if (url.origin != null && typeof url.origin !== "string") { throw new InvalidArgumentError("Invalid URL origin: the origin must be a string or null/undefined."); } 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 path13 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`; if (origin.endsWith("/")) { origin = origin.substring(0, origin.length - 1); } if (path13 && !path13.startsWith("/")) { path13 = `/${path13}`; } url = new URL(origin + path13); } return url; } function parseOrigin(url) { url = parseURL(url); if (url.pathname !== "/" || url.search || url.hash) { throw new InvalidArgumentError("invalid url"); } return url; } function getHostname(host) { if (host[0] === "[") { const idx2 = host.indexOf("]"); assert6(idx2 !== -1); return host.substr(1, idx2 - 1); } const idx = host.indexOf(":"); if (idx === -1) return host; return host.substr(0, idx); } function getServerName(host) { if (!host) { return null; } assert6.strictEqual(typeof host, "string"); const servername = getHostname(host); if (net.isIP(servername)) { return ""; } return servername; } function deepClone(obj) { return JSON.parse(JSON.stringify(obj)); } function isAsyncIterable(obj) { return !!(obj != null && typeof obj[Symbol.asyncIterator] === "function"); } function isIterable(obj) { return !!(obj != null && (typeof obj[Symbol.iterator] === "function" || typeof obj[Symbol.asyncIterator] === "function")); } function bodyLength(body) { if (body == null) { return 0; } 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)) { return body.size != null ? body.size : null; } else if (isBuffer(body)) { return body.byteLength; } return null; } function isDestroyed(stream2) { return !stream2 || !!(stream2.destroyed || stream2[kDestroyed]); } function isReadableAborted(stream2) { const state = stream2 && stream2._readableState; return isDestroyed(stream2) && state && !state.endEmitted; } function destroy(stream2, err) { if (!isStream(stream2) || isDestroyed(stream2)) { return; } if (typeof stream2.destroy === "function") { if (Object.getPrototypeOf(stream2).constructor === IncomingMessage) { stream2.socket = null; } stream2.destroy(err); } else if (err) { process.nextTick((stream3, err2) => { stream3.emit("error", err2); }, stream2, err); } if (stream2.destroyed !== true) { stream2[kDestroyed] = true; } } var KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/; function parseKeepAliveTimeout(val) { const m3 = val.toString().match(KEEPALIVE_TIMEOUT_EXPR); return m3 ? parseInt(m3[1], 10) * 1e3 : null; } function parseHeaders(headers, obj = {}) { if (!Array.isArray(headers)) return headers; for (let i3 = 0; i3 < headers.length; i3 += 2) { const key = headers[i3].toString().toLowerCase(); let val = obj[key]; if (!val) { if (Array.isArray(headers[i3 + 1])) { obj[key] = headers[i3 + 1]; } else { obj[key] = headers[i3 + 1].toString("utf8"); } } else { if (!Array.isArray(val)) { val = [val]; obj[key] = val; } val.push(headers[i3 + 1].toString("utf8")); } } if ("content-length" in obj && "content-disposition" in obj) { obj["content-disposition"] = Buffer.from(obj["content-disposition"]).toString("latin1"); } return obj; } function parseRawHeaders(headers) { const ret = []; let hasContentLength = false; let contentDispositionIdx = -1; for (let n3 = 0; n3 < headers.length; n3 += 2) { const key = headers[n3 + 0].toString(); const val = headers[n3 + 1].toString("utf8"); if (key.length === 14 && (key === "content-length" || key.toLowerCase() === "content-length")) { ret.push(key, val); hasContentLength = true; } else if (key.length === 19 && (key === "content-disposition" || key.toLowerCase() === "content-disposition")) { contentDispositionIdx = ret.push(key, val) - 1; } else { ret.push(key, val); } } if (hasContentLength && contentDispositionIdx !== -1) { ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString("latin1"); } return ret; } function isBuffer(buffer) { return buffer instanceof Uint8Array || Buffer.isBuffer(buffer); } function validateHandler(handler, method, upgrade) { if (!handler || typeof handler !== "object") { throw new InvalidArgumentError("handler must be an object"); } if (typeof handler.onConnect !== "function") { throw new InvalidArgumentError("invalid onConnect method"); } if (typeof handler.onError !== "function") { throw new InvalidArgumentError("invalid onError method"); } if (typeof handler.onBodySent !== "function" && handler.onBodySent !== void 0) { throw new InvalidArgumentError("invalid onBodySent method"); } if (upgrade || method === "CONNECT") { if (typeof handler.onUpgrade !== "function") { throw new InvalidArgumentError("invalid onUpgrade method"); } } else { if (typeof handler.onHeaders !== "function") { throw new InvalidArgumentError("invalid onHeaders method"); } if (typeof handler.onData !== "function") { throw new InvalidArgumentError("invalid onData method"); } if (typeof handler.onComplete !== "function") { throw new InvalidArgumentError("invalid onComplete method"); } } } function isDisturbed(body) { return !!(body && (stream.isDisturbed ? stream.isDisturbed(body) || body[kBodyUsed] : body[kBodyUsed] || body.readableDidRead || body._readableState && body._readableState.dataEmitted || isReadableAborted(body))); } function isErrored(body) { return !!(body && (stream.isErrored ? stream.isErrored(body) : /state: 'errored'/.test( nodeUtil.inspect(body) ))); } function isReadable(body) { return !!(body && (stream.isReadable ? stream.isReadable(body) : /state: 'readable'/.test( nodeUtil.inspect(body) ))); } function getSocketInfo(socket) { return { localAddress: socket.localAddress, localPort: socket.localPort, remoteAddress: socket.remoteAddress, remoteP