vercel
Version:
The command-line interface for Vercel
1,508 lines (1,493 loc) • 1.11 MB
JavaScript
import { createRequire as __createRequire } from 'node:module';
import { fileURLToPath as __fileURLToPath } from 'node:url';
import { dirname as __dirname_ } from 'node:path';
const require = __createRequire(import.meta.url);
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __dirname_(__filename);
import {
require_dist as require_dist5
} from "../../chunks/chunk-2HSQ7YUK.js";
import {
getUpdateCommand
} from "../../chunks/chunk-FUBTAFL2.js";
import {
highlight
} from "../../chunks/chunk-V5P25P7F.js";
import {
getSubcommand
} from "../../chunks/chunk-YPQSDAEW.js";
import {
devCommand
} from "../../chunks/chunk-ZAAKSLHC.js";
import {
OUTPUT_DIR,
getStaticServiceSchedules,
importBuilders,
require_mime_types,
require_npa,
staticFiles
} from "../../chunks/chunk-PNA7EZB2.js";
import "../../chunks/chunk-IB5L4LKZ.js";
import {
pickOverrides
} from "../../chunks/chunk-LVUE7LLE.js";
import "../../chunks/chunk-N733ZD4W.js";
import {
displayDetectedServices,
readConfig,
setupAndLink
} from "../../chunks/chunk-UTXSTM52.js";
import {
getLocalPathConfig
} from "../../chunks/chunk-4VPRHRPA.js";
import {
help
} from "../../chunks/chunk-MMF4BVAP.js";
import {
VERCEL_DIR,
findRepoRoot,
getLinkedProject,
getVercelDirectory,
param,
pullEnvRecords,
readJSONFile,
require_brace_expansion,
require_dist as require_dist2,
require_dist2 as require_dist3,
require_dist3 as require_dist4,
require_fast_deep_equal,
require_frameworks,
require_inherits,
require_json_parse_better_errors,
require_lib,
require_main,
require_minimatch,
require_pluralize,
resolveProjectCwd,
tryDetectServices,
validateConfig
} from "../../chunks/chunk-X775BOSL.js";
import {
TelemetryClient
} from "../../chunks/chunk-4OEA5ILS.js";
import {
buildCommandWithYes,
outputActionRequired
} from "../../chunks/chunk-ULXHXZCZ.js";
import {
require_ms
} from "../../chunks/chunk-CO5D46AG.js";
import {
require_lib as require_lib2
} from "../../chunks/chunk-N2T234LO.js";
import "../../chunks/chunk-DKD6GTQT.js";
import {
getFlagsSpecification,
parseArguments,
printError
} from "../../chunks/chunk-4GQQJY5Y.js";
import {
CantParseJSONFile,
LambdaSizeExceededError,
MissingDotenvVarsError,
NowError,
cmd,
getCommandName,
getCommandNamePlain,
getTitleName,
packageName,
require_bytes
} from "../../chunks/chunk-UGXBNJMO.js";
import "../../chunks/chunk-P4QNYOFB.js";
import {
link_default,
output_manager_default,
require_dist
} from "../../chunks/chunk-ZQKJVHXY.js";
import {
require_source,
require_supports_color
} from "../../chunks/chunk-S7KYDPEM.js";
import {
__commonJS,
__require,
__toESM
} from "../../chunks/chunk-TZ2YI2VH.js";
// ../../node_modules/.pnpm/bytes@3.1.0/node_modules/bytes/index.js
var require_bytes2 = __commonJS({
"../../node_modules/.pnpm/bytes@3.1.0/node_modules/bytes/index.js"(exports2, module2) {
"use strict";
module2.exports = bytes2;
module2.exports.format = format;
module2.exports.parse = parse2;
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
var map = {
b: 1,
kb: 1 << 10,
mb: 1 << 20,
gb: 1 << 30,
tb: Math.pow(1024, 4),
pb: Math.pow(1024, 5)
};
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
function bytes2(value, options) {
if (typeof value === "string") {
return parse2(value);
}
if (typeof value === "number") {
return format(value, options);
}
return null;
}
function format(value, options) {
if (!Number.isFinite(value)) {
return null;
}
var mag = Math.abs(value);
var thousandsSeparator = options && options.thousandsSeparator || "";
var unitSeparator = options && options.unitSeparator || "";
var decimalPlaces = options && options.decimalPlaces !== void 0 ? options.decimalPlaces : 2;
var fixedDecimals = Boolean(options && options.fixedDecimals);
var unit = options && options.unit || "";
if (!unit || !map[unit.toLowerCase()]) {
if (mag >= map.pb) {
unit = "PB";
} else if (mag >= map.tb) {
unit = "TB";
} else if (mag >= map.gb) {
unit = "GB";
} else if (mag >= map.mb) {
unit = "MB";
} else if (mag >= map.kb) {
unit = "KB";
} else {
unit = "B";
}
}
var val = value / map[unit.toLowerCase()];
var str = val.toFixed(decimalPlaces);
if (!fixedDecimals) {
str = str.replace(formatDecimalsRegExp, "$1");
}
if (thousandsSeparator) {
str = str.replace(formatThousandsRegExp, thousandsSeparator);
}
return str + unitSeparator + unit;
}
function parse2(val) {
if (typeof val === "number" && !isNaN(val)) {
return val;
}
if (typeof val !== "string") {
return null;
}
var results = parseRegExp.exec(val);
var floatValue;
var unit = "b";
if (!results) {
floatValue = parseInt(val, 10);
unit = "b";
} else {
floatValue = parseFloat(results[1]);
unit = results[4].toLowerCase();
}
return Math.floor(map[unit] * floatValue);
}
}
});
// ../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/lib/compat/callsite-tostring.js
var require_callsite_tostring = __commonJS({
"../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/lib/compat/callsite-tostring.js"(exports2, module2) {
"use strict";
module2.exports = callSiteToString2;
function callSiteFileLocation(callSite) {
var fileName;
var fileLocation = "";
if (callSite.isNative()) {
fileLocation = "native";
} else if (callSite.isEval()) {
fileName = callSite.getScriptNameOrSourceURL();
if (!fileName) {
fileLocation = callSite.getEvalOrigin();
}
} else {
fileName = callSite.getFileName();
}
if (fileName) {
fileLocation += fileName;
var lineNumber = callSite.getLineNumber();
if (lineNumber != null) {
fileLocation += ":" + lineNumber;
var columnNumber = callSite.getColumnNumber();
if (columnNumber) {
fileLocation += ":" + columnNumber;
}
}
}
return fileLocation || "unknown source";
}
function callSiteToString2(callSite) {
var addSuffix = true;
var fileLocation = callSiteFileLocation(callSite);
var functionName = callSite.getFunctionName();
var isConstructor = callSite.isConstructor();
var isMethodCall = !(callSite.isToplevel() || isConstructor);
var line = "";
if (isMethodCall) {
var methodName = callSite.getMethodName();
var typeName = getConstructorName(callSite);
if (functionName) {
if (typeName && functionName.indexOf(typeName) !== 0) {
line += typeName + ".";
}
line += functionName;
if (methodName && functionName.lastIndexOf("." + methodName) !== functionName.length - methodName.length - 1) {
line += " [as " + methodName + "]";
}
} else {
line += typeName + "." + (methodName || "<anonymous>");
}
} else if (isConstructor) {
line += "new " + (functionName || "<anonymous>");
} else if (functionName) {
line += functionName;
} else {
addSuffix = false;
line += fileLocation;
}
if (addSuffix) {
line += " (" + fileLocation + ")";
}
return line;
}
function getConstructorName(obj) {
var receiver = obj.receiver;
return receiver.constructor && receiver.constructor.name || null;
}
}
});
// ../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/lib/compat/event-listener-count.js
var require_event_listener_count = __commonJS({
"../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/lib/compat/event-listener-count.js"(exports2, module2) {
"use strict";
module2.exports = eventListenerCount2;
function eventListenerCount2(emitter, type) {
return emitter.listeners(type).length;
}
}
});
// ../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/lib/compat/index.js
var require_compat = __commonJS({
"../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/lib/compat/index.js"(exports2, module2) {
"use strict";
var EventEmitter = __require("events").EventEmitter;
lazyProperty(module2.exports, "callSiteToString", function callSiteToString2() {
var limit = Error.stackTraceLimit;
var obj = {};
var prep = Error.prepareStackTrace;
function prepareObjectStackTrace2(obj2, stack3) {
return stack3;
}
Error.prepareStackTrace = prepareObjectStackTrace2;
Error.stackTraceLimit = 2;
Error.captureStackTrace(obj);
var stack2 = obj.stack.slice();
Error.prepareStackTrace = prep;
Error.stackTraceLimit = limit;
return stack2[0].toString ? toString : require_callsite_tostring();
});
lazyProperty(module2.exports, "eventListenerCount", function eventListenerCount2() {
return EventEmitter.listenerCount || require_event_listener_count();
});
function lazyProperty(obj, prop, getter) {
function get() {
var val = getter();
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
value: val
});
return val;
}
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: true,
get
});
}
function toString(obj) {
return obj.toString();
}
}
});
// ../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/index.js
var require_depd = __commonJS({
"../../node_modules/.pnpm/depd@1.1.2/node_modules/depd/index.js"(exports, module) {
var callSiteToString = require_compat().callSiteToString;
var eventListenerCount = require_compat().eventListenerCount;
var relative = __require("path").relative;
module.exports = depd;
var basePath = process.cwd();
function containsNamespace(str, namespace) {
var vals = str.split(/[ ,]+/);
var ns = String(namespace).toLowerCase();
for (var i = 0; i < vals.length; i++) {
var val = vals[i];
if (val && (val === "*" || val.toLowerCase() === ns)) {
return true;
}
}
return false;
}
function convertDataDescriptorToAccessor(obj, prop, message2) {
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
var value = descriptor.value;
descriptor.get = function getter() {
return value;
};
if (descriptor.writable) {
descriptor.set = function setter(val) {
return value = val;
};
}
delete descriptor.value;
delete descriptor.writable;
Object.defineProperty(obj, prop, descriptor);
return descriptor;
}
function createArgumentsString(arity) {
var str = "";
for (var i = 0; i < arity; i++) {
str += ", arg" + i;
}
return str.substr(2);
}
function createStackString(stack2) {
var str = this.name + ": " + this.namespace;
if (this.message) {
str += " deprecated " + this.message;
}
for (var i = 0; i < stack2.length; i++) {
str += "\n at " + callSiteToString(stack2[i]);
}
return str;
}
function depd(namespace) {
if (!namespace) {
throw new TypeError("argument namespace is required");
}
var stack2 = getStack();
var site2 = callSiteLocation(stack2[1]);
var file = site2[0];
function deprecate2(message2) {
log.call(deprecate2, message2);
}
deprecate2._file = file;
deprecate2._ignored = isignored(namespace);
deprecate2._namespace = namespace;
deprecate2._traced = istraced(namespace);
deprecate2._warned = /* @__PURE__ */ Object.create(null);
deprecate2.function = wrapfunction;
deprecate2.property = wrapproperty;
return deprecate2;
}
function isignored(namespace) {
if (process.noDeprecation) {
return true;
}
var str = process.env.NO_DEPRECATION || "";
return containsNamespace(str, namespace);
}
function istraced(namespace) {
if (process.traceDeprecation) {
return true;
}
var str = process.env.TRACE_DEPRECATION || "";
return containsNamespace(str, namespace);
}
function log(message2, site2) {
var haslisteners = eventListenerCount(process, "deprecation") !== 0;
if (!haslisteners && this._ignored) {
return;
}
var caller;
var callFile;
var callSite;
var depSite;
var i = 0;
var seen = false;
var stack2 = getStack();
var file = this._file;
if (site2) {
depSite = site2;
callSite = callSiteLocation(stack2[1]);
callSite.name = depSite.name;
file = callSite[0];
} else {
i = 2;
depSite = callSiteLocation(stack2[i]);
callSite = depSite;
}
for (; i < stack2.length; i++) {
caller = callSiteLocation(stack2[i]);
callFile = caller[0];
if (callFile === file) {
seen = true;
} else if (callFile === this._file) {
file = this._file;
} else if (seen) {
break;
}
}
var key = caller ? depSite.join(":") + "__" + caller.join(":") : void 0;
if (key !== void 0 && key in this._warned) {
return;
}
this._warned[key] = true;
var msg = message2;
if (!msg) {
msg = callSite === depSite || !callSite.name ? defaultMessage(depSite) : defaultMessage(callSite);
}
if (haslisteners) {
var err = DeprecationError(this._namespace, msg, stack2.slice(i));
process.emit("deprecation", err);
return;
}
var format = process.stderr.isTTY ? formatColor : formatPlain;
var output = format.call(this, msg, caller, stack2.slice(i));
process.stderr.write(output + "\n", "utf8");
}
function callSiteLocation(callSite) {
var file = callSite.getFileName() || "<anonymous>";
var line = callSite.getLineNumber();
var colm = callSite.getColumnNumber();
if (callSite.isEval()) {
file = callSite.getEvalOrigin() + ", " + file;
}
var site2 = [file, line, colm];
site2.callSite = callSite;
site2.name = callSite.getFunctionName();
return site2;
}
function defaultMessage(site2) {
var callSite = site2.callSite;
var funcName = site2.name;
if (!funcName) {
funcName = "<anonymous@" + formatLocation(site2) + ">";
}
var context = callSite.getThis();
var typeName = context && callSite.getTypeName();
if (typeName === "Object") {
typeName = void 0;
}
if (typeName === "Function") {
typeName = context.name || typeName;
}
return typeName && callSite.getMethodName() ? typeName + "." + funcName : funcName;
}
function formatPlain(msg, caller, stack2) {
var timestamp = (/* @__PURE__ */ new Date()).toUTCString();
var formatted = timestamp + " " + this._namespace + " deprecated " + msg;
if (this._traced) {
for (var i = 0; i < stack2.length; i++) {
formatted += "\n at " + callSiteToString(stack2[i]);
}
return formatted;
}
if (caller) {
formatted += " at " + formatLocation(caller);
}
return formatted;
}
function formatColor(msg, caller, stack2) {
var formatted = "\x1B[36;1m" + this._namespace + "\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m" + msg + "\x1B[39m";
if (this._traced) {
for (var i = 0; i < stack2.length; i++) {
formatted += "\n \x1B[36mat " + callSiteToString(stack2[i]) + "\x1B[39m";
}
return formatted;
}
if (caller) {
formatted += " \x1B[36m" + formatLocation(caller) + "\x1B[39m";
}
return formatted;
}
function formatLocation(callSite) {
return relative(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
}
function getStack() {
var limit = Error.stackTraceLimit;
var obj = {};
var prep = Error.prepareStackTrace;
Error.prepareStackTrace = prepareObjectStackTrace;
Error.stackTraceLimit = Math.max(10, limit);
Error.captureStackTrace(obj);
var stack2 = obj.stack.slice(1);
Error.prepareStackTrace = prep;
Error.stackTraceLimit = limit;
return stack2;
}
function prepareObjectStackTrace(obj, stack2) {
return stack2;
}
function wrapfunction(fn, message) {
if (typeof fn !== "function") {
throw new TypeError("argument fn must be a function");
}
var args = createArgumentsString(fn.length);
var deprecate = this;
var stack = getStack();
var site = callSiteLocation(stack[1]);
site.name = fn.name;
var deprecatedfn = eval("(function (" + args + ') {\n"use strict"\nlog.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n})');
return deprecatedfn;
}
function wrapproperty(obj, prop, message2) {
if (!obj || typeof obj !== "object" && typeof obj !== "function") {
throw new TypeError("argument obj must be object");
}
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
if (!descriptor) {
throw new TypeError("must call property on owner object");
}
if (!descriptor.configurable) {
throw new TypeError("property must be configurable");
}
var deprecate2 = this;
var stack2 = getStack();
var site2 = callSiteLocation(stack2[1]);
site2.name = prop;
if ("value" in descriptor) {
descriptor = convertDataDescriptorToAccessor(obj, prop, message2);
}
var get = descriptor.get;
var set = descriptor.set;
if (typeof get === "function") {
descriptor.get = function getter() {
log.call(deprecate2, message2, site2);
return get.apply(this, arguments);
};
}
if (typeof set === "function") {
descriptor.set = function setter() {
log.call(deprecate2, message2, site2);
return set.apply(this, arguments);
};
}
Object.defineProperty(obj, prop, descriptor);
}
function DeprecationError(namespace, message2, stack2) {
var error2 = new Error();
var stackString;
Object.defineProperty(error2, "constructor", {
value: DeprecationError
});
Object.defineProperty(error2, "message", {
configurable: true,
enumerable: false,
value: message2,
writable: true
});
Object.defineProperty(error2, "name", {
enumerable: false,
configurable: true,
value: "DeprecationError",
writable: true
});
Object.defineProperty(error2, "namespace", {
configurable: true,
enumerable: false,
value: namespace,
writable: true
});
Object.defineProperty(error2, "stack", {
configurable: true,
enumerable: false,
get: function() {
if (stackString !== void 0) {
return stackString;
}
return stackString = createStackString.call(this, stack2);
},
set: function setter(val) {
stackString = val;
}
});
return error2;
}
}
});
// ../../node_modules/.pnpm/setprototypeof@1.1.1/node_modules/setprototypeof/index.js
var require_setprototypeof = __commonJS({
"../../node_modules/.pnpm/setprototypeof@1.1.1/node_modules/setprototypeof/index.js"(exports2, module2) {
"use strict";
module2.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);
function setProtoOf(obj, proto) {
obj.__proto__ = proto;
return obj;
}
function mixinProperties(obj, proto) {
for (var prop in proto) {
if (!obj.hasOwnProperty(prop)) {
obj[prop] = proto[prop];
}
}
return obj;
}
}
});
// ../../node_modules/.pnpm/statuses@1.5.0/node_modules/statuses/codes.json
var require_codes = __commonJS({
"../../node_modules/.pnpm/statuses@1.5.0/node_modules/statuses/codes.json"(exports2, module2) {
module2.exports = {
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"103": "Early Hints",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
"206": "Partial Content",
"207": "Multi-Status",
"208": "Already Reported",
"226": "IM Used",
"300": "Multiple Choices",
"301": "Moved Permanently",
"302": "Found",
"303": "See Other",
"304": "Not Modified",
"305": "Use Proxy",
"306": "(Unused)",
"307": "Temporary Redirect",
"308": "Permanent Redirect",
"400": "Bad Request",
"401": "Unauthorized",
"402": "Payment Required",
"403": "Forbidden",
"404": "Not Found",
"405": "Method Not Allowed",
"406": "Not Acceptable",
"407": "Proxy Authentication Required",
"408": "Request Timeout",
"409": "Conflict",
"410": "Gone",
"411": "Length Required",
"412": "Precondition Failed",
"413": "Payload Too Large",
"414": "URI Too Long",
"415": "Unsupported Media Type",
"416": "Range Not Satisfiable",
"417": "Expectation Failed",
"418": "I'm a teapot",
"421": "Misdirected Request",
"422": "Unprocessable Entity",
"423": "Locked",
"424": "Failed Dependency",
"425": "Unordered Collection",
"426": "Upgrade Required",
"428": "Precondition Required",
"429": "Too Many Requests",
"431": "Request Header Fields Too Large",
"451": "Unavailable For Legal Reasons",
"500": "Internal Server Error",
"501": "Not Implemented",
"502": "Bad Gateway",
"503": "Service Unavailable",
"504": "Gateway Timeout",
"505": "HTTP Version Not Supported",
"506": "Variant Also Negotiates",
"507": "Insufficient Storage",
"508": "Loop Detected",
"509": "Bandwidth Limit Exceeded",
"510": "Not Extended",
"511": "Network Authentication Required"
};
}
});
// ../../node_modules/.pnpm/statuses@1.5.0/node_modules/statuses/index.js
var require_statuses = __commonJS({
"../../node_modules/.pnpm/statuses@1.5.0/node_modules/statuses/index.js"(exports2, module2) {
"use strict";
var codes = require_codes();
module2.exports = status;
status.STATUS_CODES = codes;
status.codes = populateStatusesMap(status, codes);
status.redirect = {
300: true,
301: true,
302: true,
303: true,
305: true,
307: true,
308: true
};
status.empty = {
204: true,
205: true,
304: true
};
status.retry = {
502: true,
503: true,
504: true
};
function populateStatusesMap(statuses, codes2) {
var arr = [];
Object.keys(codes2).forEach(function forEachCode(code) {
var message2 = codes2[code];
var status2 = Number(code);
statuses[status2] = message2;
statuses[message2] = status2;
statuses[message2.toLowerCase()] = status2;
arr.push(status2);
});
return arr;
}
function status(code) {
if (typeof code === "number") {
if (!status[code])
throw new Error("invalid status code: " + code);
return code;
}
if (typeof code !== "string") {
throw new TypeError("code must be a number or string");
}
var n = parseInt(code, 10);
if (!isNaN(n)) {
if (!status[n])
throw new Error("invalid status code: " + n);
return n;
}
n = status[code.toLowerCase()];
if (!n)
throw new Error('invalid status message: "' + code + '"');
return n;
}
}
});
// ../../node_modules/.pnpm/toidentifier@1.0.0/node_modules/toidentifier/index.js
var require_toidentifier = __commonJS({
"../../node_modules/.pnpm/toidentifier@1.0.0/node_modules/toidentifier/index.js"(exports2, module2) {
module2.exports = toIdentifier;
function toIdentifier(str) {
return str.split(" ").map(function(token) {
return token.slice(0, 1).toUpperCase() + token.slice(1);
}).join("").replace(/[^ _0-9a-z]/gi, "");
}
}
});
// ../../node_modules/.pnpm/http-errors@1.7.3/node_modules/http-errors/index.js
var require_http_errors = __commonJS({
"../../node_modules/.pnpm/http-errors@1.7.3/node_modules/http-errors/index.js"(exports2, module2) {
"use strict";
var deprecate2 = require_depd()("http-errors");
var setPrototypeOf = require_setprototypeof();
var statuses = require_statuses();
var inherits = require_inherits();
var toIdentifier = require_toidentifier();
module2.exports = createError;
module2.exports.HttpError = createHttpErrorConstructor();
populateConstructorExports(module2.exports, statuses.codes, module2.exports.HttpError);
function codeClass(status) {
return Number(String(status).charAt(0) + "00");
}
function createError() {
var err;
var msg;
var status = 500;
var props = {};
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (arg instanceof Error) {
err = arg;
status = err.status || err.statusCode || status;
continue;
}
switch (typeof arg) {
case "string":
msg = arg;
break;
case "number":
status = arg;
if (i !== 0) {
deprecate2("non-first-argument status code; replace with createError(" + arg + ", ...)");
}
break;
case "object":
props = arg;
break;
}
}
if (typeof status === "number" && (status < 400 || status >= 600)) {
deprecate2("non-error status code; use only 4xx or 5xx status codes");
}
if (typeof status !== "number" || !statuses[status] && (status < 400 || status >= 600)) {
status = 500;
}
var HttpError = createError[status] || createError[codeClass(status)];
if (!err) {
err = HttpError ? new HttpError(msg) : new Error(msg || statuses[status]);
Error.captureStackTrace(err, createError);
}
if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
err.expose = status < 500;
err.status = err.statusCode = status;
}
for (var key in props) {
if (key !== "status" && key !== "statusCode") {
err[key] = props[key];
}
}
return err;
}
function createHttpErrorConstructor() {
function HttpError() {
throw new TypeError("cannot construct abstract class");
}
inherits(HttpError, Error);
return HttpError;
}
function createClientErrorConstructor(HttpError, name, code) {
var className = name.match(/Error$/) ? name : name + "Error";
function ClientError(message2) {
var msg = message2 != null ? message2 : statuses[code];
var err = new Error(msg);
Error.captureStackTrace(err, ClientError);
setPrototypeOf(err, ClientError.prototype);
Object.defineProperty(err, "message", {
enumerable: true,
configurable: true,
value: msg,
writable: true
});
Object.defineProperty(err, "name", {
enumerable: false,
configurable: true,
value: className,
writable: true
});
return err;
}
inherits(ClientError, HttpError);
nameFunc(ClientError, className);
ClientError.prototype.status = code;
ClientError.prototype.statusCode = code;
ClientError.prototype.expose = true;
return ClientError;
}
function createServerErrorConstructor(HttpError, name, code) {
var className = name.match(/Error$/) ? name : name + "Error";
function ServerError(message2) {
var msg = message2 != null ? message2 : statuses[code];
var err = new Error(msg);
Error.captureStackTrace(err, ServerError);
setPrototypeOf(err, ServerError.prototype);
Object.defineProperty(err, "message", {
enumerable: true,
configurable: true,
value: msg,
writable: true
});
Object.defineProperty(err, "name", {
enumerable: false,
configurable: true,
value: className,
writable: true
});
return err;
}
inherits(ServerError, HttpError);
nameFunc(ServerError, className);
ServerError.prototype.status = code;
ServerError.prototype.statusCode = code;
ServerError.prototype.expose = false;
return ServerError;
}
function nameFunc(func, name) {
var desc = Object.getOwnPropertyDescriptor(func, "name");
if (desc && desc.configurable) {
desc.value = name;
Object.defineProperty(func, "name", desc);
}
}
function populateConstructorExports(exports3, codes, HttpError) {
codes.forEach(function forEachCode(code) {
var CodeError;
var name = toIdentifier(statuses[code]);
switch (codeClass(code)) {
case 400:
CodeError = createClientErrorConstructor(HttpError, name, code);
break;
case 500:
CodeError = createServerErrorConstructor(HttpError, name, code);
break;
}
if (CodeError) {
exports3[code] = CodeError;
exports3[name] = CodeError;
}
});
exports3["I'mateapot"] = deprecate2.function(
exports3.ImATeapot,
`"I'mateapot"; use "ImATeapot" instead`
);
}
}
});
// ../../node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.js
var require_safer = __commonJS({
"../../node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.js"(exports2, module2) {
"use strict";
var buffer = __require("buffer");
var Buffer2 = buffer.Buffer;
var safer = {};
var key;
for (key in buffer) {
if (!buffer.hasOwnProperty(key))
continue;
if (key === "SlowBuffer" || key === "Buffer")
continue;
safer[key] = buffer[key];
}
var Safer = safer.Buffer = {};
for (key in Buffer2) {
if (!Buffer2.hasOwnProperty(key))
continue;
if (key === "allocUnsafe" || key === "allocUnsafeSlow")
continue;
Safer[key] = Buffer2[key];
}
safer.Buffer.prototype = Buffer2.prototype;
if (!Safer.from || Safer.from === Uint8Array.from) {
Safer.from = function(value, encodingOrOffset, length) {
if (typeof value === "number") {
throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value);
}
if (value && typeof value.length === "undefined") {
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
}
return Buffer2(value, encodingOrOffset, length);
};
}
if (!Safer.alloc) {
Safer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size);
}
if (size < 0 || size >= 2 * (1 << 30)) {
throw new RangeError('The value "' + size + '" is invalid for option "size"');
}
var buf = Buffer2(size);
if (!fill || fill.length === 0) {
buf.fill(0);
} else if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
return buf;
};
}
if (!safer.kStringMaxLength) {
try {
safer.kStringMaxLength = process.binding("buffer").kStringMaxLength;
} catch (e) {
}
}
if (!safer.constants) {
safer.constants = {
MAX_LENGTH: safer.kMaxLength
};
if (safer.kStringMaxLength) {
safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength;
}
}
module2.exports = safer;
}
});
// ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/lib/bom-handling.js
var require_bom_handling = __commonJS({
"../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/lib/bom-handling.js"(exports2) {
"use strict";
var BOMChar = "\uFEFF";
exports2.PrependBOM = PrependBOMWrapper;
function PrependBOMWrapper(encoder, options) {
this.encoder = encoder;
this.addBOM = true;
}
PrependBOMWrapper.prototype.write = function(str) {
if (this.addBOM) {
str = BOMChar + str;
this.addBOM = false;
}
return this.encoder.write(str);
};
PrependBOMWrapper.prototype.end = function() {
return this.encoder.end();
};
exports2.StripBOM = StripBOMWrapper;
function StripBOMWrapper(decoder, options) {
this.decoder = decoder;
this.pass = false;
this.options = options || {};
}
StripBOMWrapper.prototype.write = function(buf) {
var res = this.decoder.write(buf);
if (this.pass || !res)
return res;
if (res[0] === BOMChar) {
res = res.slice(1);
if (typeof this.options.stripBOM === "function")
this.options.stripBOM();
}
this.pass = true;
return res;
};
StripBOMWrapper.prototype.end = function() {
return this.decoder.end();
};
}
});
// ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/internal.js
var require_internal = __commonJS({
"../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
"use strict";
var Buffer2 = require_safer().Buffer;
module2.exports = {
// Encodings
utf8: { type: "_internal", bomAware: true },
cesu8: { type: "_internal", bomAware: true },
unicode11utf8: "utf8",
ucs2: { type: "_internal", bomAware: true },
utf16le: "ucs2",
binary: { type: "_internal" },
base64: { type: "_internal" },
hex: { type: "_internal" },
// Codec.
_internal: InternalCodec
};
function InternalCodec(codecOptions, iconv) {
this.enc = codecOptions.encodingName;
this.bomAware = codecOptions.bomAware;
if (this.enc === "base64")
this.encoder = InternalEncoderBase64;
else if (this.enc === "cesu8") {
this.enc = "utf8";
this.encoder = InternalEncoderCesu8;
if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
this.decoder = InternalDecoderCesu8;
this.defaultCharUnicode = iconv.defaultCharUnicode;
}
}
}
InternalCodec.prototype.encoder = InternalEncoder;
InternalCodec.prototype.decoder = InternalDecoder;
var StringDecoder = __require("string_decoder").StringDecoder;
if (!StringDecoder.prototype.end)
StringDecoder.prototype.end = function() {
};
function InternalDecoder(options, codec) {
StringDecoder.call(this, codec.enc);
}
InternalDecoder.prototype = StringDecoder.prototype;
function InternalEncoder(options, codec) {
this.enc = codec.enc;
}
InternalEncoder.prototype.write = function(str) {
return Buffer2.from(str, this.enc);
};
InternalEncoder.prototype.end = function() {
};
function InternalEncoderBase64(options, codec) {
this.prevStr = "";
}
InternalEncoderBase64.prototype.write = function(str) {
str = this.prevStr + str;
var completeQuads = str.length - str.length % 4;
this.prevStr = str.slice(completeQuads);
str = str.slice(0, completeQuads);
return Buffer2.from(str, "base64");
};
InternalEncoderBase64.prototype.end = function() {
return Buffer2.from(this.prevStr, "base64");
};
function InternalEncoderCesu8(options, codec) {
}
InternalEncoderCesu8.prototype.write = function(str) {
var buf = Buffer2.alloc(str.length * 3), bufIdx = 0;
for (var i = 0; i < str.length; i++) {
var charCode = str.charCodeAt(i);
if (charCode < 128)
buf[bufIdx++] = charCode;
else if (charCode < 2048) {
buf[bufIdx++] = 192 + (charCode >>> 6);
buf[bufIdx++] = 128 + (charCode & 63);
} else {
buf[bufIdx++] = 224 + (charCode >>> 12);
buf[bufIdx++] = 128 + (charCode >>> 6 & 63);
buf[bufIdx++] = 128 + (charCode & 63);
}
}
return buf.slice(0, bufIdx);
};
InternalEncoderCesu8.prototype.end = function() {
};
function InternalDecoderCesu8(options, codec) {
this.acc = 0;
this.contBytes = 0;
this.accBytes = 0;
this.defaultCharUnicode = codec.defaultCharUnicode;
}
InternalDecoderCesu8.prototype.write = function(buf) {
var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, res = "";
for (var i = 0; i < buf.length; i++) {
var curByte = buf[i];
if ((curByte & 192) !== 128) {
if (contBytes > 0) {
res += this.defaultCharUnicode;
contBytes = 0;
}
if (curByte < 128) {
res += String.fromCharCode(curByte);
} else if (curByte < 224) {
acc = curByte & 31;
contBytes = 1;
accBytes = 1;
} else if (curByte < 240) {
acc = curByte & 15;
contBytes = 2;
accBytes = 1;
} else {
res += this.defaultCharUnicode;
}
} else {
if (contBytes > 0) {
acc = acc << 6 | curByte & 63;
contBytes--;
accBytes++;
if (contBytes === 0) {
if (accBytes === 2 && acc < 128 && acc > 0)
res += this.defaultCharUnicode;
else if (accBytes === 3 && acc < 2048)
res += this.defaultCharUnicode;
else
res += String.fromCharCode(acc);
}
} else {
res += this.defaultCharUnicode;
}
}
}
this.acc = acc;
this.contBytes = contBytes;
this.accBytes = accBytes;
return res;
};
InternalDecoderCesu8.prototype.end = function() {
var res = 0;
if (this.contBytes > 0)
res += this.defaultCharUnicode;
return res;
};
}
});
// ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/utf16.js
var require_utf16 = __commonJS({
"../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/utf16.js"(exports2) {
"use strict";
var Buffer2 = require_safer().Buffer;
exports2.utf16be = Utf16BECodec;
function Utf16BECodec() {
}
Utf16BECodec.prototype.encoder = Utf16BEEncoder;
Utf16BECodec.prototype.decoder = Utf16BEDecoder;
Utf16BECodec.prototype.bomAware = true;
function Utf16BEEncoder() {
}
Utf16BEEncoder.prototype.write = function(str) {
var buf = Buffer2.from(str, "ucs2");
for (var i = 0; i < buf.length; i += 2) {
var tmp = buf[i];
buf[i] = buf[i + 1];
buf[i + 1] = tmp;
}
return buf;
};
Utf16BEEncoder.prototype.end = function() {
};
function Utf16BEDecoder() {
this.overflowByte = -1;
}
Utf16BEDecoder.prototype.write = function(buf) {
if (buf.length == 0)
return "";
var buf2 = Buffer2.alloc(buf.length + 1), i = 0, j = 0;
if (this.overflowByte !== -1) {
buf2[0] = buf[0];
buf2[1] = this.overflowByte;
i = 1;
j = 2;
}
for (; i < buf.length - 1; i += 2, j += 2) {
buf2[j] = buf[i + 1];
buf2[j + 1] = buf[i];
}
this.overflowByte = i == buf.length - 1 ? buf[buf.length - 1] : -1;
return buf2.slice(0, j).toString("ucs2");
};
Utf16BEDecoder.prototype.end = function() {
};
exports2.utf16 = Utf16Codec;
function Utf16Codec(codecOptions, iconv) {
this.iconv = iconv;
}
Utf16Codec.prototype.encoder = Utf16Encoder;
Utf16Codec.prototype.decoder = Utf16Decoder;
function Utf16Encoder(options, codec) {
options = options || {};
if (options.addBOM === void 0)
options.addBOM = true;
this.encoder = codec.iconv.getEncoder("utf-16le", options);
}
Utf16Encoder.prototype.write = function(str) {
return this.encoder.write(str);
};
Utf16Encoder.prototype.end = function() {
return this.encoder.end();
};
function Utf16Decoder(options, codec) {
this.decoder = null;
this.initialBytes = [];
this.initialBytesLen = 0;
this.options = options || {};
this.iconv = codec.iconv;
}
Utf16Decoder.prototype.write = function(buf) {
if (!this.decoder) {
this.initialBytes.push(buf);
this.initialBytesLen += buf.length;
if (this.initialBytesLen < 16)
return "";
var buf = Buffer2.concat(this.initialBytes), encoding = detectEncoding(buf, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
this.initialBytes.length = this.initialBytesLen = 0;
}
return this.decoder.write(buf);
};
Utf16Decoder.prototype.end = function() {
if (!this.decoder) {
var buf = Buffer2.concat(this.initialBytes), encoding = detectEncoding(buf, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
var res = this.decoder.write(buf), trail = this.decoder.end();
return trail ? res + trail : res;
}
return this.decoder.end();
};
function detectEncoding(buf, defaultEncoding) {
var enc = defaultEncoding || "utf-16le";
if (buf.length >= 2) {
if (buf[0] == 254 && buf[1] == 255)
enc = "utf-16be";
else if (buf[0] == 255 && buf[1] == 254)
enc = "utf-16le";
else {
var asciiCharsLE = 0, asciiCharsBE = 0, _len = Math.min(buf.length - buf.length % 2, 64);
for (var i = 0; i < _len; i += 2) {
if (buf[i] === 0 && buf[i + 1] !== 0)
asciiCharsBE++;
if (buf[i] !== 0 && buf[i + 1] === 0)
asciiCharsLE++;
}
if (asciiCharsBE > asciiCharsLE)
enc = "utf-16be";
else if (asciiCharsBE < asciiCharsLE)
enc = "utf-16le";
}
}
return enc;
}
}
});
// ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/utf7.js
var require_utf7 = __commonJS({
"../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/utf7.js"(exports2) {
"use strict";
var Buffer2 = require_safer().Buffer;
exports2.utf7 = Utf7Codec;
exports2.unicode11utf7 = "utf7";
function Utf7Codec(codecOptions, iconv) {
this.iconv = iconv;
}
Utf7Codec.prototype.encoder = Utf7Encoder;
Utf7Codec.prototype.decoder = Utf7Decoder;
Utf7Codec.prototype.bomAware = true;
var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
function Utf7Encoder(options, codec) {
this.iconv = codec.iconv;
}
Utf7Encoder.prototype.write = function(str) {
return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
}.bind(this)));
};
Utf7Encoder.prototype.end = function() {
};
function Utf7Decoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = "";
}
var base64Regex = /[A-Za-z0-9\/+]/;
var base64Chars = [];
for (i = 0; i < 256; i++)
base64Chars[i] = base64Regex.test(String.fromCharCode(i));
var i;
var plusChar = "+".charCodeAt(0);
var minusChar = "-".charCodeAt(0);
var andChar = "&".charCodeAt(0);
Utf7Decoder.prototype.write = function(buf) {
var res = "", lastI = 0, inBase64 = this.inBase64, base64Accum = this.base64Accum;
for (var i2 = 0; i2 < buf.length; i2++) {
if (!inBase64) {
if (buf[i2] == plusChar) {
res += this.iconv.decode(buf.slice(lastI, i2), "ascii");
lastI = i2 + 1;
inBase64 = true;
}
} else {
if (!base64Chars[buf[i2]]) {
if (i2 == lastI && buf[i2] == minusChar) {
res += "+";
} else {
var b64str = base64Accum + buf.slice(lastI, i2).toString();
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
}
if (buf[i2] != minusChar)
i2--;
lastI = i2 + 1;
inBase64 = false;
base64Accum = "";
}
}
}
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii");
} else {
var b64str = base64Accum + buf.slice(lastI).toString();
var canBeDecoded = b64str.length - b64str.length % 8;
base64Accum = b64str.slice(canBeDecoded);
b64str = b64str.slice(0, canBeDecoded);
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
}
this.inBase64 = inBase64;
this.base64Accum = base64Accum;
return res;
};
Utf7Decoder.prototype.end = function() {
var res = "";
if (this.inBase64 && this.base64Accum.length > 0)
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
this.inBase64 = false;
this.base64Accum = "";
return res;
};
exports2.utf7imap = Utf7IMAPCodec;
function Utf7IMAPCodec(codecOptions, iconv) {
this.iconv = iconv;
}
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;
Utf7IMAPCodec.prototype.bomAware = true;
function Utf7IMAPEncoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = Buffer2.alloc(6);
this.base64AccumIdx = 0;
}
Utf7IMAPEncoder.prototype.write = function(str) {
var inBase64 = this.inBase64, base64Accum = this.base64Accum, base64AccumIdx = this.base64AccumIdx, buf = Buffer2.alloc(str.length * 5 + 10), bufIdx = 0;
for (var i2 = 0; i2 < str.length; i2++) {
var uChar = str.charCodeAt(i2);
if (32 <= uChar && uChar <= 126) {
if (inBase64) {
if (base64AccumIdx > 0) {
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar;
inBase64 = false;
}
if (!inBase64) {
buf[bufIdx++] = uChar;
if (uChar === andChar)
buf[bufIdx++] = minusChar;
}
} else {
if (!inBase64) {
buf[bufIdx++] = andChar;
inBase64 = true;
}
if (inBase64) {
base64Accum[base64AccumIdx++] = uChar >> 8;
base64Accum[base64AccumIdx++] = uChar & 255;
if (base64AccumIdx == base64Accum.length) {
bufIdx += buf.write(base64Accum.toString("base64").replace(/\//g, ","), bufIdx);
base64AccumIdx = 0;
}
}
}
}
this.inBase64 = inBase64;
this.base64AccumIdx = base64AccumIdx;
return buf.slice(0, bufIdx);
};
Utf7IMAPEncoder.prototype.end = function() {
var buf = Buffer2.alloc(10), bufIdx = 0;
if (this.inBase64) {
if (this.base64AccumIdx > 0) {
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
this.base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar;
this.inBase64 = false;
}
return buf.slice(0, bufIdx);
};
function Utf7IMAPDecoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = "";
}
var base64IMAPChars = base64Chars.slice();
base64IMAPChars[",".charCodeAt(0)] = true;
Utf7IMAPDecoder.prototype.write = function(buf) {
var res = "", lastI = 0, inBase64 = this.inBase64, base64Accum = this.base64Accum;
for (var i2 = 0; i2 < buf.length; i2++) {
if (!inBase64) {
if (buf[i2] == andChar) {
res += this.iconv.decode(buf.slice(lastI, i2), "ascii");
lastI = i2 + 1;
inBase64 = true;
}
} else {
if (!base64IMAPChars[buf[i2]]) {
if (i2 == lastI && buf[i2] == minusChar) {
res += "&";
} else {
var b64str = base64Accum + buf.slice(lastI, i2).toString().replace(/,/g, "/");
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
}
if (buf[i2] != minusChar)
i2--;
lastI = i2 + 1;
inBase64 = false;
base64Accum = "";
}
}
}
if (!inBase64) {
res += thi