@sladg/nextjs-lambda
Version:
Plug-and-play lambda for replacing default NextJS image optimization handler.
21,163 lines • 687 kB
JavaScript
#!/usr/bin/env node
"use strict";
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 __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
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 name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
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: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
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/commander/lib/error.js
var require_error = __commonJS({
"node_modules/commander/lib/error.js"(exports) {
var CommanderError2 = class extends Error {
/**
* Constructs the CommanderError class
* @param {number} exitCode suggested exit code which could be used with process.exit
* @param {string} code an id string representing the error
* @param {string} message human-readable description of the error
* @constructor
*/
constructor(exitCode, code, message) {
super(message);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.code = code;
this.exitCode = exitCode;
this.nestedError = void 0;
}
};
var InvalidArgumentError2 = class extends CommanderError2 {
/**
* Constructs the InvalidArgumentError class
* @param {string} [message] explanation of why argument is invalid
* @constructor
*/
constructor(message) {
super(1, "commander.invalidArgument", message);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
}
};
exports.CommanderError = CommanderError2;
exports.InvalidArgumentError = InvalidArgumentError2;
}
});
// node_modules/commander/lib/argument.js
var require_argument = __commonJS({
"node_modules/commander/lib/argument.js"(exports) {
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
var Argument2 = class {
/**
* Initialize a new command argument with the given name and description.
* The default is that the argument is required, and you can explicitly
* indicate this with <> around the name. Put [] around the name for an optional argument.
*
* @param {string} name
* @param {string} [description]
*/
constructor(name, description) {
this.description = description || "";
this.variadic = false;
this.parseArg = void 0;
this.defaultValue = void 0;
this.defaultValueDescription = void 0;
this.argChoices = void 0;
switch (name[0]) {
case "<":
this.required = true;
this._name = name.slice(1, -1);
break;
case "[":
this.required = false;
this._name = name.slice(1, -1);
break;
default:
this.required = true;
this._name = name;
break;
}
if (this._name.length > 3 && this._name.slice(-3) === "...") {
this.variadic = true;
this._name = this._name.slice(0, -3);
}
}
/**
* Return argument name.
*
* @return {string}
*/
name() {
return this._name;
}
/**
* @api private
*/
_concatValue(value, previous) {
if (previous === this.defaultValue || !Array.isArray(previous)) {
return [value];
}
return previous.concat(value);
}
/**
* Set the default value, and optionally supply the description to be displayed in the help.
*
* @param {any} value
* @param {string} [description]
* @return {Argument}
*/
default(value, description) {
this.defaultValue = value;
this.defaultValueDescription = description;
return this;
}
/**
* Set the custom handler for processing CLI command arguments into argument values.
*
* @param {Function} [fn]
* @return {Argument}
*/
argParser(fn) {
this.parseArg = fn;
return this;
}
/**
* Only allow argument value to be one of choices.
*
* @param {string[]} values
* @return {Argument}
*/
choices(values) {
this.argChoices = values.slice();
this.parseArg = (arg, previous) => {
if (!this.argChoices.includes(arg)) {
throw new InvalidArgumentError2(`Allowed choices are ${this.argChoices.join(", ")}.`);
}
if (this.variadic) {
return this._concatValue(arg, previous);
}
return arg;
};
return this;
}
/**
* Make argument required.
*/
argRequired() {
this.required = true;
return this;
}
/**
* Make argument optional.
*/
argOptional() {
this.required = false;
return this;
}
};
function humanReadableArgName(arg) {
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
}
exports.Argument = Argument2;
exports.humanReadableArgName = humanReadableArgName;
}
});
// node_modules/commander/lib/help.js
var require_help = __commonJS({
"node_modules/commander/lib/help.js"(exports) {
var { humanReadableArgName } = require_argument();
var Help2 = class {
constructor() {
this.helpWidth = void 0;
this.sortSubcommands = false;
this.sortOptions = false;
this.showGlobalOptions = false;
}
/**
* Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.
*
* @param {Command} cmd
* @returns {Command[]}
*/
visibleCommands(cmd) {
const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
if (cmd._hasImplicitHelpCommand()) {
const [, helpName, helpArgs] = cmd._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
const helpCommand = cmd.createCommand(helpName).helpOption(false);
helpCommand.description(cmd._helpCommandDescription);
if (helpArgs)
helpCommand.arguments(helpArgs);
visibleCommands.push(helpCommand);
}
if (this.sortSubcommands) {
visibleCommands.sort((a, b) => {
return a.name().localeCompare(b.name());
});
}
return visibleCommands;
}
/**
* Compare options for sort.
*
* @param {Option} a
* @param {Option} b
* @returns number
*/
compareOptions(a, b) {
const getSortKey = (option) => {
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
};
return getSortKey(a).localeCompare(getSortKey(b));
}
/**
* Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.
*
* @param {Command} cmd
* @returns {Option[]}
*/
visibleOptions(cmd) {
const visibleOptions = cmd.options.filter((option) => !option.hidden);
const showShortHelpFlag = cmd._hasHelpOption && cmd._helpShortFlag && !cmd._findOption(cmd._helpShortFlag);
const showLongHelpFlag = cmd._hasHelpOption && !cmd._findOption(cmd._helpLongFlag);
if (showShortHelpFlag || showLongHelpFlag) {
let helpOption;
if (!showShortHelpFlag) {
helpOption = cmd.createOption(cmd._helpLongFlag, cmd._helpDescription);
} else if (!showLongHelpFlag) {
helpOption = cmd.createOption(cmd._helpShortFlag, cmd._helpDescription);
} else {
helpOption = cmd.createOption(cmd._helpFlags, cmd._helpDescription);
}
visibleOptions.push(helpOption);
}
if (this.sortOptions) {
visibleOptions.sort(this.compareOptions);
}
return visibleOptions;
}
/**
* Get an array of the visible global options. (Not including help.)
*
* @param {Command} cmd
* @returns {Option[]}
*/
visibleGlobalOptions(cmd) {
if (!this.showGlobalOptions)
return [];
const globalOptions = [];
for (let parentCmd = cmd.parent; parentCmd; parentCmd = parentCmd.parent) {
const visibleOptions = parentCmd.options.filter((option) => !option.hidden);
globalOptions.push(...visibleOptions);
}
if (this.sortOptions) {
globalOptions.sort(this.compareOptions);
}
return globalOptions;
}
/**
* Get an array of the arguments if any have a description.
*
* @param {Command} cmd
* @returns {Argument[]}
*/
visibleArguments(cmd) {
if (cmd._argsDescription) {
cmd._args.forEach((argument) => {
argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
});
}
if (cmd._args.find((argument) => argument.description)) {
return cmd._args;
}
return [];
}
/**
* Get the command term to show in the list of subcommands.
*
* @param {Command} cmd
* @returns {string}
*/
subcommandTerm(cmd) {
const args = cmd._args.map((arg) => humanReadableArgName(arg)).join(" ");
return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + // simplistic check for non-help option
(args ? " " + args : "");
}
/**
* Get the option term to show in the list of options.
*
* @param {Option} option
* @returns {string}
*/
optionTerm(option) {
return option.flags;
}
/**
* Get the argument term to show in the list of arguments.
*
* @param {Argument} argument
* @returns {string}
*/
argumentTerm(argument) {
return argument.name();
}
/**
* Get the longest command term length.
*
* @param {Command} cmd
* @param {Help} helper
* @returns {number}
*/
longestSubcommandTermLength(cmd, helper) {
return helper.visibleCommands(cmd).reduce((max, command) => {
return Math.max(max, helper.subcommandTerm(command).length);
}, 0);
}
/**
* Get the longest option term length.
*
* @param {Command} cmd
* @param {Help} helper
* @returns {number}
*/
longestOptionTermLength(cmd, helper) {
return helper.visibleOptions(cmd).reduce((max, option) => {
return Math.max(max, helper.optionTerm(option).length);
}, 0);
}
/**
* Get the longest global option term length.
*
* @param {Command} cmd
* @param {Help} helper
* @returns {number}
*/
longestGlobalOptionTermLength(cmd, helper) {
return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
return Math.max(max, helper.optionTerm(option).length);
}, 0);
}
/**
* Get the longest argument term length.
*
* @param {Command} cmd
* @param {Help} helper
* @returns {number}
*/
longestArgumentTermLength(cmd, helper) {
return helper.visibleArguments(cmd).reduce((max, argument) => {
return Math.max(max, helper.argumentTerm(argument).length);
}, 0);
}
/**
* Get the command usage to be displayed at the top of the built-in help.
*
* @param {Command} cmd
* @returns {string}
*/
commandUsage(cmd) {
let cmdName = cmd._name;
if (cmd._aliases[0]) {
cmdName = cmdName + "|" + cmd._aliases[0];
}
let parentCmdNames = "";
for (let parentCmd = cmd.parent; parentCmd; parentCmd = parentCmd.parent) {
parentCmdNames = parentCmd.name() + " " + parentCmdNames;
}
return parentCmdNames + cmdName + " " + cmd.usage();
}
/**
* Get the description for the command.
*
* @param {Command} cmd
* @returns {string}
*/
commandDescription(cmd) {
return cmd.description();
}
/**
* Get the subcommand summary to show in the list of subcommands.
* (Fallback to description for backwards compatibility.)
*
* @param {Command} cmd
* @returns {string}
*/
subcommandDescription(cmd) {
return cmd.summary() || cmd.description();
}
/**
* Get the option description to show in the list of options.
*
* @param {Option} option
* @return {string}
*/
optionDescription(option) {
const extraInfo = [];
if (option.argChoices) {
extraInfo.push(
// use stringify to match the display of the default value
`choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`
);
}
if (option.defaultValue !== void 0) {
const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean";
if (showDefault) {
extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`);
}
}
if (option.presetArg !== void 0 && option.optional) {
extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);
}
if (option.envVar !== void 0) {
extraInfo.push(`env: ${option.envVar}`);
}
if (extraInfo.length > 0) {
return `${option.description} (${extraInfo.join(", ")})`;
}
return option.description;
}
/**
* Get the argument description to show in the list of arguments.
*
* @param {Argument} argument
* @return {string}
*/
argumentDescription(argument) {
const extraInfo = [];
if (argument.argChoices) {
extraInfo.push(
// use stringify to match the display of the default value
`choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`
);
}
if (argument.defaultValue !== void 0) {
extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
}
if (extraInfo.length > 0) {
const extraDescripton = `(${extraInfo.join(", ")})`;
if (argument.description) {
return `${argument.description} ${extraDescripton}`;
}
return extraDescripton;
}
return argument.description;
}
/**
* Generate the built-in help text.
*
* @param {Command} cmd
* @param {Help} helper
* @returns {string}
*/
formatHelp(cmd, helper) {
const termWidth = helper.padWidth(cmd, helper);
const helpWidth = helper.helpWidth || 80;
const itemIndentWidth = 2;
const itemSeparatorWidth = 2;
function formatItem(term, description) {
if (description) {
const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;
return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth);
}
return term;
}
function formatList(textArray) {
return textArray.join("\n").replace(/^/gm, " ".repeat(itemIndentWidth));
}
let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
const commandDescription = helper.commandDescription(cmd);
if (commandDescription.length > 0) {
output = output.concat([helper.wrap(commandDescription, helpWidth, 0), ""]);
}
const argumentList = helper.visibleArguments(cmd).map((argument) => {
return formatItem(helper.argumentTerm(argument), helper.argumentDescription(argument));
});
if (argumentList.length > 0) {
output = output.concat(["Arguments:", formatList(argumentList), ""]);
}
const optionList = helper.visibleOptions(cmd).map((option) => {
return formatItem(helper.optionTerm(option), helper.optionDescription(option));
});
if (optionList.length > 0) {
output = output.concat(["Options:", formatList(optionList), ""]);
}
if (this.showGlobalOptions) {
const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
return formatItem(helper.optionTerm(option), helper.optionDescription(option));
});
if (globalOptionList.length > 0) {
output = output.concat(["Global Options:", formatList(globalOptionList), ""]);
}
}
const commandList = helper.visibleCommands(cmd).map((cmd2) => {
return formatItem(helper.subcommandTerm(cmd2), helper.subcommandDescription(cmd2));
});
if (commandList.length > 0) {
output = output.concat(["Commands:", formatList(commandList), ""]);
}
return output.join("\n");
}
/**
* Calculate the pad width from the maximum term length.
*
* @param {Command} cmd
* @param {Help} helper
* @returns {number}
*/
padWidth(cmd, helper) {
return Math.max(
helper.longestOptionTermLength(cmd, helper),
helper.longestGlobalOptionTermLength(cmd, helper),
helper.longestSubcommandTermLength(cmd, helper),
helper.longestArgumentTermLength(cmd, helper)
);
}
/**
* Wrap the given string to width characters per line, with lines after the first indented.
* Do not wrap if insufficient room for wrapping (minColumnWidth), or string is manually formatted.
*
* @param {string} str
* @param {number} width
* @param {number} indent
* @param {number} [minColumnWidth=40]
* @return {string}
*
*/
wrap(str, width, indent, minColumnWidth = 40) {
const indents = " \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF";
const manualIndent = new RegExp(`[\\n][${indents}]+`);
if (str.match(manualIndent))
return str;
const columnWidth = width - indent;
if (columnWidth < minColumnWidth)
return str;
const leadingStr = str.slice(0, indent);
const columnText = str.slice(indent).replace("\r\n", "\n");
const indentString = " ".repeat(indent);
const zeroWidthSpace = "\u200B";
const breaks = `\\s${zeroWidthSpace}`;
const regex = new RegExp(`
|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, "g");
const lines = columnText.match(regex) || [];
return leadingStr + lines.map((line, i) => {
if (line === "\n")
return "";
return (i > 0 ? indentString : "") + line.trimEnd();
}).join("\n");
}
};
exports.Help = Help2;
}
});
// node_modules/commander/lib/option.js
var require_option = __commonJS({
"node_modules/commander/lib/option.js"(exports) {
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
var Option2 = class {
/**
* Initialize a new `Option` with the given `flags` and `description`.
*
* @param {string} flags
* @param {string} [description]
*/
constructor(flags, description) {
this.flags = flags;
this.description = description || "";
this.required = flags.includes("<");
this.optional = flags.includes("[");
this.variadic = /\w\.\.\.[>\]]$/.test(flags);
this.mandatory = false;
const optionFlags = splitOptionFlags(flags);
this.short = optionFlags.shortFlag;
this.long = optionFlags.longFlag;
this.negate = false;
if (this.long) {
this.negate = this.long.startsWith("--no-");
}
this.defaultValue = void 0;
this.defaultValueDescription = void 0;
this.presetArg = void 0;
this.envVar = void 0;
this.parseArg = void 0;
this.hidden = false;
this.argChoices = void 0;
this.conflictsWith = [];
this.implied = void 0;
}
/**
* Set the default value, and optionally supply the description to be displayed in the help.
*
* @param {any} value
* @param {string} [description]
* @return {Option}
*/
default(value, description) {
this.defaultValue = value;
this.defaultValueDescription = description;
return this;
}
/**
* Preset to use when option used without option-argument, especially optional but also boolean and negated.
* The custom processing (parseArg) is called.
*
* @example
* new Option('--color').default('GREYSCALE').preset('RGB');
* new Option('--donate [amount]').preset('20').argParser(parseFloat);
*
* @param {any} arg
* @return {Option}
*/
preset(arg) {
this.presetArg = arg;
return this;
}
/**
* Add option name(s) that conflict with this option.
* An error will be displayed if conflicting options are found during parsing.
*
* @example
* new Option('--rgb').conflicts('cmyk');
* new Option('--js').conflicts(['ts', 'jsx']);
*
* @param {string | string[]} names
* @return {Option}
*/
conflicts(names) {
this.conflictsWith = this.conflictsWith.concat(names);
return this;
}
/**
* Specify implied option values for when this option is set and the implied options are not.
*
* The custom processing (parseArg) is not called on the implied values.
*
* @example
* program
* .addOption(new Option('--log', 'write logging information to file'))
* .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));
*
* @param {Object} impliedOptionValues
* @return {Option}
*/
implies(impliedOptionValues) {
this.implied = Object.assign(this.implied || {}, impliedOptionValues);
return this;
}
/**
* Set environment variable to check for option value.
*
* An environment variable is only used if when processed the current option value is
* undefined, or the source of the current value is 'default' or 'config' or 'env'.
*
* @param {string} name
* @return {Option}
*/
env(name) {
this.envVar = name;
return this;
}
/**
* Set the custom handler for processing CLI option arguments into option values.
*
* @param {Function} [fn]
* @return {Option}
*/
argParser(fn) {
this.parseArg = fn;
return this;
}
/**
* Whether the option is mandatory and must have a value after parsing.
*
* @param {boolean} [mandatory=true]
* @return {Option}
*/
makeOptionMandatory(mandatory = true) {
this.mandatory = !!mandatory;
return this;
}
/**
* Hide option in help.
*
* @param {boolean} [hide=true]
* @return {Option}
*/
hideHelp(hide = true) {
this.hidden = !!hide;
return this;
}
/**
* @api private
*/
_concatValue(value, previous) {
if (previous === this.defaultValue || !Array.isArray(previous)) {
return [value];
}
return previous.concat(value);
}
/**
* Only allow option value to be one of choices.
*
* @param {string[]} values
* @return {Option}
*/
choices(values) {
this.argChoices = values.slice();
this.parseArg = (arg, previous) => {
if (!this.argChoices.includes(arg)) {
throw new InvalidArgumentError2(`Allowed choices are ${this.argChoices.join(", ")}.`);
}
if (this.variadic) {
return this._concatValue(arg, previous);
}
return arg;
};
return this;
}
/**
* Return option name.
*
* @return {string}
*/
name() {
if (this.long) {
return this.long.replace(/^--/, "");
}
return this.short.replace(/^-/, "");
}
/**
* Return option name, in a camelcase format that can be used
* as a object attribute key.
*
* @return {string}
* @api private
*/
attributeName() {
return camelcase(this.name().replace(/^no-/, ""));
}
/**
* Check if `arg` matches the short or long flag.
*
* @param {string} arg
* @return {boolean}
* @api private
*/
is(arg) {
return this.short === arg || this.long === arg;
}
/**
* Return whether a boolean option.
*
* Options are one of boolean, negated, required argument, or optional argument.
*
* @return {boolean}
* @api private
*/
isBoolean() {
return !this.required && !this.optional && !this.negate;
}
};
var DualOptions = class {
/**
* @param {Option[]} options
*/
constructor(options) {
this.positiveOptions = /* @__PURE__ */ new Map();
this.negativeOptions = /* @__PURE__ */ new Map();
this.dualOptions = /* @__PURE__ */ new Set();
options.forEach((option) => {
if (option.negate) {
this.negativeOptions.set(option.attributeName(), option);
} else {
this.positiveOptions.set(option.attributeName(), option);
}
});
this.negativeOptions.forEach((value, key) => {
if (this.positiveOptions.has(key)) {
this.dualOptions.add(key);
}
});
}
/**
* Did the value come from the option, and not from possible matching dual option?
*
* @param {any} value
* @param {Option} option
* @returns {boolean}
*/
valueFromOption(value, option) {
const optionKey = option.attributeName();
if (!this.dualOptions.has(optionKey))
return true;
const preset = this.negativeOptions.get(optionKey).presetArg;
const negativeValue = preset !== void 0 ? preset : false;
return option.negate === (negativeValue === value);
}
};
function camelcase(str) {
return str.split("-").reduce((str2, word) => {
return str2 + word[0].toUpperCase() + word.slice(1);
});
}
function splitOptionFlags(flags) {
let shortFlag;
let longFlag;
const flagParts = flags.split(/[ |,]+/);
if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
shortFlag = flagParts.shift();
longFlag = flagParts.shift();
if (!shortFlag && /^-[^-]$/.test(longFlag)) {
shortFlag = longFlag;
longFlag = void 0;
}
return { shortFlag, longFlag };
}
exports.Option = Option2;
exports.splitOptionFlags = splitOptionFlags;
exports.DualOptions = DualOptions;
}
});
// node_modules/commander/lib/suggestSimilar.js
var require_suggestSimilar = __commonJS({
"node_modules/commander/lib/suggestSimilar.js"(exports) {
var maxDistance = 3;
function editDistance(a, b) {
if (Math.abs(a.length - b.length) > maxDistance)
return Math.max(a.length, b.length);
const d = [];
for (let i = 0; i <= a.length; i++) {
d[i] = [i];
}
for (let j = 0; j <= b.length; j++) {
d[0][j] = j;
}
for (let j = 1; j <= b.length; j++) {
for (let i = 1; i <= a.length; i++) {
let cost = 1;
if (a[i - 1] === b[j - 1]) {
cost = 0;
} else {
cost = 1;
}
d[i][j] = Math.min(
d[i - 1][j] + 1,
// deletion
d[i][j - 1] + 1,
// insertion
d[i - 1][j - 1] + cost
// substitution
);
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
}
}
}
return d[a.length][b.length];
}
function suggestSimilar(word, candidates) {
if (!candidates || candidates.length === 0)
return "";
candidates = Array.from(new Set(candidates));
const searchingOptions = word.startsWith("--");
if (searchingOptions) {
word = word.slice(2);
candidates = candidates.map((candidate) => candidate.slice(2));
}
let similar = [];
let bestDistance = maxDistance;
const minSimilarity = 0.4;
candidates.forEach((candidate) => {
if (candidate.length <= 1)
return;
const distance = editDistance(word, candidate);
const length = Math.max(word.length, candidate.length);
const similarity = (length - distance) / length;
if (similarity > minSimilarity) {
if (distance < bestDistance) {
bestDistance = distance;
similar = [candidate];
} else if (distance === bestDistance) {
similar.push(candidate);
}
}
});
similar.sort((a, b) => a.localeCompare(b));
if (searchingOptions) {
similar = similar.map((candidate) => `--${candidate}`);
}
if (similar.length > 1) {
return `
(Did you mean one of ${similar.join(", ")}?)`;
}
if (similar.length === 1) {
return `
(Did you mean ${similar[0]}?)`;
}
return "";
}
exports.suggestSimilar = suggestSimilar;
}
});
// node_modules/commander/lib/command.js
var require_command = __commonJS({
"node_modules/commander/lib/command.js"(exports) {
var EventEmitter = require("events").EventEmitter;
var childProcess = require("child_process");
var path3 = require("path");
var fs = require("fs");
var process2 = require("process");
var { Argument: Argument2, humanReadableArgName } = require_argument();
var { CommanderError: CommanderError2 } = require_error();
var { Help: Help2 } = require_help();
var { Option: Option2, splitOptionFlags, DualOptions } = require_option();
var { suggestSimilar } = require_suggestSimilar();
var Command2 = class extends EventEmitter {
/**
* Initialize a new `Command`.
*
* @param {string} [name]
*/
constructor(name) {
super();
this.commands = [];
this.options = [];
this.parent = null;
this._allowUnknownOption = false;
this._allowExcessArguments = true;
this._args = [];
this.args = [];
this.rawArgs = [];
this.processedArgs = [];
this._scriptPath = null;
this._name = name || "";
this._optionValues = {};
this._optionValueSources = {};
this._storeOptionsAsProperties = false;
this._actionHandler = null;
this._executableHandler = false;
this._executableFile = null;
this._executableDir = null;
this._defaultCommandName = null;
this._exitCallback = null;
this._aliases = [];
this._combineFlagAndOptionalValue = true;
this._description = "";
this._summary = "";
this._argsDescription = void 0;
this._enablePositionalOptions = false;
this._passThroughOptions = false;
this._lifeCycleHooks = {};
this._showHelpAfterError = false;
this._showSuggestionAfterError = true;
this._outputConfiguration = {
writeOut: (str) => process2.stdout.write(str),
writeErr: (str) => process2.stderr.write(str),
getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : void 0,
getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : void 0,
outputError: (str, write) => write(str)
};
this._hidden = false;
this._hasHelpOption = true;
this._helpFlags = "-h, --help";
this._helpDescription = "display help for command";
this._helpShortFlag = "-h";
this._helpLongFlag = "--help";
this._addImplicitHelpCommand = void 0;
this._helpCommandName = "help";
this._helpCommandnameAndArgs = "help [command]";
this._helpCommandDescription = "display help for command";
this._helpConfiguration = {};
}
/**
* Copy settings that are useful to have in common across root command and subcommands.
*
* (Used internally when adding a command using `.command()` so subcommands inherit parent settings.)
*
* @param {Command} sourceCommand
* @return {Command} `this` command for chaining
*/
copyInheritedSettings(sourceCommand) {
this._outputConfiguration = sourceCommand._outputConfiguration;
this._hasHelpOption = sourceCommand._hasHelpOption;
this._helpFlags = sourceCommand._helpFlags;
this._helpDescription = sourceCommand._helpDescription;
this._helpShortFlag = sourceCommand._helpShortFlag;
this._helpLongFlag = sourceCommand._helpLongFlag;
this._helpCommandName = sourceCommand._helpCommandName;
this._helpCommandnameAndArgs = sourceCommand._helpCommandnameAndArgs;
this._helpCommandDescription = sourceCommand._helpCommandDescription;
this._helpConfiguration = sourceCommand._helpConfiguration;
this._exitCallback = sourceCommand._exitCallback;
this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;
this._combineFlagAndOptionalValue = sourceCommand._combineFlagAndOptionalValue;
this._allowExcessArguments = sourceCommand._allowExcessArguments;
this._enablePositionalOptions = sourceCommand._enablePositionalOptions;
this._showHelpAfterError = sourceCommand._showHelpAfterError;
this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;
return this;
}
/**
* Define a command.
*
* There are two styles of command: pay attention to where to put the description.
*
* @example
* // Command implemented using action handler (description is supplied separately to `.command`)
* program
* .command('clone <source> [destination]')
* .description('clone a repository into a newly created directory')
* .action((source, destination) => {
* console.log('clone command called');
* });
*
* // Command implemented using separate executable file (description is second parameter to `.command`)
* program
* .command('start <service>', 'start named service')
* .command('stop [service]', 'stop named service, or all if no name supplied');
*
* @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
* @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
* @param {Object} [execOpts] - configuration options (for executable)
* @return {Command} returns new command for action handler, or `this` for executable command
*/
command(nameAndArgs, actionOptsOrExecDesc, execOpts) {
let desc = actionOptsOrExecDesc;
let opts = execOpts;
if (typeof desc === "object" && desc !== null) {
opts = desc;
desc = null;
}
opts = opts || {};
const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);
const cmd = this.createCommand(name);
if (desc) {
cmd.description(desc);
cmd._executableHandler = true;
}
if (opts.isDefault)
this._defaultCommandName = cmd._name;
cmd._hidden = !!(opts.noHelp || opts.hidden);
cmd._executableFile = opts.executableFile || null;
if (args)
cmd.arguments(args);
this.commands.push(cmd);
cmd.parent = this;
cmd.copyInheritedSettings(this);
if (desc)
return this;
return cmd;
}
/**
* Factory routine to create a new unattached command.
*
* See .command() for creating an attached subcommand, which uses this routine to
* create the command. You can override createCommand to customise subcommands.
*
* @param {string} [name]
* @return {Command} new command
*/
createCommand(name) {
return new Command2(name);
}
/**
* You can customise the help with a subclass of Help by overriding createHelp,
* or by overriding Help properties using configureHelp().
*
* @return {Help}
*/
createHelp() {
return Object.assign(new Help2(), this.configureHelp());
}
/**
* You can customise the help by overriding Help properties using configureHelp(),
* or with a subclass of Help by overriding createHelp().
*
* @param {Object} [configuration] - configuration options
* @return {Command|Object} `this` command for chaining, or stored configuration
*/
configureHelp(configuration) {
if (configuration === void 0)
return this._helpConfiguration;
this._helpConfiguration = configuration;
return this;
}
/**
* The default output goes to stdout and stderr. You can customise this for special
* applications. You can also customise the display of errors by overriding outputError.
*
* The configuration properties are all functions:
*
* // functions to change where being written, stdout and stderr
* writeOut(str)
* writeErr(str)
* // matching functions to specify width for wrapping help
* getOutHelpWidth()
* getErrHelpWidth()
* // functions based on what is being written out
* outputError(str, write) // used for displaying errors, and not used for displaying help
*
* @param {Object} [configuration] - configuration options
* @return {Command|Object} `this` command for chaining, or stored configuration
*/
configureOutput(configuration) {
if (configuration === void 0)
return this._outputConfiguration;
Object.assign(this._outputConfiguration, configuration);
return this;
}
/**
* Display the help or a custom message after an error occurs.
*
* @param {boolean|string} [displayHelp]
* @return {Command} `this` command for chaining
*/
showHelpAfterError(displayHelp = true) {
if (typeof displayHelp !== "string")
displayHelp = !!displayHelp;
this._showHelpAfterError = displayHelp;
return this;
}
/**
* Display suggestion of similar commands for unknown commands, or options for unknown options.
*
* @param {boolean} [displaySuggestion]
* @return {Command} `this` command for chaining
*/
showSuggestionAfterError(displaySuggestion = true) {
this._showSuggestionAfterError = !!displaySuggestion;
return this;
}
/**
* Add a prepared subcommand.
*
* See .command() for creating an attached subcommand which inherits settings from its parent.
*
* @param {Command} cmd - new subcommand
* @param {Object} [opts] - configuration options
* @return {Command} `this` command for chaining
*/
addCommand(cmd, opts) {
if (!cmd._name) {
throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);
}
opts = opts || {};
if (opts.isDefault)
this._defaultCommandName = cmd._name;
if (opts.noHelp || opts.hidden)
cmd._hidden = true;
this.commands.push(cmd);
cmd.parent = this;
return this;
}
/**
* Factory routine to create a new unattached argument.
*
* See .argument() for creating an attached argument, which uses this routine to
* create the argument. You can override createArgument to return a custom argument.
*
* @param {string} name
* @param {string} [description]
* @return {Argument} new argument
*/
createArgument(name, description) {
return new Argument2(name, description);
}
/**
* Define argument syntax for command.
*
* The default is that the argument is required, and you can explicitly
* indicate this with <> around the name. Put [] around the name for an optional argument.
*
* @example
* program.argument('<input-file>');
* program.argument('[output-file]');
*
* @param {string} name
* @param {string} [description]
* @param {Function|*} [fn] - custom argument processing function
* @param {*} [defaultValue]
* @return {Command} `this` command for chaining
*/
argument(name, description, fn, defaultValue) {
const argument = this.createArgument(name, description);
if (typeof fn === "function") {
argument.default(defaultValue).argParser(fn);
} else {
argument.default(fn);
}
this.addArgument(argument);
return this;
}
/**
* Define argument syntax for command, adding multiple at once (without descriptions).
*
* See also .argument().
*
* @example
* program.arguments('<cmd> [env]');
*
* @param {string} names
* @return {Command} `this` command for chaining
*/
arguments(names) {
names.split(/ +/).forEach((detail) => {
this.argument(detail);
});
return this;
}
/**
* Define argument syntax for command, adding a prepared argument.
*
* @param {Argument} argument
* @return {Command} `this` command for chaining
*/
addArgument(argument) {
const previousArgument = this._args.slice(-1)[0];
if (previousArgument && previousArgument.variadic) {
throw new Error(`only the last argument can be variadic '${previousArgument.name()}'`);
}
if (argument.required && argument.defaultValue !== void 0 && argument.parseArg === void 0) {
throw new Error(`a default value for a required argument is never used: '${argument.name()}'`);
}
this._args.push(argument);
return this;
}
/**
* Override default decision whether to add implicit help command.
*
* addHelpCommand() // force on
* addHelpCommand(false); // force off
* addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details
*
* @return {Command} `this` command for chaining
*/
addHelpCommand(enableOrNameAndArgs, description) {
if (enableOrNameAndArgs === false) {
this._addImplicitHelpCommand = false;
} else {
this._addImplicitHelpCommand = true;
if (typeof enableOrNameAndArgs === "string") {
this._helpCommandName = enableOrNameAndArgs.split(" ")[0];
this._helpCommandnameAndArgs = enableOrNameAndArgs;
}
this._helpCommandDescription = description || this._helpCommandDescription;
}
return this;
}
/**
* @return {boolean}
* @api private
*/
_hasImplicitHelpCommand() {
if (this._addImplicitHelpCommand === void 0) {
return this.commands.length && !this._actionHandler && !this._findCommand("help");
}
return this._addImplicitHelpCommand;
}
/**
* Add hook for life cycle event.
*
* @param {string} event
* @param {Function} listener
* @return {Command} `this` command for chaining
*/
hook(event, listener) {
const allowedValues = ["preSubcommand", "preAction", "postAction"];
if (!allowedValues.includes(event)) {
throw new Error(`Unexpected value for event passed to hook : '${event}'.
Expecting one of '${allowedValues.join("', '")}'`);
}
if (this._lifeCycleHooks[event]) {
this._lifeCycleHooks[event].push(listener);
} else {
this._lifeCycleHooks[event] = [listener];
}
return this;
}
/**
* Register callback to use as replacement for calling process.exit.
*
* @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing
* @return {Command} `this` command for chaining
*/
exitOverride(fn) {
if (fn) {
this._exitCallback = fn;
} else {
this._exitCallback = (err) => {
if (err.code !== "commander.executeSubCommandAsync") {
throw err;
} else {
}
};
}
return this;
}
/**
* Call process.exit, and _exitCallback if defined.
*
* @param {number} exitCode exit code for using with process.exit
* @param {string} code an id string representing the error
* @param {string} message human-readable description of the error
* @return never
* @api private
*/
_exit(exitCode, code, message) {
if (this._exitCallback) {
this._exitCallback(new CommanderError2(exitCode, code, message));
}
process2.exit(exitCode);
}
/**
* Register callback `fn` for the command.
*
* @example
* program
* .command('serve')
* .description('start service')
* .action(function() {
* // do work here
* });
*
* @param {Function} fn
* @return {Command} `this` command for chaining
*/
action(fn) {
const listener = (args) => {
const expectedArgsCount = this._args.length;
const actionArgs = args.slice(0, expectedArgsCount);
if (this._storeOptionsAsProperties) {
actionArgs[expectedArgsCount] = this;
} else {
actionArgs[expectedArgsCount] = this.opts();
}
actionArgs.push(this);
return fn.apply(this, actionArgs);
};
this._actionHandler = listener;
return this;
}
/**
* Factory routine to create a new unattached option.
*
* See .option() for creating an attached option, which uses this routine to
* create the option. You can override createOption to return a custom option.
*
* @param {string} flags
* @param {string} [description]
* @return {Option} new option
*/
createOption(flags, description) {
return new Option2(flags, description);
}
/**
* Add an option.
*
* @param {Option} option
* @return {Command} `this` command for chaining
*/
addOption(option) {
const oname = option.name();
const name = option.attributeName();
if (option.negate) {
const positiveLongFlag = option.long.replace(/^--no-/, "--");
if (!this._findOption(positiveLongFlag)) {
this.setOptionValueWithSource(name, option.defaultValue === void 0 ? true : option.defaultValue, "default");
}
} else if (option.defaultValue !== void 0) {
this.setOptionValueWithSource(name, option.defaultValue, "default");
}
this.options.push(option);
const handleOptionValue = (val, invalidValueMessage, valueSource) => {
if (val == null && option.presetArg !== void 0) {
val = option.presetArg;
}
const oldValue = this.getOptionValue(name);
if (val !== null && option.parseArg) {
try {
val = option.parseArg(val, oldValue);
} catch (err) {
if (err.code === "commander.invalidArgument") {
const message = `${invalidValueMessage} ${err.message}`;
this.error(message, { exitCode: err.exitCode, code: err.code });
}
throw err;
}
} else if (val !== null && option.variadic) {
val = option._concatValue(val, oldValue);
}
if (val == null) {
if (option.negate) {
val = false;
} else if (option.isBoolean() || option.optional) {
val = true;
} else {
val = "";
}
}
this.setOptionValueWithSource(name, val, valueSource);
};
this.on("option:" + oname, (val) => {
const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
handleOptionValue(val, invalidValueMessage, "cli");
});
if (option.envVar) {
this.on("optionEnv:" + oname, (val) => {
const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
handleOptionValue(val, invalidValueMessage, "env");
});
}
return this;
}
/**
* Internal implementation shared by .option() and .requiredOption()
*
* @api private
*/
_optionEx(config, flags, description, fn, defaultValue) {
if (typeof flags === "object" && flags instanceof Option2) {
throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
}
const option = this.createOption(flags, description);
option.makeOptionMandatory(!!config.mandatory);
if (typeof fn === "function") {
option.default(defaultValue).argParser(fn);
} else if (fn instanceof RegExp) {
const regex = fn;
fn = (val, def) => {
const m = regex.exec(val);
return m ? m[0] : def;
};
option.default(defaultValue).argParser(fn);
} else {
option.default(fn);
}
return this.addOption(option);
}
/**
* Define option with `flags`, `description` and optional
* coercion `fn`.
*
* The `flags` string contains the short and/or long flags,
* separated by comma, a pipe or space. The following are all valid
* all will output this way when `--help` is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* @example
* // simple boolean defaulting to undefined
* program.option('-p, --pepper', 'add pepper');
*
* program.pepper
* // => undefined
*
* --pepper
* program.pepper
* // => true
*
* // simple boolean defaulting to true (unless non-negated option is also defined)
* program.option('-C, --no-cheese', 'remove cheese');
*
* program.cheese
* // => true
*
* --no-cheese
* program.cheese
* // => false
*
* // required argument
* program.option('-C, --chdir <path>', 'change the working directory');
*
* --chdir /tmp
* program.chdir
* // => "/tmp"
*
* // optional argument
* program.option('-c, --cheese [type]', 'add cheese [marble]');
*
* @param {string} flags
* @param {string} [description]
* @param {Function|*} [fn] - custom option processing function or default value
* @param {*} [defaultValue]
* @return {Command} `this` command for chaining
*/
option(flags, description, fn, defaultValue) {
return this._optionEx({}, flags, description, fn, defaultValue);
}
/**
* Add a required option which must have a value after parsing. This usually means
* the option must be specified on the command line. (Otherwise the same as .option().)
*
* The `flags` string contains the short and/or long flags, separated by comma, a pipe or space.
*
* @param {string} flags
* @param {string} [description]
* @param {Function|*} [fn] - custom option processing function or default value
* @param {*} [defaultValue]
* @return {Command} `this` command for chaining
*/
requiredOption(flags, description, fn, defaultValue) {
return this._optionEx({ mandatory: true }, flags, description, fn, defaultValue);
}
/**
* Alter parsing of short flags with optional values.
*
* @example
* // for `.option('-f,--flag [value]'):
* program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour
* program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
*
* @param {Boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag.
*/
combineFlagAndOptionalValue(combine = true) {
this._combineFlagAndOptionalValue = !!combine;
return this;
}
/**
* Allow unknown options on the command line.
*
* @param {Boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown
* for unknown options.
*/
allowUnknownOption(allowUnknown = true) {
this._allowUnknownOption = !!allowUnknown;
return this;
}
/**
* Allow excess command-arguments on the command line. Pass false to make excess arguments an error.
*
* @param {Boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown
* for excess arguments.
*/
allowExcessArguments(allowExcess = true) {
this._allowExcessArguments = !!allowExcess;
return this;
}
/**
* Enable positional options. Positional means global options are specified before subcommands which lets
* subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.
* The default behaviour is non-positional and global options may appear anywhere on the command line.
*
* @param {Boolean} [positional=true]
*/
enablePositionalOptions(positional = true) {
this._enablePositionalOptions = !!positional;
return this;
}
/**
* Pass through options that come after command-arguments rather than treat them as command-options,
* so actual command-options come before command-arguments. Turning this on for a subcommand requires
* positional options to have been enabled on the program (parent commands).
* The default behaviour is non-positional and options may appear before or after command-arguments.
*
* @param {Boolean} [passThrough=true]
* for unknown options.
*/
passThroughOptions(passThrough = true) {
this._passThroughOptions = !!passThrough;
if (!!this.parent && passThrough && !this.parent._enablePositionalOptions) {
throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
}
return this;
}
/**
* Whether to store option values as properties on command object,
* or store separately (specify false). In both cases the option values can be accessed using .opts().
*
* @param {boolean} [storeAsProperties=true]
* @return {Command} `this` command for chaining
*/
storeOptionsAsProperties(storeAsProperties = true) {
this._storeOptionsAsProperties = !!storeAsProperties;
if (this.options.length) {
throw new Error("call .storeOptionsAsProperties() before adding options");
}
return this;
}
/**
* Retrieve option value.
*
* @param {string} key
* @return {Object} value
*/
getOptionValue(key) {
if (this._storeOptionsAsProperties) {
return this[key];
}
return this._optionValues[key];
}
/**
* Store option value.
*
* @param {string} key
* @param {Object} value
* @return {Command} `this` command for chaining
*/
setOptionValue(key, value) {
return this.setOptionValueWithSource(key, value, void 0);
}
/**
* Store option value and where the value came from.
*
* @param {string} key
* @param {Object} value
* @param {string} source - expected values are default/config/env/cli/implied
* @return {Command} `this` command for chaining
*/
setOptionValueWithSource(key, value, source) {
if (this._storeOptionsAsProperties) {
this[key] = value;
} else {
this._optionValues[key] = value;
}
this._optionValueSources[key] = source;
return this;
}
/**
* Get source of option value.
* Expected values are default | config | env | cli | implied
*
* @param {string} key
* @return {string}
*/
getOptionValueSource(key) {
return this._optionValueSources[key];
}
/**
* Get source of option value. See also .optsWithGlobals().
* Expected values are default | config | env | cli | implied
*
* @param {string} key
* @return {string}
*/
getOptionValueSourceWithGlobals(key) {
let source;
getCommandAndParents(this).forEach((cmd) => {
if (cmd.getOptionValueSource(key) !== void 0) {
source = cmd.getOptionValueSource(key);
}
});
return source;
}
/**
* Get user arguments from implied or explicit arguments.
* Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches.
*
* @api private
*/
_prepareUserArgs(argv, parseOptions) {
if (argv !== void 0 && !Array.isArray(argv)) {
throw new Error("first parameter to parse must be array or undefined");
}
parseOptions = parseOptions || {};
if (argv === void 0) {
argv = process2.argv;
if (process2.versions && process2.versions.electron) {
parseOptions.from = "electron";
}
}
this.rawArgs = argv.slice();
let userArgs;
switch (parseOptions.from) {
case void 0:
case "node":
this._scriptPath = argv[1];
userArgs = argv.slice(2);
break;
case "electron":
if (process2.defaultApp) {
this._scriptPath = argv[1];
userArgs = argv.slice(2);
} else {
userArgs = argv.slice(1);
}
break;
case "user":
userArgs = argv.slice(0);
break;
default:
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
}
if (!this._name && this._scriptPath)
this.nameFromFilename(this._scriptPath);
this._name = this._name || "program";
return userArgs;
}
/**
* Parse `argv`, setting options and invoking commands when defined.
*
* The default expectation is that the arguments are from node and have the application as argv[0]
* and the script being run in argv[1], with user parameters after that.
*
* @example
* program.parse(process.argv);
* program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions
* program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
*
* @param {string[]} [argv] - optional, defaults to process.argv
* @param {Object} [parseOptions] - optionally specify style of options with from: node/user/electron
* @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'
* @return {Command} `this` command for chaining
*/
parse(argv, parseOptions) {
const userArgs = this._prepareUserArgs(argv, parseOptions);
this._parseCommand([], userArgs);
return this;
}
/**
* Parse `argv`, setting options and invoking commands when defined.
*
* Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.
*
* The default expectation is that the arguments are from node and have the application as argv[0]
* and the script being run in argv[1], with user parameters after that.
*
* @example
* await program.parseAsync(process.argv);
* await program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions
* await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
*
* @param {string[]} [argv]
* @param {Object} [parseOptions]
* @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'
* @return {Promise}
*/
async parseAsync(argv, parseOptions) {
const userArgs = this._prepareUserArgs(argv, parseOptions);
await this._parseCommand([], userArgs);
return this;
}
/**
* Execute a sub-command executable.
*
* @api private
*/
_executeSubCommand(subcommand, args) {
args = args.slice();
let launchWithNode = false;
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
function findFile(baseDir, baseName) {
const localBin = path3.resolve(baseDir, baseName);
if (fs.existsSync(localBin))
return localBin;
if (sourceExt.includes(path3.extname(baseName)))
return void 0;
const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
if (foundExt)
return `${localBin}${foundExt}`;
return void 0;
}
this._checkForMissingMandatoryOptions();
this._checkForConflictingOptions();
let executableFile = subcommand._executableFile || `${this._name}-${subcommand._name}`;
let executableDir = this._executableDir || "";
if (this._scriptPath) {
let resolvedScriptPath;
try {
resolvedScriptPath = fs.realpathSync(this._scriptPath);
} catch (err) {
resolvedScriptPath = this._scriptPath;
}
executableDir = path3.resolve(path3.dirname(resolvedScriptPath), executableDir);
}
if (executableDir) {
let localFile = findFile(executableDir, executableFile);
if (!localFile && !subcommand._executableFile && this._scriptPath) {
const legacyName = path3.basename(this._scriptPath, path3.extname(this._scriptPath));
if (legacyName !== this._name) {
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
}
}
executableFile = localFile || executableFile;
}
launchWithNode = sourceExt.includes(path3.extname(executableFile));
let proc;
if (process2.platform !== "win32") {
if (launchWithNode) {
args.unshift(executableFile);
args = incrementNodeInspectorPort(process2.execArgv).concat(args);
proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
} else {
proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
}
} else {
args.unshift(executableFile);
args = incrementNodeInspectorPort(process2.execArgv).concat(args);
proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
}
if (!proc.killed) {
const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
signals.forEach((signal) => {
process2.on(signal, () => {
if (proc.killed === false && proc.exitCode === null) {
proc.kill(signal);
}
});
});
}
const exitCallback = this._exitCallback;
if (!exitCallback) {
proc.on("close", process2.exit.bind(process2));
} else {
proc.on("close", () => {
exitCallback(new CommanderError2(process2.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
});
}
proc.on("error", (err) => {
if (err.code === "ENOENT") {
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
const executableMissing = `'${executableFile}' does not exist
- if '${subcommand._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
- ${executableDirMessage}`;
throw new Error(executableMissing);
} else if (err.code === "EACCES") {
throw new Error(`'${executableFile}' not executable`);
}
if (!exitCallback) {
process2.exit(1);
} else {
const wrappedError = new CommanderError2(1, "commander.executeSubCommandAsync", "(error)");
wrappedError.nestedError = err;
exitCallback(wrappedError);
}
});
this.runningCommand = proc;
}
/**
* @api private
*/
_dispatchSubcommand(commandName, operands, unknown) {
const subCommand = this._findCommand(commandName);
if (!subCommand)
this.help({ error: true });
let hookResult;
hookResult = this._chainOrCallSubCommandHook(hookResult, subCommand, "preSubcommand");
hookResult = this._chainOrCall(hookResult, () => {
if (subCommand._executableHandler) {
this._executeSubCommand(subCommand, operands.concat(unknown));
} else {
return subCommand._parseCommand(operands, unknown);
}
});
return hookResult;
}
/**
* Check this.args against expected this._args.
*
* @api private
*/
_checkNumberOfArguments() {
this._args.forEach((arg, i) => {
if (arg.required && this.args[i] == null) {
this.missingArgument(arg.name());
}
});
if (this._args.length > 0 && this._args[this._args.length - 1].variadic) {
return;
}
if (this.args.length > this._args.length) {
this._excessArguments(this.args);
}
}
/**
* Process this.args using this._args and save as this.processedArgs!
*
* @api private
*/
_processArguments() {
const myParseArg = (argument, value, previous) => {
let parsedValue = value;
if (value !== null && argument.parseArg) {
try {
parsedValue = argument.parseArg(value, previous);
} catch (err) {
if (err.code === "commander.invalidArgument") {
const message = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'. ${err.message}`;
this.error(message, { exitCode: err.exitCode, code: err.code });
}
throw err;
}
}
return parsedValue;
};
this._checkNumberOfArguments();
const processedArgs = [];
this._args.forEach((declaredArg, index2) => {
let value = declaredArg.defaultValue;
if (declaredArg.variadic) {
if (index2 < this.args.length) {
value = this.args.slice(index2);
if (declaredArg.parseArg) {
value = value.reduce((processed, v) => {
return myParseArg(declaredArg, v, processed);
}, declaredArg.defaultValue);
}
} else if (value === void 0) {
value = [];
}
} else if (index2 < this.args.length) {
value = this.args[index2];
if (declaredArg.parseArg) {
value = myParseArg(declaredArg, value, declaredArg.defaultValue);
}
}
processedArgs[index2] = value;
});
this.processedArgs = processedArgs;
}
/**
* Once we have a promise we chain, but call synchronously until then.
*
* @param {Promise|undefined} promise
* @param {Function} fn
* @return {Promise|undefined}
* @api private
*/
_chainOrCall(promise, fn) {
if (promise && promise.then && typeof promise.then === "function") {
return promise.then(() => fn());
}
return fn();
}
/**
*
* @param {Promise|undefined} promise
* @param {string} event
* @return {Promise|undefined}
* @api private
*/
_chainOrCallHooks(promise, event) {
let result = promise;
const hooks = [];
getCommandAndParents(this).reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== void 0).forEach((hookedCommand) => {
hookedCommand._lifeCycleHooks[event].forEach((callback) => {
hooks.push({ hookedCommand, callback });
});
});
if (event === "postAction") {
hooks.reverse();
}
hooks.forEach((hookDetail) => {
result = this._chainOrCall(result, () => {
return hookDetail.callback(hookDetail.hookedCommand, this);
});
});
return result;
}
/**
*
* @param {Promise|undefined} promise
* @param {Command} subCommand
* @param {string} event
* @return {Promise|undefined}
* @api private
*/
_chainOrCallSubCommandHook(promise, subCommand, event) {
let result = promise;
if (this._lifeCycleHooks[event] !== void 0) {
this._lifeCycleHooks[event].forEach((hook) => {
result = this._chainOrCall(result, () => {
return hook(this, subCommand);
});
});
}
return result;
}
/**
* Process arguments in context of this command.
* Returns action result, in case it is a promise.
*
* @api private
*/
_parseCommand(operands, unknown) {
const parsed = this.parseOptions(unknown);
this._parseOptionsEnv();
this._parseOptionsImplied();
operands = operands.concat(parsed.operands);
unknown = parsed.unknown;
this.args = operands.concat(unknown);
if (operands && this._findCommand(operands[0])) {
return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);
}
if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) {
if (operands.length === 1) {
this.help();
}
return this._dispatchSubcommand(operands[1], [], [this._helpLongFlag]);
}
if (this._defaultCommandName) {
outputHelpIfRequested(this, unknown);
return this._dispatchSubcommand(this._defaultCommandName, operands, unknown);
}
if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
this.help({ error: true });
}
outputHelpIfRequested(this, parsed.unknown);
this._checkForMissingMandatoryOptions();
this._checkForConflictingOptions();
const checkForUnknownOptions = () => {
if (parsed.unknown.length > 0) {
this.unknownOption(parsed.unknown[0]);
}
};
const commandEvent = `command:${this.name()}`;
if (this._actionHandler) {
checkForUnknownOptions();
this._processArguments();
let actionResult;
actionResult = this._chainOrCallHooks(actionResult, "preAction");
actionResult = this._chainOrCall(actionResult, () => this._actionHandler(this.processedArgs));
if (this.parent) {
actionResult = this._chainOrCall(actionResult, () => {
this.parent.emit(commandEvent, operands, unknown);
});
}
actionResult = this._chainOrCallHooks(actionResult, "postAction");
return actionResult;
}
if (this.parent && this.parent.listenerCount(commandEvent)) {
checkForUnknownOptions();
this._processArguments();
this.parent.emit(commandEvent, operands, unknown);
} else if (operands.length) {
if (this._findCommand("*")) {
return this._dispatchSubcommand("*", operands, unknown);
}
if (this.listenerCount("command:*")) {
this.emit("command:*", operands, unknown);
} else if (this.commands.length) {
this.unknownCommand();
} else {
checkForUnknownOptions();
this._processArguments();
}
} else if (this.commands.length) {
checkForUnknownOptions();
this.help({ error: true });
} else {
checkForUnknownOptions();
this._processArguments();
}
}
/**
* Find matching command.
*
* @api private
*/
_findCommand(name) {
if (!name)
return void 0;
return this.commands.find((cmd) => cmd._name === name || cmd._aliases.includes(name));
}
/**
* Return an option matching `arg` if any.
*
* @param {string} arg
* @return {Option}
* @api private
*/
_findOption(arg) {
return this.options.find((option) => option.is(arg));
}
/**
* Display an error message if a mandatory option does not have a value.
* Called after checking for help flags in leaf subcommand.
*
* @api private
*/
_checkForMissingMandatoryOptions() {
for (let cmd = this; cmd; cmd = cmd.parent) {
cmd.options.forEach((anOption) => {
if (anOption.mandatory && cmd.getOptionValue(anOption.attributeName()) === void 0) {
cmd.missingMandatoryOptionValue(anOption);
}
});
}
}
/**
* Display an error message if conflicting options are used together in this.
*
* @api private
*/
_checkForConflictingLocalOptions() {
const definedNonDefaultOptions = this.options.filter(
(option) => {
const optionKey = option.attributeName();
if (this.getOptionValue(optionKey) === void 0) {
return false;
}
return this.getOptionValueSource(optionKey) !== "default";
}
);
const optionsWithConflicting = definedNonDefaultOptions.filter(
(option) => option.conflictsWith.length > 0
);
optionsWithConflicting.forEach((option) => {
const conflictingAndDefined = definedNonDefaultOptions.find(
(defined) => option.conflictsWith.includes(defined.attributeName())
);
if (conflictingAndDefined) {
this._conflictingOption(option, conflictingAndDefined);
}
});
}
/**
* Display an error message if conflicting options are used together.
* Called after checking for help flags in leaf subcommand.
*
* @api private
*/
_checkForConflictingOptions() {
for (let cmd = this; cmd; cmd = cmd.parent) {
cmd._checkForConflictingLocalOptions();
}
}
/**
* Parse options from `argv` removing known options,
* and return argv split into operands and unknown arguments.
*
* Examples:
*
* argv => operands, unknown
* --known kkk op => [op], []
* op --known kkk => [op], []
* sub --unknown uuu op => [sub], [--unknown uuu op]
* sub -- --unknown uuu op => [sub --unknown uuu op], []
*
* @param {String[]} argv
* @return {{operands: String[], unknown: String[]}}
*/
parseOptions(argv) {
const operands = [];
const unknown = [];
let dest = operands;
const args = argv.slice();
function maybeOption(arg) {
return arg.length > 1 && arg[0] === "-";
}
let activeVariadicOption = null;
while (args.length) {
const arg = args.shift();
if (arg === "--") {
if (dest === unknown)
dest.push(arg);
dest.push(...args);
break;
}
if (activeVariadicOption && !maybeOption(arg)) {
this.emit(`option:${activeVariadicOption.name()}`, arg);
continue;
}
activeVariadicOption = null;
if (maybeOption(arg)) {
const option = this._findOption(arg);
if (option) {
if (option.required) {
const value = args.shift();
if (value === void 0)
this.optionMissingArgument(option);
this.emit(`option:${option.name()}`, value);
} else if (option.optional) {
let value = null;
if (args.length > 0 && !maybeOption(args[0])) {
value = args.shift();
}
this.emit(`option:${option.name()}`, value);
} else {
this.emit(`option:${option.name()}`);
}
activeVariadicOption = option.variadic ? option : null;
continue;
}
}
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
const option = this._findOption(`-${arg[1]}`);
if (option) {
if (option.required || option.optional && this._combineFlagAndOptionalValue) {
this.emit(`option:${option.name()}`, arg.slice(2));
} else {
this.emit(`option:${option.name()}`);
args.unshift(`-${arg.slice(2)}`);
}
continue;
}
}
if (/^--[^=]+=/.test(arg)) {
const index2 = arg.indexOf("=");
const option = this._findOption(arg.slice(0, index2));
if (option && (option.required || option.optional)) {
this.emit(`option:${option.name()}`, arg.slice(index2 + 1));
continue;
}
}
if (maybeOption(arg)) {
dest = unknown;
}
if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
if (this._findCommand(arg)) {
operands.push(arg);
if (args.length > 0)
unknown.push(...args);
break;
} else if (arg === this._helpCommandName && this._hasImplicitHelpCommand()) {
operands.push(arg);
if (args.length > 0)
operands.push(...args);
break;
} else if (this._defaultCommandName) {
unknown.push(arg);
if (args.length > 0)
unknown.push(...args);
break;
}
}
if (this._passThroughOptions) {
dest.push(arg);
if (args.length > 0)
dest.push(...args);
break;
}
dest.push(arg);
}
return { operands, unknown };
}
/**
* Return an object containing local option values as key-value pairs.
*
* @return {Object}
*/
opts() {
if (this._storeOptionsAsProperties) {
const result = {};
const len = this.options.length;
for (let i = 0; i < len; i++) {
const key = this.options[i].attributeName();
result[key] = key === this._versionOptionName ? this._version : this[key];
}
return result;
}
return this._optionValues;
}
/**
* Return an object containing merged local and global option values as key-value pairs.
*
* @return {Object}
*/
optsWithGlobals() {
return getCommandAndParents(this).reduce(
(combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),
{}
);
}
/**
* Display error message and exit (or call exitOverride).
*
* @param {string} message
* @param {Object} [errorOptions]
* @param {string} [errorOptions.code] - an id string representing the error
* @param {number} [errorOptions.exitCode] - used with process.exit
*/
error(message, errorOptions) {
this._outputConfiguration.outputError(`${message}
`, this._outputConfiguration.writeErr);
if (typeof this._showHelpAfterError === "string") {
this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`);
} else if (this._showHelpAfterError) {
this._outputConfiguration.writeErr("\n");
this.outputHelp({ error: true });
}
const config = errorOptions || {};
const exitCode = config.exitCode || 1;
const code = config.code || "commander.error";
this._exit(exitCode, code, message);
}
/**
* Apply any option related environment variables, if option does
* not have a value from cli or client code.
*
* @api private
*/
_parseOptionsEnv() {
this.options.forEach((option) => {
if (option.envVar && option.envVar in process2.env) {
const optionKey = option.attributeName();
if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
if (option.required || option.optional) {
this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
} else {
this.emit(`optionEnv:${option.name()}`);
}
}
}
});
}
/**
* Apply any implied option values, if option is undefined or default value.
*
* @api private
*/
_parseOptionsImplied() {
const dualHelper = new DualOptions(this.options);
const hasCustomOptionValue = (optionKey) => {
return this.getOptionValue(optionKey) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(optionKey));
};
this.options.filter((option) => option.implied !== void 0 && hasCustomOptionValue(option.attributeName()) && dualHelper.valueFromOption(this.getOptionValue(option.attributeName()), option)).forEach((option) => {
Object.keys(option.implied).filter((impliedKey) => !hasCustomOptionValue(impliedKey)).forEach((impliedKey) => {
this.setOptionValueWithSource(impliedKey, option.implied[impliedKey], "implied");
});
});
}
/**
* Argument `name` is missing.
*
* @param {string} name
* @api private
*/
missingArgument(name) {
const message = `error: missing required argument '${name}'`;
this.error(message, { code: "commander.missingArgument" });
}
/**
* `Option` is missing an argument.
*
* @param {Option} option
* @api private
*/
optionMissingArgument(option) {
const message = `error: option '${option.flags}' argument missing`;
this.error(message, { code: "commander.optionMissingArgument" });
}
/**
* `Option` does not have a value, and is a mandatory option.
*
* @param {Option} option
* @api private
*/
missingMandatoryOptionValue(option) {
const message = `error: required option '${option.flags}' not specified`;
this.error(message, { code: "commander.missingMandatoryOptionValue" });
}
/**
* `Option` conflicts with another option.
*
* @param {Option} option
* @param {Option} conflictingOption
* @api private
*/
_conflictingOption(option, conflictingOption) {
const findBestOptionFromValue = (option2) => {
const optionKey = option2.attributeName();
const optionValue = this.getOptionValue(optionKey);
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
if (negativeOption && (negativeOption.presetArg === void 0 && optionValue === false || negativeOption.presetArg !== void 0 && optionValue === negativeOption.presetArg)) {
return negativeOption;
}
return positiveOption || option2;
};
const getErrorMessage = (option2) => {
const bestOption = findBestOptionFromValue(option2);
const optionKey = bestOption.attributeName();
const source = this.getOptionValueSource(optionKey);
if (source === "env") {
return `environment variable '${bestOption.envVar}'`;
}
return `option '${bestOption.flags}'`;
};
const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;
this.error(message, { code: "commander.conflictingOption" });
}
/**
* Unknown option `flag`.
*
* @param {string} flag
* @api private
*/
unknownOption(flag) {
if (this._allowUnknownOption)
return;
let suggestion = "";
if (flag.startsWith("--") && this._showSuggestionAfterError) {
let candidateFlags = [];
let command = this;
do {
const moreFlags = command.createHelp().visibleOptions(command).filter((option) => option.long).map((option) => option.long);
candidateFlags = candidateFlags.concat(moreFlags);
command = command.parent;
} while (command && !command._enablePositionalOptions);
suggestion = suggestSimilar(flag, candidateFlags);
}
const message = `error: unknown option '${flag}'${suggestion}`;
this.error(message, { code: "commander.unknownOption" });
}
/**
* Excess arguments, more than expected.
*
* @param {string[]} receivedArgs
* @api private
*/
_excessArguments(receivedArgs) {
if (this._allowExcessArguments)
return;
const expected = this._args.length;
const s = expected === 1 ? "" : "s";
const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;
this.error(message, { code: "commander.excessArguments" });
}
/**
* Unknown command.
*
* @api private
*/
unknownCommand() {
const unknownName = this.args[0];
let suggestion = "";
if (this._showSuggestionAfterError) {
const candidateNames = [];
this.createHelp().visibleCommands(this).forEach((command) => {
candidateNames.push(command.name());
if (command.alias())
candidateNames.push(command.alias());
});
suggestion = suggestSimilar(unknownName, candidateNames);
}
const message = `error: unknown command '${unknownName}'${suggestion}`;
this.error(message, { code: "commander.unknownCommand" });
}
/**
* Set the program version to `str`.
*
* This method auto-registers the "-V, --version" flag
* which will print the version number when passed.
*
* You can optionally supply the flags and description to override the defaults.
*
* @param {string} str
* @param {string} [flags]
* @param {string} [description]
* @return {this | string} `this` command for chaining, or version string if no arguments
*/
version(str, flags, description) {
if (str === void 0)
return this._version;
this._version = str;
flags = flags || "-V, --version";
description = description || "output the version number";
const versionOption = this.createOption(flags, description);
this._versionOptionName = versionOption.attributeName();
this.options.push(versionOption);
this.on("option:" + versionOption.name(), () => {
this._outputConfiguration.writeOut(`${str}
`);
this._exit(0, "commander.version", str);
});
return this;
}
/**
* Set the description.
*
* @param {string} [str]
* @param {Object} [argsDescription]
* @return {string|Command}
*/
description(str, argsDescription) {
if (str === void 0 && argsDescription === void 0)
return this._description;
this._description = str;
if (argsDescription) {
this._argsDescription = argsDescription;
}
return this;
}
/**
* Set the summary. Used when listed as subcommand of parent.
*
* @param {string} [str]
* @return {string|Command}
*/
summary(str) {
if (str === void 0)
return this._summary;
this._summary = str;
return this;
}
/**
* Set an alias for the command.
*
* You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.
*
* @param {string} [alias]
* @return {string|Command}
*/
alias(alias) {
if (alias === void 0)
return this._aliases[0];
let command = this;
if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
command = this.commands[this.commands.length - 1];
}
if (alias === command._name)
throw new Error("Command alias can't be the same as its name");
command._aliases.push(alias);
return this;
}
/**
* Set aliases for the command.
*
* Only the first alias is shown in the auto-generated help.
*
* @param {string[]} [aliases]
* @return {string[]|Command}
*/
aliases(aliases) {
if (aliases === void 0)
return this._aliases;
aliases.forEach((alias) => this.alias(alias));
return this;
}
/**
* Set / get the command usage `str`.
*
* @param {string} [str]
* @return {String|Command}
*/
usage(str) {
if (str === void 0) {
if (this._usage)
return this._usage;
const args = this._args.map((arg) => {
return humanReadableArgName(arg);
});
return [].concat(
this.options.length || this._hasHelpOption ? "[options]" : [],
this.commands.length ? "[command]" : [],
this._args.length ? args : []
).join(" ");
}
this._usage = str;
return this;
}
/**
* Get or set the name of the command.
*
* @param {string} [str]
* @return {string|Command}
*/
name(str) {
if (str === void 0)
return this._name;
this._name = str;
return this;
}
/**
* Set the name of the command from script filename, such as process.argv[1],
* or require.main.filename, or __filename.
*
* (Used internally and public although not documented in README.)
*
* @example
* program.nameFromFilename(require.main.filename);
*
* @param {string} filename
* @return {Command}
*/
nameFromFilename(filename) {
this._name = path3.basename(filename, path3.extname(filename));
return this;
}
/**
* Get or set the directory for searching for executable subcommands of this command.
*
* @example
* program.executableDir(__dirname);
* // or
* program.executableDir('subcommands');
*
* @param {string} [path]
* @return {string|Command}
*/
executableDir(path4) {
if (path4 === void 0)
return this._executableDir;
this._executableDir = path4;
return this;
}
/**
* Return program help documentation.
*
* @param {{ error: boolean }} [contextOptions] - pass {error:true} to wrap for stderr instead of stdout
* @return {string}
*/
helpInformation(contextOptions) {
const helper = this.createHelp();
if (helper.helpWidth === void 0) {
helper.helpWidth = contextOptions && contextOptions.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
}
return helper.formatHelp(this, helper);
}
/**
* @api private
*/
_getHelpContext(contextOptions) {
contextOptions = contextOptions || {};
const context = { error: !!contextOptions.error };
let write;
if (context.error) {
write = (arg) => this._outputConfiguration.writeErr(arg);
} else {
write = (arg) => this._outputConfiguration.writeOut(arg);
}
context.write = contextOptions.write || write;
context.command = this;
return context;
}
/**
* Output help information for this command.
*
* Outputs built-in help, and custom text added using `.addHelpText()`.
*
* @param {{ error: boolean } | Function} [contextOptions] - pass {error:true} to write to stderr instead of stdout
*/
outputHelp(contextOptions) {
let deprecatedCallback;
if (typeof contextOptions === "function") {
deprecatedCallback = contextOptions;
contextOptions = void 0;
}
const context = this._getHelpContext(contextOptions);
getCommandAndParents(this).reverse().forEach((command) => command.emit("beforeAllHelp", context));
this.emit("beforeHelp", context);
let helpInformation = this.helpInformation(context);
if (deprecatedCallback) {
helpInformation = deprecatedCallback(helpInformation);
if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
throw new Error("outputHelp callback must return a string or a Buffer");
}
}
context.write(helpInformation);
this.emit(this._helpLongFlag);
this.emit("afterHelp", context);
getCommandAndParents(this).forEach((command) => command.emit("afterAllHelp", context));
}
/**
* You can pass in flags and a description to override the help
* flags and help description for your command. Pass in false to
* disable the built-in help option.
*
* @param {string | boolean} [flags]
* @param {string} [description]
* @return {Command} `this` command for chaining
*/
helpOption(flags, description) {
if (typeof flags === "boolean") {
this._hasHelpOption = flags;
return this;
}
this._helpFlags = flags || this._helpFlags;
this._helpDescription = description || this._helpDescription;
const helpFlags = splitOptionFlags(this._helpFlags);
this._helpShortFlag = helpFlags.shortFlag;
this._helpLongFlag = helpFlags.longFlag;
return this;
}
/**
* Output help information and exit.
*
* Outputs built-in help, and custom text added using `.addHelpText()`.
*
* @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout
*/
help(contextOptions) {
this.outputHelp(contextOptions);
let exitCode = process2.exitCode || 0;
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
exitCode = 1;
}
this._exit(exitCode, "commander.help", "(outputHelp)");
}
/**
* Add additional text to be displayed with the built-in help.
*
* Position is 'before' or 'after' to affect just this command,
* and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.
*
* @param {string} position - before or after built-in help
* @param {string | Function} text - string to add, or a function returning a string
* @return {Command} `this` command for chaining
*/
addHelpText(position, text) {
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
if (!allowedValues.includes(position)) {
throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${allowedValues.join("', '")}'`);
}
const helpEvent = `${position}Help`;
this.on(helpEvent, (context) => {
let helpStr;
if (typeof text === "function") {
helpStr = text({ error: context.error, command: context.command });
} else {
helpStr = text;
}
if (helpStr) {
context.write(`${helpStr}
`);
}
});
return this;
}
};
function outputHelpIfRequested(cmd, args) {
const helpOption = cmd._hasHelpOption && args.find((arg) => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag);
if (helpOption) {
cmd.outputHelp();
cmd._exit(0, "commander.helpDisplayed", "(outputHelp)");
}
}
function incrementNodeInspectorPort(args) {
return args.map((arg) => {
if (!arg.startsWith("--inspect")) {
return arg;
}
let debugOption;
let debugHost = "127.0.0.1";
let debugPort = "9229";
let match;
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
debugOption = match[1];
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
debugOption = match[1];
if (/^\d+$/.test(match[3])) {
debugPort = match[3];
} else {
debugHost = match[3];
}
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
debugOption = match[1];
debugHost = match[3];
debugPort = match[4];
}
if (debugOption && debugPort !== "0") {
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
}
return arg;
});
}
function getCommandAndParents(startCommand) {
const result = [];
for (let command = startCommand; command; command = command.parent) {
result.push(command);
}
return result;
}
exports.Command = Command2;
}
});
// node_modules/commander/index.js
var require_commander = __commonJS({
"node_modules/commander/index.js"(exports, module2) {
var { Argument: Argument2 } = require_argument();
var { Command: Command2 } = require_command();
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
var { Help: Help2 } = require_help();
var { Option: Option2 } = require_option();
exports = module2.exports = new Command2();
exports.program = exports;
exports.Argument = Argument2;
exports.Command = Command2;
exports.CommanderError = CommanderError2;
exports.Help = Help2;
exports.InvalidArgumentError = InvalidArgumentError2;
exports.InvalidOptionArgumentError = InvalidArgumentError2;
exports.Option = Option2;
}
});
// node_modules/readdir-glob/node_modules/minimatch/lib/path.js
var require_path = __commonJS({
"node_modules/readdir-glob/node_modules/minimatch/lib/path.js"(exports, module2) {
var isWindows = typeof process === "object" && process && process.platform === "win32";
module2.exports = isWindows ? { sep: "\\" } : { sep: "/" };
}
});
// node_modules/balanced-match/index.js
var require_balanced_match = __commonJS({
"node_modules/balanced-match/index.js"(exports, module2) {
"use strict";
module2.exports = balanced;
function balanced(a, b, str) {
if (a instanceof RegExp)
a = maybeMatch(a, str);
if (b instanceof RegExp)
b = maybeMatch(b, str);
var r = range2(a, b, str);
return r && {
start: r[0],
end: r[1],
pre: str.slice(0, r[0]),
body: str.slice(r[0] + a.length, r[1]),
post: str.slice(r[1] + b.length)
};
}
function maybeMatch(reg, str) {
var m = str.match(reg);
return m ? m[0] : null;
}
balanced.range = range2;
function range2(a, b, str) {
var begs, beg, left, right, result;
var ai = str.indexOf(a);
var bi = str.indexOf(b, ai + 1);
var i = ai;
if (ai >= 0 && bi > 0) {
if (a === b) {
return [ai, bi];
}
begs = [];
left = str.length;
while (i >= 0 && !result) {
if (i == ai) {
begs.push(i);
ai = str.indexOf(a, i + 1);
} else if (begs.length == 1) {
result = [begs.pop(), bi];
} else {
beg = begs.pop();
if (beg < left) {
left = beg;
right = bi;
}
bi = str.indexOf(b, i + 1);
}
i = ai < bi && ai >= 0 ? ai : bi;
}
if (begs.length) {
result = [left, right];
}
}
return result;
}
}
});
// node_modules/readdir-glob/node_modules/brace-expansion/index.js
var require_brace_expansion = __commonJS({
"node_modules/readdir-glob/node_modules/brace-expansion/index.js"(exports, module2) {
var balanced = require_balanced_match();
module2.exports = expandTop;
var escSlash = "\0SLASH" + Math.random() + "\0";
var escOpen = "\0OPEN" + Math.random() + "\0";
var escClose = "\0CLOSE" + Math.random() + "\0";
var escComma = "\0COMMA" + Math.random() + "\0";
var escPeriod = "\0PERIOD" + Math.random() + "\0";
function numeric(str) {
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
}
function escapeBraces(str) {
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
}
function unescapeBraces(str) {
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
}
function parseCommaParts(str) {
if (!str)
return [""];
var parts = [];
var m = balanced("{", "}", str);
if (!m)
return str.split(",");
var pre = m.pre;
var body = m.body;
var post = m.post;
var p = pre.split(",");
p[p.length - 1] += "{" + body + "}";
var postParts = parseCommaParts(post);
if (post.length) {
p[p.length - 1] += postParts.shift();
p.push.apply(p, postParts);
}
parts.push.apply(parts, p);
return parts;
}
function expandTop(str) {
if (!str)
return [];
if (str.substr(0, 2) === "{}") {
str = "\\{\\}" + str.substr(2);
}
return expand(escapeBraces(str), true).map(unescapeBraces);
}
function embrace(str) {
return "{" + str + "}";
}
function isPadded(el) {
return /^-?0\d/.test(el);
}
function lte(i, y) {
return i <= y;
}
function gte(i, y) {
return i >= y;
}
function expand(str, isTop) {
var expansions = [];
var m = balanced("{", "}", str);
if (!m)
return [str];
var pre = m.pre;
var post = m.post.length ? expand(m.post, false) : [""];
if (/\$$/.test(m.pre)) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + "{" + m.body + "}" + post[k];
expansions.push(expansion);
}
} else {
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(",") >= 0;
if (!isSequence && !isOptions) {
if (m.post.match(/,.*\}/)) {
str = m.pre + "{" + m.body + escClose + m.post;
return expand(str);
}
return [str];
}
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
n = expand(n[0], false).map(embrace);
if (n.length === 1) {
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length);
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i = x; test(i, y); i += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === "\\")
c = "";
} else {
c = String(i);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join("0");
if (i < 0)
c = "-" + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = [];
for (var j = 0; j < n.length; j++) {
N.push.apply(N, expand(n[j], false));
}
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
}
return expansions;
}
}
});
// node_modules/readdir-glob/node_modules/minimatch/minimatch.js
var require_minimatch = __commonJS({
"node_modules/readdir-glob/node_modules/minimatch/minimatch.js"(exports, module2) {
var minimatch = module2.exports = (p, pattern, options = {}) => {
assertValidPattern(pattern);
if (!options.nocomment && pattern.charAt(0) === "#") {
return false;
}
return new Minimatch(pattern, options).match(p);
};
module2.exports = minimatch;
var path3 = require_path();
minimatch.sep = path3.sep;
var GLOBSTAR = Symbol("globstar **");
minimatch.GLOBSTAR = GLOBSTAR;
var expand = require_brace_expansion();
var plTypes = {
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
"?": { open: "(?:", close: ")?" },
"+": { open: "(?:", close: ")+" },
"*": { open: "(?:", close: ")*" },
"@": { open: "(?:", close: ")" }
};
var qmark = "[^/]";
var star = qmark + "*?";
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
var charSet = (s) => s.split("").reduce((set, c) => {
set[c] = true;
return set;
}, {});
var reSpecials = charSet("().*{}+?[]^$\\!");
var addPatternStartSet = charSet("[.(");
var slashSplit = /\/+/;
minimatch.filter = (pattern, options = {}) => (p, i, list) => minimatch(p, pattern, options);
var ext = (a, b = {}) => {
const t = {};
Object.keys(a).forEach((k) => t[k] = a[k]);
Object.keys(b).forEach((k) => t[k] = b[k]);
return t;
};
minimatch.defaults = (def) => {
if (!def || typeof def !== "object" || !Object.keys(def).length) {
return minimatch;
}
const orig = minimatch;
const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
m.Minimatch = class Minimatch extends orig.Minimatch {
constructor(pattern, options) {
super(pattern, ext(def, options));
}
};
m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
m.defaults = (options) => orig.defaults(ext(def, options));
m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
return m;
};
minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
var braceExpand = (pattern, options = {}) => {
assertValidPattern(pattern);
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
return [pattern];
}
return expand(pattern);
};
var MAX_PATTERN_LENGTH = 1024 * 64;
var assertValidPattern = (pattern) => {
if (typeof pattern !== "string") {
throw new TypeError("invalid pattern");
}
if (pattern.length > MAX_PATTERN_LENGTH) {
throw new TypeError("pattern is too long");
}
};
var SUBPARSE = Symbol("subparse");
minimatch.makeRe = (pattern, options) => new Minimatch(pattern, options || {}).makeRe();
minimatch.match = (list, pattern, options = {}) => {
const mm = new Minimatch(pattern, options);
list = list.filter((f) => mm.match(f));
if (mm.options.nonull && !list.length) {
list.push(pattern);
}
return list;
};
var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
var Minimatch = class {
constructor(pattern, options) {
assertValidPattern(pattern);
if (!options)
options = {};
this.options = options;
this.set = [];
this.pattern = pattern;
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
if (this.windowsPathsNoEscape) {
this.pattern = this.pattern.replace(/\\/g, "/");
}
this.regexp = null;
this.negate = false;
this.comment = false;
this.empty = false;
this.partial = !!options.partial;
this.make();
}
debug() {
}
make() {
const pattern = this.pattern;
const options = this.options;
if (!options.nocomment && pattern.charAt(0) === "#") {
this.comment = true;
return;
}
if (!pattern) {
this.empty = true;
return;
}
this.parseNegate();
let set = this.globSet = this.braceExpand();
if (options.debug)
this.debug = (...args) => console.error(...args);
this.debug(this.pattern, set);
set = this.globParts = set.map((s) => s.split(slashSplit));
this.debug(this.pattern, set);
set = set.map((s, si, set2) => s.map(this.parse, this));
this.debug(this.pattern, set);
set = set.filter((s) => s.indexOf(false) === -1);
this.debug(this.pattern, set);
this.set = set;
}
parseNegate() {
if (this.options.nonegate)
return;
const pattern = this.pattern;
let negate = false;
let negateOffset = 0;
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
negate = !negate;
negateOffset++;
}
if (negateOffset)
this.pattern = pattern.substr(negateOffset);
this.negate = negate;
}
// set partial to true to test if, for example,
// "/a/b" matches the start of "/*/b/*/d"
// Partial means, if you run out of file before you run
// out of pattern, then that's fine, as long as all
// the parts match.
matchOne(file, pattern, partial) {
var options = this.options;
this.debug(
"matchOne",
{ "this": this, file, pattern }
);
this.debug("matchOne", file.length, pattern.length);
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
this.debug("matchOne loop");
var p = pattern[pi];
var f = file[fi];
this.debug(pattern, p, f);
if (p === false)
return false;
if (p === GLOBSTAR) {
this.debug("GLOBSTAR", [pattern, p, f]);
var fr = fi;
var pr = pi + 1;
if (pr === pl) {
this.debug("** at the end");
for (; fi < fl; fi++) {
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
return false;
}
return true;
}
while (fr < fl) {
var swallowee = file[fr];
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
this.debug("globstar found match!", fr, fl, swallowee);
return true;
} else {
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
this.debug("dot detected!", file, fr, pattern, pr);
break;
}
this.debug("globstar swallow a segment, and continue");
fr++;
}
}
if (partial) {
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
if (fr === fl)
return true;
}
return false;
}
var hit;
if (typeof p === "string") {
hit = f === p;
this.debug("string match", p, f, hit);
} else {
hit = f.match(p);
this.debug("pattern match", p, f, hit);
}
if (!hit)
return false;
}
if (fi === fl && pi === pl) {
return true;
} else if (fi === fl) {
return partial;
} else if (pi === pl) {
return fi === fl - 1 && file[fi] === "";
}
throw new Error("wtf?");
}
braceExpand() {
return braceExpand(this.pattern, this.options);
}
parse(pattern, isSub) {
assertValidPattern(pattern);
const options = this.options;
if (pattern === "**") {
if (!options.noglobstar)
return GLOBSTAR;
else
pattern = "*";
}
if (pattern === "")
return "";
let re = "";
let hasMagic = !!options.nocase;
let escaping = false;
const patternListStack = [];
const negativeLists = [];
let stateChar;
let inClass = false;
let reClassStart = -1;
let classStart = -1;
let cs;
let pl;
let sp;
const patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
const clearStateChar = () => {
if (stateChar) {
switch (stateChar) {
case "*":
re += star;
hasMagic = true;
break;
case "?":
re += qmark;
hasMagic = true;
break;
default:
re += "\\" + stateChar;
break;
}
this.debug("clearStateChar %j %j", stateChar, re);
stateChar = false;
}
};
for (let i = 0, c; i < pattern.length && (c = pattern.charAt(i)); i++) {
this.debug("%s %s %s %j", pattern, i, re, c);
if (escaping) {
if (c === "/") {
return false;
}
if (reSpecials[c]) {
re += "\\";
}
re += c;
escaping = false;
continue;
}
switch (c) {
case "/": {
return false;
}
case "\\":
clearStateChar();
escaping = true;
continue;
case "?":
case "*":
case "+":
case "@":
case "!":
this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
if (inClass) {
this.debug(" in class");
if (c === "!" && i === classStart + 1)
c = "^";
re += c;
continue;
}
this.debug("call clearStateChar %j", stateChar);
clearStateChar();
stateChar = c;
if (options.noext)
clearStateChar();
continue;
case "(":
if (inClass) {
re += "(";
continue;
}
if (!stateChar) {
re += "\\(";
continue;
}
patternListStack.push({
type: stateChar,
start: i - 1,
reStart: re.length,
open: plTypes[stateChar].open,
close: plTypes[stateChar].close
});
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
this.debug("plType %j %j", stateChar, re);
stateChar = false;
continue;
case ")":
if (inClass || !patternListStack.length) {
re += "\\)";
continue;
}
clearStateChar();
hasMagic = true;
pl = patternListStack.pop();
re += pl.close;
if (pl.type === "!") {
negativeLists.push(pl);
}
pl.reEnd = re.length;
continue;
case "|":
if (inClass || !patternListStack.length) {
re += "\\|";
continue;
}
clearStateChar();
re += "|";
continue;
case "[":
clearStateChar();
if (inClass) {
re += "\\" + c;
continue;
}
inClass = true;
classStart = i;
reClassStart = re.length;
re += c;
continue;
case "]":
if (i === classStart + 1 || !inClass) {
re += "\\" + c;
continue;
}
cs = pattern.substring(classStart + 1, i);
try {
RegExp("[" + cs + "]");
} catch (er) {
sp = this.parse(cs, SUBPARSE);
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
hasMagic = hasMagic || sp[1];
inClass = false;
continue;
}
hasMagic = true;
inClass = false;
re += c;
continue;
default:
clearStateChar();
if (reSpecials[c] && !(c === "^" && inClass)) {
re += "\\";
}
re += c;
break;
}
}
if (inClass) {
cs = pattern.substr(classStart + 1);
sp = this.parse(cs, SUBPARSE);
re = re.substr(0, reClassStart) + "\\[" + sp[0];
hasMagic = hasMagic || sp[1];
}
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
let tail;
tail = re.slice(pl.reStart + pl.open.length);
this.debug("setting tail", re, pl);
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_2, $1, $2) => {
if (!$2) {
$2 = "\\";
}
return $1 + $1 + $2 + "|";
});
this.debug("tail=%j\n %s", tail, tail, pl, re);
const t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
hasMagic = true;
re = re.slice(0, pl.reStart) + t + "\\(" + tail;
}
clearStateChar();
if (escaping) {
re += "\\\\";
}
const addPatternStart = addPatternStartSet[re.charAt(0)];
for (let n = negativeLists.length - 1; n > -1; n--) {
const nl = negativeLists[n];
const nlBefore = re.slice(0, nl.reStart);
const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
let nlAfter = re.slice(nl.reEnd);
const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
const openParensBefore = nlBefore.split("(").length - 1;
let cleanAfter = nlAfter;
for (let i = 0; i < openParensBefore; i++) {
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
}
nlAfter = cleanAfter;
const dollar = nlAfter === "" && isSub !== SUBPARSE ? "$" : "";
re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
}
if (re !== "" && hasMagic) {
re = "(?=.)" + re;
}
if (addPatternStart) {
re = patternStart + re;
}
if (isSub === SUBPARSE) {
return [re, hasMagic];
}
if (!hasMagic) {
return globUnescape(pattern);
}
const flags = options.nocase ? "i" : "";
try {
return Object.assign(new RegExp("^" + re + "$", flags), {
_glob: pattern,
_src: re
});
} catch (er) {
return new RegExp("$.");
}
}
makeRe() {
if (this.regexp || this.regexp === false)
return this.regexp;
const set = this.set;
if (!set.length) {
this.regexp = false;
return this.regexp;
}
const options = this.options;
const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
const flags = options.nocase ? "i" : "";
let re = set.map((pattern) => {
pattern = pattern.map(
(p) => typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src
).reduce((set2, p) => {
if (!(set2[set2.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
set2.push(p);
}
return set2;
}, []);
pattern.forEach((p, i) => {
if (p !== GLOBSTAR || pattern[i - 1] === GLOBSTAR) {
return;
}
if (i === 0) {
if (pattern.length > 1) {
pattern[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i + 1];
} else {
pattern[i] = twoStar;
}
} else if (i === pattern.length - 1) {
pattern[i - 1] += "(?:\\/|" + twoStar + ")?";
} else {
pattern[i - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i + 1];
pattern[i + 1] = GLOBSTAR;
}
});
return pattern.filter((p) => p !== GLOBSTAR).join("/");
}).join("|");
re = "^(?:" + re + ")$";
if (this.negate)
re = "^(?!" + re + ").*$";
try {
this.regexp = new RegExp(re, flags);
} catch (ex) {
this.regexp = false;
}
return this.regexp;
}
match(f, partial = this.partial) {
this.debug("match", f, this.pattern);
if (this.comment)
return false;
if (this.empty)
return f === "";
if (f === "/" && partial)
return true;
const options = this.options;
if (path3.sep !== "/") {
f = f.split(path3.sep).join("/");
}
f = f.split(slashSplit);
this.debug(this.pattern, "split", f);
const set = this.set;
this.debug(this.pattern, "set", set);
let filename;
for (let i = f.length - 1; i >= 0; i--) {
filename = f[i];
if (filename)
break;
}
for (let i = 0; i < set.length; i++) {
const pattern = set[i];
let file = f;
if (options.matchBase && pattern.length === 1) {
file = [filename];
}
const hit = this.matchOne(file, pattern, partial);
if (hit) {
if (options.flipNegate)
return true;
return !this.negate;
}
}
if (options.flipNegate)
return false;
return this.negate;
}
static defaults(def) {
return minimatch.defaults(def).Minimatch;
}
};
minimatch.Minimatch = Minimatch;
}
});
// node_modules/readdir-glob/index.js
var require_readdir_glob = __commonJS({
"node_modules/readdir-glob/index.js"(exports, module2) {
module2.exports = readdirGlob;
var fs = require("fs");
var { EventEmitter } = require("events");
var { Minimatch } = require_minimatch();
var { resolve } = require("path");
function readdir(dir2, strict) {
return new Promise((resolve2, reject2) => {
fs.readdir(dir2, { withFileTypes: true }, (err, files) => {
if (err) {
switch (err.code) {
case "ENOTDIR":
if (strict) {
reject2(err);
} else {
resolve2([]);
}
break;
case "ENOTSUP":
case "ENOENT":
case "ENAMETOOLONG":
case "UNKNOWN":
resolve2([]);
break;
case "ELOOP":
default:
reject2(err);
break;
}
} else {
resolve2(files);
}
});
});
}
function stat(file, followSymlinks) {
return new Promise((resolve2, reject2) => {
const statFunc = followSymlinks ? fs.stat : fs.lstat;
statFunc(file, (err, stats) => {
if (err) {
switch (err.code) {
case "ENOENT":
if (followSymlinks) {
resolve2(stat(file, false));
} else {
resolve2(null);
}
break;
default:
resolve2(null);
break;
}
} else {
resolve2(stats);
}
});
});
}
async function* exploreWalkAsync(dir2, path3, followSymlinks, useStat, shouldSkip, strict) {
let files = await readdir(path3 + dir2, strict);
for (const file of files) {
let name = file.name;
if (name === void 0) {
name = file;
useStat = true;
}
const filename = dir2 + "/" + name;
const relative = filename.slice(1);
const absolute = path3 + "/" + relative;
let stats = null;
if (useStat || followSymlinks) {
stats = await stat(absolute, followSymlinks);
}
if (!stats && file.name !== void 0) {
stats = file;
}
if (stats === null) {
stats = { isDirectory: () => false };
}
if (stats.isDirectory()) {
if (!shouldSkip(relative)) {
yield { relative, absolute, stats };
yield* exploreWalkAsync(filename, path3, followSymlinks, useStat, shouldSkip, false);
}
} else {
yield { relative, absolute, stats };
}
}
}
async function* explore(path3, followSymlinks, useStat, shouldSkip) {
yield* exploreWalkAsync("", path3, followSymlinks, useStat, shouldSkip, true);
}
function readOptions(options) {
return {
pattern: options.pattern,
dot: !!options.dot,
noglobstar: !!options.noglobstar,
matchBase: !!options.matchBase,
nocase: !!options.nocase,
ignore: options.ignore,
skip: options.skip,
follow: !!options.follow,
stat: !!options.stat,
nodir: !!options.nodir,
mark: !!options.mark,
silent: !!options.silent,
absolute: !!options.absolute
};
}
var ReaddirGlob = class extends EventEmitter {
constructor(cwd, options, cb) {
super();
if (typeof options === "function") {
cb = options;
options = null;
}
this.options = readOptions(options || {});
this.matchers = [];
if (this.options.pattern) {
const matchers = Array.isArray(this.options.pattern) ? this.options.pattern : [this.options.pattern];
this.matchers = matchers.map(
(m) => new Minimatch(m, {
dot: this.options.dot,
noglobstar: this.options.noglobstar,
matchBase: this.options.matchBase,
nocase: this.options.nocase
})
);
}
this.ignoreMatchers = [];
if (this.options.ignore) {
const ignorePatterns = Array.isArray(this.options.ignore) ? this.options.ignore : [this.options.ignore];
this.ignoreMatchers = ignorePatterns.map(
(ignore) => new Minimatch(ignore, { dot: true })
);
}
this.skipMatchers = [];
if (this.options.skip) {
const skipPatterns = Array.isArray(this.options.skip) ? this.options.skip : [this.options.skip];
this.skipMatchers = skipPatterns.map(
(skip) => new Minimatch(skip, { dot: true })
);
}
this.iterator = explore(resolve(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
this.paused = false;
this.inactive = false;
this.aborted = false;
if (cb) {
this._matches = [];
this.on("match", (match) => this._matches.push(this.options.absolute ? match.absolute : match.relative));
this.on("error", (err) => cb(err));
this.on("end", () => cb(null, this._matches));
}
setTimeout(() => this._next(), 0);
}
_shouldSkipDirectory(relative) {
return this.skipMatchers.some((m) => m.match(relative));
}
_fileMatches(relative, isDirectory) {
const file = relative + (isDirectory ? "/" : "");
return (this.matchers.length === 0 || this.matchers.some((m) => m.match(file))) && !this.ignoreMatchers.some((m) => m.match(file)) && (!this.options.nodir || !isDirectory);
}
_next() {
if (!this.paused && !this.aborted) {
this.iterator.next().then((obj) => {
if (!obj.done) {
const isDirectory = obj.value.stats.isDirectory();
if (this._fileMatches(obj.value.relative, isDirectory)) {
let relative = obj.value.relative;
let absolute = obj.value.absolute;
if (this.options.mark && isDirectory) {
relative += "/";
absolute += "/";
}
if (this.options.stat) {
this.emit("match", { relative, absolute, stat: obj.value.stats });
} else {
this.emit("match", { relative, absolute });
}
}
this._next(this.iterator);
} else {
this.emit("end");
}
}).catch((err) => {
this.abort();
this.emit("error", err);
if (!err.code && !this.options.silent) {
console.error(err);
}
});
} else {
this.inactive = true;
}
}
abort() {
this.aborted = true;
}
pause() {
this.paused = true;
}
resume() {
this.paused = false;
if (this.inactive) {
this.inactive = false;
this._next();
}
}
};
function readdirGlob(pattern, options, cb) {
return new ReaddirGlob(pattern, options, cb);
}
readdirGlob.ReaddirGlob = ReaddirGlob;
}
});
// node_modules/async/dist/async.mjs
var async_exports = {};
__export(async_exports, {
all: () => every$1,
allLimit: () => everyLimit$1,
allSeries: () => everySeries$1,
any: () => some$1,
anyLimit: () => someLimit$1,
anySeries: () => someSeries$1,
apply: () => apply,
applyEach: () => applyEach$1,
applyEachSeries: () => applyEachSeries,
asyncify: () => asyncify,
auto: () => auto,
autoInject: () => autoInject,
cargo: () => cargo,
cargoQueue: () => cargo$1,
compose: () => compose,
concat: () => concat$1,
concatLimit: () => concatLimit$1,
concatSeries: () => concatSeries$1,
constant: () => constant,
default: () => async_default,
detect: () => detect$1,
detectLimit: () => detectLimit$1,
detectSeries: () => detectSeries$1,
dir: () => dir,
doDuring: () => doWhilst$1,
doUntil: () => doUntil,
doWhilst: () => doWhilst$1,
during: () => whilst$1,
each: () => each,
eachLimit: () => eachLimit$2,
eachOf: () => eachOf$1,
eachOfLimit: () => eachOfLimit$2,
eachOfSeries: () => eachOfSeries$1,
eachSeries: () => eachSeries$1,
ensureAsync: () => ensureAsync,
every: () => every$1,
everyLimit: () => everyLimit$1,
everySeries: () => everySeries$1,
filter: () => filter$1,
filterLimit: () => filterLimit$1,
filterSeries: () => filterSeries$1,
find: () => detect$1,
findLimit: () => detectLimit$1,
findSeries: () => detectSeries$1,
flatMap: () => concat$1,
flatMapLimit: () => concatLimit$1,
flatMapSeries: () => concatSeries$1,
foldl: () => reduce$1,
foldr: () => reduceRight,
forEach: () => each,
forEachLimit: () => eachLimit$2,
forEachOf: () => eachOf$1,
forEachOfLimit: () => eachOfLimit$2,
forEachOfSeries: () => eachOfSeries$1,
forEachSeries: () => eachSeries$1,
forever: () => forever$1,
groupBy: () => groupBy,
groupByLimit: () => groupByLimit$1,
groupBySeries: () => groupBySeries,
inject: () => reduce$1,
log: () => log,
map: () => map$1,
mapLimit: () => mapLimit$1,
mapSeries: () => mapSeries$1,
mapValues: () => mapValues,
mapValuesLimit: () => mapValuesLimit$1,
mapValuesSeries: () => mapValuesSeries,
memoize: () => memoize,
nextTick: () => nextTick,
parallel: () => parallel$1,
parallelLimit: () => parallelLimit,
priorityQueue: () => priorityQueue,
queue: () => queue$1,
race: () => race$1,
reduce: () => reduce$1,
reduceRight: () => reduceRight,
reflect: () => reflect,
reflectAll: () => reflectAll,
reject: () => reject$2,
rejectLimit: () => rejectLimit$1,
rejectSeries: () => rejectSeries$1,
retry: () => retry,
retryable: () => retryable,
select: () => filter$1,
selectLimit: () => filterLimit$1,
selectSeries: () => filterSeries$1,
seq: () => seq,
series: () => series,
setImmediate: () => setImmediate$1,
some: () => some$1,
someLimit: () => someLimit$1,
someSeries: () => someSeries$1,
sortBy: () => sortBy$1,
timeout: () => timeout,
times: () => times,
timesLimit: () => timesLimit,
timesSeries: () => timesSeries,
transform: () => transform,
tryEach: () => tryEach$1,
unmemoize: () => unmemoize,
until: () => until,
waterfall: () => waterfall$1,
whilst: () => whilst$1,
wrapSync: () => asyncify
});
function apply(fn, ...args) {
return (...callArgs) => fn(...args, ...callArgs);
}
function initialParams(fn) {
return function(...args) {
var callback = args.pop();
return fn.call(this, args, callback);
};
}
function fallback(fn) {
setTimeout(fn, 0);
}
function wrap(defer) {
return (fn, ...args) => defer(() => fn(...args));
}
function asyncify(func) {
if (isAsync(func)) {
return function(...args) {
const callback = args.pop();
const promise = func.apply(this, args);
return handlePromise(promise, callback);
};
}
return initialParams(function(args, callback) {
var result;
try {
result = func.apply(this, args);
} catch (e) {
return callback(e);
}
if (result && typeof result.then === "function") {
return handlePromise(result, callback);
} else {
callback(null, result);
}
});
}
function handlePromise(promise, callback) {
return promise.then((value) => {
invokeCallback(callback, null, value);
}, (err) => {
invokeCallback(callback, err && err.message ? err : new Error(err));
});
}
function invokeCallback(callback, error, value) {
try {
callback(error, value);
} catch (err) {
setImmediate$1((e) => {
throw e;
}, err);
}
}
function isAsync(fn) {
return fn[Symbol.toStringTag] === "AsyncFunction";
}
function isAsyncGenerator(fn) {
return fn[Symbol.toStringTag] === "AsyncGenerator";
}
function isAsyncIterable(obj) {
return typeof obj[Symbol.asyncIterator] === "function";
}
function wrapAsync(asyncFn) {
if (typeof asyncFn !== "function")
throw new Error("expected a function");
return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;
}
function awaitify(asyncFn, arity = asyncFn.length) {
if (!arity)
throw new Error("arity is undefined");
function awaitable(...args) {
if (typeof args[arity - 1] === "function") {
return asyncFn.apply(this, args);
}
return new Promise((resolve, reject2) => {
args[arity - 1] = (err, ...cbArgs) => {
if (err)
return reject2(err);
resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]);
};
asyncFn.apply(this, args);
});
}
return awaitable;
}
function applyEach(eachfn) {
return function applyEach2(fns, ...callArgs) {
const go = awaitify(function(callback) {
var that = this;
return eachfn(fns, (fn, cb) => {
wrapAsync(fn).apply(that, callArgs.concat(cb));
}, callback);
});
return go;
};
}
function _asyncMap(eachfn, arr, iteratee, callback) {
arr = arr || [];
var results = [];
var counter = 0;
var _iteratee = wrapAsync(iteratee);
return eachfn(arr, (value, _2, iterCb) => {
var index2 = counter++;
_iteratee(value, (err, v) => {
results[index2] = v;
iterCb(err);
});
}, (err) => {
callback(err, results);
});
}
function isArrayLike(value) {
return value && typeof value.length === "number" && value.length >= 0 && value.length % 1 === 0;
}
function once(fn) {
function wrapper(...args) {
if (fn === null)
return;
var callFn = fn;
fn = null;
callFn.apply(this, args);
}
Object.assign(wrapper, fn);
return wrapper;
}
function getIterator(coll) {
return coll[Symbol.iterator] && coll[Symbol.iterator]();
}
function createArrayIterator(coll) {
var i = -1;
var len = coll.length;
return function next() {
return ++i < len ? { value: coll[i], key: i } : null;
};
}
function createES2015Iterator(iterator) {
var i = -1;
return function next() {
var item = iterator.next();
if (item.done)
return null;
i++;
return { value: item.value, key: i };
};
}
function createObjectIterator(obj) {
var okeys = obj ? Object.keys(obj) : [];
var i = -1;
var len = okeys.length;
return function next() {
var key = okeys[++i];
if (key === "__proto__") {
return next();
}
return i < len ? { value: obj[key], key } : null;
};
}
function createIterator(coll) {
if (isArrayLike(coll)) {
return createArrayIterator(coll);
}
var iterator = getIterator(coll);
return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll);
}
function onlyOnce(fn) {
return function(...args) {
if (fn === null)
throw new Error("Callback was already called.");
var callFn = fn;
fn = null;
callFn.apply(this, args);
};
}
function asyncEachOfLimit(generator, limit, iteratee, callback) {
let done = false;
let canceled = false;
let awaiting = false;
let running = 0;
let idx = 0;
function replenish() {
if (running >= limit || awaiting || done)
return;
awaiting = true;
generator.next().then(({ value, done: iterDone }) => {
if (canceled || done)
return;
awaiting = false;
if (iterDone) {
done = true;
if (running <= 0) {
callback(null);
}
return;
}
running++;
iteratee(value, idx, iterateeCallback);
idx++;
replenish();
}).catch(handleError);
}
function iterateeCallback(err, result) {
running -= 1;
if (canceled)
return;
if (err)
return handleError(err);
if (err === false) {
done = true;
canceled = true;
return;
}
if (result === breakLoop || done && running <= 0) {
done = true;
return callback(null);
}
replenish();
}
function handleError(err) {
if (canceled)
return;
awaiting = false;
done = true;
callback(err);
}
replenish();
}
function eachOfLimit$1(coll, limit, iteratee, callback) {
return eachOfLimit(limit)(coll, wrapAsync(iteratee), callback);
}
function eachOfArrayLike(coll, iteratee, callback) {
callback = once(callback);
var index2 = 0, completed = 0, { length } = coll, canceled = false;
if (length === 0) {
callback(null);
}
function iteratorCallback(err, value) {
if (err === false) {
canceled = true;
}
if (canceled === true)
return;
if (err) {
callback(err);
} else if (++completed === length || value === breakLoop) {
callback(null);
}
}
for (; index2 < length; index2++) {
iteratee(coll[index2], index2, onlyOnce(iteratorCallback));
}
}
function eachOfGeneric(coll, iteratee, callback) {
return eachOfLimit$2(coll, Infinity, iteratee, callback);
}
function eachOf(coll, iteratee, callback) {
var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
return eachOfImplementation(coll, wrapAsync(iteratee), callback);
}
function map(coll, iteratee, callback) {
return _asyncMap(eachOf$1, coll, iteratee, callback);
}
function eachOfSeries(coll, iteratee, callback) {
return eachOfLimit$2(coll, 1, iteratee, callback);
}
function mapSeries(coll, iteratee, callback) {
return _asyncMap(eachOfSeries$1, coll, iteratee, callback);
}
function promiseCallback() {
let resolve, reject2;
function callback(err, ...args) {
if (err)
return reject2(err);
resolve(args.length > 1 ? args : args[0]);
}
callback[PROMISE_SYMBOL] = new Promise((res, rej) => {
resolve = res, reject2 = rej;
});
return callback;
}
function auto(tasks, concurrency, callback) {
if (typeof concurrency !== "number") {
callback = concurrency;
concurrency = null;
}
callback = once(callback || promiseCallback());
var numTasks = Object.keys(tasks).length;
if (!numTasks) {
return callback(null);
}
if (!concurrency) {
concurrency = numTasks;
}
var results = {};
var runningTasks = 0;
var canceled = false;
var hasError = false;
var listeners = /* @__PURE__ */ Object.create(null);
var readyTasks = [];
var readyToCheck = [];
var uncheckedDependencies = {};
Object.keys(tasks).forEach((key) => {
var task = tasks[key];
if (!Array.isArray(task)) {
enqueueTask(key, [task]);
readyToCheck.push(key);
return;
}
var dependencies = task.slice(0, task.length - 1);
var remainingDependencies = dependencies.length;
if (remainingDependencies === 0) {
enqueueTask(key, task);
readyToCheck.push(key);
return;
}
uncheckedDependencies[key] = remainingDependencies;
dependencies.forEach((dependencyName) => {
if (!tasks[dependencyName]) {
throw new Error("async.auto task `" + key + "` has a non-existent dependency `" + dependencyName + "` in " + dependencies.join(", "));
}
addListener(dependencyName, () => {
remainingDependencies--;
if (remainingDependencies === 0) {
enqueueTask(key, task);
}
});
});
});
checkForDeadlocks();
processQueue();
function enqueueTask(key, task) {
readyTasks.push(() => runTask(key, task));
}
function processQueue() {
if (canceled)
return;
if (readyTasks.length === 0 && runningTasks === 0) {
return callback(null, results);
}
while (readyTasks.length && runningTasks < concurrency) {
var run = readyTasks.shift();
run();
}
}
function addListener(taskName, fn) {
var taskListeners = listeners[taskName];
if (!taskListeners) {
taskListeners = listeners[taskName] = [];
}
taskListeners.push(fn);
}
function taskComplete(taskName) {
var taskListeners = listeners[taskName] || [];
taskListeners.forEach((fn) => fn());
processQueue();
}
function runTask(key, task) {
if (hasError)
return;
var taskCallback = onlyOnce((err, ...result) => {
runningTasks--;
if (err === false) {
canceled = true;
return;
}
if (result.length < 2) {
[result] = result;
}
if (err) {
var safeResults = {};
Object.keys(results).forEach((rkey) => {
safeResults[rkey] = results[rkey];
});
safeResults[key] = result;
hasError = true;
listeners = /* @__PURE__ */ Object.create(null);
if (canceled)
return;
callback(err, safeResults);
} else {
results[key] = result;
taskComplete(key);
}
});
runningTasks++;
var taskFn = wrapAsync(task[task.length - 1]);
if (task.length > 1) {
taskFn(results, taskCallback);
} else {
taskFn(taskCallback);
}
}
function checkForDeadlocks() {
var currentTask;
var counter = 0;
while (readyToCheck.length) {
currentTask = readyToCheck.pop();
counter++;
getDependents(currentTask).forEach((dependent) => {
if (--uncheckedDependencies[dependent] === 0) {
readyToCheck.push(dependent);
}
});
}
if (counter !== numTasks) {
throw new Error(
"async.auto cannot execute tasks due to a recursive dependency"
);
}
}
function getDependents(taskName) {
var result = [];
Object.keys(tasks).forEach((key) => {
const task = tasks[key];
if (Array.isArray(task) && task.indexOf(taskName) >= 0) {
result.push(key);
}
});
return result;
}
return callback[PROMISE_SYMBOL];
}
function stripComments(string) {
let stripped = "";
let index2 = 0;
let endBlockComment = string.indexOf("*/");
while (index2 < string.length) {
if (string[index2] === "/" && string[index2 + 1] === "/") {
let endIndex = string.indexOf("\n", index2);
index2 = endIndex === -1 ? string.length : endIndex;
} else if (endBlockComment !== -1 && string[index2] === "/" && string[index2 + 1] === "*") {
let endIndex = string.indexOf("*/", index2);
if (endIndex !== -1) {
index2 = endIndex + 2;
endBlockComment = string.indexOf("*/", index2);
} else {
stripped += string[index2];
index2++;
}
} else {
stripped += string[index2];
index2++;
}
}
return stripped;
}
function parseParams(func) {
const src = stripComments(func.toString());
let match = src.match(FN_ARGS);
if (!match) {
match = src.match(ARROW_FN_ARGS);
}
if (!match)
throw new Error("could not parse args in autoInject\nSource:\n" + src);
let [, args] = match;
return args.replace(/\s/g, "").split(FN_ARG_SPLIT).map((arg) => arg.replace(FN_ARG, "").trim());
}
function autoInject(tasks, callback) {
var newTasks = {};
Object.keys(tasks).forEach((key) => {
var taskFn = tasks[key];
var params;
var fnIsAsync = isAsync(taskFn);
var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0;
if (Array.isArray(taskFn)) {
params = [...taskFn];
taskFn = params.pop();
newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
} else if (hasNoDeps) {
newTasks[key] = taskFn;
} else {
params = parseParams(taskFn);
if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {
throw new Error("autoInject task functions require explicit parameters.");
}
if (!fnIsAsync)
params.pop();
newTasks[key] = params.concat(newTask);
}
function newTask(results, taskCb) {
var newArgs = params.map((name) => results[name]);
newArgs.push(taskCb);
wrapAsync(taskFn)(...newArgs);
}
});
return auto(newTasks, callback);
}
function setInitial(dll, node) {
dll.length = 1;
dll.head = dll.tail = node;
}
function queue(worker, concurrency, payload) {
if (concurrency == null) {
concurrency = 1;
} else if (concurrency === 0) {
throw new RangeError("Concurrency must not be zero");
}
var _worker = wrapAsync(worker);
var numRunning = 0;
var workersList = [];
const events = {
error: [],
drain: [],
saturated: [],
unsaturated: [],
empty: []
};
function on(event, handler) {
events[event].push(handler);
}
function once2(event, handler) {
const handleAndRemove = (...args) => {
off(event, handleAndRemove);
handler(...args);
};
events[event].push(handleAndRemove);
}
function off(event, handler) {
if (!event)
return Object.keys(events).forEach((ev) => events[ev] = []);
if (!handler)
return events[event] = [];
events[event] = events[event].filter((ev) => ev !== handler);
}
function trigger(event, ...args) {
events[event].forEach((handler) => handler(...args));
}
var processingScheduled = false;
function _insert(data, insertAtFront, rejectOnError, callback) {
if (callback != null && typeof callback !== "function") {
throw new Error("task callback must be a function");
}
q.started = true;
var res, rej;
function promiseCallback2(err, ...args) {
if (err)
return rejectOnError ? rej(err) : res();
if (args.length <= 1)
return res(args[0]);
res(args);
}
var item = q._createTaskItem(
data,
rejectOnError ? promiseCallback2 : callback || promiseCallback2
);
if (insertAtFront) {
q._tasks.unshift(item);
} else {
q._tasks.push(item);
}
if (!processingScheduled) {
processingScheduled = true;
setImmediate$1(() => {
processingScheduled = false;
q.process();
});
}
if (rejectOnError || !callback) {
return new Promise((resolve, reject2) => {
res = resolve;
rej = reject2;
});
}
}
function _createCB(tasks) {
return function(err, ...args) {
numRunning -= 1;
for (var i = 0, l = tasks.length; i < l; i++) {
var task = tasks[i];
var index2 = workersList.indexOf(task);
if (index2 === 0) {
workersList.shift();
} else if (index2 > 0) {
workersList.splice(index2, 1);
}
task.callback(err, ...args);
if (err != null) {
trigger("error", err, task.data);
}
}
if (numRunning <= q.concurrency - q.buffer) {
trigger("unsaturated");
}
if (q.idle()) {
trigger("drain");
}
q.process();
};
}
function _maybeDrain(data) {
if (data.length === 0 && q.idle()) {
setImmediate$1(() => trigger("drain"));
return true;
}
return false;
}
const eventMethod = (name) => (handler) => {
if (!handler) {
return new Promise((resolve, reject2) => {
once2(name, (err, data) => {
if (err)
return reject2(err);
resolve(data);
});
});
}
off(name);
on(name, handler);
};
var isProcessing = false;
var q = {
_tasks: new DLL(),
_createTaskItem(data, callback) {
return {
data,
callback
};
},
*[Symbol.iterator]() {
yield* q._tasks[Symbol.iterator]();
},
concurrency,
payload,
buffer: concurrency / 4,
started: false,
paused: false,
push(data, callback) {
if (Array.isArray(data)) {
if (_maybeDrain(data))
return;
return data.map((datum) => _insert(datum, false, false, callback));
}
return _insert(data, false, false, callback);
},
pushAsync(data, callback) {
if (Array.isArray(data)) {
if (_maybeDrain(data))
return;
return data.map((datum) => _insert(datum, false, true, callback));
}
return _insert(data, false, true, callback);
},
kill() {
off();
q._tasks.empty();
},
unshift(data, callback) {
if (Array.isArray(data)) {
if (_maybeDrain(data))
return;
return data.map((datum) => _insert(datum, true, false, callback));
}
return _insert(data, true, false, callback);
},
unshiftAsync(data, callback) {
if (Array.isArray(data)) {
if (_maybeDrain(data))
return;
return data.map((datum) => _insert(datum, true, true, callback));
}
return _insert(data, true, true, callback);
},
remove(testFn) {
q._tasks.remove(testFn);
},
process() {
if (isProcessing) {
return;
}
isProcessing = true;
while (!q.paused && numRunning < q.concurrency && q._tasks.length) {
var tasks = [], data = [];
var l = q._tasks.length;
if (q.payload)
l = Math.min(l, q.payload);
for (var i = 0; i < l; i++) {
var node = q._tasks.shift();
tasks.push(node);
workersList.push(node);
data.push(node.data);
}
numRunning += 1;
if (q._tasks.length === 0) {
trigger("empty");
}
if (numRunning === q.concurrency) {
trigger("saturated");
}
var cb = onlyOnce(_createCB(tasks));
_worker(data, cb);
}
isProcessing = false;
},
length() {
return q._tasks.length;
},
running() {
return numRunning;
},
workersList() {
return workersList;
},
idle() {
return q._tasks.length + numRunning === 0;
},
pause() {
q.paused = true;
},
resume() {
if (q.paused === false) {
return;
}
q.paused = false;
setImmediate$1(q.process);
}
};
Object.defineProperties(q, {
saturated: {
writable: false,
value: eventMethod("saturated")
},
unsaturated: {
writable: false,
value: eventMethod("unsaturated")
},
empty: {
writable: false,
value: eventMethod("empty")
},
drain: {
writable: false,
value: eventMethod("drain")
},
error: {
writable: false,
value: eventMethod("error")
}
});
return q;
}
function cargo(worker, payload) {
return queue(worker, 1, payload);
}
function cargo$1(worker, concurrency, payload) {
return queue(worker, concurrency, payload);
}
function reduce(coll, memo, iteratee, callback) {
callback = once(callback);
var _iteratee = wrapAsync(iteratee);
return eachOfSeries$1(coll, (x, i, iterCb) => {
_iteratee(memo, x, (err, v) => {
memo = v;
iterCb(err);
});
}, (err) => callback(err, memo));
}
function seq(...functions) {
var _functions = functions.map(wrapAsync);
return function(...args) {
var that = this;
var cb = args[args.length - 1];
if (typeof cb == "function") {
args.pop();
} else {
cb = promiseCallback();
}
reduce$1(
_functions,
args,
(newargs, fn, iterCb) => {
fn.apply(that, newargs.concat((err, ...nextargs) => {
iterCb(err, nextargs);
}));
},
(err, results) => cb(err, ...results)
);
return cb[PROMISE_SYMBOL];
};
}
function compose(...args) {
return seq(...args.reverse());
}
function mapLimit(coll, limit, iteratee, callback) {
return _asyncMap(eachOfLimit(limit), coll, iteratee, callback);
}
function concatLimit(coll, limit, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return mapLimit$1(coll, limit, (val, iterCb) => {
_iteratee(val, (err, ...args) => {
if (err)
return iterCb(err);
return iterCb(err, args);
});
}, (err, mapResults) => {
var result = [];
for (var i = 0; i < mapResults.length; i++) {
if (mapResults[i]) {
result = result.concat(...mapResults[i]);
}
}
return callback(err, result);
});
}
function concat(coll, iteratee, callback) {
return concatLimit$1(coll, Infinity, iteratee, callback);
}
function concatSeries(coll, iteratee, callback) {
return concatLimit$1(coll, 1, iteratee, callback);
}
function constant(...args) {
return function(...ignoredArgs) {
var callback = ignoredArgs.pop();
return callback(null, ...args);
};
}
function _createTester(check, getResult) {
return (eachfn, arr, _iteratee, cb) => {
var testPassed = false;
var testResult;
const iteratee = wrapAsync(_iteratee);
eachfn(arr, (value, _2, callback) => {
iteratee(value, (err, result) => {
if (err || err === false)
return callback(err);
if (check(result) && !testResult) {
testPassed = true;
testResult = getResult(true, value);
return callback(null, breakLoop);
}
callback();
});
}, (err) => {
if (err)
return cb(err);
cb(null, testPassed ? testResult : getResult(false));
});
};
}
function detect(coll, iteratee, callback) {
return _createTester((bool) => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback);
}
function detectLimit(coll, limit, iteratee, callback) {
return _createTester((bool) => bool, (res, item) => item)(eachOfLimit(limit), coll, iteratee, callback);
}
function detectSeries(coll, iteratee, callback) {
return _createTester((bool) => bool, (res, item) => item)(eachOfLimit(1), coll, iteratee, callback);
}
function consoleFunc(name) {
return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => {
if (typeof console === "object") {
if (err) {
if (console.error) {
console.error(err);
}
} else if (console[name]) {
resultArgs.forEach((x) => console[name](x));
}
}
});
}
function doWhilst(iteratee, test, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results;
function next(err, ...args) {
if (err)
return callback(err);
if (err === false)
return;
results = args;
_test(...args, check);
}
function check(err, truth) {
if (err)
return callback(err);
if (err === false)
return;
if (!truth)
return callback(null, ...results);
_fn(next);
}
return check(null, true);
}
function doUntil(iteratee, test, callback) {
const _test = wrapAsync(test);
return doWhilst$1(iteratee, (...args) => {
const cb = args.pop();
_test(...args, (err, truth) => cb(err, !truth));
}, callback);
}
function _withoutIndex(iteratee) {
return (value, index2, callback) => iteratee(value, callback);
}
function eachLimit(coll, iteratee, callback) {
return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
}
function eachLimit$1(coll, limit, iteratee, callback) {
return eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
}
function eachSeries(coll, iteratee, callback) {
return eachLimit$2(coll, 1, iteratee, callback);
}
function ensureAsync(fn) {
if (isAsync(fn))
return fn;
return function(...args) {
var callback = args.pop();
var sync = true;
args.push((...innerArgs) => {
if (sync) {
setImmediate$1(() => callback(...innerArgs));
} else {
callback(...innerArgs);
}
});
fn.apply(this, args);
sync = false;
};
}
function every(coll, iteratee, callback) {
return _createTester((bool) => !bool, (res) => !res)(eachOf$1, coll, iteratee, callback);
}
function everyLimit(coll, limit, iteratee, callback) {
return _createTester((bool) => !bool, (res) => !res)(eachOfLimit(limit), coll, iteratee, callback);
}
function everySeries(coll, iteratee, callback) {
return _createTester((bool) => !bool, (res) => !res)(eachOfSeries$1, coll, iteratee, callback);
}
function filterArray(eachfn, arr, iteratee, callback) {
var truthValues = new Array(arr.length);
eachfn(arr, (x, index2, iterCb) => {
iteratee(x, (err, v) => {
truthValues[index2] = !!v;
iterCb(err);
});
}, (err) => {
if (err)
return callback(err);
var results = [];
for (var i = 0; i < arr.length; i++) {
if (truthValues[i])
results.push(arr[i]);
}
callback(null, results);
});
}
function filterGeneric(eachfn, coll, iteratee, callback) {
var results = [];
eachfn(coll, (x, index2, iterCb) => {
iteratee(x, (err, v) => {
if (err)
return iterCb(err);
if (v) {
results.push({ index: index2, value: x });
}
iterCb(err);
});
}, (err) => {
if (err)
return callback(err);
callback(null, results.sort((a, b) => a.index - b.index).map((v) => v.value));
});
}
function _filter(eachfn, coll, iteratee, callback) {
var filter2 = isArrayLike(coll) ? filterArray : filterGeneric;
return filter2(eachfn, coll, wrapAsync(iteratee), callback);
}
function filter(coll, iteratee, callback) {
return _filter(eachOf$1, coll, iteratee, callback);
}
function filterLimit(coll, limit, iteratee, callback) {
return _filter(eachOfLimit(limit), coll, iteratee, callback);
}
function filterSeries(coll, iteratee, callback) {
return _filter(eachOfSeries$1, coll, iteratee, callback);
}
function forever(fn, errback) {
var done = onlyOnce(errback);
var task = wrapAsync(ensureAsync(fn));
function next(err) {
if (err)
return done(err);
if (err === false)
return;
task(next);
}
return next();
}
function groupByLimit(coll, limit, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return mapLimit$1(coll, limit, (val, iterCb) => {
_iteratee(val, (err, key) => {
if (err)
return iterCb(err);
return iterCb(err, { key, val });
});
}, (err, mapResults) => {
var result = {};
var { hasOwnProperty } = Object.prototype;
for (var i = 0; i < mapResults.length; i++) {
if (mapResults[i]) {
var { key } = mapResults[i];
var { val } = mapResults[i];
if (hasOwnProperty.call(result, key)) {
result[key].push(val);
} else {
result[key] = [val];
}
}
}
return callback(err, result);
});
}
function groupBy(coll, iteratee, callback) {
return groupByLimit$1(coll, Infinity, iteratee, callback);
}
function groupBySeries(coll, iteratee, callback) {
return groupByLimit$1(coll, 1, iteratee, callback);
}
function mapValuesLimit(obj, limit, iteratee, callback) {
callback = once(callback);
var newObj = {};
var _iteratee = wrapAsync(iteratee);
return eachOfLimit(limit)(obj, (val, key, next) => {
_iteratee(val, key, (err, result) => {
if (err)
return next(err);
newObj[key] = result;
next(err);
});
}, (err) => callback(err, newObj));
}
function mapValues(obj, iteratee, callback) {
return mapValuesLimit$1(obj, Infinity, iteratee, callback);
}
function mapValuesSeries(obj, iteratee, callback) {
return mapValuesLimit$1(obj, 1, iteratee, callback);
}
function memoize(fn, hasher = (v) => v) {
var memo = /* @__PURE__ */ Object.create(null);
var queues = /* @__PURE__ */ Object.create(null);
var _fn = wrapAsync(fn);
var memoized = initialParams((args, callback) => {
var key = hasher(...args);
if (key in memo) {
setImmediate$1(() => callback(null, ...memo[key]));
} else if (key in queues) {
queues[key].push(callback);
} else {
queues[key] = [callback];
_fn(...args, (err, ...resultArgs) => {
if (!err) {
memo[key] = resultArgs;
}
var q = queues[key];
delete queues[key];
for (var i = 0, l = q.length; i < l; i++) {
q[i](err, ...resultArgs);
}
});
}
});
memoized.memo = memo;
memoized.unmemoized = fn;
return memoized;
}
function parallel$1(tasks, callback) {
return parallel(eachOf$1, tasks, callback);
}
function parallelLimit(tasks, limit, callback) {
return parallel(eachOfLimit(limit), tasks, callback);
}
function queue$1(worker, concurrency) {
var _worker = wrapAsync(worker);
return queue((items, cb) => {
_worker(items[0], cb);
}, concurrency, 1);
}
function leftChi(i) {
return (i << 1) + 1;
}
function parent(i) {
return (i + 1 >> 1) - 1;
}
function smaller(x, y) {
if (x.priority !== y.priority) {
return x.priority < y.priority;
} else {
return x.pushCount < y.pushCount;
}
}
function priorityQueue(worker, concurrency) {
var q = queue$1(worker, concurrency);
var {
push,
pushAsync
} = q;
q._tasks = new Heap();
q._createTaskItem = ({ data, priority }, callback) => {
return {
data,
priority,
callback
};
};
function createDataItems(tasks, priority) {
if (!Array.isArray(tasks)) {
return { data: tasks, priority };
}
return tasks.map((data) => {
return { data, priority };
});
}
q.push = function(data, priority = 0, callback) {
return push(createDataItems(data, priority), callback);
};
q.pushAsync = function(data, priority = 0, callback) {
return pushAsync(createDataItems(data, priority), callback);
};
delete q.unshift;
delete q.unshiftAsync;
return q;
}
function race(tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks))
return callback(new TypeError("First argument to race must be an array of functions"));
if (!tasks.length)
return callback();
for (var i = 0, l = tasks.length; i < l; i++) {
wrapAsync(tasks[i])(callback);
}
}
function reduceRight(array, memo, iteratee, callback) {
var reversed = [...array].reverse();
return reduce$1(reversed, memo, iteratee, callback);
}
function reflect(fn) {
var _fn = wrapAsync(fn);
return initialParams(function reflectOn(args, reflectCallback) {
args.push((error, ...cbArgs) => {
let retVal = {};
if (error) {
retVal.error = error;
}
if (cbArgs.length > 0) {
var value = cbArgs;
if (cbArgs.length <= 1) {
[value] = cbArgs;
}
retVal.value = value;
}
reflectCallback(null, retVal);
});
return _fn.apply(this, args);
});
}
function reflectAll(tasks) {
var results;
if (Array.isArray(tasks)) {
results = tasks.map(reflect);
} else {
results = {};
Object.keys(tasks).forEach((key) => {
results[key] = reflect.call(this, tasks[key]);
});
}
return results;
}
function reject(eachfn, arr, _iteratee, callback) {
const iteratee = wrapAsync(_iteratee);
return _filter(eachfn, arr, (value, cb) => {
iteratee(value, (err, v) => {
cb(err, !v);
});
}, callback);
}
function reject$1(coll, iteratee, callback) {
return reject(eachOf$1, coll, iteratee, callback);
}
function rejectLimit(coll, limit, iteratee, callback) {
return reject(eachOfLimit(limit), coll, iteratee, callback);
}
function rejectSeries(coll, iteratee, callback) {
return reject(eachOfSeries$1, coll, iteratee, callback);
}
function constant$1(value) {
return function() {
return value;
};
}
function retry(opts, task, callback) {
var options = {
times: DEFAULT_TIMES,
intervalFunc: constant$1(DEFAULT_INTERVAL)
};
if (arguments.length < 3 && typeof opts === "function") {
callback = task || promiseCallback();
task = opts;
} else {
parseTimes(options, opts);
callback = callback || promiseCallback();
}
if (typeof task !== "function") {
throw new Error("Invalid arguments for async.retry");
}
var _task = wrapAsync(task);
var attempt = 1;
function retryAttempt() {
_task((err, ...args) => {
if (err === false)
return;
if (err && attempt++ < options.times && (typeof options.errorFilter != "function" || options.errorFilter(err))) {
setTimeout(retryAttempt, options.intervalFunc(attempt - 1));
} else {
callback(err, ...args);
}
});
}
retryAttempt();
return callback[PROMISE_SYMBOL];
}
function parseTimes(acc, t) {
if (typeof t === "object") {
acc.times = +t.times || DEFAULT_TIMES;
acc.intervalFunc = typeof t.interval === "function" ? t.interval : constant$1(+t.interval || DEFAULT_INTERVAL);
acc.errorFilter = t.errorFilter;
} else if (typeof t === "number" || typeof t === "string") {
acc.times = +t || DEFAULT_TIMES;
} else {
throw new Error("Invalid arguments for async.retry");
}
}
function retryable(opts, task) {
if (!task) {
task = opts;
opts = null;
}
let arity = opts && opts.arity || task.length;
if (isAsync(task)) {
arity += 1;
}
var _task = wrapAsync(task);
return initialParams((args, callback) => {
if (args.length < arity - 1 || callback == null) {
args.push(callback);
callback = promiseCallback();
}
function taskFn(cb) {
_task(...args, cb);
}
if (opts)
retry(opts, taskFn, callback);
else
retry(taskFn, callback);
return callback[PROMISE_SYMBOL];
});
}
function series(tasks, callback) {
return parallel(eachOfSeries$1, tasks, callback);
}
function some(coll, iteratee, callback) {
return _createTester(Boolean, (res) => res)(eachOf$1, coll, iteratee, callback);
}
function someLimit(coll, limit, iteratee, callback) {
return _createTester(Boolean, (res) => res)(eachOfLimit(limit), coll, iteratee, callback);
}
function someSeries(coll, iteratee, callback) {
return _createTester(Boolean, (res) => res)(eachOfSeries$1, coll, iteratee, callback);
}
function sortBy(coll, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return map$1(coll, (x, iterCb) => {
_iteratee(x, (err, criteria) => {
if (err)
return iterCb(err);
iterCb(err, { value: x, criteria });
});
}, (err, results) => {
if (err)
return callback(err);
callback(null, results.sort(comparator).map((v) => v.value));
});
function comparator(left, right) {
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}
}
function timeout(asyncFn, milliseconds, info) {
var fn = wrapAsync(asyncFn);
return initialParams((args, callback) => {
var timedOut = false;
var timer;
function timeoutCallback() {
var name = asyncFn.name || "anonymous";
var error = new Error('Callback function "' + name + '" timed out.');
error.code = "ETIMEDOUT";
if (info) {
error.info = info;
}
timedOut = true;
callback(error);
}
args.push((...cbArgs) => {
if (!timedOut) {
callback(...cbArgs);
clearTimeout(timer);
}
});
timer = setTimeout(timeoutCallback, milliseconds);
fn(...args);
});
}
function range(size) {
var result = Array(size);
while (size--) {
result[size] = size;
}
return result;
}
function timesLimit(count, limit, iteratee, callback) {
var _iteratee = wrapAsync(iteratee);
return mapLimit$1(range(count), limit, _iteratee, callback);
}
function times(n, iteratee, callback) {
return timesLimit(n, Infinity, iteratee, callback);
}
function timesSeries(n, iteratee, callback) {
return timesLimit(n, 1, iteratee, callback);
}
function transform(coll, accumulator, iteratee, callback) {
if (arguments.length <= 3 && typeof accumulator === "function") {
callback = iteratee;
iteratee = accumulator;
accumulator = Array.isArray(coll) ? [] : {};
}
callback = once(callback || promiseCallback());
var _iteratee = wrapAsync(iteratee);
eachOf$1(coll, (v, k, cb) => {
_iteratee(accumulator, v, k, cb);
}, (err) => callback(err, accumulator));
return callback[PROMISE_SYMBOL];
}
function tryEach(tasks, callback) {
var error = null;
var result;
return eachSeries$1(tasks, (task, taskCb) => {
wrapAsync(task)((err, ...args) => {
if (err === false)
return taskCb(err);
if (args.length < 2) {
[result] = args;
} else {
result = args;
}
error = err;
taskCb(err ? null : {});
});
}, () => callback(error, result));
}
function unmemoize(fn) {
return (...args) => {
return (fn.unmemoized || fn)(...args);
};
}
function whilst(test, iteratee, callback) {
callback = onlyOnce(callback);
var _fn = wrapAsync(iteratee);
var _test = wrapAsync(test);
var results = [];
function next(err, ...rest) {
if (err)
return callback(err);
results = rest;
if (err === false)
return;
_test(check);
}
function check(err, truth) {
if (err)
return callback(err);
if (err === false)
return;
if (!truth)
return callback(null, ...results);
_fn(next);
}
return _test(check);
}
function until(test, iteratee, callback) {
const _test = wrapAsync(test);
return whilst$1((cb) => _test((err, truth) => cb(err, !truth)), iteratee, callback);
}
function waterfall(tasks, callback) {
callback = once(callback);
if (!Array.isArray(tasks))
return callback(new Error("First argument to waterfall must be an array of functions"));
if (!tasks.length)
return callback();
var taskIndex = 0;
function nextTask(args) {
var task = wrapAsync(tasks[taskIndex++]);
task(...args, onlyOnce(next));
}
function next(err, ...args) {
if (err === false)
return;
if (err || taskIndex === tasks.length) {
return callback(err, ...args);
}
nextTask(args);
}
nextTask([]);
}
var hasQueueMicrotask, hasSetImmediate, hasNextTick, _defer, setImmediate$1, breakLoop, eachOfLimit, eachOfLimit$2, eachOf$1, map$1, applyEach$1, eachOfSeries$1, mapSeries$1, applyEachSeries, PROMISE_SYMBOL, FN_ARGS, ARROW_FN_ARGS, FN_ARG_SPLIT, FN_ARG, DLL, reduce$1, mapLimit$1, concatLimit$1, concat$1, concatSeries$1, detect$1, detectLimit$1, detectSeries$1, dir, doWhilst$1, each, eachLimit$2, eachSeries$1, every$1, everyLimit$1, everySeries$1, filter$1, filterLimit$1, filterSeries$1, forever$1, groupByLimit$1, log, mapValuesLimit$1, _defer$1, nextTick, parallel, Heap, race$1, reject$2, rejectLimit$1, rejectSeries$1, DEFAULT_TIMES, DEFAULT_INTERVAL, some$1, someLimit$1, someSeries$1, sortBy$1, tryEach$1, whilst$1, waterfall$1, index, async_default;
var init_async = __esm({
"node_modules/async/dist/async.mjs"() {
hasQueueMicrotask = typeof queueMicrotask === "function" && queueMicrotask;
hasSetImmediate = typeof setImmediate === "function" && setImmediate;
hasNextTick = typeof process === "object" && typeof process.nextTick === "function";
if (hasQueueMicrotask) {
_defer = queueMicrotask;
} else if (hasSetImmediate) {
_defer = setImmediate;
} else if (hasNextTick) {
_defer = process.nextTick;
} else {
_defer = fallback;
}
setImmediate$1 = wrap(_defer);
breakLoop = {};
eachOfLimit = (limit) => {
return (obj, iteratee, callback) => {
callback = once(callback);
if (limit <= 0) {
throw new RangeError("concurrency limit cannot be less than 1");
}
if (!obj) {
return callback(null);
}
if (isAsyncGenerator(obj)) {
return asyncEachOfLimit(obj, limit, iteratee, callback);
}
if (isAsyncIterable(obj)) {
return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback);
}
var nextElem = createIterator(obj);
var done = false;
var canceled = false;
var running = 0;
var looping = false;
function iterateeCallback(err, value) {
if (canceled)
return;
running -= 1;
if (err) {
done = true;
callback(err);
} else if (err === false) {
done = true;
canceled = true;
} else if (value === breakLoop || done && running <= 0) {
done = true;
return callback(null);
} else if (!looping) {
replenish();
}
}
function replenish() {
looping = true;
while (running < limit && !done) {
var elem = nextElem();
if (elem === null) {
done = true;
if (running <= 0) {
callback(null);
}
return;
}
running += 1;
iteratee(elem.value, elem.key, onlyOnce(iterateeCallback));
}
looping = false;
}
replenish();
};
};
eachOfLimit$2 = awaitify(eachOfLimit$1, 4);
eachOf$1 = awaitify(eachOf, 3);
map$1 = awaitify(map, 3);
applyEach$1 = applyEach(map$1);
eachOfSeries$1 = awaitify(eachOfSeries, 3);
mapSeries$1 = awaitify(mapSeries, 3);
applyEachSeries = applyEach(mapSeries$1);
PROMISE_SYMBOL = Symbol("promiseCallback");
FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;
ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;
FN_ARG_SPLIT = /,/;
FN_ARG = /(=.+)?(\s*)$/;
DLL = class {
constructor() {
this.head = this.tail = null;
this.length = 0;
}
removeLink(node) {
if (node.prev)
node.prev.next = node.next;
else
this.head = node.next;
if (node.next)
node.next.prev = node.prev;
else
this.tail = node.prev;
node.prev = node.next = null;
this.length -= 1;
return node;
}
empty() {
while (this.head)
this.shift();
return this;
}
insertAfter(node, newNode) {
newNode.prev = node;
newNode.next = node.next;
if (node.next)
node.next.prev = newNode;
else
this.tail = newNode;
node.next = newNode;
this.length += 1;
}
insertBefore(node, newNode) {
newNode.prev = node.prev;
newNode.next = node;
if (node.prev)
node.prev.next = newNode;
else
this.head = newNode;
node.prev = newNode;
this.length += 1;
}
unshift(node) {
if (this.head)
this.insertBefore(this.head, node);
else
setInitial(this, node);
}
push(node) {
if (this.tail)
this.insertAfter(this.tail, node);
else
setInitial(this, node);
}
shift() {
return this.head && this.removeLink(this.head);
}
pop() {
return this.tail && this.removeLink(this.tail);
}
toArray() {
return [...this];
}
*[Symbol.iterator]() {
var cur = this.head;
while (cur) {
yield cur.data;
cur = cur.next;
}
}
remove(testFn) {
var curr = this.head;
while (curr) {
var { next } = curr;
if (testFn(curr)) {
this.removeLink(curr);
}
curr = next;
}
return this;
}
};
reduce$1 = awaitify(reduce, 4);
mapLimit$1 = awaitify(mapLimit, 4);
concatLimit$1 = awaitify(concatLimit, 4);
concat$1 = awaitify(concat, 3);
concatSeries$1 = awaitify(concatSeries, 3);
detect$1 = awaitify(detect, 3);
detectLimit$1 = awaitify(detectLimit, 4);
detectSeries$1 = awaitify(detectSeries, 3);
dir = consoleFunc("dir");
doWhilst$1 = awaitify(doWhilst, 3);
each = awaitify(eachLimit, 3);
eachLimit$2 = awaitify(eachLimit$1, 4);
eachSeries$1 = awaitify(eachSeries, 3);
every$1 = awaitify(every, 3);
everyLimit$1 = awaitify(everyLimit, 4);
everySeries$1 = awaitify(everySeries, 3);
filter$1 = awaitify(filter, 3);
filterLimit$1 = awaitify(filterLimit, 4);
filterSeries$1 = awaitify(filterSeries, 3);
forever$1 = awaitify(forever, 2);
groupByLimit$1 = awaitify(groupByLimit, 4);
log = consoleFunc("log");
mapValuesLimit$1 = awaitify(mapValuesLimit, 4);
if (hasNextTick) {
_defer$1 = process.nextTick;
} else if (hasSetImmediate) {
_defer$1 = setImmediate;
} else {
_defer$1 = fallback;
}
nextTick = wrap(_defer$1);
parallel = awaitify((eachfn, tasks, callback) => {
var results = isArrayLike(tasks) ? [] : {};
eachfn(tasks, (task, key, taskCb) => {
wrapAsync(task)((err, ...result) => {
if (result.length < 2) {
[result] = result;
}
results[key] = result;
taskCb(err);
});
}, (err) => callback(err, results));
}, 3);
Heap = class {
constructor() {
this.heap = [];
this.pushCount = Number.MIN_SAFE_INTEGER;
}
get length() {
return this.heap.length;
}
empty() {
this.heap = [];
return this;
}
percUp(index2) {
let p;
while (index2 > 0 && smaller(this.heap[index2], this.heap[p = parent(index2)])) {
let t = this.heap[index2];
this.heap[index2] = this.heap[p];
this.heap[p] = t;
index2 = p;
}
}
percDown(index2) {
let l;
while ((l = leftChi(index2)) < this.heap.length) {
if (l + 1 < this.heap.length && smaller(this.heap[l + 1], this.heap[l])) {
l = l + 1;
}
if (smaller(this.heap[index2], this.heap[l])) {
break;
}
let t = this.heap[index2];
this.heap[index2] = this.heap[l];
this.heap[l] = t;
index2 = l;
}
}
push(node) {
node.pushCount = ++this.pushCount;
this.heap.push(node);
this.percUp(this.heap.length - 1);
}
unshift(node) {
return this.heap.push(node);
}
shift() {
let [top] = this.heap;
this.heap[0] = this.heap[this.heap.length - 1];
this.heap.pop();
this.percDown(0);
return top;
}
toArray() {
return [...this];
}
*[Symbol.iterator]() {
for (let i = 0; i < this.heap.length; i++) {
yield this.heap[i].data;
}
}
remove(testFn) {
let j = 0;
for (let i = 0; i < this.heap.length; i++) {
if (!testFn(this.heap[i])) {
this.heap[j] = this.heap[i];
j++;
}
}
this.heap.splice(j);
for (let i = parent(this.heap.length - 1); i >= 0; i--) {
this.percDown(i);
}
return this;
}
};
race$1 = awaitify(race, 2);
reject$2 = awaitify(reject$1, 3);
rejectLimit$1 = awaitify(rejectLimit, 4);
rejectSeries$1 = awaitify(rejectSeries, 3);
DEFAULT_TIMES = 5;
DEFAULT_INTERVAL = 0;
some$1 = awaitify(some, 3);
someLimit$1 = awaitify(someLimit, 4);
someSeries$1 = awaitify(someSeries, 3);
sortBy$1 = awaitify(sortBy, 3);
tryEach$1 = awaitify(tryEach);
whilst$1 = awaitify(whilst, 3);
waterfall$1 = awaitify(waterfall);
index = {
apply,
applyEach: applyEach$1,
applyEachSeries,
asyncify,
auto,
autoInject,
cargo,
cargoQueue: cargo$1,
compose,
concat: concat$1,
concatLimit: concatLimit$1,
concatSeries: concatSeries$1,
constant,
detect: detect$1,
detectLimit: detectLimit$1,
detectSeries: detectSeries$1,
dir,
doUntil,
doWhilst: doWhilst$1,
each,
eachLimit: eachLimit$2,
eachOf: eachOf$1,
eachOfLimit: eachOfLimit$2,
eachOfSeries: eachOfSeries$1,
eachSeries: eachSeries$1,
ensureAsync,
every: every$1,
everyLimit: everyLimit$1,
everySeries: everySeries$1,
filter: filter$1,
filterLimit: filterLimit$1,
filterSeries: filterSeries$1,
forever: forever$1,
groupBy,
groupByLimit: groupByLimit$1,
groupBySeries,
log,
map: map$1,
mapLimit: mapLimit$1,
mapSeries: mapSeries$1,
mapValues,
mapValuesLimit: mapValuesLimit$1,
mapValuesSeries,
memoize,
nextTick,
parallel: parallel$1,
parallelLimit,
priorityQueue,
queue: queue$1,
race: race$1,
reduce: reduce$1,
reduceRight,
reflect,
reflectAll,
reject: reject$2,
rejectLimit: rejectLimit$1,
rejectSeries: rejectSeries$1,
retry,
retryable,
seq,
series,
setImmediate: setImmediate$1,
some: some$1,
someLimit: someLimit$1,
someSeries: someSeries$1,
sortBy: sortBy$1,
timeout,
times,
timesLimit,
timesSeries,
transform,
tryEach: tryEach$1,
unmemoize,
until,
waterfall: waterfall$1,
whilst: whilst$1,
// aliases
all: every$1,
allLimit: everyLimit$1,
allSeries: everySeries$1,
any: some$1,
anyLimit: someLimit$1,
anySeries: someSeries$1,
find: detect$1,
findLimit: detectLimit$1,
findSeries: detectSeries$1,
flatMap: concat$1,
flatMapLimit: concatLimit$1,
flatMapSeries: concatSeries$1,
forEach: each,
forEachSeries: eachSeries$1,
forEachLimit: eachLimit$2,
forEachOf: eachOf$1,
forEachOfSeries: eachOfSeries$1,
forEachOfLimit: eachOfLimit$2,
inject: reduce$1,
foldl: reduce$1,
foldr: reduceRight,
select: filter$1,
selectLimit: filterLimit$1,
selectSeries: filterSeries$1,
wrapSync: asyncify,
during: whilst$1,
doDuring: doWhilst$1
};
async_default = index;
}
});
// node_modules/graceful-fs/polyfills.js
var require_polyfills = __commonJS({
"node_modules/graceful-fs/polyfills.js"(exports, module2) {
var constants = require("constants");
var origCwd = process.cwd;
var cwd = null;
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process);
return cwd;
};
try {
process.cwd();
} catch (er) {
}
if (typeof process.chdir === "function") {
chdir = process.chdir;
process.chdir = function(d) {
cwd = null;
chdir.call(process, d);
};
if (Object.setPrototypeOf)
Object.setPrototypeOf(process.chdir, chdir);
}
var chdir;
module2.exports = patch;
function patch(fs) {
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs);
}
if (!fs.lutimes) {
patchLutimes(fs);
}
fs.chown = chownFix(fs.chown);
fs.fchown = chownFix(fs.fchown);
fs.lchown = chownFix(fs.lchown);
fs.chmod = chmodFix(fs.chmod);
fs.fchmod = chmodFix(fs.fchmod);
fs.lchmod = chmodFix(fs.lchmod);
fs.chownSync = chownFixSync(fs.chownSync);
fs.fchownSync = chownFixSync(fs.fchownSync);
fs.lchownSync = chownFixSync(fs.lchownSync);
fs.chmodSync = chmodFixSync(fs.chmodSync);
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
fs.stat = statFix(fs.stat);
fs.fstat = statFix(fs.fstat);
fs.lstat = statFix(fs.lstat);
fs.statSync = statFixSync(fs.statSync);
fs.fstatSync = statFixSync(fs.fstatSync);
fs.lstatSync = statFixSync(fs.lstatSync);
if (fs.chmod && !fs.lchmod) {
fs.lchmod = function(path3, mode, cb) {
if (cb)
process.nextTick(cb);
};
fs.lchmodSync = function() {
};
}
if (fs.chown && !fs.lchown) {
fs.lchown = function(path3, uid, gid, cb) {
if (cb)
process.nextTick(cb);
};
fs.lchownSync = function() {
};
}
if (platform === "win32") {
fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
function rename(from, to, cb) {
var start = Date.now();
var backoff = 0;
fs$rename(from, to, function CB(er) {
if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
setTimeout(function() {
fs.stat(to, function(stater, st) {
if (stater && stater.code === "ENOENT")
fs$rename(from, to, CB);
else
cb(er);
});
}, backoff);
if (backoff < 100)
backoff += 10;
return;
}
if (cb)
cb(er);
});
}
if (Object.setPrototypeOf)
Object.setPrototypeOf(rename, fs$rename);
return rename;
}(fs.rename);
}
fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
function read(fd, buffer, offset, length, position, callback_) {
var callback;
if (callback_ && typeof callback_ === "function") {
var eagCounter = 0;
callback = function(er, _2, __) {
if (er && er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
}
callback_.apply(this, arguments);
};
}
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
}
if (Object.setPrototypeOf)
Object.setPrototypeOf(read, fs$read);
return read;
}(fs.read);
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
return function(fd, buffer, offset, length, position) {
var eagCounter = 0;
while (true) {
try {
return fs$readSync.call(fs, fd, buffer, offset, length, position);
} catch (er) {
if (er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
continue;
}
throw er;
}
}
};
}(fs.readSync);
function patchLchmod(fs2) {
fs2.lchmod = function(path3, mode, callback) {
fs2.open(
path3,
constants.O_WRONLY | constants.O_SYMLINK,
mode,
function(err, fd) {
if (err) {
if (callback)
callback(err);
return;
}
fs2.fchmod(fd, mode, function(err2) {
fs2.close(fd, function(err22) {
if (callback)
callback(err2 || err22);
});
});
}
);
};
fs2.lchmodSync = function(path3, mode) {
var fd = fs2.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
var threw = true;
var ret;
try {
ret = fs2.fchmodSync(fd, mode);
threw = false;
} finally {
if (threw) {
try {
fs2.closeSync(fd);
} catch (er) {
}
} else {
fs2.closeSync(fd);
}
}
return ret;
};
}
function patchLutimes(fs2) {
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
fs2.lutimes = function(path3, at, mt, cb) {
fs2.open(path3, constants.O_SYMLINK, function(er, fd) {
if (er) {
if (cb)
cb(er);
return;
}
fs2.futimes(fd, at, mt, function(er2) {
fs2.close(fd, function(er22) {
if (cb)
cb(er2 || er22);
});
});
});
};
fs2.lutimesSync = function(path3, at, mt) {
var fd = fs2.openSync(path3, constants.O_SYMLINK);
var ret;
var threw = true;
try {
ret = fs2.futimesSync(fd, at, mt);
threw = false;
} finally {
if (threw) {
try {
fs2.closeSync(fd);
} catch (er) {
}
} else {
fs2.closeSync(fd);
}
}
return ret;
};
} else if (fs2.futimes) {
fs2.lutimes = function(_a, _b, _c, cb) {
if (cb)
process.nextTick(cb);
};
fs2.lutimesSync = function() {
};
}
}
function chmodFix(orig) {
if (!orig)
return orig;
return function(target, mode, cb) {
return orig.call(fs, target, mode, function(er) {
if (chownErOk(er))
er = null;
if (cb)
cb.apply(this, arguments);
});
};
}
function chmodFixSync(orig) {
if (!orig)
return orig;
return function(target, mode) {
try {
return orig.call(fs, target, mode);
} catch (er) {
if (!chownErOk(er))
throw er;
}
};
}
function chownFix(orig) {
if (!orig)
return orig;
return function(target, uid, gid, cb) {
return orig.call(fs, target, uid, gid, function(er) {
if (chownErOk(er))
er = null;
if (cb)
cb.apply(this, arguments);
});
};
}
function chownFixSync(orig) {
if (!orig)
return orig;
return function(target, uid, gid) {
try {
return orig.call(fs, target, uid, gid);
} catch (er) {
if (!chownErOk(er))
throw er;
}
};
}
function statFix(orig) {
if (!orig)
return orig;
return function(target, options, cb) {
if (typeof options === "function") {
cb = options;
options = null;
}
function callback(er, stats) {
if (stats) {
if (stats.uid < 0)
stats.uid += 4294967296;
if (stats.gid < 0)
stats.gid += 4294967296;
}
if (cb)
cb.apply(this, arguments);
}
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
};
}
function statFixSync(orig) {
if (!orig)
return orig;
return function(target, options) {
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
if (stats) {
if (stats.uid < 0)
stats.uid += 4294967296;
if (stats.gid < 0)
stats.gid += 4294967296;
}
return stats;
};
}
function chownErOk(er) {
if (!er)
return true;
if (er.code === "ENOSYS")
return true;
var nonroot = !process.getuid || process.getuid() !== 0;
if (nonroot) {
if (er.code === "EINVAL" || er.code === "EPERM")
return true;
}
return false;
}
}
}
});
// node_modules/graceful-fs/legacy-streams.js
var require_legacy_streams = __commonJS({
"node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
var Stream = require("stream").Stream;
module2.exports = legacy;
function legacy(fs) {
return {
ReadStream,
WriteStream
};
function ReadStream(path3, options) {
if (!(this instanceof ReadStream))
return new ReadStream(path3, options);
Stream.call(this);
var self2 = this;
this.path = path3;
this.fd = null;
this.readable = true;
this.paused = false;
this.flags = "r";
this.mode = 438;
this.bufferSize = 64 * 1024;
options = options || {};
var keys = Object.keys(options);
for (var index2 = 0, length = keys.length; index2 < length; index2++) {
var key = keys[index2];
this[key] = options[key];
}
if (this.encoding)
this.setEncoding(this.encoding);
if (this.start !== void 0) {
if ("number" !== typeof this.start) {
throw TypeError("start must be a Number");
}
if (this.end === void 0) {
this.end = Infinity;
} else if ("number" !== typeof this.end) {
throw TypeError("end must be a Number");
}
if (this.start > this.end) {
throw new Error("start must be <= end");
}
this.pos = this.start;
}
if (this.fd !== null) {
process.nextTick(function() {
self2._read();
});
return;
}
fs.open(this.path, this.flags, this.mode, function(err, fd) {
if (err) {
self2.emit("error", err);
self2.readable = false;
return;
}
self2.fd = fd;
self2.emit("open", fd);
self2._read();
});
}
function WriteStream(path3, options) {
if (!(this instanceof WriteStream))
return new WriteStream(path3, options);
Stream.call(this);
this.path = path3;
this.fd = null;
this.writable = true;
this.flags = "w";
this.encoding = "binary";
this.mode = 438;
this.bytesWritten = 0;
options = options || {};
var keys = Object.keys(options);
for (var index2 = 0, length = keys.length; index2 < length; index2++) {
var key = keys[index2];
this[key] = options[key];
}
if (this.start !== void 0) {
if ("number" !== typeof this.start) {
throw TypeError("start must be a Number");
}
if (this.start < 0) {
throw new Error("start must be >= zero");
}
this.pos = this.start;
}
this.busy = false;
this._queue = [];
if (this.fd === null) {
this._open = fs.open;
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
this.flush();
}
}
}
}
});
// node_modules/graceful-fs/clone.js
var require_clone = __commonJS({
"node_modules/graceful-fs/clone.js"(exports, module2) {
"use strict";
module2.exports = clone;
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
return obj.__proto__;
};
function clone(obj) {
if (obj === null || typeof obj !== "object")
return obj;
if (obj instanceof Object)
var copy = { __proto__: getPrototypeOf(obj) };
else
var copy = /* @__PURE__ */ Object.create(null);
Object.getOwnPropertyNames(obj).forEach(function(key) {
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
});
return copy;
}
}
});
// node_modules/graceful-fs/graceful-fs.js
var require_graceful_fs = __commonJS({
"node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
var fs = require("fs");
var polyfills = require_polyfills();
var legacy = require_legacy_streams();
var clone = require_clone();
var util = require("util");
var gracefulQueue;
var previousSymbol;
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
gracefulQueue = Symbol.for("graceful-fs.queue");
previousSymbol = Symbol.for("graceful-fs.previous");
} else {
gracefulQueue = "___graceful-fs.queue";
previousSymbol = "___graceful-fs.previous";
}
function noop() {
}
function publishQueue(context, queue3) {
Object.defineProperty(context, gracefulQueue, {
get: function() {
return queue3;
}
});
}
var debug = noop;
if (util.debuglog)
debug = util.debuglog("gfs4");
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
debug = function() {
var m = util.format.apply(util, arguments);
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
console.error(m);
};
if (!fs[gracefulQueue]) {
queue2 = global[gracefulQueue] || [];
publishQueue(fs, queue2);
fs.close = function(fs$close) {
function close(fd, cb) {
return fs$close.call(fs, fd, function(err) {
if (!err) {
resetQueue();
}
if (typeof cb === "function")
cb.apply(this, arguments);
});
}
Object.defineProperty(close, previousSymbol, {
value: fs$close
});
return close;
}(fs.close);
fs.closeSync = function(fs$closeSync) {
function closeSync(fd) {
fs$closeSync.apply(fs, arguments);
resetQueue();
}
Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
});
return closeSync;
}(fs.closeSync);
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
process.on("exit", function() {
debug(fs[gracefulQueue]);
require("assert").equal(fs[gracefulQueue].length, 0);
});
}
}
var queue2;
if (!global[gracefulQueue]) {
publishQueue(global, fs[gracefulQueue]);
}
module2.exports = patch(clone(fs));
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
module2.exports = patch(fs);
fs.__patched = true;
}
function patch(fs2) {
polyfills(fs2);
fs2.gracefulify = patch;
fs2.createReadStream = createReadStream;
fs2.createWriteStream = createWriteStream2;
var fs$readFile = fs2.readFile;
fs2.readFile = readFile;
function readFile(path3, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$readFile(path3, options, cb);
function go$readFile(path4, options2, cb2, startTime) {
return fs$readFile(path4, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$readFile, [path4, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$writeFile = fs2.writeFile;
fs2.writeFile = writeFile;
function writeFile(path3, data, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$writeFile(path3, data, options, cb);
function go$writeFile(path4, data2, options2, cb2, startTime) {
return fs$writeFile(path4, data2, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$writeFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$appendFile = fs2.appendFile;
if (fs$appendFile)
fs2.appendFile = appendFile;
function appendFile(path3, data, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$appendFile(path3, data, options, cb);
function go$appendFile(path4, data2, options2, cb2, startTime) {
return fs$appendFile(path4, data2, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$appendFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$copyFile = fs2.copyFile;
if (fs$copyFile)
fs2.copyFile = copyFile;
function copyFile(src, dest, flags, cb) {
if (typeof flags === "function") {
cb = flags;
flags = 0;
}
return go$copyFile(src, dest, flags, cb);
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
return fs$copyFile(src2, dest2, flags2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$readdir = fs2.readdir;
fs2.readdir = readdir;
var noReaddirOptionVersions = /^v[0-5]\./;
function readdir(path3, options, cb) {
if (typeof options === "function")
cb = options, options = null;
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path4, options2, cb2, startTime) {
return fs$readdir(path4, fs$readdirCallback(
path4,
options2,
cb2,
startTime
));
} : function go$readdir2(path4, options2, cb2, startTime) {
return fs$readdir(path4, options2, fs$readdirCallback(
path4,
options2,
cb2,
startTime
));
};
return go$readdir(path3, options, cb);
function fs$readdirCallback(path4, options2, cb2, startTime) {
return function(err, files) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([
go$readdir,
[path4, options2, cb2],
err,
startTime || Date.now(),
Date.now()
]);
else {
if (files && files.sort)
files.sort();
if (typeof cb2 === "function")
cb2.call(this, err, files);
}
};
}
}
if (process.version.substr(0, 4) === "v0.8") {
var legStreams = legacy(fs2);
ReadStream = legStreams.ReadStream;
WriteStream = legStreams.WriteStream;
}
var fs$ReadStream = fs2.ReadStream;
if (fs$ReadStream) {
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
ReadStream.prototype.open = ReadStream$open;
}
var fs$WriteStream = fs2.WriteStream;
if (fs$WriteStream) {
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
WriteStream.prototype.open = WriteStream$open;
}
Object.defineProperty(fs2, "ReadStream", {
get: function() {
return ReadStream;
},
set: function(val) {
ReadStream = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(fs2, "WriteStream", {
get: function() {
return WriteStream;
},
set: function(val) {
WriteStream = val;
},
enumerable: true,
configurable: true
});
var FileReadStream = ReadStream;
Object.defineProperty(fs2, "FileReadStream", {
get: function() {
return FileReadStream;
},
set: function(val) {
FileReadStream = val;
},
enumerable: true,
configurable: true
});
var FileWriteStream = WriteStream;
Object.defineProperty(fs2, "FileWriteStream", {
get: function() {
return FileWriteStream;
},
set: function(val) {
FileWriteStream = val;
},
enumerable: true,
configurable: true
});
function ReadStream(path3, options) {
if (this instanceof ReadStream)
return fs$ReadStream.apply(this, arguments), this;
else
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
}
function ReadStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
if (err) {
if (that.autoClose)
that.destroy();
that.emit("error", err);
} else {
that.fd = fd;
that.emit("open", fd);
that.read();
}
});
}
function WriteStream(path3, options) {
if (this instanceof WriteStream)
return fs$WriteStream.apply(this, arguments), this;
else
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
}
function WriteStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
if (err) {
that.destroy();
that.emit("error", err);
} else {
that.fd = fd;
that.emit("open", fd);
}
});
}
function createReadStream(path3, options) {
return new fs2.ReadStream(path3, options);
}
function createWriteStream2(path3, options) {
return new fs2.WriteStream(path3, options);
}
var fs$open = fs2.open;
fs2.open = open;
function open(path3, flags, mode, cb) {
if (typeof mode === "function")
cb = mode, mode = null;
return go$open(path3, flags, mode, cb);
function go$open(path4, flags2, mode2, cb2, startTime) {
return fs$open(path4, flags2, mode2, function(err, fd) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$open, [path4, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
return fs2;
}
function enqueue(elem) {
debug("ENQUEUE", elem[0].name, elem[1]);
fs[gracefulQueue].push(elem);
retry2();
}
var retryTimer;
function resetQueue() {
var now = Date.now();
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
if (fs[gracefulQueue][i].length > 2) {
fs[gracefulQueue][i][3] = now;
fs[gracefulQueue][i][4] = now;
}
}
retry2();
}
function retry2() {
clearTimeout(retryTimer);
retryTimer = void 0;
if (fs[gracefulQueue].length === 0)
return;
var elem = fs[gracefulQueue].shift();
var fn = elem[0];
var args = elem[1];
var err = elem[2];
var startTime = elem[3];
var lastTime = elem[4];
if (startTime === void 0) {
debug("RETRY", fn.name, args);
fn.apply(null, args);
} else if (Date.now() - startTime >= 6e4) {
debug("TIMEOUT", fn.name, args);
var cb = args.pop();
if (typeof cb === "function")
cb.call(null, err);
} else {
var sinceAttempt = Date.now() - lastTime;
var sinceStart = Math.max(lastTime - startTime, 1);
var desiredDelay = Math.min(sinceStart * 1.2, 100);
if (sinceAttempt >= desiredDelay) {
debug("RETRY", fn.name, args);
fn.apply(null, args.concat([startTime]));
} else {
fs[gracefulQueue].push(elem);
}
}
if (retryTimer === void 0) {
retryTimer = setTimeout(retry2, 0);
}
}
}
});
// node_modules/process-nextick-args/index.js
var require_process_nextick_args = __commonJS({
"node_modules/process-nextick-args/index.js"(exports, module2) {
"use strict";
if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
module2.exports = { nextTick: nextTick2 };
} else {
module2.exports = process;
}
function nextTick2(fn, arg1, arg2, arg3) {
if (typeof fn !== "function") {
throw new TypeError('"callback" argument must be a function');
}
var len = arguments.length;
var args, i;
switch (len) {
case 0:
case 1:
return process.nextTick(fn);
case 2:
return process.nextTick(function afterTickOne() {
fn.call(null, arg1);
});
case 3:
return process.nextTick(function afterTickTwo() {
fn.call(null, arg1, arg2);
});
case 4:
return process.nextTick(function afterTickThree() {
fn.call(null, arg1, arg2, arg3);
});
default:
args = new Array(len - 1);
i = 0;
while (i < args.length) {
args[i++] = arguments[i];
}
return process.nextTick(function afterTick() {
fn.apply(null, args);
});
}
}
}
});
// node_modules/isarray/index.js
var require_isarray = __commonJS({
"node_modules/isarray/index.js"(exports, module2) {
var toString = {}.toString;
module2.exports = Array.isArray || function(arr) {
return toString.call(arr) == "[object Array]";
};
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream.js
var require_stream = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/stream.js"(exports, module2) {
module2.exports = require("stream");
}
});
// node_modules/lazystream/node_modules/safe-buffer/index.js
var require_safe_buffer = __commonJS({
"node_modules/lazystream/node_modules/safe-buffer/index.js"(exports, module2) {
var buffer = require("buffer");
var Buffer2 = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
module2.exports = buffer;
} else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer2(arg, encodingOrOffset, length);
}
copyProps(Buffer2, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
throw new TypeError("Argument must not be a number");
}
return Buffer2(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
var buf = Buffer2(size);
if (fill !== void 0) {
if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return Buffer2(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return buffer.SlowBuffer(size);
};
}
});
// node_modules/core-util-is/lib/util.js
var require_util = __commonJS({
"node_modules/core-util-is/lib/util.js"(exports) {
function isArray(arg) {
if (Array.isArray) {
return Array.isArray(arg);
}
return objectToString(arg) === "[object Array]";
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === "boolean";
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === "number";
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === "string";
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === "symbol";
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return objectToString(re) === "[object RegExp]";
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === "object" && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return objectToString(d) === "[object Date]";
}
exports.isDate = isDate;
function isError(e) {
return objectToString(e) === "[object Error]" || e instanceof Error;
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === "function";
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
typeof arg === "undefined";
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = require("buffer").Buffer.isBuffer;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
}
});
// node_modules/inherits/inherits_browser.js
var require_inherits_browser = __commonJS({
"node_modules/inherits/inherits_browser.js"(exports, module2) {
if (typeof Object.create === "function") {
module2.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
};
} else {
module2.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
var TempCtor = function() {
};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
}
};
}
}
});
// node_modules/inherits/inherits.js
var require_inherits = __commonJS({
"node_modules/inherits/inherits.js"(exports, module2) {
try {
util = require("util");
if (typeof util.inherits !== "function")
throw "";
module2.exports = util.inherits;
} catch (e) {
module2.exports = require_inherits_browser();
}
var util;
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/BufferList.js
var require_BufferList = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports, module2) {
"use strict";
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var Buffer2 = require_safe_buffer().Buffer;
var util = require("util");
function copyBuffer(src, target, offset) {
src.copy(target, offset);
}
module2.exports = function() {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
BufferList.prototype.push = function push(v) {
var entry = { data: v, next: null };
if (this.length > 0)
this.tail.next = entry;
else
this.head = entry;
this.tail = entry;
++this.length;
};
BufferList.prototype.unshift = function unshift(v) {
var entry = { data: v, next: this.head };
if (this.length === 0)
this.tail = entry;
this.head = entry;
++this.length;
};
BufferList.prototype.shift = function shift() {
if (this.length === 0)
return;
var ret = this.head.data;
if (this.length === 1)
this.head = this.tail = null;
else
this.head = this.head.next;
--this.length;
return ret;
};
BufferList.prototype.clear = function clear() {
this.head = this.tail = null;
this.length = 0;
};
BufferList.prototype.join = function join(s) {
if (this.length === 0)
return "";
var p = this.head;
var ret = "" + p.data;
while (p = p.next) {
ret += s + p.data;
}
return ret;
};
BufferList.prototype.concat = function concat2(n) {
if (this.length === 0)
return Buffer2.alloc(0);
if (this.length === 1)
return this.head.data;
var ret = Buffer2.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
};
return BufferList;
}();
if (util && util.inspect && util.inspect.custom) {
module2.exports.prototype[util.inspect.custom] = function() {
var obj = util.inspect({ length: this.length });
return this.constructor.name + " " + obj;
};
}
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/destroy.js
var require_destroy = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
function destroy(err, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
pna.nextTick(emitErrorNT, this, err);
}
return this;
}
if (this._readableState) {
this._readableState.destroyed = true;
}
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err || null, function(err2) {
if (!cb && err2) {
pna.nextTick(emitErrorNT, _this, err2);
if (_this._writableState) {
_this._writableState.errorEmitted = true;
}
} else if (cb) {
cb(err2);
}
});
return this;
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
function emitErrorNT(self2, err) {
self2.emit("error", err);
}
module2.exports = {
destroy,
undestroy
};
}
});
// node_modules/util-deprecate/node.js
var require_node = __commonJS({
"node_modules/util-deprecate/node.js"(exports, module2) {
module2.exports = require("util").deprecate;
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/_stream_writable.js
var require_stream_writable = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/_stream_writable.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
module2.exports = Writable;
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function() {
onCorkedFinish(_this, state);
};
}
var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
var Duplex;
Writable.WritableState = WritableState;
var util = Object.create(require_util());
util.inherits = require_inherits();
var internalUtil = {
deprecate: require_node()
};
var Stream = require_stream();
var Buffer2 = require_safe_buffer().Buffer;
var OurUint8Array = global.Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var destroyImpl = require_destroy();
util.inherits(Writable, Stream);
function nop() {
}
function WritableState(options, stream) {
Duplex = Duplex || require_stream_duplex();
options = options || {};
var isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.writableObjectMode;
var hwm = options.highWaterMark;
var writableHwm = options.writableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
if (hwm || hwm === 0)
this.highWaterMark = hwm;
else if (isDuplex && (writableHwm || writableHwm === 0))
this.highWaterMark = writableHwm;
else
this.highWaterMark = defaultHwm;
this.highWaterMark = Math.floor(this.highWaterMark);
this.finalCalled = false;
this.needDrain = false;
this.ending = false;
this.ended = false;
this.finished = false;
this.destroyed = false;
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.length = 0;
this.writing = false;
this.corked = 0;
this.sync = true;
this.bufferProcessing = false;
this.onwrite = function(er) {
onwrite(stream, er);
};
this.writecb = null;
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
this.pendingcb = 0;
this.prefinished = false;
this.errorEmitted = false;
this.bufferedRequestCount = 0;
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function() {
try {
Object.defineProperty(WritableState.prototype, "buffer", {
get: internalUtil.deprecate(function() {
return this.getBuffer();
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
});
} catch (_2) {
}
})();
var realHasInstance;
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function(object) {
if (realHasInstance.call(this, object))
return true;
if (this !== Writable)
return false;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function(object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || require_stream_duplex();
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
return new Writable(options);
}
this._writableState = new WritableState(options, this);
this.writable = true;
if (options) {
if (typeof options.write === "function")
this._write = options.write;
if (typeof options.writev === "function")
this._writev = options.writev;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
if (typeof options.final === "function")
this._final = options.final;
}
Stream.call(this);
}
Writable.prototype.pipe = function() {
this.emit("error", new Error("Cannot pipe, not readable"));
};
function writeAfterEnd(stream, cb) {
var er = new Error("write after end");
stream.emit("error", er);
pna.nextTick(cb, er);
}
function validChunk(stream, state, chunk, cb) {
var valid = true;
var er = false;
if (chunk === null) {
er = new TypeError("May not write null values to stream");
} else if (typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
er = new TypeError("Invalid non-string/buffer chunk");
}
if (er) {
stream.emit("error", er);
pna.nextTick(cb, er);
valid = false;
}
return valid;
}
Writable.prototype.write = function(chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
var isBuf = !state.objectMode && _isUint8Array(chunk);
if (isBuf && !Buffer2.isBuffer(chunk)) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (isBuf)
encoding = "buffer";
else if (!encoding)
encoding = state.defaultEncoding;
if (typeof cb !== "function")
cb = nop;
if (state.ended)
writeAfterEnd(this, cb);
else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
return ret;
};
Writable.prototype.cork = function() {
var state = this._writableState;
state.corked++;
};
Writable.prototype.uncork = function() {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest)
clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
if (typeof encoding === "string")
encoding = encoding.toLowerCase();
if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
throw new TypeError("Unknown encoding: " + encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
chunk = Buffer2.from(chunk, encoding);
}
return chunk;
}
Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function() {
return this._writableState.highWaterMark;
}
});
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state, chunk, encoding);
if (chunk !== newChunk) {
isBuf = true;
encoding = "buffer";
chunk = newChunk;
}
}
var len = state.objectMode ? 1 : chunk.length;
state.length += len;
var ret = state.length < state.highWaterMark;
if (!ret)
state.needDrain = true;
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = {
chunk,
encoding,
isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
return ret;
}
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writelen = len;
state.writecb = cb;
state.writing = true;
state.sync = true;
if (writev)
stream._writev(chunk, state.onwrite);
else
stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync) {
pna.nextTick(cb, er);
pna.nextTick(finishMaybe, stream, state);
stream._writableState.errorEmitted = true;
stream.emit("error", er);
} else {
cb(er);
stream._writableState.errorEmitted = true;
stream.emit("error", er);
finishMaybe(stream, state);
}
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
onwriteStateUpdate(state);
if (er)
onwriteError(stream, state, sync, er, cb);
else {
var finished = needFinish(state);
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
asyncWrite(afterWrite, stream, state, finished, cb);
} else {
afterWrite(stream, state, finished, cb);
}
}
}
function afterWrite(stream, state, finished, cb) {
if (!finished)
onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
}
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit("drain");
}
}
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && entry && entry.next) {
var l = state.bufferedRequestCount;
var buffer = new Array(l);
var holder = state.corkedRequestsFree;
holder.entry = entry;
var count = 0;
var allBuffers = true;
while (entry) {
buffer[count] = entry;
if (!entry.isBuf)
allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state, true, state.length, buffer, "", holder.finish);
state.pendingcb++;
state.lastBufferedRequest = null;
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
state.bufferedRequestCount = 0;
} else {
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
state.bufferedRequestCount--;
if (state.writing) {
break;
}
}
if (entry === null)
state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
Writable.prototype._write = function(chunk, encoding, cb) {
cb(new Error("_write() is not implemented"));
};
Writable.prototype._writev = null;
Writable.prototype.end = function(chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === "function") {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (chunk !== null && chunk !== void 0)
this.write(chunk, encoding);
if (state.corked) {
state.corked = 1;
this.uncork();
}
if (!state.ending && !state.finished)
endWritable(this, state, cb);
};
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function callFinal(stream, state) {
stream._final(function(err) {
state.pendingcb--;
if (err) {
stream.emit("error", err);
}
state.prefinished = true;
stream.emit("prefinish");
finishMaybe(stream, state);
});
}
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === "function") {
state.pendingcb++;
state.finalCalled = true;
pna.nextTick(callFinal, stream, state);
} else {
state.prefinished = true;
stream.emit("prefinish");
}
}
}
function finishMaybe(stream, state) {
var need = needFinish(state);
if (need) {
prefinish(stream, state);
if (state.pendingcb === 0) {
state.finished = true;
stream.emit("finish");
}
}
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
if (state.finished)
pna.nextTick(cb);
else
stream.once("finish", cb);
}
state.ended = true;
stream.writable = false;
}
function onCorkedFinish(corkReq, state, err) {
var entry = corkReq.entry;
corkReq.entry = null;
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
}
if (state.corkedRequestsFree) {
state.corkedRequestsFree.next = corkReq;
} else {
state.corkedRequestsFree = corkReq;
}
}
Object.defineProperty(Writable.prototype, "destroyed", {
get: function() {
if (this._writableState === void 0) {
return false;
}
return this._writableState.destroyed;
},
set: function(value) {
if (!this._writableState) {
return;
}
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
Writable.prototype._destroy = function(err, cb) {
this.end();
cb(err);
};
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/_stream_duplex.js
var require_stream_duplex = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/_stream_duplex.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
var objectKeys = Object.keys || function(obj) {
var keys2 = [];
for (var key in obj) {
keys2.push(key);
}
return keys2;
};
module2.exports = Duplex;
var util = Object.create(require_util());
util.inherits = require_inherits();
var Readable = require_stream_readable();
var Writable = require_stream_writable();
util.inherits(Duplex, Readable);
{
keys = objectKeys(Writable.prototype);
for (v = 0; v < keys.length; v++) {
method = keys[v];
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
}
}
var keys;
var method;
var v;
function Duplex(options) {
if (!(this instanceof Duplex))
return new Duplex(options);
Readable.call(this, options);
Writable.call(this, options);
if (options && options.readable === false)
this.readable = false;
if (options && options.writable === false)
this.writable = false;
this.allowHalfOpen = true;
if (options && options.allowHalfOpen === false)
this.allowHalfOpen = false;
this.once("end", onend);
}
Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function() {
return this._writableState.highWaterMark;
}
});
function onend() {
if (this.allowHalfOpen || this._writableState.ended)
return;
pna.nextTick(onEndNT, this);
}
function onEndNT(self2) {
self2.end();
}
Object.defineProperty(Duplex.prototype, "destroyed", {
get: function() {
if (this._readableState === void 0 || this._writableState === void 0) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set: function(value) {
if (this._readableState === void 0 || this._writableState === void 0) {
return;
}
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
Duplex.prototype._destroy = function(err, cb) {
this.push(null);
this.end();
pna.nextTick(cb, err);
};
}
});
// node_modules/lazystream/node_modules/string_decoder/lib/string_decoder.js
var require_string_decoder = __commonJS({
"node_modules/lazystream/node_modules/string_decoder/lib/string_decoder.js"(exports) {
"use strict";
var Buffer2 = require_safe_buffer().Buffer;
var isEncoding = Buffer2.isEncoding || function(encoding) {
encoding = "" + encoding;
switch (encoding && encoding.toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
case "raw":
return true;
default:
return false;
}
};
function _normalizeEncoding(enc) {
if (!enc)
return "utf8";
var retried;
while (true) {
switch (enc) {
case "utf8":
case "utf-8":
return "utf8";
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return "utf16le";
case "latin1":
case "binary":
return "latin1";
case "base64":
case "ascii":
case "hex":
return enc;
default:
if (retried)
return;
enc = ("" + enc).toLowerCase();
retried = true;
}
}
}
function normalizeEncoding(enc) {
var nenc = _normalizeEncoding(enc);
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc)))
throw new Error("Unknown encoding: " + enc);
return nenc || enc;
}
exports.StringDecoder = StringDecoder;
function StringDecoder(encoding) {
this.encoding = normalizeEncoding(encoding);
var nb;
switch (this.encoding) {
case "utf16le":
this.text = utf16Text;
this.end = utf16End;
nb = 4;
break;
case "utf8":
this.fillLast = utf8FillLast;
nb = 4;
break;
case "base64":
this.text = base64Text;
this.end = base64End;
nb = 3;
break;
default:
this.write = simpleWrite;
this.end = simpleEnd;
return;
}
this.lastNeed = 0;
this.lastTotal = 0;
this.lastChar = Buffer2.allocUnsafe(nb);
}
StringDecoder.prototype.write = function(buf) {
if (buf.length === 0)
return "";
var r;
var i;
if (this.lastNeed) {
r = this.fillLast(buf);
if (r === void 0)
return "";
i = this.lastNeed;
this.lastNeed = 0;
} else {
i = 0;
}
if (i < buf.length)
return r ? r + this.text(buf, i) : this.text(buf, i);
return r || "";
};
StringDecoder.prototype.end = utf8End;
StringDecoder.prototype.text = utf8Text;
StringDecoder.prototype.fillLast = function(buf) {
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
this.lastNeed -= buf.length;
};
function utf8CheckByte(byte) {
if (byte <= 127)
return 0;
else if (byte >> 5 === 6)
return 2;
else if (byte >> 4 === 14)
return 3;
else if (byte >> 3 === 30)
return 4;
return byte >> 6 === 2 ? -1 : -2;
}
function utf8CheckIncomplete(self2, buf, i) {
var j = buf.length - 1;
if (j < i)
return 0;
var nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 1;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 2;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) {
if (nb === 2)
nb = 0;
else
self2.lastNeed = nb - 3;
}
return nb;
}
return 0;
}
function utf8CheckExtraBytes(self2, buf, p) {
if ((buf[0] & 192) !== 128) {
self2.lastNeed = 0;
return "\uFFFD";
}
if (self2.lastNeed > 1 && buf.length > 1) {
if ((buf[1] & 192) !== 128) {
self2.lastNeed = 1;
return "\uFFFD";
}
if (self2.lastNeed > 2 && buf.length > 2) {
if ((buf[2] & 192) !== 128) {
self2.lastNeed = 2;
return "\uFFFD";
}
}
}
}
function utf8FillLast(buf) {
var p = this.lastTotal - this.lastNeed;
var r = utf8CheckExtraBytes(this, buf, p);
if (r !== void 0)
return r;
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, p, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, p, 0, buf.length);
this.lastNeed -= buf.length;
}
function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed)
return buf.toString("utf8", i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString("utf8", i, end);
}
function utf8End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + "\uFFFD";
return r;
}
function utf16Text(buf, i) {
if ((buf.length - i) % 2 === 0) {
var r = buf.toString("utf16le", i);
if (r) {
var c = r.charCodeAt(r.length - 1);
if (c >= 55296 && c <= 56319) {
this.lastNeed = 2;
this.lastTotal = 4;
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
return r.slice(0, -1);
}
}
return r;
}
this.lastNeed = 1;
this.lastTotal = 2;
this.lastChar[0] = buf[buf.length - 1];
return buf.toString("utf16le", i, buf.length - 1);
}
function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString("utf16le", 0, end);
}
return r;
}
function base64Text(buf, i) {
var n = (buf.length - i) % 3;
if (n === 0)
return buf.toString("base64", i);
this.lastNeed = 3 - n;
this.lastTotal = 3;
if (n === 1) {
this.lastChar[0] = buf[buf.length - 1];
} else {
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
}
return buf.toString("base64", i, buf.length - n);
}
function base64End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
return r;
}
function simpleWrite(buf) {
return buf.toString(this.encoding);
}
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : "";
}
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js
var require_stream_readable = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
module2.exports = Readable;
var isArray = require_isarray();
var Duplex;
Readable.ReadableState = ReadableState;
var EE = require("events").EventEmitter;
var EElistenerCount = function(emitter, type) {
return emitter.listeners(type).length;
};
var Stream = require_stream();
var Buffer2 = require_safe_buffer().Buffer;
var OurUint8Array = global.Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var util = Object.create(require_util());
util.inherits = require_inherits();
var debugUtil = require("util");
var debug = void 0;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog("stream");
} else {
debug = function() {
};
}
var BufferList = require_BufferList();
var destroyImpl = require_destroy();
var StringDecoder;
util.inherits(Readable, Stream);
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
function prependListener(emitter, event, fn) {
if (typeof emitter.prependListener === "function")
return emitter.prependListener(event, fn);
if (!emitter._events || !emitter._events[event])
emitter.on(event, fn);
else if (isArray(emitter._events[event]))
emitter._events[event].unshift(fn);
else
emitter._events[event] = [fn, emitter._events[event]];
}
function ReadableState(options, stream) {
Duplex = Duplex || require_stream_duplex();
options = options || {};
var isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
var hwm = options.highWaterMark;
var readableHwm = options.readableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
if (hwm || hwm === 0)
this.highWaterMark = hwm;
else if (isDuplex && (readableHwm || readableHwm === 0))
this.highWaterMark = readableHwm;
else
this.highWaterMark = defaultHwm;
this.highWaterMark = Math.floor(this.highWaterMark);
this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
this.flowing = null;
this.ended = false;
this.endEmitted = false;
this.reading = false;
this.sync = true;
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
this.destroyed = false;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.awaitDrain = 0;
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder)
StringDecoder = require_string_decoder().StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
Duplex = Duplex || require_stream_duplex();
if (!(this instanceof Readable))
return new Readable(options);
this._readableState = new ReadableState(options, this);
this.readable = true;
if (options) {
if (typeof options.read === "function")
this._read = options.read;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
}
Stream.call(this);
}
Object.defineProperty(Readable.prototype, "destroyed", {
get: function() {
if (this._readableState === void 0) {
return false;
}
return this._readableState.destroyed;
},
set: function(value) {
if (!this._readableState) {
return;
}
this._readableState.destroyed = value;
}
});
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
Readable.prototype._destroy = function(err, cb) {
this.push(null);
cb(err);
};
Readable.prototype.push = function(chunk, encoding) {
var state = this._readableState;
var skipChunkCheck;
if (!state.objectMode) {
if (typeof chunk === "string") {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
chunk = Buffer2.from(chunk, encoding);
encoding = "";
}
skipChunkCheck = true;
}
} else {
skipChunkCheck = true;
}
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
};
Readable.prototype.unshift = function(chunk) {
return readableAddChunk(this, chunk, null, true, false);
};
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
var state = stream._readableState;
if (chunk === null) {
state.reading = false;
onEofChunk(stream, state);
} else {
var er;
if (!skipChunkCheck)
er = chunkInvalid(state, chunk);
if (er) {
stream.emit("error", er);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (addToFront) {
if (state.endEmitted)
stream.emit("error", new Error("stream.unshift() after end event"));
else
addChunk(stream, state, chunk, true);
} else if (state.ended) {
stream.emit("error", new Error("stream.push() after EOF"));
} else {
state.reading = false;
if (state.decoder && !encoding) {
chunk = state.decoder.write(chunk);
if (state.objectMode || chunk.length !== 0)
addChunk(stream, state, chunk, false);
else
maybeReadMore(stream, state);
} else {
addChunk(stream, state, chunk, false);
}
}
} else if (!addToFront) {
state.reading = false;
}
}
return needMoreData(state);
}
function addChunk(stream, state, chunk, addToFront) {
if (state.flowing && state.length === 0 && !state.sync) {
stream.emit("data", chunk);
stream.read(0);
} else {
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront)
state.buffer.unshift(chunk);
else
state.buffer.push(chunk);
if (state.needReadable)
emitReadable(stream);
}
maybeReadMore(stream, state);
}
function chunkInvalid(state, chunk) {
var er;
if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
er = new TypeError("Invalid non-string/buffer chunk");
}
return er;
}
function needMoreData(state) {
return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
}
Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
Readable.prototype.setEncoding = function(enc) {
if (!StringDecoder)
StringDecoder = require_string_decoder().StringDecoder;
this._readableState.decoder = new StringDecoder(enc);
this._readableState.encoding = enc;
return this;
};
var MAX_HWM = 8388608;
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
n--;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
n++;
}
return n;
}
function howMuchToRead(n, state) {
if (n <= 0 || state.length === 0 && state.ended)
return 0;
if (state.objectMode)
return 1;
if (n !== n) {
if (state.flowing && state.length)
return state.buffer.head.data.length;
else
return state.length;
}
if (n > state.highWaterMark)
state.highWaterMark = computeNewHighWaterMark(n);
if (n <= state.length)
return n;
if (!state.ended) {
state.needReadable = true;
return 0;
}
return state.length;
}
Readable.prototype.read = function(n) {
debug("read", n);
n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
if (n !== 0)
state.emittedReadable = false;
if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
debug("read: emitReadable", state.length, state.ended);
if (state.length === 0 && state.ended)
endReadable(this);
else
emitReadable(this);
return null;
}
n = howMuchToRead(n, state);
if (n === 0 && state.ended) {
if (state.length === 0)
endReadable(this);
return null;
}
var doRead = state.needReadable;
debug("need readable", doRead);
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug("length less than watermark", doRead);
}
if (state.ended || state.reading) {
doRead = false;
debug("reading or ended", doRead);
} else if (doRead) {
debug("do read");
state.reading = true;
state.sync = true;
if (state.length === 0)
state.needReadable = true;
this._read(state.highWaterMark);
state.sync = false;
if (!state.reading)
n = howMuchToRead(nOrig, state);
}
var ret;
if (n > 0)
ret = fromList(n, state);
else
ret = null;
if (ret === null) {
state.needReadable = true;
n = 0;
} else {
state.length -= n;
}
if (state.length === 0) {
if (!state.ended)
state.needReadable = true;
if (nOrig !== n && state.ended)
endReadable(this);
}
if (ret !== null)
this.emit("data", ret);
return ret;
};
function onEofChunk(stream, state) {
if (state.ended)
return;
if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
}
}
state.ended = true;
emitReadable(stream);
}
function emitReadable(stream) {
var state = stream._readableState;
state.needReadable = false;
if (!state.emittedReadable) {
debug("emitReadable", state.flowing);
state.emittedReadable = true;
if (state.sync)
pna.nextTick(emitReadable_, stream);
else
emitReadable_(stream);
}
}
function emitReadable_(stream) {
debug("emit readable");
stream.emit("readable");
flow(stream);
}
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
pna.nextTick(maybeReadMore_, stream, state);
}
}
function maybeReadMore_(stream, state) {
var len = state.length;
while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
debug("maybeReadMore read 0");
stream.read(0);
if (len === state.length)
break;
else
len = state.length;
}
state.readingMore = false;
}
Readable.prototype._read = function(n) {
this.emit("error", new Error("_read() is not implemented"));
};
Readable.prototype.pipe = function(dest, pipeOpts) {
var src = this;
var state = this._readableState;
switch (state.pipesCount) {
case 0:
state.pipes = dest;
break;
case 1:
state.pipes = [state.pipes, dest];
break;
default:
state.pipes.push(dest);
break;
}
state.pipesCount += 1;
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
var endFn = doEnd ? onend : unpipe;
if (state.endEmitted)
pna.nextTick(endFn);
else
src.once("end", endFn);
dest.on("unpipe", onunpipe);
function onunpipe(readable, unpipeInfo) {
debug("onunpipe");
if (readable === src) {
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
unpipeInfo.hasUnpiped = true;
cleanup();
}
}
}
function onend() {
debug("onend");
dest.end();
}
var ondrain = pipeOnDrain(src);
dest.on("drain", ondrain);
var cleanedUp = false;
function cleanup() {
debug("cleanup");
dest.removeListener("close", onclose);
dest.removeListener("finish", onfinish);
dest.removeListener("drain", ondrain);
dest.removeListener("error", onerror);
dest.removeListener("unpipe", onunpipe);
src.removeListener("end", onend);
src.removeListener("end", unpipe);
src.removeListener("data", ondata);
cleanedUp = true;
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
ondrain();
}
var increasedAwaitDrain = false;
src.on("data", ondata);
function ondata(chunk) {
debug("ondata");
increasedAwaitDrain = false;
var ret = dest.write(chunk);
if (false === ret && !increasedAwaitDrain) {
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug("false write response, pause", src._readableState.awaitDrain);
src._readableState.awaitDrain++;
increasedAwaitDrain = true;
}
src.pause();
}
}
function onerror(er) {
debug("onerror", er);
unpipe();
dest.removeListener("error", onerror);
if (EElistenerCount(dest, "error") === 0)
dest.emit("error", er);
}
prependListener(dest, "error", onerror);
function onclose() {
dest.removeListener("finish", onfinish);
unpipe();
}
dest.once("close", onclose);
function onfinish() {
debug("onfinish");
dest.removeListener("close", onclose);
unpipe();
}
dest.once("finish", onfinish);
function unpipe() {
debug("unpipe");
src.unpipe(dest);
}
dest.emit("pipe", src);
if (!state.flowing) {
debug("pipe resume");
src.resume();
}
return dest;
};
function pipeOnDrain(src) {
return function() {
var state = src._readableState;
debug("pipeOnDrain", state.awaitDrain);
if (state.awaitDrain)
state.awaitDrain--;
if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
state.flowing = true;
flow(src);
}
};
}
Readable.prototype.unpipe = function(dest) {
var state = this._readableState;
var unpipeInfo = { hasUnpiped: false };
if (state.pipesCount === 0)
return this;
if (state.pipesCount === 1) {
if (dest && dest !== state.pipes)
return this;
if (!dest)
dest = state.pipes;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
if (dest)
dest.emit("unpipe", this, unpipeInfo);
return this;
}
if (!dest) {
var dests = state.pipes;
var len = state.pipesCount;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
for (var i = 0; i < len; i++) {
dests[i].emit("unpipe", this, unpipeInfo);
}
return this;
}
var index2 = indexOf(state.pipes, dest);
if (index2 === -1)
return this;
state.pipes.splice(index2, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1)
state.pipes = state.pipes[0];
dest.emit("unpipe", this, unpipeInfo);
return this;
};
Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
if (ev === "data") {
if (this._readableState.flowing !== false)
this.resume();
} else if (ev === "readable") {
var state = this._readableState;
if (!state.endEmitted && !state.readableListening) {
state.readableListening = state.needReadable = true;
state.emittedReadable = false;
if (!state.reading) {
pna.nextTick(nReadingNextTick, this);
} else if (state.length) {
emitReadable(this);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
function nReadingNextTick(self2) {
debug("readable nexttick read 0");
self2.read(0);
}
Readable.prototype.resume = function() {
var state = this._readableState;
if (!state.flowing) {
debug("resume");
state.flowing = true;
resume(this, state);
}
return this;
};
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
pna.nextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
if (!state.reading) {
debug("resume read 0");
stream.read(0);
}
state.resumeScheduled = false;
state.awaitDrain = 0;
stream.emit("resume");
flow(stream);
if (state.flowing && !state.reading)
stream.read(0);
}
Readable.prototype.pause = function() {
debug("call pause flowing=%j", this._readableState.flowing);
if (false !== this._readableState.flowing) {
debug("pause");
this._readableState.flowing = false;
this.emit("pause");
}
return this;
};
function flow(stream) {
var state = stream._readableState;
debug("flow", state.flowing);
while (state.flowing && stream.read() !== null) {
}
}
Readable.prototype.wrap = function(stream) {
var _this = this;
var state = this._readableState;
var paused = false;
stream.on("end", function() {
debug("wrapped end");
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length)
_this.push(chunk);
}
_this.push(null);
});
stream.on("data", function(chunk) {
debug("wrapped data");
if (state.decoder)
chunk = state.decoder.write(chunk);
if (state.objectMode && (chunk === null || chunk === void 0))
return;
else if (!state.objectMode && (!chunk || !chunk.length))
return;
var ret = _this.push(chunk);
if (!ret) {
paused = true;
stream.pause();
}
});
for (var i in stream) {
if (this[i] === void 0 && typeof stream[i] === "function") {
this[i] = function(method) {
return function() {
return stream[method].apply(stream, arguments);
};
}(i);
}
}
for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}
this._read = function(n2) {
debug("wrapped _read", n2);
if (paused) {
paused = false;
stream.resume();
}
};
return this;
};
Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function() {
return this._readableState.highWaterMark;
}
});
Readable._fromList = fromList;
function fromList(n, state) {
if (state.length === 0)
return null;
var ret;
if (state.objectMode)
ret = state.buffer.shift();
else if (!n || n >= state.length) {
if (state.decoder)
ret = state.buffer.join("");
else if (state.buffer.length === 1)
ret = state.buffer.head.data;
else
ret = state.buffer.concat(state.length);
state.buffer.clear();
} else {
ret = fromListPartial(n, state.buffer, state.decoder);
}
return ret;
}
function fromListPartial(n, list, hasStrings) {
var ret;
if (n < list.head.data.length) {
ret = list.head.data.slice(0, n);
list.head.data = list.head.data.slice(n);
} else if (n === list.head.data.length) {
ret = list.shift();
} else {
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
}
return ret;
}
function copyFromBufferString(n, list) {
var p = list.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length)
ret += str;
else
ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next)
list.head = p.next;
else
list.head = list.tail = null;
} else {
list.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
list.length -= c;
return ret;
}
function copyFromBuffer(n, list) {
var ret = Buffer2.allocUnsafe(n);
var p = list.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next)
list.head = p.next;
else
list.head = list.tail = null;
} else {
list.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
list.length -= c;
return ret;
}
function endReadable(stream) {
var state = stream._readableState;
if (state.length > 0)
throw new Error('"endReadable()" called on non-empty stream');
if (!state.endEmitted) {
state.ended = true;
pna.nextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit("end");
}
}
function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x)
return i;
}
return -1;
}
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/_stream_transform.js
var require_stream_transform = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/_stream_transform.js"(exports, module2) {
"use strict";
module2.exports = Transform;
var Duplex = require_stream_duplex();
var util = Object.create(require_util());
util.inherits = require_inherits();
util.inherits(Transform, Duplex);
function afterTransform(er, data) {
var ts = this._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (!cb) {
return this.emit("error", new Error("write callback called multiple times"));
}
ts.writechunk = null;
ts.writecb = null;
if (data != null)
this.push(data);
cb(er);
var rs = this._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
this._read(rs.highWaterMark);
}
}
function Transform(options) {
if (!(this instanceof Transform))
return new Transform(options);
Duplex.call(this, options);
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: null
};
this._readableState.needReadable = true;
this._readableState.sync = false;
if (options) {
if (typeof options.transform === "function")
this._transform = options.transform;
if (typeof options.flush === "function")
this._flush = options.flush;
}
this.on("prefinish", prefinish);
}
function prefinish() {
var _this = this;
if (typeof this._flush === "function") {
this._flush(function(er, data) {
done(_this, er, data);
});
} else {
done(this, null, null);
}
}
Transform.prototype.push = function(chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
Transform.prototype._transform = function(chunk, encoding, cb) {
throw new Error("_transform() is not implemented");
};
Transform.prototype._write = function(chunk, encoding, cb) {
var ts = this._transformState;
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
this._read(rs.highWaterMark);
}
};
Transform.prototype._read = function(n) {
var ts = this._transformState;
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
ts.needTransform = true;
}
};
Transform.prototype._destroy = function(err, cb) {
var _this2 = this;
Duplex.prototype._destroy.call(this, err, function(err2) {
cb(err2);
_this2.emit("close");
});
};
function done(stream, er, data) {
if (er)
return stream.emit("error", er);
if (data != null)
stream.push(data);
if (stream._writableState.length)
throw new Error("Calling transform done when ws.length != 0");
if (stream._transformState.transforming)
throw new Error("Calling transform done when still transforming");
return stream.push(null);
}
}
});
// node_modules/lazystream/node_modules/readable-stream/lib/_stream_passthrough.js
var require_stream_passthrough = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module2) {
"use strict";
module2.exports = PassThrough;
var Transform = require_stream_transform();
var util = Object.create(require_util());
util.inherits = require_inherits();
util.inherits(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough))
return new PassThrough(options);
Transform.call(this, options);
}
PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
};
}
});
// node_modules/lazystream/node_modules/readable-stream/readable.js
var require_readable = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/readable.js"(exports, module2) {
var Stream = require("stream");
if (process.env.READABLE_STREAM === "disable" && Stream) {
module2.exports = Stream;
exports = module2.exports = Stream.Readable;
exports.Readable = Stream.Readable;
exports.Writable = Stream.Writable;
exports.Duplex = Stream.Duplex;
exports.Transform = Stream.Transform;
exports.PassThrough = Stream.PassThrough;
exports.Stream = Stream;
} else {
exports = module2.exports = require_stream_readable();
exports.Stream = Stream || exports;
exports.Readable = exports;
exports.Writable = require_stream_writable();
exports.Duplex = require_stream_duplex();
exports.Transform = require_stream_transform();
exports.PassThrough = require_stream_passthrough();
}
}
});
// node_modules/lazystream/node_modules/readable-stream/passthrough.js
var require_passthrough = __commonJS({
"node_modules/lazystream/node_modules/readable-stream/passthrough.js"(exports, module2) {
module2.exports = require_readable().PassThrough;
}
});
// node_modules/lazystream/lib/lazystream.js
var require_lazystream = __commonJS({
"node_modules/lazystream/lib/lazystream.js"(exports, module2) {
var util = require("util");
var PassThrough = require_passthrough();
module2.exports = {
Readable,
Writable
};
util.inherits(Readable, PassThrough);
util.inherits(Writable, PassThrough);
function beforeFirstCall(instance, method, callback) {
instance[method] = function() {
delete instance[method];
callback.apply(this, arguments);
return this[method].apply(this, arguments);
};
}
function Readable(fn, options) {
if (!(this instanceof Readable))
return new Readable(fn, options);
PassThrough.call(this, options);
beforeFirstCall(this, "_read", function() {
var source = fn.call(this, options);
var emit = this.emit.bind(this, "error");
source.on("error", emit);
source.pipe(this);
});
this.emit("readable");
}
function Writable(fn, options) {
if (!(this instanceof Writable))
return new Writable(fn, options);
PassThrough.call(this, options);
beforeFirstCall(this, "_write", function() {
var destination = fn.call(this, options);
var emit = this.emit.bind(this, "error");
destination.on("error", emit);
this.pipe(destination);
});
this.emit("writable");
}
}
});
// node_modules/normalize-path/index.js
var require_normalize_path = __commonJS({
"node_modules/normalize-path/index.js"(exports, module2) {
module2.exports = function(path3, stripTrailing) {
if (typeof path3 !== "string") {
throw new TypeError("expected path to be a string");
}
if (path3 === "\\" || path3 === "/")
return "/";
var len = path3.length;
if (len <= 1)
return path3;
var prefix = "";
if (len > 4 && path3[3] === "\\") {
var ch = path3[2];
if ((ch === "?" || ch === ".") && path3.slice(0, 2) === "\\\\") {
path3 = path3.slice(2);
prefix = "//";
}
}
var segs = path3.split(/[/\\]+/);
if (stripTrailing !== false && segs[segs.length - 1] === "") {
segs.pop();
}
return prefix + segs.join("/");
};
}
});
// node_modules/lodash.defaults/index.js
var require_lodash = __commonJS({
"node_modules/lodash.defaults/index.js"(exports, module2) {
var MAX_SAFE_INTEGER = 9007199254740991;
var argsTag = "[object Arguments]";
var funcTag = "[object Function]";
var genTag = "[object GeneratorFunction]";
var reIsUint = /^(?:0|[1-9]\d*)$/;
function apply2(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
function baseTimes(n, iteratee) {
var index2 = -1, result = Array(n);
while (++index2 < n) {
result[index2] = iteratee(index2);
}
return result;
}
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var objectToString = objectProto.toString;
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
var nativeMax = Math.max;
function arrayLikeKeys(value, inherited) {
var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
var length = result.length, skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
function assignInDefaults(objValue, srcValue, key, object) {
if (objValue === void 0 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) {
return srcValue;
}
return objValue;
}
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
object[key] = value;
}
}
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object), result = [];
for (var key in object) {
if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
function baseRest(func, start) {
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
return function() {
var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array(length);
while (++index2 < length) {
array[index2] = args[start + index2];
}
index2 = -1;
var otherArgs = Array(start + 1);
while (++index2 < start) {
otherArgs[index2] = args[index2];
}
otherArgs[start] = array;
return apply2(func, this, otherArgs);
};
}
function copyObject(source, props, object, customizer) {
object || (object = {});
var index2 = -1, length = props.length;
while (++index2 < length) {
var key = props[index2];
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
assignValue(object, key, newValue === void 0 ? source[key] : newValue);
}
return object;
}
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index2 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? void 0 : customizer;
length = 1;
}
object = Object(object);
while (++index2 < length) {
var source = sources[index2];
if (source) {
assigner(object, source, index2, customizer);
}
}
return object;
});
}
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
}
function isIterateeCall(value, index2, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index2;
if (type == "number" ? isArrayLike2(object) && isIndex(index2, object.length) : type == "string" && index2 in object) {
return eq(object[index2], value);
}
return false;
}
function isPrototype(value) {
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
return value === proto;
}
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
function eq(value, other) {
return value === other || value !== value && other !== other;
}
function isArguments(value) {
return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
}
var isArray = Array.isArray;
function isArrayLike2(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike2(value);
}
function isFunction(value) {
var tag = isObject(value) ? objectToString.call(value) : "";
return tag == funcTag || tag == genTag;
}
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
function isObject(value) {
var type = typeof value;
return !!value && (type == "object" || type == "function");
}
function isObjectLike(value) {
return !!value && typeof value == "object";
}
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keysIn(source), object, customizer);
});
var defaults = baseRest(function(args) {
args.push(void 0, assignInDefaults);
return apply2(assignInWith, void 0, args);
});
function keysIn(object) {
return isArrayLike2(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
module2.exports = defaults;
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/stream.js
var require_stream2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/stream.js"(exports, module2) {
module2.exports = require("stream");
}
});
// node_modules/archiver-utils/node_modules/safe-buffer/index.js
var require_safe_buffer2 = __commonJS({
"node_modules/archiver-utils/node_modules/safe-buffer/index.js"(exports, module2) {
var buffer = require("buffer");
var Buffer2 = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
module2.exports = buffer;
} else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer2(arg, encodingOrOffset, length);
}
copyProps(Buffer2, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
throw new TypeError("Argument must not be a number");
}
return Buffer2(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
var buf = Buffer2(size);
if (fill !== void 0) {
if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return Buffer2(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return buffer.SlowBuffer(size);
};
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/BufferList.js
var require_BufferList2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports, module2) {
"use strict";
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var Buffer2 = require_safe_buffer2().Buffer;
var util = require("util");
function copyBuffer(src, target, offset) {
src.copy(target, offset);
}
module2.exports = function() {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
BufferList.prototype.push = function push(v) {
var entry = { data: v, next: null };
if (this.length > 0)
this.tail.next = entry;
else
this.head = entry;
this.tail = entry;
++this.length;
};
BufferList.prototype.unshift = function unshift(v) {
var entry = { data: v, next: this.head };
if (this.length === 0)
this.tail = entry;
this.head = entry;
++this.length;
};
BufferList.prototype.shift = function shift() {
if (this.length === 0)
return;
var ret = this.head.data;
if (this.length === 1)
this.head = this.tail = null;
else
this.head = this.head.next;
--this.length;
return ret;
};
BufferList.prototype.clear = function clear() {
this.head = this.tail = null;
this.length = 0;
};
BufferList.prototype.join = function join(s) {
if (this.length === 0)
return "";
var p = this.head;
var ret = "" + p.data;
while (p = p.next) {
ret += s + p.data;
}
return ret;
};
BufferList.prototype.concat = function concat2(n) {
if (this.length === 0)
return Buffer2.alloc(0);
if (this.length === 1)
return this.head.data;
var ret = Buffer2.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
};
return BufferList;
}();
if (util && util.inspect && util.inspect.custom) {
module2.exports.prototype[util.inspect.custom] = function() {
var obj = util.inspect({ length: this.length });
return this.constructor.name + " " + obj;
};
}
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/destroy.js
var require_destroy2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
function destroy(err, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
pna.nextTick(emitErrorNT, this, err);
}
return this;
}
if (this._readableState) {
this._readableState.destroyed = true;
}
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err || null, function(err2) {
if (!cb && err2) {
pna.nextTick(emitErrorNT, _this, err2);
if (_this._writableState) {
_this._writableState.errorEmitted = true;
}
} else if (cb) {
cb(err2);
}
});
return this;
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
function emitErrorNT(self2, err) {
self2.emit("error", err);
}
module2.exports = {
destroy,
undestroy
};
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_writable.js
var require_stream_writable2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_writable.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
module2.exports = Writable;
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function() {
onCorkedFinish(_this, state);
};
}
var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
var Duplex;
Writable.WritableState = WritableState;
var util = Object.create(require_util());
util.inherits = require_inherits();
var internalUtil = {
deprecate: require_node()
};
var Stream = require_stream2();
var Buffer2 = require_safe_buffer2().Buffer;
var OurUint8Array = global.Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var destroyImpl = require_destroy2();
util.inherits(Writable, Stream);
function nop() {
}
function WritableState(options, stream) {
Duplex = Duplex || require_stream_duplex2();
options = options || {};
var isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.writableObjectMode;
var hwm = options.highWaterMark;
var writableHwm = options.writableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
if (hwm || hwm === 0)
this.highWaterMark = hwm;
else if (isDuplex && (writableHwm || writableHwm === 0))
this.highWaterMark = writableHwm;
else
this.highWaterMark = defaultHwm;
this.highWaterMark = Math.floor(this.highWaterMark);
this.finalCalled = false;
this.needDrain = false;
this.ending = false;
this.ended = false;
this.finished = false;
this.destroyed = false;
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.length = 0;
this.writing = false;
this.corked = 0;
this.sync = true;
this.bufferProcessing = false;
this.onwrite = function(er) {
onwrite(stream, er);
};
this.writecb = null;
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
this.pendingcb = 0;
this.prefinished = false;
this.errorEmitted = false;
this.bufferedRequestCount = 0;
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function() {
try {
Object.defineProperty(WritableState.prototype, "buffer", {
get: internalUtil.deprecate(function() {
return this.getBuffer();
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
});
} catch (_2) {
}
})();
var realHasInstance;
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function(object) {
if (realHasInstance.call(this, object))
return true;
if (this !== Writable)
return false;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function(object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || require_stream_duplex2();
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
return new Writable(options);
}
this._writableState = new WritableState(options, this);
this.writable = true;
if (options) {
if (typeof options.write === "function")
this._write = options.write;
if (typeof options.writev === "function")
this._writev = options.writev;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
if (typeof options.final === "function")
this._final = options.final;
}
Stream.call(this);
}
Writable.prototype.pipe = function() {
this.emit("error", new Error("Cannot pipe, not readable"));
};
function writeAfterEnd(stream, cb) {
var er = new Error("write after end");
stream.emit("error", er);
pna.nextTick(cb, er);
}
function validChunk(stream, state, chunk, cb) {
var valid = true;
var er = false;
if (chunk === null) {
er = new TypeError("May not write null values to stream");
} else if (typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
er = new TypeError("Invalid non-string/buffer chunk");
}
if (er) {
stream.emit("error", er);
pna.nextTick(cb, er);
valid = false;
}
return valid;
}
Writable.prototype.write = function(chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
var isBuf = !state.objectMode && _isUint8Array(chunk);
if (isBuf && !Buffer2.isBuffer(chunk)) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (isBuf)
encoding = "buffer";
else if (!encoding)
encoding = state.defaultEncoding;
if (typeof cb !== "function")
cb = nop;
if (state.ended)
writeAfterEnd(this, cb);
else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
return ret;
};
Writable.prototype.cork = function() {
var state = this._writableState;
state.corked++;
};
Writable.prototype.uncork = function() {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest)
clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
if (typeof encoding === "string")
encoding = encoding.toLowerCase();
if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
throw new TypeError("Unknown encoding: " + encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
chunk = Buffer2.from(chunk, encoding);
}
return chunk;
}
Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function() {
return this._writableState.highWaterMark;
}
});
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state, chunk, encoding);
if (chunk !== newChunk) {
isBuf = true;
encoding = "buffer";
chunk = newChunk;
}
}
var len = state.objectMode ? 1 : chunk.length;
state.length += len;
var ret = state.length < state.highWaterMark;
if (!ret)
state.needDrain = true;
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = {
chunk,
encoding,
isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
return ret;
}
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writelen = len;
state.writecb = cb;
state.writing = true;
state.sync = true;
if (writev)
stream._writev(chunk, state.onwrite);
else
stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync) {
pna.nextTick(cb, er);
pna.nextTick(finishMaybe, stream, state);
stream._writableState.errorEmitted = true;
stream.emit("error", er);
} else {
cb(er);
stream._writableState.errorEmitted = true;
stream.emit("error", er);
finishMaybe(stream, state);
}
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
onwriteStateUpdate(state);
if (er)
onwriteError(stream, state, sync, er, cb);
else {
var finished = needFinish(state);
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
asyncWrite(afterWrite, stream, state, finished, cb);
} else {
afterWrite(stream, state, finished, cb);
}
}
}
function afterWrite(stream, state, finished, cb) {
if (!finished)
onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
}
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit("drain");
}
}
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && entry && entry.next) {
var l = state.bufferedRequestCount;
var buffer = new Array(l);
var holder = state.corkedRequestsFree;
holder.entry = entry;
var count = 0;
var allBuffers = true;
while (entry) {
buffer[count] = entry;
if (!entry.isBuf)
allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state, true, state.length, buffer, "", holder.finish);
state.pendingcb++;
state.lastBufferedRequest = null;
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
state.bufferedRequestCount = 0;
} else {
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
state.bufferedRequestCount--;
if (state.writing) {
break;
}
}
if (entry === null)
state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
Writable.prototype._write = function(chunk, encoding, cb) {
cb(new Error("_write() is not implemented"));
};
Writable.prototype._writev = null;
Writable.prototype.end = function(chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === "function") {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (chunk !== null && chunk !== void 0)
this.write(chunk, encoding);
if (state.corked) {
state.corked = 1;
this.uncork();
}
if (!state.ending && !state.finished)
endWritable(this, state, cb);
};
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function callFinal(stream, state) {
stream._final(function(err) {
state.pendingcb--;
if (err) {
stream.emit("error", err);
}
state.prefinished = true;
stream.emit("prefinish");
finishMaybe(stream, state);
});
}
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === "function") {
state.pendingcb++;
state.finalCalled = true;
pna.nextTick(callFinal, stream, state);
} else {
state.prefinished = true;
stream.emit("prefinish");
}
}
}
function finishMaybe(stream, state) {
var need = needFinish(state);
if (need) {
prefinish(stream, state);
if (state.pendingcb === 0) {
state.finished = true;
stream.emit("finish");
}
}
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
if (state.finished)
pna.nextTick(cb);
else
stream.once("finish", cb);
}
state.ended = true;
stream.writable = false;
}
function onCorkedFinish(corkReq, state, err) {
var entry = corkReq.entry;
corkReq.entry = null;
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
}
if (state.corkedRequestsFree) {
state.corkedRequestsFree.next = corkReq;
} else {
state.corkedRequestsFree = corkReq;
}
}
Object.defineProperty(Writable.prototype, "destroyed", {
get: function() {
if (this._writableState === void 0) {
return false;
}
return this._writableState.destroyed;
},
set: function(value) {
if (!this._writableState) {
return;
}
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
Writable.prototype._destroy = function(err, cb) {
this.end();
cb(err);
};
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_duplex.js
var require_stream_duplex2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_duplex.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
var objectKeys = Object.keys || function(obj) {
var keys2 = [];
for (var key in obj) {
keys2.push(key);
}
return keys2;
};
module2.exports = Duplex;
var util = Object.create(require_util());
util.inherits = require_inherits();
var Readable = require_stream_readable2();
var Writable = require_stream_writable2();
util.inherits(Duplex, Readable);
{
keys = objectKeys(Writable.prototype);
for (v = 0; v < keys.length; v++) {
method = keys[v];
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
}
}
var keys;
var method;
var v;
function Duplex(options) {
if (!(this instanceof Duplex))
return new Duplex(options);
Readable.call(this, options);
Writable.call(this, options);
if (options && options.readable === false)
this.readable = false;
if (options && options.writable === false)
this.writable = false;
this.allowHalfOpen = true;
if (options && options.allowHalfOpen === false)
this.allowHalfOpen = false;
this.once("end", onend);
}
Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function() {
return this._writableState.highWaterMark;
}
});
function onend() {
if (this.allowHalfOpen || this._writableState.ended)
return;
pna.nextTick(onEndNT, this);
}
function onEndNT(self2) {
self2.end();
}
Object.defineProperty(Duplex.prototype, "destroyed", {
get: function() {
if (this._readableState === void 0 || this._writableState === void 0) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set: function(value) {
if (this._readableState === void 0 || this._writableState === void 0) {
return;
}
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
Duplex.prototype._destroy = function(err, cb) {
this.push(null);
this.end();
pna.nextTick(cb, err);
};
}
});
// node_modules/archiver-utils/node_modules/string_decoder/lib/string_decoder.js
var require_string_decoder2 = __commonJS({
"node_modules/archiver-utils/node_modules/string_decoder/lib/string_decoder.js"(exports) {
"use strict";
var Buffer2 = require_safe_buffer2().Buffer;
var isEncoding = Buffer2.isEncoding || function(encoding) {
encoding = "" + encoding;
switch (encoding && encoding.toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
case "raw":
return true;
default:
return false;
}
};
function _normalizeEncoding(enc) {
if (!enc)
return "utf8";
var retried;
while (true) {
switch (enc) {
case "utf8":
case "utf-8":
return "utf8";
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return "utf16le";
case "latin1":
case "binary":
return "latin1";
case "base64":
case "ascii":
case "hex":
return enc;
default:
if (retried)
return;
enc = ("" + enc).toLowerCase();
retried = true;
}
}
}
function normalizeEncoding(enc) {
var nenc = _normalizeEncoding(enc);
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc)))
throw new Error("Unknown encoding: " + enc);
return nenc || enc;
}
exports.StringDecoder = StringDecoder;
function StringDecoder(encoding) {
this.encoding = normalizeEncoding(encoding);
var nb;
switch (this.encoding) {
case "utf16le":
this.text = utf16Text;
this.end = utf16End;
nb = 4;
break;
case "utf8":
this.fillLast = utf8FillLast;
nb = 4;
break;
case "base64":
this.text = base64Text;
this.end = base64End;
nb = 3;
break;
default:
this.write = simpleWrite;
this.end = simpleEnd;
return;
}
this.lastNeed = 0;
this.lastTotal = 0;
this.lastChar = Buffer2.allocUnsafe(nb);
}
StringDecoder.prototype.write = function(buf) {
if (buf.length === 0)
return "";
var r;
var i;
if (this.lastNeed) {
r = this.fillLast(buf);
if (r === void 0)
return "";
i = this.lastNeed;
this.lastNeed = 0;
} else {
i = 0;
}
if (i < buf.length)
return r ? r + this.text(buf, i) : this.text(buf, i);
return r || "";
};
StringDecoder.prototype.end = utf8End;
StringDecoder.prototype.text = utf8Text;
StringDecoder.prototype.fillLast = function(buf) {
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
this.lastNeed -= buf.length;
};
function utf8CheckByte(byte) {
if (byte <= 127)
return 0;
else if (byte >> 5 === 6)
return 2;
else if (byte >> 4 === 14)
return 3;
else if (byte >> 3 === 30)
return 4;
return byte >> 6 === 2 ? -1 : -2;
}
function utf8CheckIncomplete(self2, buf, i) {
var j = buf.length - 1;
if (j < i)
return 0;
var nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 1;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 2;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) {
if (nb === 2)
nb = 0;
else
self2.lastNeed = nb - 3;
}
return nb;
}
return 0;
}
function utf8CheckExtraBytes(self2, buf, p) {
if ((buf[0] & 192) !== 128) {
self2.lastNeed = 0;
return "\uFFFD";
}
if (self2.lastNeed > 1 && buf.length > 1) {
if ((buf[1] & 192) !== 128) {
self2.lastNeed = 1;
return "\uFFFD";
}
if (self2.lastNeed > 2 && buf.length > 2) {
if ((buf[2] & 192) !== 128) {
self2.lastNeed = 2;
return "\uFFFD";
}
}
}
}
function utf8FillLast(buf) {
var p = this.lastTotal - this.lastNeed;
var r = utf8CheckExtraBytes(this, buf, p);
if (r !== void 0)
return r;
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, p, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, p, 0, buf.length);
this.lastNeed -= buf.length;
}
function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed)
return buf.toString("utf8", i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString("utf8", i, end);
}
function utf8End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + "\uFFFD";
return r;
}
function utf16Text(buf, i) {
if ((buf.length - i) % 2 === 0) {
var r = buf.toString("utf16le", i);
if (r) {
var c = r.charCodeAt(r.length - 1);
if (c >= 55296 && c <= 56319) {
this.lastNeed = 2;
this.lastTotal = 4;
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
return r.slice(0, -1);
}
}
return r;
}
this.lastNeed = 1;
this.lastTotal = 2;
this.lastChar[0] = buf[buf.length - 1];
return buf.toString("utf16le", i, buf.length - 1);
}
function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString("utf16le", 0, end);
}
return r;
}
function base64Text(buf, i) {
var n = (buf.length - i) % 3;
if (n === 0)
return buf.toString("base64", i);
this.lastNeed = 3 - n;
this.lastTotal = 3;
if (n === 1) {
this.lastChar[0] = buf[buf.length - 1];
} else {
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
}
return buf.toString("base64", i, buf.length - n);
}
function base64End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
return r;
}
function simpleWrite(buf) {
return buf.toString(this.encoding);
}
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : "";
}
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_readable.js
var require_stream_readable2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_readable.js"(exports, module2) {
"use strict";
var pna = require_process_nextick_args();
module2.exports = Readable;
var isArray = require_isarray();
var Duplex;
Readable.ReadableState = ReadableState;
var EE = require("events").EventEmitter;
var EElistenerCount = function(emitter, type) {
return emitter.listeners(type).length;
};
var Stream = require_stream2();
var Buffer2 = require_safe_buffer2().Buffer;
var OurUint8Array = global.Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var util = Object.create(require_util());
util.inherits = require_inherits();
var debugUtil = require("util");
var debug = void 0;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog("stream");
} else {
debug = function() {
};
}
var BufferList = require_BufferList2();
var destroyImpl = require_destroy2();
var StringDecoder;
util.inherits(Readable, Stream);
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
function prependListener(emitter, event, fn) {
if (typeof emitter.prependListener === "function")
return emitter.prependListener(event, fn);
if (!emitter._events || !emitter._events[event])
emitter.on(event, fn);
else if (isArray(emitter._events[event]))
emitter._events[event].unshift(fn);
else
emitter._events[event] = [fn, emitter._events[event]];
}
function ReadableState(options, stream) {
Duplex = Duplex || require_stream_duplex2();
options = options || {};
var isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
var hwm = options.highWaterMark;
var readableHwm = options.readableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
if (hwm || hwm === 0)
this.highWaterMark = hwm;
else if (isDuplex && (readableHwm || readableHwm === 0))
this.highWaterMark = readableHwm;
else
this.highWaterMark = defaultHwm;
this.highWaterMark = Math.floor(this.highWaterMark);
this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
this.flowing = null;
this.ended = false;
this.endEmitted = false;
this.reading = false;
this.sync = true;
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
this.destroyed = false;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.awaitDrain = 0;
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder)
StringDecoder = require_string_decoder2().StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
Duplex = Duplex || require_stream_duplex2();
if (!(this instanceof Readable))
return new Readable(options);
this._readableState = new ReadableState(options, this);
this.readable = true;
if (options) {
if (typeof options.read === "function")
this._read = options.read;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
}
Stream.call(this);
}
Object.defineProperty(Readable.prototype, "destroyed", {
get: function() {
if (this._readableState === void 0) {
return false;
}
return this._readableState.destroyed;
},
set: function(value) {
if (!this._readableState) {
return;
}
this._readableState.destroyed = value;
}
});
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
Readable.prototype._destroy = function(err, cb) {
this.push(null);
cb(err);
};
Readable.prototype.push = function(chunk, encoding) {
var state = this._readableState;
var skipChunkCheck;
if (!state.objectMode) {
if (typeof chunk === "string") {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
chunk = Buffer2.from(chunk, encoding);
encoding = "";
}
skipChunkCheck = true;
}
} else {
skipChunkCheck = true;
}
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
};
Readable.prototype.unshift = function(chunk) {
return readableAddChunk(this, chunk, null, true, false);
};
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
var state = stream._readableState;
if (chunk === null) {
state.reading = false;
onEofChunk(stream, state);
} else {
var er;
if (!skipChunkCheck)
er = chunkInvalid(state, chunk);
if (er) {
stream.emit("error", er);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (addToFront) {
if (state.endEmitted)
stream.emit("error", new Error("stream.unshift() after end event"));
else
addChunk(stream, state, chunk, true);
} else if (state.ended) {
stream.emit("error", new Error("stream.push() after EOF"));
} else {
state.reading = false;
if (state.decoder && !encoding) {
chunk = state.decoder.write(chunk);
if (state.objectMode || chunk.length !== 0)
addChunk(stream, state, chunk, false);
else
maybeReadMore(stream, state);
} else {
addChunk(stream, state, chunk, false);
}
}
} else if (!addToFront) {
state.reading = false;
}
}
return needMoreData(state);
}
function addChunk(stream, state, chunk, addToFront) {
if (state.flowing && state.length === 0 && !state.sync) {
stream.emit("data", chunk);
stream.read(0);
} else {
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront)
state.buffer.unshift(chunk);
else
state.buffer.push(chunk);
if (state.needReadable)
emitReadable(stream);
}
maybeReadMore(stream, state);
}
function chunkInvalid(state, chunk) {
var er;
if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
er = new TypeError("Invalid non-string/buffer chunk");
}
return er;
}
function needMoreData(state) {
return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
}
Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
Readable.prototype.setEncoding = function(enc) {
if (!StringDecoder)
StringDecoder = require_string_decoder2().StringDecoder;
this._readableState.decoder = new StringDecoder(enc);
this._readableState.encoding = enc;
return this;
};
var MAX_HWM = 8388608;
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
n--;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
n++;
}
return n;
}
function howMuchToRead(n, state) {
if (n <= 0 || state.length === 0 && state.ended)
return 0;
if (state.objectMode)
return 1;
if (n !== n) {
if (state.flowing && state.length)
return state.buffer.head.data.length;
else
return state.length;
}
if (n > state.highWaterMark)
state.highWaterMark = computeNewHighWaterMark(n);
if (n <= state.length)
return n;
if (!state.ended) {
state.needReadable = true;
return 0;
}
return state.length;
}
Readable.prototype.read = function(n) {
debug("read", n);
n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
if (n !== 0)
state.emittedReadable = false;
if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
debug("read: emitReadable", state.length, state.ended);
if (state.length === 0 && state.ended)
endReadable(this);
else
emitReadable(this);
return null;
}
n = howMuchToRead(n, state);
if (n === 0 && state.ended) {
if (state.length === 0)
endReadable(this);
return null;
}
var doRead = state.needReadable;
debug("need readable", doRead);
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug("length less than watermark", doRead);
}
if (state.ended || state.reading) {
doRead = false;
debug("reading or ended", doRead);
} else if (doRead) {
debug("do read");
state.reading = true;
state.sync = true;
if (state.length === 0)
state.needReadable = true;
this._read(state.highWaterMark);
state.sync = false;
if (!state.reading)
n = howMuchToRead(nOrig, state);
}
var ret;
if (n > 0)
ret = fromList(n, state);
else
ret = null;
if (ret === null) {
state.needReadable = true;
n = 0;
} else {
state.length -= n;
}
if (state.length === 0) {
if (!state.ended)
state.needReadable = true;
if (nOrig !== n && state.ended)
endReadable(this);
}
if (ret !== null)
this.emit("data", ret);
return ret;
};
function onEofChunk(stream, state) {
if (state.ended)
return;
if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
}
}
state.ended = true;
emitReadable(stream);
}
function emitReadable(stream) {
var state = stream._readableState;
state.needReadable = false;
if (!state.emittedReadable) {
debug("emitReadable", state.flowing);
state.emittedReadable = true;
if (state.sync)
pna.nextTick(emitReadable_, stream);
else
emitReadable_(stream);
}
}
function emitReadable_(stream) {
debug("emit readable");
stream.emit("readable");
flow(stream);
}
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
pna.nextTick(maybeReadMore_, stream, state);
}
}
function maybeReadMore_(stream, state) {
var len = state.length;
while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
debug("maybeReadMore read 0");
stream.read(0);
if (len === state.length)
break;
else
len = state.length;
}
state.readingMore = false;
}
Readable.prototype._read = function(n) {
this.emit("error", new Error("_read() is not implemented"));
};
Readable.prototype.pipe = function(dest, pipeOpts) {
var src = this;
var state = this._readableState;
switch (state.pipesCount) {
case 0:
state.pipes = dest;
break;
case 1:
state.pipes = [state.pipes, dest];
break;
default:
state.pipes.push(dest);
break;
}
state.pipesCount += 1;
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
var endFn = doEnd ? onend : unpipe;
if (state.endEmitted)
pna.nextTick(endFn);
else
src.once("end", endFn);
dest.on("unpipe", onunpipe);
function onunpipe(readable, unpipeInfo) {
debug("onunpipe");
if (readable === src) {
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
unpipeInfo.hasUnpiped = true;
cleanup();
}
}
}
function onend() {
debug("onend");
dest.end();
}
var ondrain = pipeOnDrain(src);
dest.on("drain", ondrain);
var cleanedUp = false;
function cleanup() {
debug("cleanup");
dest.removeListener("close", onclose);
dest.removeListener("finish", onfinish);
dest.removeListener("drain", ondrain);
dest.removeListener("error", onerror);
dest.removeListener("unpipe", onunpipe);
src.removeListener("end", onend);
src.removeListener("end", unpipe);
src.removeListener("data", ondata);
cleanedUp = true;
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
ondrain();
}
var increasedAwaitDrain = false;
src.on("data", ondata);
function ondata(chunk) {
debug("ondata");
increasedAwaitDrain = false;
var ret = dest.write(chunk);
if (false === ret && !increasedAwaitDrain) {
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug("false write response, pause", src._readableState.awaitDrain);
src._readableState.awaitDrain++;
increasedAwaitDrain = true;
}
src.pause();
}
}
function onerror(er) {
debug("onerror", er);
unpipe();
dest.removeListener("error", onerror);
if (EElistenerCount(dest, "error") === 0)
dest.emit("error", er);
}
prependListener(dest, "error", onerror);
function onclose() {
dest.removeListener("finish", onfinish);
unpipe();
}
dest.once("close", onclose);
function onfinish() {
debug("onfinish");
dest.removeListener("close", onclose);
unpipe();
}
dest.once("finish", onfinish);
function unpipe() {
debug("unpipe");
src.unpipe(dest);
}
dest.emit("pipe", src);
if (!state.flowing) {
debug("pipe resume");
src.resume();
}
return dest;
};
function pipeOnDrain(src) {
return function() {
var state = src._readableState;
debug("pipeOnDrain", state.awaitDrain);
if (state.awaitDrain)
state.awaitDrain--;
if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
state.flowing = true;
flow(src);
}
};
}
Readable.prototype.unpipe = function(dest) {
var state = this._readableState;
var unpipeInfo = { hasUnpiped: false };
if (state.pipesCount === 0)
return this;
if (state.pipesCount === 1) {
if (dest && dest !== state.pipes)
return this;
if (!dest)
dest = state.pipes;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
if (dest)
dest.emit("unpipe", this, unpipeInfo);
return this;
}
if (!dest) {
var dests = state.pipes;
var len = state.pipesCount;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
for (var i = 0; i < len; i++) {
dests[i].emit("unpipe", this, unpipeInfo);
}
return this;
}
var index2 = indexOf(state.pipes, dest);
if (index2 === -1)
return this;
state.pipes.splice(index2, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1)
state.pipes = state.pipes[0];
dest.emit("unpipe", this, unpipeInfo);
return this;
};
Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
if (ev === "data") {
if (this._readableState.flowing !== false)
this.resume();
} else if (ev === "readable") {
var state = this._readableState;
if (!state.endEmitted && !state.readableListening) {
state.readableListening = state.needReadable = true;
state.emittedReadable = false;
if (!state.reading) {
pna.nextTick(nReadingNextTick, this);
} else if (state.length) {
emitReadable(this);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
function nReadingNextTick(self2) {
debug("readable nexttick read 0");
self2.read(0);
}
Readable.prototype.resume = function() {
var state = this._readableState;
if (!state.flowing) {
debug("resume");
state.flowing = true;
resume(this, state);
}
return this;
};
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
pna.nextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
if (!state.reading) {
debug("resume read 0");
stream.read(0);
}
state.resumeScheduled = false;
state.awaitDrain = 0;
stream.emit("resume");
flow(stream);
if (state.flowing && !state.reading)
stream.read(0);
}
Readable.prototype.pause = function() {
debug("call pause flowing=%j", this._readableState.flowing);
if (false !== this._readableState.flowing) {
debug("pause");
this._readableState.flowing = false;
this.emit("pause");
}
return this;
};
function flow(stream) {
var state = stream._readableState;
debug("flow", state.flowing);
while (state.flowing && stream.read() !== null) {
}
}
Readable.prototype.wrap = function(stream) {
var _this = this;
var state = this._readableState;
var paused = false;
stream.on("end", function() {
debug("wrapped end");
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length)
_this.push(chunk);
}
_this.push(null);
});
stream.on("data", function(chunk) {
debug("wrapped data");
if (state.decoder)
chunk = state.decoder.write(chunk);
if (state.objectMode && (chunk === null || chunk === void 0))
return;
else if (!state.objectMode && (!chunk || !chunk.length))
return;
var ret = _this.push(chunk);
if (!ret) {
paused = true;
stream.pause();
}
});
for (var i in stream) {
if (this[i] === void 0 && typeof stream[i] === "function") {
this[i] = function(method) {
return function() {
return stream[method].apply(stream, arguments);
};
}(i);
}
}
for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}
this._read = function(n2) {
debug("wrapped _read", n2);
if (paused) {
paused = false;
stream.resume();
}
};
return this;
};
Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function() {
return this._readableState.highWaterMark;
}
});
Readable._fromList = fromList;
function fromList(n, state) {
if (state.length === 0)
return null;
var ret;
if (state.objectMode)
ret = state.buffer.shift();
else if (!n || n >= state.length) {
if (state.decoder)
ret = state.buffer.join("");
else if (state.buffer.length === 1)
ret = state.buffer.head.data;
else
ret = state.buffer.concat(state.length);
state.buffer.clear();
} else {
ret = fromListPartial(n, state.buffer, state.decoder);
}
return ret;
}
function fromListPartial(n, list, hasStrings) {
var ret;
if (n < list.head.data.length) {
ret = list.head.data.slice(0, n);
list.head.data = list.head.data.slice(n);
} else if (n === list.head.data.length) {
ret = list.shift();
} else {
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
}
return ret;
}
function copyFromBufferString(n, list) {
var p = list.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length)
ret += str;
else
ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next)
list.head = p.next;
else
list.head = list.tail = null;
} else {
list.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
list.length -= c;
return ret;
}
function copyFromBuffer(n, list) {
var ret = Buffer2.allocUnsafe(n);
var p = list.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next)
list.head = p.next;
else
list.head = list.tail = null;
} else {
list.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
list.length -= c;
return ret;
}
function endReadable(stream) {
var state = stream._readableState;
if (state.length > 0)
throw new Error('"endReadable()" called on non-empty stream');
if (!state.endEmitted) {
state.ended = true;
pna.nextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit("end");
}
}
function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x)
return i;
}
return -1;
}
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_transform.js
var require_stream_transform2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_transform.js"(exports, module2) {
"use strict";
module2.exports = Transform;
var Duplex = require_stream_duplex2();
var util = Object.create(require_util());
util.inherits = require_inherits();
util.inherits(Transform, Duplex);
function afterTransform(er, data) {
var ts = this._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (!cb) {
return this.emit("error", new Error("write callback called multiple times"));
}
ts.writechunk = null;
ts.writecb = null;
if (data != null)
this.push(data);
cb(er);
var rs = this._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
this._read(rs.highWaterMark);
}
}
function Transform(options) {
if (!(this instanceof Transform))
return new Transform(options);
Duplex.call(this, options);
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: null
};
this._readableState.needReadable = true;
this._readableState.sync = false;
if (options) {
if (typeof options.transform === "function")
this._transform = options.transform;
if (typeof options.flush === "function")
this._flush = options.flush;
}
this.on("prefinish", prefinish);
}
function prefinish() {
var _this = this;
if (typeof this._flush === "function") {
this._flush(function(er, data) {
done(_this, er, data);
});
} else {
done(this, null, null);
}
}
Transform.prototype.push = function(chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
Transform.prototype._transform = function(chunk, encoding, cb) {
throw new Error("_transform() is not implemented");
};
Transform.prototype._write = function(chunk, encoding, cb) {
var ts = this._transformState;
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
this._read(rs.highWaterMark);
}
};
Transform.prototype._read = function(n) {
var ts = this._transformState;
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
ts.needTransform = true;
}
};
Transform.prototype._destroy = function(err, cb) {
var _this2 = this;
Duplex.prototype._destroy.call(this, err, function(err2) {
cb(err2);
_this2.emit("close");
});
};
function done(stream, er, data) {
if (er)
return stream.emit("error", er);
if (data != null)
stream.push(data);
if (stream._writableState.length)
throw new Error("Calling transform done when ws.length != 0");
if (stream._transformState.transforming)
throw new Error("Calling transform done when still transforming");
return stream.push(null);
}
}
});
// node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_passthrough.js
var require_stream_passthrough2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module2) {
"use strict";
module2.exports = PassThrough;
var Transform = require_stream_transform2();
var util = Object.create(require_util());
util.inherits = require_inherits();
util.inherits(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough))
return new PassThrough(options);
Transform.call(this, options);
}
PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
};
}
});
// node_modules/archiver-utils/node_modules/readable-stream/readable.js
var require_readable2 = __commonJS({
"node_modules/archiver-utils/node_modules/readable-stream/readable.js"(exports, module2) {
var Stream = require("stream");
if (process.env.READABLE_STREAM === "disable" && Stream) {
module2.exports = Stream;
exports = module2.exports = Stream.Readable;
exports.Readable = Stream.Readable;
exports.Writable = Stream.Writable;
exports.Duplex = Stream.Duplex;
exports.Transform = Stream.Transform;
exports.PassThrough = Stream.PassThrough;
exports.Stream = Stream;
} else {
exports = module2.exports = require_stream_readable2();
exports.Stream = Stream || exports;
exports.Readable = exports;
exports.Writable = require_stream_writable2();
exports.Duplex = require_stream_duplex2();
exports.Transform = require_stream_transform2();
exports.PassThrough = require_stream_passthrough2();
}
}
});
// node_modules/lodash.flatten/index.js
var require_lodash2 = __commonJS({
"node_modules/lodash.flatten/index.js"(exports, module2) {
var MAX_SAFE_INTEGER = 9007199254740991;
var argsTag = "[object Arguments]";
var funcTag = "[object Function]";
var genTag = "[object GeneratorFunction]";
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
function arrayPush(array, values) {
var index2 = -1, length = values.length, offset = array.length;
while (++index2 < length) {
array[offset + index2] = values[index2];
}
return array;
}
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var objectToString = objectProto.toString;
var Symbol2 = root.Symbol;
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
function baseFlatten(array, depth, predicate, isStrict, result) {
var index2 = -1, length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index2 < length) {
var value = array[index2];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
function isFlattenable(value) {
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}
function flatten(array) {
var length = array ? array.length : 0;
return length ? baseFlatten(array, 1) : [];
}
function isArguments(value) {
return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
}
var isArray = Array.isArray;
function isArrayLike2(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike2(value);
}
function isFunction(value) {
var tag = isObject(value) ? objectToString.call(value) : "";
return tag == funcTag || tag == genTag;
}
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
function isObject(value) {
var type = typeof value;
return !!value && (type == "object" || type == "function");
}
function isObjectLike(value) {
return !!value && typeof value == "object";
}
module2.exports = flatten;
}
});
// node_modules/lodash.difference/index.js
var require_lodash3 = __commonJS({
"node_modules/lodash.difference/index.js"(exports, module2) {
var LARGE_ARRAY_SIZE = 200;
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var MAX_SAFE_INTEGER = 9007199254740991;
var argsTag = "[object Arguments]";
var funcTag = "[object Function]";
var genTag = "[object GeneratorFunction]";
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
function apply2(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
function arrayIncludes(array, value) {
var length = array ? array.length : 0;
return !!length && baseIndexOf(array, value, 0) > -1;
}
function arrayIncludesWith(array, value, comparator) {
var index2 = -1, length = array ? array.length : 0;
while (++index2 < length) {
if (comparator(value, array[index2])) {
return true;
}
}
return false;
}
function arrayMap(array, iteratee) {
var index2 = -1, length = array ? array.length : 0, result = Array(length);
while (++index2 < length) {
result[index2] = iteratee(array[index2], index2, array);
}
return result;
}
function arrayPush(array, values) {
var index2 = -1, length = values.length, offset = array.length;
while (++index2 < length) {
array[offset + index2] = values[index2];
}
return array;
}
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length, index2 = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index2-- : ++index2 < length) {
if (predicate(array[index2], index2, array)) {
return index2;
}
}
return -1;
}
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
return baseFindIndex(array, baseIsNaN, fromIndex);
}
var index2 = fromIndex - 1, length = array.length;
while (++index2 < length) {
if (array[index2] === value) {
return index2;
}
}
return -1;
}
function baseIsNaN(value) {
return value !== value;
}
function baseUnary(func) {
return function(value) {
return func(value);
};
}
function cacheHas(cache, key) {
return cache.has(key);
}
function getValue(object, key) {
return object == null ? void 0 : object[key];
}
function isHostObject(value) {
var result = false;
if (value != null && typeof value.toString != "function") {
try {
result = !!(value + "");
} catch (e) {
}
}
return result;
}
var arrayProto = Array.prototype;
var funcProto = Function.prototype;
var objectProto = Object.prototype;
var coreJsData = root["__core-js_shared__"];
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var objectToString = objectProto.toString;
var reIsNative = RegExp(
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
var Symbol2 = root.Symbol;
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
var splice = arrayProto.splice;
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
var nativeMax = Math.max;
var Map2 = getNative(root, "Map");
var nativeCreate = getNative(Object, "create");
function Hash(entries) {
var index2 = -1, length = entries ? entries.length : 0;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? void 0 : result;
}
return hasOwnProperty.call(data, key) ? data[key] : void 0;
}
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
}
function hashSet(key, value) {
var data = this.__data__;
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
var index2 = -1, length = entries ? entries.length : 0;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function listCacheClear() {
this.__data__ = [];
}
function listCacheDelete(key) {
var data = this.__data__, index2 = assocIndexOf(data, key);
if (index2 < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index2 == lastIndex) {
data.pop();
} else {
splice.call(data, index2, 1);
}
return true;
}
function listCacheGet(key) {
var data = this.__data__, index2 = assocIndexOf(data, key);
return index2 < 0 ? void 0 : data[index2][1];
}
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value) {
var data = this.__data__, index2 = assocIndexOf(data, key);
if (index2 < 0) {
data.push([key, value]);
} else {
data[index2][1] = value;
}
return this;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
var index2 = -1, length = entries ? entries.length : 0;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function mapCacheClear() {
this.__data__ = {
"hash": new Hash(),
"map": new (Map2 || ListCache)(),
"string": new Hash()
};
}
function mapCacheDelete(key) {
return getMapData(this, key)["delete"](key);
}
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function SetCache(values) {
var index2 = -1, length = values ? values.length : 0;
this.__data__ = new MapCache();
while (++index2 < length) {
this.add(values[index2]);
}
}
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
function setCacheHas(value) {
return this.__data__.has(value);
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
function baseDifference(array, values, iteratee, comparator) {
var index2 = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap(values, baseUnary(iteratee));
}
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
} else if (values.length >= LARGE_ARRAY_SIZE) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
}
outer:
while (++index2 < length) {
var value = array[index2], computed = iteratee ? iteratee(value) : value;
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
}
}
result.push(value);
} else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
return result;
}
function baseFlatten(array, depth, predicate, isStrict, result) {
var index2 = -1, length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index2 < length) {
var value = array[index2];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
function baseRest(func, start) {
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
return function() {
var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array(length);
while (++index2 < length) {
array[index2] = args[start + index2];
}
index2 = -1;
var otherArgs = Array(start + 1);
while (++index2 < start) {
otherArgs[index2] = args[index2];
}
otherArgs[start] = array;
return apply2(func, this, otherArgs);
};
}
function getMapData(map2, key) {
var data = map2.__data__;
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : void 0;
}
function isFlattenable(value) {
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}
function isKeyable(value) {
var type = typeof value;
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {
}
try {
return func + "";
} catch (e) {
}
}
return "";
}
var difference = baseRest(function(array, values) {
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
});
function eq(value, other) {
return value === other || value !== value && other !== other;
}
function isArguments(value) {
return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
}
var isArray = Array.isArray;
function isArrayLike2(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike2(value);
}
function isFunction(value) {
var tag = isObject(value) ? objectToString.call(value) : "";
return tag == funcTag || tag == genTag;
}
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
function isObject(value) {
var type = typeof value;
return !!value && (type == "object" || type == "function");
}
function isObjectLike(value) {
return !!value && typeof value == "object";
}
module2.exports = difference;
}
});
// node_modules/lodash.union/index.js
var require_lodash4 = __commonJS({
"node_modules/lodash.union/index.js"(exports, module2) {
var LARGE_ARRAY_SIZE = 200;
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var INFINITY = 1 / 0;
var MAX_SAFE_INTEGER = 9007199254740991;
var argsTag = "[object Arguments]";
var funcTag = "[object Function]";
var genTag = "[object GeneratorFunction]";
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
function apply2(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
function arrayIncludes(array, value) {
var length = array ? array.length : 0;
return !!length && baseIndexOf(array, value, 0) > -1;
}
function arrayIncludesWith(array, value, comparator) {
var index2 = -1, length = array ? array.length : 0;
while (++index2 < length) {
if (comparator(value, array[index2])) {
return true;
}
}
return false;
}
function arrayPush(array, values) {
var index2 = -1, length = values.length, offset = array.length;
while (++index2 < length) {
array[offset + index2] = values[index2];
}
return array;
}
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length, index2 = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index2-- : ++index2 < length) {
if (predicate(array[index2], index2, array)) {
return index2;
}
}
return -1;
}
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
return baseFindIndex(array, baseIsNaN, fromIndex);
}
var index2 = fromIndex - 1, length = array.length;
while (++index2 < length) {
if (array[index2] === value) {
return index2;
}
}
return -1;
}
function baseIsNaN(value) {
return value !== value;
}
function cacheHas(cache, key) {
return cache.has(key);
}
function getValue(object, key) {
return object == null ? void 0 : object[key];
}
function isHostObject(value) {
var result = false;
if (value != null && typeof value.toString != "function") {
try {
result = !!(value + "");
} catch (e) {
}
}
return result;
}
function setToArray(set) {
var index2 = -1, result = Array(set.size);
set.forEach(function(value) {
result[++index2] = value;
});
return result;
}
var arrayProto = Array.prototype;
var funcProto = Function.prototype;
var objectProto = Object.prototype;
var coreJsData = root["__core-js_shared__"];
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var objectToString = objectProto.toString;
var reIsNative = RegExp(
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
var Symbol2 = root.Symbol;
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
var splice = arrayProto.splice;
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
var nativeMax = Math.max;
var Map2 = getNative(root, "Map");
var Set2 = getNative(root, "Set");
var nativeCreate = getNative(Object, "create");
function Hash(entries) {
var index2 = -1, length = entries ? entries.length : 0;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? void 0 : result;
}
return hasOwnProperty.call(data, key) ? data[key] : void 0;
}
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
}
function hashSet(key, value) {
var data = this.__data__;
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
var index2 = -1, length = entries ? entries.length : 0;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function listCacheClear() {
this.__data__ = [];
}
function listCacheDelete(key) {
var data = this.__data__, index2 = assocIndexOf(data, key);
if (index2 < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index2 == lastIndex) {
data.pop();
} else {
splice.call(data, index2, 1);
}
return true;
}
function listCacheGet(key) {
var data = this.__data__, index2 = assocIndexOf(data, key);
return index2 < 0 ? void 0 : data[index2][1];
}
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value) {
var data = this.__data__, index2 = assocIndexOf(data, key);
if (index2 < 0) {
data.push([key, value]);
} else {
data[index2][1] = value;
}
return this;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
var index2 = -1, length = entries ? entries.length : 0;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
function mapCacheClear() {
this.__data__ = {
"hash": new Hash(),
"map": new (Map2 || ListCache)(),
"string": new Hash()
};
}
function mapCacheDelete(key) {
return getMapData(this, key)["delete"](key);
}
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function SetCache(values) {
var index2 = -1, length = values ? values.length : 0;
this.__data__ = new MapCache();
while (++index2 < length) {
this.add(values[index2]);
}
}
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
function setCacheHas(value) {
return this.__data__.has(value);
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
function baseFlatten(array, depth, predicate, isStrict, result) {
var index2 = -1, length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index2 < length) {
var value = array[index2];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
function baseRest(func, start) {
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
return function() {
var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array(length);
while (++index2 < length) {
array[index2] = args[start + index2];
}
index2 = -1;
var otherArgs = Array(start + 1);
while (++index2 < start) {
otherArgs[index2] = args[index2];
}
otherArgs[start] = array;
return apply2(func, this, otherArgs);
};
}
function baseUniq(array, iteratee, comparator) {
var index2 = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
} else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
}
isCommon = false;
includes = cacheHas;
seen = new SetCache();
} else {
seen = iteratee ? [] : result;
}
outer:
while (++index2 < length) {
var value = array[index2], computed = iteratee ? iteratee(value) : value;
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
} else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values) {
return new Set2(values);
};
function getMapData(map2, key) {
var data = map2.__data__;
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : void 0;
}
function isFlattenable(value) {
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}
function isKeyable(value) {
var type = typeof value;
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {
}
try {
return func + "";
} catch (e) {
}
}
return "";
}
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
function eq(value, other) {
return value === other || value !== value && other !== other;
}
function isArguments(value) {
return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
}
var isArray = Array.isArray;
function isArrayLike2(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike2(value);
}
function isFunction(value) {
var tag = isObject(value) ? objectToString.call(value) : "";
return tag == funcTag || tag == genTag;
}
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
function isObject(value) {
var type = typeof value;
return !!value && (type == "object" || type == "function");
}
function isObjectLike(value) {
return !!value && typeof value == "object";
}
function noop() {
}
module2.exports = union;
}
});
// node_modules/lodash.isplainobject/index.js
var require_lodash5 = __commonJS({
"node_modules/lodash.isplainobject/index.js"(exports, module2) {
var objectTag = "[object Object]";
function isHostObject(value) {
var result = false;
if (value != null && typeof value.toString != "function") {
try {
result = !!(value + "");
} catch (e) {
}
}
return result;
}
function overArg(func, transform2) {
return function(arg) {
return func(transform2(arg));
};
}
var funcProto = Function.prototype;
var objectProto = Object.prototype;
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var objectCtorString = funcToString.call(Object);
var objectToString = objectProto.toString;
var getPrototype = overArg(Object.getPrototypeOf, Object);
function isObjectLike(value) {
return !!value && typeof value == "object";
}
function isPlainObject(value) {
if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
module2.exports = isPlainObject;
}
});
// node_modules/fs.realpath/old.js
var require_old = __commonJS({
"node_modules/fs.realpath/old.js"(exports) {
var pathModule = require("path");
var isWindows = process.platform === "win32";
var fs = require("fs");
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
function rethrow() {
var callback;
if (DEBUG) {
var backtrace = new Error();
callback = debugCallback;
} else
callback = missingCallback;
return callback;
function debugCallback(err) {
if (err) {
backtrace.message = err.message;
err = backtrace;
missingCallback(err);
}
}
function missingCallback(err) {
if (err) {
if (process.throwDeprecation)
throw err;
else if (!process.noDeprecation) {
var msg = "fs: missing callback " + (err.stack || err.message);
if (process.traceDeprecation)
console.trace(msg);
else
console.error(msg);
}
}
}
}
function maybeCallback(cb) {
return typeof cb === "function" ? cb : rethrow();
}
var normalize = pathModule.normalize;
if (isWindows) {
nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
} else {
nextPartRe = /(.*?)(?:[\/]+|$)/g;
}
var nextPartRe;
if (isWindows) {
splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
} else {
splitRootRe = /^[\/]*/;
}
var splitRootRe;
exports.realpathSync = function realpathSync(p, cache) {
p = pathModule.resolve(p);
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
return cache[p];
}
var original = p, seenLinks = {}, knownHard = {};
var pos;
var current;
var base;
var previous;
start();
function start() {
var m = splitRootRe.exec(p);
pos = m[0].length;
current = m[0];
base = m[0];
previous = "";
if (isWindows && !knownHard[base]) {
fs.lstatSync(base);
knownHard[base] = true;
}
}
while (pos < p.length) {
nextPartRe.lastIndex = pos;
var result = nextPartRe.exec(p);
previous = current;
current += result[0];
base = previous + result[1];
pos = nextPartRe.lastIndex;
if (knownHard[base] || cache && cache[base] === base) {
continue;
}
var resolvedLink;
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
resolvedLink = cache[base];
} else {
var stat = fs.lstatSync(base);
if (!stat.isSymbolicLink()) {
knownHard[base] = true;
if (cache)
cache[base] = base;
continue;
}
var linkTarget = null;
if (!isWindows) {
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
if (seenLinks.hasOwnProperty(id)) {
linkTarget = seenLinks[id];
}
}
if (linkTarget === null) {
fs.statSync(base);
linkTarget = fs.readlinkSync(base);
}
resolvedLink = pathModule.resolve(previous, linkTarget);
if (cache)
cache[base] = resolvedLink;
if (!isWindows)
seenLinks[id] = linkTarget;
}
p = pathModule.resolve(resolvedLink, p.slice(pos));
start();
}
if (cache)
cache[original] = p;
return p;
};
exports.realpath = function realpath(p, cache, cb) {
if (typeof cb !== "function") {
cb = maybeCallback(cache);
cache = null;
}
p = pathModule.resolve(p);
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
return process.nextTick(cb.bind(null, null, cache[p]));
}
var original = p, seenLinks = {}, knownHard = {};
var pos;
var current;
var base;
var previous;
start();
function start() {
var m = splitRootRe.exec(p);
pos = m[0].length;
current = m[0];
base = m[0];
previous = "";
if (isWindows && !knownHard[base]) {
fs.lstat(base, function(err) {
if (err)
return cb(err);
knownHard[base] = true;
LOOP();
});
} else {
process.nextTick(LOOP);
}
}
function LOOP() {
if (pos >= p.length) {
if (cache)
cache[original] = p;
return cb(null, p);
}
nextPartRe.lastIndex = pos;
var result = nextPartRe.exec(p);
previous = current;
current += result[0];
base = previous + result[1];
pos = nextPartRe.lastIndex;
if (knownHard[base] || cache && cache[base] === base) {
return process.nextTick(LOOP);
}
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
return gotResolvedLink(cache[base]);
}
return fs.lstat(base, gotStat);
}
function gotStat(err, stat) {
if (err)
return cb(err);
if (!stat.isSymbolicLink()) {
knownHard[base] = true;
if (cache)
cache[base] = base;
return process.nextTick(LOOP);
}
if (!isWindows) {
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
if (seenLinks.hasOwnProperty(id)) {
return gotTarget(null, seenLinks[id], base);
}
}
fs.stat(base, function(err2) {
if (err2)
return cb(err2);
fs.readlink(base, function(err3, target) {
if (!isWindows)
seenLinks[id] = target;
gotTarget(err3, target);
});
});
}
function gotTarget(err, target, base2) {
if (err)
return cb(err);
var resolvedLink = pathModule.resolve(previous, target);
if (cache)
cache[base2] = resolvedLink;
gotResolvedLink(resolvedLink);
}
function gotResolvedLink(resolvedLink) {
p = pathModule.resolve(resolvedLink, p.slice(pos));
start();
}
};
}
});
// node_modules/fs.realpath/index.js
var require_fs = __commonJS({
"node_modules/fs.realpath/index.js"(exports, module2) {
module2.exports = realpath;
realpath.realpath = realpath;
realpath.sync = realpathSync;
realpath.realpathSync = realpathSync;
realpath.monkeypatch = monkeypatch;
realpath.unmonkeypatch = unmonkeypatch;
var fs = require("fs");
var origRealpath = fs.realpath;
var origRealpathSync = fs.realpathSync;
var version = process.version;
var ok = /^v[0-5]\./.test(version);
var old = require_old();
function newError(er) {
return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
}
function realpath(p, cache, cb) {
if (ok) {
return origRealpath(p, cache, cb);
}
if (typeof cache === "function") {
cb = cache;
cache = null;
}
origRealpath(p, cache, function(er, result) {
if (newError(er)) {
old.realpath(p, cache, cb);
} else {
cb(er, result);
}
});
}
function realpathSync(p, cache) {
if (ok) {
return origRealpathSync(p, cache);
}
try {
return origRealpathSync(p, cache);
} catch (er) {
if (newError(er)) {
return old.realpathSync(p, cache);
} else {
throw er;
}
}
}
function monkeypatch() {
fs.realpath = realpath;
fs.realpathSync = realpathSync;
}
function unmonkeypatch() {
fs.realpath = origRealpath;
fs.realpathSync = origRealpathSync;
}
}
});
// node_modules/concat-map/index.js
var require_concat_map = __commonJS({
"node_modules/concat-map/index.js"(exports, module2) {
module2.exports = function(xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
var x = fn(xs[i], i);
if (isArray(x))
res.push.apply(res, x);
else
res.push(x);
}
return res;
};
var isArray = Array.isArray || function(xs) {
return Object.prototype.toString.call(xs) === "[object Array]";
};
}
});
// node_modules/brace-expansion/index.js
var require_brace_expansion2 = __commonJS({
"node_modules/brace-expansion/index.js"(exports, module2) {
var concatMap = require_concat_map();
var balanced = require_balanced_match();
module2.exports = expandTop;
var escSlash = "\0SLASH" + Math.random() + "\0";
var escOpen = "\0OPEN" + Math.random() + "\0";
var escClose = "\0CLOSE" + Math.random() + "\0";
var escComma = "\0COMMA" + Math.random() + "\0";
var escPeriod = "\0PERIOD" + Math.random() + "\0";
function numeric(str) {
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
}
function escapeBraces(str) {
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
}
function unescapeBraces(str) {
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
}
function parseCommaParts(str) {
if (!str)
return [""];
var parts = [];
var m = balanced("{", "}", str);
if (!m)
return str.split(",");
var pre = m.pre;
var body = m.body;
var post = m.post;
var p = pre.split(",");
p[p.length - 1] += "{" + body + "}";
var postParts = parseCommaParts(post);
if (post.length) {
p[p.length - 1] += postParts.shift();
p.push.apply(p, postParts);
}
parts.push.apply(parts, p);
return parts;
}
function expandTop(str) {
if (!str)
return [];
if (str.substr(0, 2) === "{}") {
str = "\\{\\}" + str.substr(2);
}
return expand(escapeBraces(str), true).map(unescapeBraces);
}
function embrace(str) {
return "{" + str + "}";
}
function isPadded(el) {
return /^-?0\d/.test(el);
}
function lte(i, y) {
return i <= y;
}
function gte(i, y) {
return i >= y;
}
function expand(str, isTop) {
var expansions = [];
var m = balanced("{", "}", str);
if (!m || /\$$/.test(m.pre))
return [str];
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(",") >= 0;
if (!isSequence && !isOptions) {
if (m.post.match(/,.*\}/)) {
str = m.pre + "{" + m.body + escClose + m.post;
return expand(str);
}
return [str];
}
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
n = expand(n[0], false).map(embrace);
if (n.length === 1) {
var post = m.post.length ? expand(m.post, false) : [""];
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
var pre = m.pre;
var post = m.post.length ? expand(m.post, false) : [""];
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length);
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i = x; test(i, y); i += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === "\\")
c = "";
} else {
c = String(i);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join("0");
if (i < 0)
c = "-" + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = concatMap(n, function(el) {
return expand(el, false);
});
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
return expansions;
}
}
});
// node_modules/minimatch/minimatch.js
var require_minimatch2 = __commonJS({
"node_modules/minimatch/minimatch.js"(exports, module2) {
module2.exports = minimatch;
minimatch.Minimatch = Minimatch;
var path3 = function() {
try {
return require("path");
} catch (e) {
}
}() || {
sep: "/"
};
minimatch.sep = path3.sep;
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
var expand = require_brace_expansion2();
var plTypes = {
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
"?": { open: "(?:", close: ")?" },
"+": { open: "(?:", close: ")+" },
"*": { open: "(?:", close: ")*" },
"@": { open: "(?:", close: ")" }
};
var qmark = "[^/]";
var star = qmark + "*?";
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
var reSpecials = charSet("().*{}+?[]^$\\!");
function charSet(s) {
return s.split("").reduce(function(set, c) {
set[c] = true;
return set;
}, {});
}
var slashSplit = /\/+/;
minimatch.filter = filter2;
function filter2(pattern, options) {
options = options || {};
return function(p, i, list) {
return minimatch(p, pattern, options);
};
}
function ext(a, b) {
b = b || {};
var t = {};
Object.keys(a).forEach(function(k) {
t[k] = a[k];
});
Object.keys(b).forEach(function(k) {
t[k] = b[k];
});
return t;
}
minimatch.defaults = function(def) {
if (!def || typeof def !== "object" || !Object.keys(def).length) {
return minimatch;
}
var orig = minimatch;
var m = function minimatch2(p, pattern, options) {
return orig(p, pattern, ext(def, options));
};
m.Minimatch = function Minimatch2(pattern, options) {
return new orig.Minimatch(pattern, ext(def, options));
};
m.Minimatch.defaults = function defaults(options) {
return orig.defaults(ext(def, options)).Minimatch;
};
m.filter = function filter3(pattern, options) {
return orig.filter(pattern, ext(def, options));
};
m.defaults = function defaults(options) {
return orig.defaults(ext(def, options));
};
m.makeRe = function makeRe2(pattern, options) {
return orig.makeRe(pattern, ext(def, options));
};
m.braceExpand = function braceExpand2(pattern, options) {
return orig.braceExpand(pattern, ext(def, options));
};
m.match = function(list, pattern, options) {
return orig.match(list, pattern, ext(def, options));
};
return m;
};
Minimatch.defaults = function(def) {
return minimatch.defaults(def).Minimatch;
};
function minimatch(p, pattern, options) {
assertValidPattern(pattern);
if (!options)
options = {};
if (!options.nocomment && pattern.charAt(0) === "#") {
return false;
}
return new Minimatch(pattern, options).match(p);
}
function Minimatch(pattern, options) {
if (!(this instanceof Minimatch)) {
return new Minimatch(pattern, options);
}
assertValidPattern(pattern);
if (!options)
options = {};
pattern = pattern.trim();
if (!options.allowWindowsEscape && path3.sep !== "/") {
pattern = pattern.split(path3.sep).join("/");
}
this.options = options;
this.set = [];
this.pattern = pattern;
this.regexp = null;
this.negate = false;
this.comment = false;
this.empty = false;
this.partial = !!options.partial;
this.make();
}
Minimatch.prototype.debug = function() {
};
Minimatch.prototype.make = make;
function make() {
var pattern = this.pattern;
var options = this.options;
if (!options.nocomment && pattern.charAt(0) === "#") {
this.comment = true;
return;
}
if (!pattern) {
this.empty = true;
return;
}
this.parseNegate();
var set = this.globSet = this.braceExpand();
if (options.debug)
this.debug = function debug() {
console.error.apply(console, arguments);
};
this.debug(this.pattern, set);
set = this.globParts = set.map(function(s) {
return s.split(slashSplit);
});
this.debug(this.pattern, set);
set = set.map(function(s, si, set2) {
return s.map(this.parse, this);
}, this);
this.debug(this.pattern, set);
set = set.filter(function(s) {
return s.indexOf(false) === -1;
});
this.debug(this.pattern, set);
this.set = set;
}
Minimatch.prototype.parseNegate = parseNegate;
function parseNegate() {
var pattern = this.pattern;
var negate = false;
var options = this.options;
var negateOffset = 0;
if (options.nonegate)
return;
for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
negate = !negate;
negateOffset++;
}
if (negateOffset)
this.pattern = pattern.substr(negateOffset);
this.negate = negate;
}
minimatch.braceExpand = function(pattern, options) {
return braceExpand(pattern, options);
};
Minimatch.prototype.braceExpand = braceExpand;
function braceExpand(pattern, options) {
if (!options) {
if (this instanceof Minimatch) {
options = this.options;
} else {
options = {};
}
}
pattern = typeof pattern === "undefined" ? this.pattern : pattern;
assertValidPattern(pattern);
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
return [pattern];
}
return expand(pattern);
}
var MAX_PATTERN_LENGTH = 1024 * 64;
var assertValidPattern = function(pattern) {
if (typeof pattern !== "string") {
throw new TypeError("invalid pattern");
}
if (pattern.length > MAX_PATTERN_LENGTH) {
throw new TypeError("pattern is too long");
}
};
Minimatch.prototype.parse = parse;
var SUBPARSE = {};
function parse(pattern, isSub) {
assertValidPattern(pattern);
var options = this.options;
if (pattern === "**") {
if (!options.noglobstar)
return GLOBSTAR;
else
pattern = "*";
}
if (pattern === "")
return "";
var re = "";
var hasMagic = !!options.nocase;
var escaping = false;
var patternListStack = [];
var negativeLists = [];
var stateChar;
var inClass = false;
var reClassStart = -1;
var classStart = -1;
var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
var self2 = this;
function clearStateChar() {
if (stateChar) {
switch (stateChar) {
case "*":
re += star;
hasMagic = true;
break;
case "?":
re += qmark;
hasMagic = true;
break;
default:
re += "\\" + stateChar;
break;
}
self2.debug("clearStateChar %j %j", stateChar, re);
stateChar = false;
}
}
for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
this.debug("%s %s %s %j", pattern, i, re, c);
if (escaping && reSpecials[c]) {
re += "\\" + c;
escaping = false;
continue;
}
switch (c) {
case "/": {
return false;
}
case "\\":
clearStateChar();
escaping = true;
continue;
case "?":
case "*":
case "+":
case "@":
case "!":
this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
if (inClass) {
this.debug(" in class");
if (c === "!" && i === classStart + 1)
c = "^";
re += c;
continue;
}
self2.debug("call clearStateChar %j", stateChar);
clearStateChar();
stateChar = c;
if (options.noext)
clearStateChar();
continue;
case "(":
if (inClass) {
re += "(";
continue;
}
if (!stateChar) {
re += "\\(";
continue;
}
patternListStack.push({
type: stateChar,
start: i - 1,
reStart: re.length,
open: plTypes[stateChar].open,
close: plTypes[stateChar].close
});
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
this.debug("plType %j %j", stateChar, re);
stateChar = false;
continue;
case ")":
if (inClass || !patternListStack.length) {
re += "\\)";
continue;
}
clearStateChar();
hasMagic = true;
var pl = patternListStack.pop();
re += pl.close;
if (pl.type === "!") {
negativeLists.push(pl);
}
pl.reEnd = re.length;
continue;
case "|":
if (inClass || !patternListStack.length || escaping) {
re += "\\|";
escaping = false;
continue;
}
clearStateChar();
re += "|";
continue;
case "[":
clearStateChar();
if (inClass) {
re += "\\" + c;
continue;
}
inClass = true;
classStart = i;
reClassStart = re.length;
re += c;
continue;
case "]":
if (i === classStart + 1 || !inClass) {
re += "\\" + c;
escaping = false;
continue;
}
var cs = pattern.substring(classStart + 1, i);
try {
RegExp("[" + cs + "]");
} catch (er) {
var sp = this.parse(cs, SUBPARSE);
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
hasMagic = hasMagic || sp[1];
inClass = false;
continue;
}
hasMagic = true;
inClass = false;
re += c;
continue;
default:
clearStateChar();
if (escaping) {
escaping = false;
} else if (reSpecials[c] && !(c === "^" && inClass)) {
re += "\\";
}
re += c;
}
}
if (inClass) {
cs = pattern.substr(classStart + 1);
sp = this.parse(cs, SUBPARSE);
re = re.substr(0, reClassStart) + "\\[" + sp[0];
hasMagic = hasMagic || sp[1];
}
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
var tail = re.slice(pl.reStart + pl.open.length);
this.debug("setting tail", re, pl);
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_2, $1, $2) {
if (!$2) {
$2 = "\\";
}
return $1 + $1 + $2 + "|";
});
this.debug("tail=%j\n %s", tail, tail, pl, re);
var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
hasMagic = true;
re = re.slice(0, pl.reStart) + t + "\\(" + tail;
}
clearStateChar();
if (escaping) {
re += "\\\\";
}
var addPatternStart = false;
switch (re.charAt(0)) {
case "[":
case ".":
case "(":
addPatternStart = true;
}
for (var n = negativeLists.length - 1; n > -1; n--) {
var nl = negativeLists[n];
var nlBefore = re.slice(0, nl.reStart);
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
var nlAfter = re.slice(nl.reEnd);
nlLast += nlAfter;
var openParensBefore = nlBefore.split("(").length - 1;
var cleanAfter = nlAfter;
for (i = 0; i < openParensBefore; i++) {
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
}
nlAfter = cleanAfter;
var dollar = "";
if (nlAfter === "" && isSub !== SUBPARSE) {
dollar = "$";
}
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
re = newRe;
}
if (re !== "" && hasMagic) {
re = "(?=.)" + re;
}
if (addPatternStart) {
re = patternStart + re;
}
if (isSub === SUBPARSE) {
return [re, hasMagic];
}
if (!hasMagic) {
return globUnescape(pattern);
}
var flags = options.nocase ? "i" : "";
try {
var regExp = new RegExp("^" + re + "$", flags);
} catch (er) {
return new RegExp("$.");
}
regExp._glob = pattern;
regExp._src = re;
return regExp;
}
minimatch.makeRe = function(pattern, options) {
return new Minimatch(pattern, options || {}).makeRe();
};
Minimatch.prototype.makeRe = makeRe;
function makeRe() {
if (this.regexp || this.regexp === false)
return this.regexp;
var set = this.set;
if (!set.length) {
this.regexp = false;
return this.regexp;
}
var options = this.options;
var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
var flags = options.nocase ? "i" : "";
var re = set.map(function(pattern) {
return pattern.map(function(p) {
return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
}).join("\\/");
}).join("|");
re = "^(?:" + re + ")$";
if (this.negate)
re = "^(?!" + re + ").*$";
try {
this.regexp = new RegExp(re, flags);
} catch (ex) {
this.regexp = false;
}
return this.regexp;
}
minimatch.match = function(list, pattern, options) {
options = options || {};
var mm = new Minimatch(pattern, options);
list = list.filter(function(f) {
return mm.match(f);
});
if (mm.options.nonull && !list.length) {
list.push(pattern);
}
return list;
};
Minimatch.prototype.match = function match(f, partial) {
if (typeof partial === "undefined")
partial = this.partial;
this.debug("match", f, this.pattern);
if (this.comment)
return false;
if (this.empty)
return f === "";
if (f === "/" && partial)
return true;
var options = this.options;
if (path3.sep !== "/") {
f = f.split(path3.sep).join("/");
}
f = f.split(slashSplit);
this.debug(this.pattern, "split", f);
var set = this.set;
this.debug(this.pattern, "set", set);
var filename;
var i;
for (i = f.length - 1; i >= 0; i--) {
filename = f[i];
if (filename)
break;
}
for (i = 0; i < set.length; i++) {
var pattern = set[i];
var file = f;
if (options.matchBase && pattern.length === 1) {
file = [filename];
}
var hit = this.matchOne(file, pattern, partial);
if (hit) {
if (options.flipNegate)
return true;
return !this.negate;
}
}
if (options.flipNegate)
return false;
return this.negate;
};
Minimatch.prototype.matchOne = function(file, pattern, partial) {
var options = this.options;
this.debug(
"matchOne",
{ "this": this, file, pattern }
);
this.debug("matchOne", file.length, pattern.length);
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
this.debug("matchOne loop");
var p = pattern[pi];
var f = file[fi];
this.debug(pattern, p, f);
if (p === false)
return false;
if (p === GLOBSTAR) {
this.debug("GLOBSTAR", [pattern, p, f]);
var fr = fi;
var pr = pi + 1;
if (pr === pl) {
this.debug("** at the end");
for (; fi < fl; fi++) {
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
return false;
}
return true;
}
while (fr < fl) {
var swallowee = file[fr];
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
this.debug("globstar found match!", fr, fl, swallowee);
return true;
} else {
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
this.debug("dot detected!", file, fr, pattern, pr);
break;
}
this.debug("globstar swallow a segment, and continue");
fr++;
}
}
if (partial) {
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
if (fr === fl)
return true;
}
return false;
}
var hit;
if (typeof p === "string") {
hit = f === p;
this.debug("string match", p, f, hit);
} else {
hit = f.match(p);
this.debug("pattern match", p, f, hit);
}
if (!hit)
return false;
}
if (fi === fl && pi === pl) {
return true;
} else if (fi === fl) {
return partial;
} else if (pi === pl) {
return fi === fl - 1 && file[fi] === "";
}
throw new Error("wtf?");
};
function globUnescape(s) {
return s.replace(/\\(.)/g, "$1");
}
function regExpEscape(s) {
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
}
});
// node_modules/path-is-absolute/index.js
var require_path_is_absolute = __commonJS({
"node_modules/path-is-absolute/index.js"(exports, module2) {
"use strict";
function posix(path3) {
return path3.charAt(0) === "/";
}
function win32(path3) {
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
var result = splitDeviceRe.exec(path3);
var device = result[1] || "";
var isUnc = Boolean(device && device.charAt(1) !== ":");
return Boolean(result[2] || isUnc);
}
module2.exports = process.platform === "win32" ? win32 : posix;
module2.exports.posix = posix;
module2.exports.win32 = win32;
}
});
// node_modules/glob/common.js
var require_common = __commonJS({
"node_modules/glob/common.js"(exports) {
exports.setopts = setopts;
exports.ownProp = ownProp;
exports.makeAbs = makeAbs;
exports.finish = finish;
exports.mark = mark;
exports.isIgnored = isIgnored;
exports.childrenIgnored = childrenIgnored;
function ownProp(obj, field) {
return Object.prototype.hasOwnProperty.call(obj, field);
}
var fs = require("fs");
var path3 = require("path");
var minimatch = require_minimatch2();
var isAbsolute = require_path_is_absolute();
var Minimatch = minimatch.Minimatch;
function alphasort(a, b) {
return a.localeCompare(b, "en");
}
function setupIgnores(self2, options) {
self2.ignore = options.ignore || [];
if (!Array.isArray(self2.ignore))
self2.ignore = [self2.ignore];
if (self2.ignore.length) {
self2.ignore = self2.ignore.map(ignoreMap);
}
}
function ignoreMap(pattern) {
var gmatcher = null;
if (pattern.slice(-3) === "/**") {
var gpattern = pattern.replace(/(\/\*\*)+$/, "");
gmatcher = new Minimatch(gpattern, { dot: true });
}
return {
matcher: new Minimatch(pattern, { dot: true }),
gmatcher
};
}
function setopts(self2, pattern, options) {
if (!options)
options = {};
if (options.matchBase && -1 === pattern.indexOf("/")) {
if (options.noglobstar) {
throw new Error("base matching requires globstar");
}
pattern = "**/" + pattern;
}
self2.silent = !!options.silent;
self2.pattern = pattern;
self2.strict = options.strict !== false;
self2.realpath = !!options.realpath;
self2.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
self2.follow = !!options.follow;
self2.dot = !!options.dot;
self2.mark = !!options.mark;
self2.nodir = !!options.nodir;
if (self2.nodir)
self2.mark = true;
self2.sync = !!options.sync;
self2.nounique = !!options.nounique;
self2.nonull = !!options.nonull;
self2.nosort = !!options.nosort;
self2.nocase = !!options.nocase;
self2.stat = !!options.stat;
self2.noprocess = !!options.noprocess;
self2.absolute = !!options.absolute;
self2.fs = options.fs || fs;
self2.maxLength = options.maxLength || Infinity;
self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
setupIgnores(self2, options);
self2.changedCwd = false;
var cwd = process.cwd();
if (!ownProp(options, "cwd"))
self2.cwd = cwd;
else {
self2.cwd = path3.resolve(options.cwd);
self2.changedCwd = self2.cwd !== cwd;
}
self2.root = options.root || path3.resolve(self2.cwd, "/");
self2.root = path3.resolve(self2.root);
if (process.platform === "win32")
self2.root = self2.root.replace(/\\/g, "/");
self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
if (process.platform === "win32")
self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
self2.nomount = !!options.nomount;
options.nonegate = true;
options.nocomment = true;
options.allowWindowsEscape = false;
self2.minimatch = new Minimatch(pattern, options);
self2.options = self2.minimatch.options;
}
function finish(self2) {
var nou = self2.nounique;
var all = nou ? [] : /* @__PURE__ */ Object.create(null);
for (var i = 0, l = self2.matches.length; i < l; i++) {
var matches = self2.matches[i];
if (!matches || Object.keys(matches).length === 0) {
if (self2.nonull) {
var literal = self2.minimatch.globSet[i];
if (nou)
all.push(literal);
else
all[literal] = true;
}
} else {
var m = Object.keys(matches);
if (nou)
all.push.apply(all, m);
else
m.forEach(function(m2) {
all[m2] = true;
});
}
}
if (!nou)
all = Object.keys(all);
if (!self2.nosort)
all = all.sort(alphasort);
if (self2.mark) {
for (var i = 0; i < all.length; i++) {
all[i] = self2._mark(all[i]);
}
if (self2.nodir) {
all = all.filter(function(e) {
var notDir = !/\/$/.test(e);
var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
if (notDir && c)
notDir = c !== "DIR" && !Array.isArray(c);
return notDir;
});
}
}
if (self2.ignore.length)
all = all.filter(function(m2) {
return !isIgnored(self2, m2);
});
self2.found = all;
}
function mark(self2, p) {
var abs = makeAbs(self2, p);
var c = self2.cache[abs];
var m = p;
if (c) {
var isDir = c === "DIR" || Array.isArray(c);
var slash = p.slice(-1) === "/";
if (isDir && !slash)
m += "/";
else if (!isDir && slash)
m = m.slice(0, -1);
if (m !== p) {
var mabs = makeAbs(self2, m);
self2.statCache[mabs] = self2.statCache[abs];
self2.cache[mabs] = self2.cache[abs];
}
}
return m;
}
function makeAbs(self2, f) {
var abs = f;
if (f.charAt(0) === "/") {
abs = path3.join(self2.root, f);
} else if (isAbsolute(f) || f === "") {
abs = f;
} else if (self2.changedCwd) {
abs = path3.resolve(self2.cwd, f);
} else {
abs = path3.resolve(f);
}
if (process.platform === "win32")
abs = abs.replace(/\\/g, "/");
return abs;
}
function isIgnored(self2, path4) {
if (!self2.ignore.length)
return false;
return self2.ignore.some(function(item) {
return item.matcher.match(path4) || !!(item.gmatcher && item.gmatcher.match(path4));
});
}
function childrenIgnored(self2, path4) {
if (!self2.ignore.length)
return false;
return self2.ignore.some(function(item) {
return !!(item.gmatcher && item.gmatcher.match(path4));
});
}
}
});
// node_modules/glob/sync.js
var require_sync = __commonJS({
"node_modules/glob/sync.js"(exports, module2) {
module2.exports = globSync;
globSync.GlobSync = GlobSync;
var rp = require_fs();
var minimatch = require_minimatch2();
var Minimatch = minimatch.Minimatch;
var Glob = require_glob().Glob;
var util = require("util");
var path3 = require("path");
var assert = require("assert");
var isAbsolute = require_path_is_absolute();
var common = require_common();
var setopts = common.setopts;
var ownProp = common.ownProp;
var childrenIgnored = common.childrenIgnored;
var isIgnored = common.isIgnored;
function globSync(pattern, options) {
if (typeof options === "function" || arguments.length === 3)
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
return new GlobSync(pattern, options).found;
}
function GlobSync(pattern, options) {
if (!pattern)
throw new Error("must provide pattern");
if (typeof options === "function" || arguments.length === 3)
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
if (!(this instanceof GlobSync))
return new GlobSync(pattern, options);
setopts(this, pattern, options);
if (this.noprocess)
return this;
var n = this.minimatch.set.length;
this.matches = new Array(n);
for (var i = 0; i < n; i++) {
this._process(this.minimatch.set[i], i, false);
}
this._finish();
}
GlobSync.prototype._finish = function() {
assert.ok(this instanceof GlobSync);
if (this.realpath) {
var self2 = this;
this.matches.forEach(function(matchset, index2) {
var set = self2.matches[index2] = /* @__PURE__ */ Object.create(null);
for (var p in matchset) {
try {
p = self2._makeAbs(p);
var real = rp.realpathSync(p, self2.realpathCache);
set[real] = true;
} catch (er) {
if (er.syscall === "stat")
set[self2._makeAbs(p)] = true;
else
throw er;
}
}
});
}
common.finish(this);
};
GlobSync.prototype._process = function(pattern, index2, inGlobStar) {
assert.ok(this instanceof GlobSync);
var n = 0;
while (typeof pattern[n] === "string") {
n++;
}
var prefix;
switch (n) {
case pattern.length:
this._processSimple(pattern.join("/"), index2);
return;
case 0:
prefix = null;
break;
default:
prefix = pattern.slice(0, n).join("/");
break;
}
var remain = pattern.slice(n);
var read;
if (prefix === null)
read = ".";
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
return typeof p === "string" ? p : "[*]";
}).join("/"))) {
if (!prefix || !isAbsolute(prefix))
prefix = "/" + prefix;
read = prefix;
} else
read = prefix;
var abs = this._makeAbs(read);
if (childrenIgnored(this, read))
return;
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
if (isGlobStar)
this._processGlobStar(prefix, read, abs, remain, index2, inGlobStar);
else
this._processReaddir(prefix, read, abs, remain, index2, inGlobStar);
};
GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index2, inGlobStar) {
var entries = this._readdir(abs, inGlobStar);
if (!entries)
return;
var pn = remain[0];
var negate = !!this.minimatch.negate;
var rawGlob = pn._glob;
var dotOk = this.dot || rawGlob.charAt(0) === ".";
var matchedEntries = [];
for (var i = 0; i < entries.length; i++) {
var e = entries[i];
if (e.charAt(0) !== "." || dotOk) {
var m;
if (negate && !prefix) {
m = !e.match(pn);
} else {
m = e.match(pn);
}
if (m)
matchedEntries.push(e);
}
}
var len = matchedEntries.length;
if (len === 0)
return;
if (remain.length === 1 && !this.mark && !this.stat) {
if (!this.matches[index2])
this.matches[index2] = /* @__PURE__ */ Object.create(null);
for (var i = 0; i < len; i++) {
var e = matchedEntries[i];
if (prefix) {
if (prefix.slice(-1) !== "/")
e = prefix + "/" + e;
else
e = prefix + e;
}
if (e.charAt(0) === "/" && !this.nomount) {
e = path3.join(this.root, e);
}
this._emitMatch(index2, e);
}
return;
}
remain.shift();
for (var i = 0; i < len; i++) {
var e = matchedEntries[i];
var newPattern;
if (prefix)
newPattern = [prefix, e];
else
newPattern = [e];
this._process(newPattern.concat(remain), index2, inGlobStar);
}
};
GlobSync.prototype._emitMatch = function(index2, e) {
if (isIgnored(this, e))
return;
var abs = this._makeAbs(e);
if (this.mark)
e = this._mark(e);
if (this.absolute) {
e = abs;
}
if (this.matches[index2][e])
return;
if (this.nodir) {
var c = this.cache[abs];
if (c === "DIR" || Array.isArray(c))
return;
}
this.matches[index2][e] = true;
if (this.stat)
this._stat(e);
};
GlobSync.prototype._readdirInGlobStar = function(abs) {
if (this.follow)
return this._readdir(abs, false);
var entries;
var lstat;
var stat;
try {
lstat = this.fs.lstatSync(abs);
} catch (er) {
if (er.code === "ENOENT") {
return null;
}
}
var isSym = lstat && lstat.isSymbolicLink();
this.symlinks[abs] = isSym;
if (!isSym && lstat && !lstat.isDirectory())
this.cache[abs] = "FILE";
else
entries = this._readdir(abs, false);
return entries;
};
GlobSync.prototype._readdir = function(abs, inGlobStar) {
var entries;
if (inGlobStar && !ownProp(this.symlinks, abs))
return this._readdirInGlobStar(abs);
if (ownProp(this.cache, abs)) {
var c = this.cache[abs];
if (!c || c === "FILE")
return null;
if (Array.isArray(c))
return c;
}
try {
return this._readdirEntries(abs, this.fs.readdirSync(abs));
} catch (er) {
this._readdirError(abs, er);
return null;
}
};
GlobSync.prototype._readdirEntries = function(abs, entries) {
if (!this.mark && !this.stat) {
for (var i = 0; i < entries.length; i++) {
var e = entries[i];
if (abs === "/")
e = abs + e;
else
e = abs + "/" + e;
this.cache[e] = true;
}
}
this.cache[abs] = entries;
return entries;
};
GlobSync.prototype._readdirError = function(f, er) {
switch (er.code) {
case "ENOTSUP":
case "ENOTDIR":
var abs = this._makeAbs(f);
this.cache[abs] = "FILE";
if (abs === this.cwdAbs) {
var error = new Error(er.code + " invalid cwd " + this.cwd);
error.path = this.cwd;
error.code = er.code;
throw error;
}
break;
case "ENOENT":
case "ELOOP":
case "ENAMETOOLONG":
case "UNKNOWN":
this.cache[this._makeAbs(f)] = false;
break;
default:
this.cache[this._makeAbs(f)] = false;
if (this.strict)
throw er;
if (!this.silent)
console.error("glob error", er);
break;
}
};
GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index2, inGlobStar) {
var entries = this._readdir(abs, inGlobStar);
if (!entries)
return;
var remainWithoutGlobStar = remain.slice(1);
var gspref = prefix ? [prefix] : [];
var noGlobStar = gspref.concat(remainWithoutGlobStar);
this._process(noGlobStar, index2, false);
var len = entries.length;
var isSym = this.symlinks[abs];
if (isSym && inGlobStar)
return;
for (var i = 0; i < len; i++) {
var e = entries[i];
if (e.charAt(0) === "." && !this.dot)
continue;
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
this._process(instead, index2, true);
var below = gspref.concat(entries[i], remain);
this._process(below, index2, true);
}
};
GlobSync.prototype._processSimple = function(prefix, index2) {
var exists = this._stat(prefix);
if (!this.matches[index2])
this.matches[index2] = /* @__PURE__ */ Object.create(null);
if (!exists)
return;
if (prefix && isAbsolute(prefix) && !this.nomount) {
var trail = /[\/\\]$/.test(prefix);
if (prefix.charAt(0) === "/") {
prefix = path3.join(this.root, prefix);
} else {
prefix = path3.resolve(this.root, prefix);
if (trail)
prefix += "/";
}
}
if (process.platform === "win32")
prefix = prefix.replace(/\\/g, "/");
this._emitMatch(index2, prefix);
};
GlobSync.prototype._stat = function(f) {
var abs = this._makeAbs(f);
var needDir = f.slice(-1) === "/";
if (f.length > this.maxLength)
return false;
if (!this.stat && ownProp(this.cache, abs)) {
var c = this.cache[abs];
if (Array.isArray(c))
c = "DIR";
if (!needDir || c === "DIR")
return c;
if (needDir && c === "FILE")
return false;
}
var exists;
var stat = this.statCache[abs];
if (!stat) {
var lstat;
try {
lstat = this.fs.lstatSync(abs);
} catch (er) {
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
this.statCache[abs] = false;
return false;
}
}
if (lstat && lstat.isSymbolicLink()) {
try {
stat = this.fs.statSync(abs);
} catch (er) {
stat = lstat;
}
} else {
stat = lstat;
}
}
this.statCache[abs] = stat;
var c = true;
if (stat)
c = stat.isDirectory() ? "DIR" : "FILE";
this.cache[abs] = this.cache[abs] || c;
if (needDir && c === "FILE")
return false;
return c;
};
GlobSync.prototype._mark = function(p) {
return common.mark(this, p);
};
GlobSync.prototype._makeAbs = function(f) {
return common.makeAbs(this, f);
};
}
});
// node_modules/wrappy/wrappy.js
var require_wrappy = __commonJS({
"node_modules/wrappy/wrappy.js"(exports, module2) {
module2.exports = wrappy;
function wrappy(fn, cb) {
if (fn && cb)
return wrappy(fn)(cb);
if (typeof fn !== "function")
throw new TypeError("need wrapper function");
Object.keys(fn).forEach(function(k) {
wrapper[k] = fn[k];
});
return wrapper;
function wrapper() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
var ret = fn.apply(this, args);
var cb2 = args[args.length - 1];
if (typeof ret === "function" && ret !== cb2) {
Object.keys(cb2).forEach(function(k) {
ret[k] = cb2[k];
});
}
return ret;
}
}
}
});
// node_modules/once/once.js
var require_once = __commonJS({
"node_modules/once/once.js"(exports, module2) {
var wrappy = require_wrappy();
module2.exports = wrappy(once2);
module2.exports.strict = wrappy(onceStrict);
once2.proto = once2(function() {
Object.defineProperty(Function.prototype, "once", {
value: function() {
return once2(this);
},
configurable: true
});
Object.defineProperty(Function.prototype, "onceStrict", {
value: function() {
return onceStrict(this);
},
configurable: true
});
});
function once2(fn) {
var f = function() {
if (f.called)
return f.value;
f.called = true;
return f.value = fn.apply(this, arguments);
};
f.called = false;
return f;
}
function onceStrict(fn) {
var f = function() {
if (f.called)
throw new Error(f.onceError);
f.called = true;
return f.value = fn.apply(this, arguments);
};
var name = fn.name || "Function wrapped with `once`";
f.onceError = name + " shouldn't be called more than once";
f.called = false;
return f;
}
}
});
// node_modules/inflight/inflight.js
var require_inflight = __commonJS({
"node_modules/inflight/inflight.js"(exports, module2) {
var wrappy = require_wrappy();
var reqs = /* @__PURE__ */ Object.create(null);
var once2 = require_once();
module2.exports = wrappy(inflight);
function inflight(key, cb) {
if (reqs[key]) {
reqs[key].push(cb);
return null;
} else {
reqs[key] = [cb];
return makeres(key);
}
}
function makeres(key) {
return once2(function RES() {
var cbs = reqs[key];
var len = cbs.length;
var args = slice(arguments);
try {
for (var i = 0; i < len; i++) {
cbs[i].apply(null, args);
}
} finally {
if (cbs.length > len) {
cbs.splice(0, len);
process.nextTick(function() {
RES.apply(null, args);
});
} else {
delete reqs[key];
}
}
});
}
function slice(args) {
var length = args.length;
var array = [];
for (var i = 0; i < length; i++)
array[i] = args[i];
return array;
}
}
});
// node_modules/glob/glob.js
var require_glob = __commonJS({
"node_modules/glob/glob.js"(exports, module2) {
module2.exports = glob2;
var rp = require_fs();
var minimatch = require_minimatch2();
var Minimatch = minimatch.Minimatch;
var inherits = require_inherits();
var EE = require("events").EventEmitter;
var path3 = require("path");
var assert = require("assert");
var isAbsolute = require_path_is_absolute();
var globSync = require_sync();
var common = require_common();
var setopts = common.setopts;
var ownProp = common.ownProp;
var inflight = require_inflight();
var util = require("util");
var childrenIgnored = common.childrenIgnored;
var isIgnored = common.isIgnored;
var once2 = require_once();
function glob2(pattern, options, cb) {
if (typeof options === "function")
cb = options, options = {};
if (!options)
options = {};
if (options.sync) {
if (cb)
throw new TypeError("callback provided to sync glob");
return globSync(pattern, options);
}
return new Glob(pattern, options, cb);
}
glob2.sync = globSync;
var GlobSync = glob2.GlobSync = globSync.GlobSync;
glob2.glob = glob2;
function extend(origin, add) {
if (add === null || typeof add !== "object") {
return origin;
}
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
}
glob2.hasMagic = function(pattern, options_) {
var options = extend({}, options_);
options.noprocess = true;
var g = new Glob(pattern, options);
var set = g.minimatch.set;
if (!pattern)
return false;
if (set.length > 1)
return true;
for (var j = 0; j < set[0].length; j++) {
if (typeof set[0][j] !== "string")
return true;
}
return false;
};
glob2.Glob = Glob;
inherits(Glob, EE);
function Glob(pattern, options, cb) {
if (typeof options === "function") {
cb = options;
options = null;
}
if (options && options.sync) {
if (cb)
throw new TypeError("callback provided to sync glob");
return new GlobSync(pattern, options);
}
if (!(this instanceof Glob))
return new Glob(pattern, options, cb);
setopts(this, pattern, options);
this._didRealPath = false;
var n = this.minimatch.set.length;
this.matches = new Array(n);
if (typeof cb === "function") {
cb = once2(cb);
this.on("error", cb);
this.on("end", function(matches) {
cb(null, matches);
});
}
var self2 = this;
this._processing = 0;
this._emitQueue = [];
this._processQueue = [];
this.paused = false;
if (this.noprocess)
return this;
if (n === 0)
return done();
var sync = true;
for (var i = 0; i < n; i++) {
this._process(this.minimatch.set[i], i, false, done);
}
sync = false;
function done() {
--self2._processing;
if (self2._processing <= 0) {
if (sync) {
process.nextTick(function() {
self2._finish();
});
} else {
self2._finish();
}
}
}
}
Glob.prototype._finish = function() {
assert(this instanceof Glob);
if (this.aborted)
return;
if (this.realpath && !this._didRealpath)
return this._realpath();
common.finish(this);
this.emit("end", this.found);
};
Glob.prototype._realpath = function() {
if (this._didRealpath)
return;
this._didRealpath = true;
var n = this.matches.length;
if (n === 0)
return this._finish();
var self2 = this;
for (var i = 0; i < this.matches.length; i++)
this._realpathSet(i, next);
function next() {
if (--n === 0)
self2._finish();
}
};
Glob.prototype._realpathSet = function(index2, cb) {
var matchset = this.matches[index2];
if (!matchset)
return cb();
var found = Object.keys(matchset);
var self2 = this;
var n = found.length;
if (n === 0)
return cb();
var set = this.matches[index2] = /* @__PURE__ */ Object.create(null);
found.forEach(function(p, i) {
p = self2._makeAbs(p);
rp.realpath(p, self2.realpathCache, function(er, real) {
if (!er)
set[real] = true;
else if (er.syscall === "stat")
set[p] = true;
else
self2.emit("error", er);
if (--n === 0) {
self2.matches[index2] = set;
cb();
}
});
});
};
Glob.prototype._mark = function(p) {
return common.mark(this, p);
};
Glob.prototype._makeAbs = function(f) {
return common.makeAbs(this, f);
};
Glob.prototype.abort = function() {
this.aborted = true;
this.emit("abort");
};
Glob.prototype.pause = function() {
if (!this.paused) {
this.paused = true;
this.emit("pause");
}
};
Glob.prototype.resume = function() {
if (this.paused) {
this.emit("resume");
this.paused = false;
if (this._emitQueue.length) {
var eq = this._emitQueue.slice(0);
this._emitQueue.length = 0;
for (var i = 0; i < eq.length; i++) {
var e = eq[i];
this._emitMatch(e[0], e[1]);
}
}
if (this._processQueue.length) {
var pq = this._processQueue.slice(0);
this._processQueue.length = 0;
for (var i = 0; i < pq.length; i++) {
var p = pq[i];
this._processing--;
this._process(p[0], p[1], p[2], p[3]);
}
}
}
};
Glob.prototype._process = function(pattern, index2, inGlobStar, cb) {
assert(this instanceof Glob);
assert(typeof cb === "function");
if (this.aborted)
return;
this._processing++;
if (this.paused) {
this._processQueue.push([pattern, index2, inGlobStar, cb]);
return;
}
var n = 0;
while (typeof pattern[n] === "string") {
n++;
}
var prefix;
switch (n) {
case pattern.length:
this._processSimple(pattern.join("/"), index2, cb);
return;
case 0:
prefix = null;
break;
default:
prefix = pattern.slice(0, n).join("/");
break;
}
var remain = pattern.slice(n);
var read;
if (prefix === null)
read = ".";
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
return typeof p === "string" ? p : "[*]";
}).join("/"))) {
if (!prefix || !isAbsolute(prefix))
prefix = "/" + prefix;
read = prefix;
} else
read = prefix;
var abs = this._makeAbs(read);
if (childrenIgnored(this, read))
return cb();
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
if (isGlobStar)
this._processGlobStar(prefix, read, abs, remain, index2, inGlobStar, cb);
else
this._processReaddir(prefix, read, abs, remain, index2, inGlobStar, cb);
};
Glob.prototype._processReaddir = function(prefix, read, abs, remain, index2, inGlobStar, cb) {
var self2 = this;
this._readdir(abs, inGlobStar, function(er, entries) {
return self2._processReaddir2(prefix, read, abs, remain, index2, inGlobStar, entries, cb);
});
};
Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index2, inGlobStar, entries, cb) {
if (!entries)
return cb();
var pn = remain[0];
var negate = !!this.minimatch.negate;
var rawGlob = pn._glob;
var dotOk = this.dot || rawGlob.charAt(0) === ".";
var matchedEntries = [];
for (var i = 0; i < entries.length; i++) {
var e = entries[i];
if (e.charAt(0) !== "." || dotOk) {
var m;
if (negate && !prefix) {
m = !e.match(pn);
} else {
m = e.match(pn);
}
if (m)
matchedEntries.push(e);
}
}
var len = matchedEntries.length;
if (len === 0)
return cb();
if (remain.length === 1 && !this.mark && !this.stat) {
if (!this.matches[index2])
this.matches[index2] = /* @__PURE__ */ Object.create(null);
for (var i = 0; i < len; i++) {
var e = matchedEntries[i];
if (prefix) {
if (prefix !== "/")
e = prefix + "/" + e;
else
e = prefix + e;
}
if (e.charAt(0) === "/" && !this.nomount) {
e = path3.join(this.root, e);
}
this._emitMatch(index2, e);
}
return cb();
}
remain.shift();
for (var i = 0; i < len; i++) {
var e = matchedEntries[i];
var newPattern;
if (prefix) {
if (prefix !== "/")
e = prefix + "/" + e;
else
e = prefix + e;
}
this._process([e].concat(remain), index2, inGlobStar, cb);
}
cb();
};
Glob.prototype._emitMatch = function(index2, e) {
if (this.aborted)
return;
if (isIgnored(this, e))
return;
if (this.paused) {
this._emitQueue.push([index2, e]);
return;
}
var abs = isAbsolute(e) ? e : this._makeAbs(e);
if (this.mark)
e = this._mark(e);
if (this.absolute)
e = abs;
if (this.matches[index2][e])
return;
if (this.nodir) {
var c = this.cache[abs];
if (c === "DIR" || Array.isArray(c))
return;
}
this.matches[index2][e] = true;
var st = this.statCache[abs];
if (st)
this.emit("stat", e, st);
this.emit("match", e);
};
Glob.prototype._readdirInGlobStar = function(abs, cb) {
if (this.aborted)
return;
if (this.follow)
return this._readdir(abs, false, cb);
var lstatkey = "lstat\0" + abs;
var self2 = this;
var lstatcb = inflight(lstatkey, lstatcb_);
if (lstatcb)
self2.fs.lstat(abs, lstatcb);
function lstatcb_(er, lstat) {
if (er && er.code === "ENOENT")
return cb();
var isSym = lstat && lstat.isSymbolicLink();
self2.symlinks[abs] = isSym;
if (!isSym && lstat && !lstat.isDirectory()) {
self2.cache[abs] = "FILE";
cb();
} else
self2._readdir(abs, false, cb);
}
};
Glob.prototype._readdir = function(abs, inGlobStar, cb) {
if (this.aborted)
return;
cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
if (!cb)
return;
if (inGlobStar && !ownProp(this.symlinks, abs))
return this._readdirInGlobStar(abs, cb);
if (ownProp(this.cache, abs)) {
var c = this.cache[abs];
if (!c || c === "FILE")
return cb();
if (Array.isArray(c))
return cb(null, c);
}
var self2 = this;
self2.fs.readdir(abs, readdirCb(this, abs, cb));
};
function readdirCb(self2, abs, cb) {
return function(er, entries) {
if (er)
self2._readdirError(abs, er, cb);
else
self2._readdirEntries(abs, entries, cb);
};
}
Glob.prototype._readdirEntries = function(abs, entries, cb) {
if (this.aborted)
return;
if (!this.mark && !this.stat) {
for (var i = 0; i < entries.length; i++) {
var e = entries[i];
if (abs === "/")
e = abs + e;
else
e = abs + "/" + e;
this.cache[e] = true;
}
}
this.cache[abs] = entries;
return cb(null, entries);
};
Glob.prototype._readdirError = function(f, er, cb) {
if (this.aborted)
return;
switch (er.code) {
case "ENOTSUP":
case "ENOTDIR":
var abs = this._makeAbs(f);
this.cache[abs] = "FILE";
if (abs === this.cwdAbs) {
var error = new Error(er.code + " invalid cwd " + this.cwd);
error.path = this.cwd;
error.code = er.code;
this.emit("error", error);
this.abort();
}
break;
case "ENOENT":
case "ELOOP":
case "ENAMETOOLONG":
case "UNKNOWN":
this.cache[this._makeAbs(f)] = false;
break;
default:
this.cache[this._makeAbs(f)] = false;
if (this.strict) {
this.emit("error", er);
this.abort();
}
if (!this.silent)
console.error("glob error", er);
break;
}
return cb();
};
Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index2, inGlobStar, cb) {
var self2 = this;
this._readdir(abs, inGlobStar, function(er, entries) {
self2._processGlobStar2(prefix, read, abs, remain, index2, inGlobStar, entries, cb);
});
};
Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index2, inGlobStar, entries, cb) {
if (!entries)
return cb();
var remainWithoutGlobStar = remain.slice(1);
var gspref = prefix ? [prefix] : [];
var noGlobStar = gspref.concat(remainWithoutGlobStar);
this._process(noGlobStar, index2, false, cb);
var isSym = this.symlinks[abs];
var len = entries.length;
if (isSym && inGlobStar)
return cb();
for (var i = 0; i < len; i++) {
var e = entries[i];
if (e.charAt(0) === "." && !this.dot)
continue;
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
this._process(instead, index2, true, cb);
var below = gspref.concat(entries[i], remain);
this._process(below, index2, true, cb);
}
cb();
};
Glob.prototype._processSimple = function(prefix, index2, cb) {
var self2 = this;
this._stat(prefix, function(er, exists) {
self2._processSimple2(prefix, index2, er, exists, cb);
});
};
Glob.prototype._processSimple2 = function(prefix, index2, er, exists, cb) {
if (!this.matches[index2])
this.matches[index2] = /* @__PURE__ */ Object.create(null);
if (!exists)
return cb();
if (prefix && isAbsolute(prefix) && !this.nomount) {
var trail = /[\/\\]$/.test(prefix);
if (prefix.charAt(0) === "/") {
prefix = path3.join(this.root, prefix);
} else {
prefix = path3.resolve(this.root, prefix);
if (trail)
prefix += "/";
}
}
if (process.platform === "win32")
prefix = prefix.replace(/\\/g, "/");
this._emitMatch(index2, prefix);
cb();
};
Glob.prototype._stat = function(f, cb) {
var abs = this._makeAbs(f);
var needDir = f.slice(-1) === "/";
if (f.length > this.maxLength)
return cb();
if (!this.stat && ownProp(this.cache, abs)) {
var c = this.cache[abs];
if (Array.isArray(c))
c = "DIR";
if (!needDir || c === "DIR")
return cb(null, c);
if (needDir && c === "FILE")
return cb();
}
var exists;
var stat = this.statCache[abs];
if (stat !== void 0) {
if (stat === false)
return cb(null, stat);
else {
var type = stat.isDirectory() ? "DIR" : "FILE";
if (needDir && type === "FILE")
return cb();
else
return cb(null, type, stat);
}
}
var self2 = this;
var statcb = inflight("stat\0" + abs, lstatcb_);
if (statcb)
self2.fs.lstat(abs, statcb);
function lstatcb_(er, lstat) {
if (lstat && lstat.isSymbolicLink()) {
return self2.fs.stat(abs, function(er2, stat2) {
if (er2)
self2._stat2(f, abs, null, lstat, cb);
else
self2._stat2(f, abs, er2, stat2, cb);
});
} else {
self2._stat2(f, abs, er, lstat, cb);
}
}
};
Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
this.statCache[abs] = false;
return cb();
}
var needDir = f.slice(-1) === "/";
this.statCache[abs] = stat;
if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
return cb(null, false, stat);
var c = true;
if (stat)
c = stat.isDirectory() ? "DIR" : "FILE";
this.cache[abs] = this.cache[abs] || c;
if (needDir && c === "FILE")
return cb();
return cb(null, c, stat);
};
}
});
// node_modules/archiver-utils/file.js
var require_file = __commonJS({
"node_modules/archiver-utils/file.js"(exports, module2) {
var fs = require_graceful_fs();
var path3 = require("path");
var flatten = require_lodash2();
var difference = require_lodash3();
var union = require_lodash4();
var isPlainObject = require_lodash5();
var glob2 = require_glob();
var file = module2.exports = {};
var pathSeparatorRe = /[\/\\]/g;
var processPatterns = function(patterns, fn) {
var result = [];
flatten(patterns).forEach(function(pattern) {
var exclusion = pattern.indexOf("!") === 0;
if (exclusion) {
pattern = pattern.slice(1);
}
var matches = fn(pattern);
if (exclusion) {
result = difference(result, matches);
} else {
result = union(result, matches);
}
});
return result;
};
file.exists = function() {
var filepath = path3.join.apply(path3, arguments);
return fs.existsSync(filepath);
};
file.expand = function(...args) {
var options = isPlainObject(args[0]) ? args.shift() : {};
var patterns = Array.isArray(args[0]) ? args[0] : args;
if (patterns.length === 0) {
return [];
}
var matches = processPatterns(patterns, function(pattern) {
return glob2.sync(pattern, options);
});
if (options.filter) {
matches = matches.filter(function(filepath) {
filepath = path3.join(options.cwd || "", filepath);
try {
if (typeof options.filter === "function") {
return options.filter(filepath);
} else {
return fs.statSync(filepath)[options.filter]();
}
} catch (e) {
return false;
}
});
}
return matches;
};
file.expandMapping = function(patterns, destBase, options) {
options = Object.assign({
rename: function(destBase2, destPath) {
return path3.join(destBase2 || "", destPath);
}
}, options);
var files = [];
var fileByDest = {};
file.expand(options, patterns).forEach(function(src) {
var destPath = src;
if (options.flatten) {
destPath = path3.basename(destPath);
}
if (options.ext) {
destPath = destPath.replace(/(\.[^\/]*)?$/, options.ext);
}
var dest = options.rename(destBase, destPath, options);
if (options.cwd) {
src = path3.join(options.cwd, src);
}
dest = dest.replace(pathSeparatorRe, "/");
src = src.replace(pathSeparatorRe, "/");
if (fileByDest[dest]) {
fileByDest[dest].src.push(src);
} else {
files.push({
src: [src],
dest
});
fileByDest[dest] = files[files.length - 1];
}
});
return files;
};
file.normalizeFilesArray = function(data) {
var files = [];
data.forEach(function(obj) {
var prop;
if ("src" in obj || "dest" in obj) {
files.push(obj);
}
});
if (files.length === 0) {
return [];
}
files = _(files).chain().forEach(function(obj) {
if (!("src" in obj) || !obj.src) {
return;
}
if (Array.isArray(obj.src)) {
obj.src = flatten(obj.src);
} else {
obj.src = [obj.src];
}
}).map(function(obj) {
var expandOptions = Object.assign({}, obj);
delete expandOptions.src;
delete expandOptions.dest;
if (obj.expand) {
return file.expandMapping(obj.src, obj.dest, expandOptions).map(function(mapObj) {
var result2 = Object.assign({}, obj);
result2.orig = Object.assign({}, obj);
result2.src = mapObj.src;
result2.dest = mapObj.dest;
["expand", "cwd", "flatten", "rename", "ext"].forEach(function(prop) {
delete result2[prop];
});
return result2;
});
}
var result = Object.assign({}, obj);
result.orig = Object.assign({}, obj);
if ("src" in result) {
Object.defineProperty(result, "src", {
enumerable: true,
get: function fn() {
var src;
if (!("result" in fn)) {
src = obj.src;
src = Array.isArray(src) ? flatten(src) : [src];
fn.result = file.expand(expandOptions, src);
}
return fn.result;
}
});
}
if ("dest" in result) {
result.dest = obj.dest;
}
return result;
}).flatten().value();
return files;
};
}
});
// node_modules/archiver-utils/index.js
var require_archiver_utils = __commonJS({
"node_modules/archiver-utils/index.js"(exports, module2) {
var fs = require_graceful_fs();
var path3 = require("path");
var nutil = require("util");
var lazystream = require_lazystream();
var normalizePath = require_normalize_path();
var defaults = require_lodash();
var Stream = require("stream").Stream;
var PassThrough = require_readable2().PassThrough;
var utils = module2.exports = {};
utils.file = require_file();
utils.collectStream = function(source, callback) {
var collection = [];
var size = 0;
source.on("error", callback);
source.on("data", function(chunk) {
collection.push(chunk);
size += chunk.length;
});
source.on("end", function() {
var buf = new Buffer(size);
var offset = 0;
collection.forEach(function(data) {
data.copy(buf, offset);
offset += data.length;
});
callback(null, buf);
});
};
utils.dateify = function(dateish) {
dateish = dateish || /* @__PURE__ */ new Date();
if (dateish instanceof Date) {
dateish = dateish;
} else if (typeof dateish === "string") {
dateish = new Date(dateish);
} else {
dateish = /* @__PURE__ */ new Date();
}
return dateish;
};
utils.defaults = function(object, source, guard) {
var args = arguments;
args[0] = args[0] || {};
return defaults(...args);
};
utils.isStream = function(source) {
return source instanceof Stream;
};
utils.lazyReadStream = function(filepath) {
return new lazystream.Readable(function() {
return fs.createReadStream(filepath);
});
};
utils.normalizeInputSource = function(source) {
if (source === null) {
return new Buffer(0);
} else if (typeof source === "string") {
return new Buffer(source);
} else if (utils.isStream(source) && !source._readableState) {
var normalized = new PassThrough();
source.pipe(normalized);
return normalized;
}
return source;
};
utils.sanitizePath = function(filepath) {
return normalizePath(filepath, false).replace(/^\w+:/, "").replace(/^(\.\.\/|\/)+/, "");
};
utils.trailingSlashIt = function(str) {
return str.slice(-1) !== "/" ? str + "/" : str;
};
utils.unixifyPath = function(filepath) {
return normalizePath(filepath, false).replace(/^\w+:/, "");
};
utils.walkdir = function(dirpath, base, callback) {
var results = [];
if (typeof base === "function") {
callback = base;
base = dirpath;
}
fs.readdir(dirpath, function(err, list) {
var i = 0;
var file;
var filepath;
if (err) {
return callback(err);
}
(function next() {
file = list[i++];
if (!file) {
return callback(null, results);
}
filepath = path3.join(dirpath, file);
fs.stat(filepath, function(err2, stats) {
results.push({
path: filepath,
relative: path3.relative(base, filepath).replace(/\\/g, "/"),
stats
});
if (stats && stats.isDirectory()) {
utils.walkdir(filepath, base, function(err3, res) {
res.forEach(function(dirEntry) {
results.push(dirEntry);
});
next();
});
} else {
next();
}
});
})();
});
};
}
});
// node_modules/archiver/lib/error.js
var require_error2 = __commonJS({
"node_modules/archiver/lib/error.js"(exports, module2) {
var util = require("util");
var ERROR_CODES = {
"ABORTED": "archive was aborted",
"DIRECTORYDIRPATHREQUIRED": "diretory dirpath argument must be a non-empty string value",
"DIRECTORYFUNCTIONINVALIDDATA": "invalid data returned by directory custom data function",
"ENTRYNAMEREQUIRED": "entry name must be a non-empty string value",
"FILEFILEPATHREQUIRED": "file filepath argument must be a non-empty string value",
"FINALIZING": "archive already finalizing",
"QUEUECLOSED": "queue closed",
"NOENDMETHOD": "no suitable finalize/end method defined by module",
"DIRECTORYNOTSUPPORTED": "support for directory entries not defined by module",
"FORMATSET": "archive format already set",
"INPUTSTEAMBUFFERREQUIRED": "input source must be valid Stream or Buffer instance",
"MODULESET": "module already set",
"SYMLINKNOTSUPPORTED": "support for symlink entries not defined by module",
"SYMLINKFILEPATHREQUIRED": "symlink filepath argument must be a non-empty string value",
"SYMLINKTARGETREQUIRED": "symlink target argument must be a non-empty string value",
"ENTRYNOTSUPPORTED": "entry not supported"
};
function ArchiverError(code, data) {
Error.captureStackTrace(this, this.constructor);
this.message = ERROR_CODES[code] || code;
this.code = code;
this.data = data;
}
util.inherits(ArchiverError, Error);
exports = module2.exports = ArchiverError;
}
});
// node_modules/readable-stream/lib/internal/streams/stream.js
var require_stream3 = __commonJS({
"node_modules/readable-stream/lib/internal/streams/stream.js"(exports, module2) {
module2.exports = require("stream");
}
});
// node_modules/readable-stream/lib/internal/streams/buffer_list.js
var require_buffer_list = __commonJS({
"node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports, module2) {
"use strict";
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
return Constructor;
}
var _require = require("buffer");
var Buffer2 = _require.Buffer;
var _require2 = require("util");
var inspect = _require2.inspect;
var custom = inspect && inspect.custom || "inspect";
function copyBuffer(src, target, offset) {
Buffer2.prototype.copy.call(src, target, offset);
}
module2.exports = /* @__PURE__ */ function() {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
_createClass(BufferList, [{
key: "push",
value: function push(v) {
var entry = {
data: v,
next: null
};
if (this.length > 0)
this.tail.next = entry;
else
this.head = entry;
this.tail = entry;
++this.length;
}
}, {
key: "unshift",
value: function unshift(v) {
var entry = {
data: v,
next: this.head
};
if (this.length === 0)
this.tail = entry;
this.head = entry;
++this.length;
}
}, {
key: "shift",
value: function shift() {
if (this.length === 0)
return;
var ret = this.head.data;
if (this.length === 1)
this.head = this.tail = null;
else
this.head = this.head.next;
--this.length;
return ret;
}
}, {
key: "clear",
value: function clear() {
this.head = this.tail = null;
this.length = 0;
}
}, {
key: "join",
value: function join(s) {
if (this.length === 0)
return "";
var p = this.head;
var ret = "" + p.data;
while (p = p.next) {
ret += s + p.data;
}
return ret;
}
}, {
key: "concat",
value: function concat2(n) {
if (this.length === 0)
return Buffer2.alloc(0);
var ret = Buffer2.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
}
// Consumes a specified amount of bytes or characters from the buffered data.
}, {
key: "consume",
value: function consume(n, hasStrings) {
var ret;
if (n < this.head.data.length) {
ret = this.head.data.slice(0, n);
this.head.data = this.head.data.slice(n);
} else if (n === this.head.data.length) {
ret = this.shift();
} else {
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
}
return ret;
}
}, {
key: "first",
value: function first() {
return this.head.data;
}
// Consumes a specified amount of characters from the buffered data.
}, {
key: "_getString",
value: function _getString(n) {
var p = this.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length)
ret += str;
else
ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next)
this.head = p.next;
else
this.head = this.tail = null;
} else {
this.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
// Consumes a specified amount of bytes from the buffered data.
}, {
key: "_getBuffer",
value: function _getBuffer(n) {
var ret = Buffer2.allocUnsafe(n);
var p = this.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next)
this.head = p.next;
else
this.head = this.tail = null;
} else {
this.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
// Make sure the linked list only shows the minimal necessary information.
}, {
key: custom,
value: function value(_2, options) {
return inspect(this, _objectSpread({}, options, {
// Only inspect one level.
depth: 0,
// It should not recurse.
customInspect: false
}));
}
}]);
return BufferList;
}();
}
});
// node_modules/readable-stream/lib/internal/streams/destroy.js
var require_destroy3 = __commonJS({
"node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module2) {
"use strict";
function destroy(err, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err) {
if (!this._writableState) {
process.nextTick(emitErrorNT, this, err);
} else if (!this._writableState.errorEmitted) {
this._writableState.errorEmitted = true;
process.nextTick(emitErrorNT, this, err);
}
}
return this;
}
if (this._readableState) {
this._readableState.destroyed = true;
}
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err || null, function(err2) {
if (!cb && err2) {
if (!_this._writableState) {
process.nextTick(emitErrorAndCloseNT, _this, err2);
} else if (!_this._writableState.errorEmitted) {
_this._writableState.errorEmitted = true;
process.nextTick(emitErrorAndCloseNT, _this, err2);
} else {
process.nextTick(emitCloseNT, _this);
}
} else if (cb) {
process.nextTick(emitCloseNT, _this);
cb(err2);
} else {
process.nextTick(emitCloseNT, _this);
}
});
return this;
}
function emitErrorAndCloseNT(self2, err) {
emitErrorNT(self2, err);
emitCloseNT(self2);
}
function emitCloseNT(self2) {
if (self2._writableState && !self2._writableState.emitClose)
return;
if (self2._readableState && !self2._readableState.emitClose)
return;
self2.emit("close");
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finalCalled = false;
this._writableState.prefinished = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
function emitErrorNT(self2, err) {
self2.emit("error", err);
}
function errorOrDestroy(stream, err) {
var rState = stream._readableState;
var wState = stream._writableState;
if (rState && rState.autoDestroy || wState && wState.autoDestroy)
stream.destroy(err);
else
stream.emit("error", err);
}
module2.exports = {
destroy,
undestroy,
errorOrDestroy
};
}
});
// node_modules/readable-stream/errors.js
var require_errors = __commonJS({
"node_modules/readable-stream/errors.js"(exports, module2) {
"use strict";
var codes = {};
function createErrorType(code, message, Base) {
if (!Base) {
Base = Error;
}
function getMessage(arg1, arg2, arg3) {
if (typeof message === "string") {
return message;
} else {
return message(arg1, arg2, arg3);
}
}
class NodeError extends Base {
constructor(arg1, arg2, arg3) {
super(getMessage(arg1, arg2, arg3));
}
}
NodeError.prototype.name = Base.name;
NodeError.prototype.code = code;
codes[code] = NodeError;
}
function oneOf(expected, thing) {
if (Array.isArray(expected)) {
const len = expected.length;
expected = expected.map((i) => String(i));
if (len > 2) {
return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1];
} else if (len === 2) {
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
} else {
return `of ${thing} ${expected[0]}`;
}
} else {
return `of ${thing} ${String(expected)}`;
}
}
function startsWith(str, search, pos) {
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
}
function endsWith(str, search, this_len) {
if (this_len === void 0 || this_len > str.length) {
this_len = str.length;
}
return str.substring(this_len - search.length, this_len) === search;
}
function includes(str, search, start) {
if (typeof start !== "number") {
start = 0;
}
if (start + search.length > str.length) {
return false;
} else {
return str.indexOf(search, start) !== -1;
}
}
createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {
return 'The value "' + value + '" is invalid for option "' + name + '"';
}, TypeError);
createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {
let determiner;
if (typeof expected === "string" && startsWith(expected, "not ")) {
determiner = "must not be";
expected = expected.replace(/^not /, "");
} else {
determiner = "must be";
}
let msg;
if (endsWith(name, " argument")) {
msg = `The ${name} ${determiner} ${oneOf(expected, "type")}`;
} else {
const type = includes(name, ".") ? "property" : "argument";
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, "type")}`;
}
msg += `. Received type ${typeof actual}`;
return msg;
}, TypeError);
createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {
return "The " + name + " method is not implemented";
});
createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
createErrorType("ERR_STREAM_DESTROYED", function(name) {
return "Cannot call " + name + " after a stream was destroyed";
});
createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
return "Unknown encoding: " + arg;
}, TypeError);
createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
module2.exports.codes = codes;
}
});
// node_modules/readable-stream/lib/internal/streams/state.js
var require_state = __commonJS({
"node_modules/readable-stream/lib/internal/streams/state.js"(exports, module2) {
"use strict";
var ERR_INVALID_OPT_VALUE = require_errors().codes.ERR_INVALID_OPT_VALUE;
function highWaterMarkFrom(options, isDuplex, duplexKey) {
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
}
function getHighWaterMark(state, options, duplexKey, isDuplex) {
var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
if (hwm != null) {
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
var name = isDuplex ? duplexKey : "highWaterMark";
throw new ERR_INVALID_OPT_VALUE(name, hwm);
}
return Math.floor(hwm);
}
return state.objectMode ? 16 : 16 * 1024;
}
module2.exports = {
getHighWaterMark
};
}
});
// node_modules/readable-stream/lib/_stream_writable.js
var require_stream_writable3 = __commonJS({
"node_modules/readable-stream/lib/_stream_writable.js"(exports, module2) {
"use strict";
module2.exports = Writable;
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function() {
onCorkedFinish(_this, state);
};
}
var Duplex;
Writable.WritableState = WritableState;
var internalUtil = {
deprecate: require_node()
};
var Stream = require_stream3();
var Buffer2 = require("buffer").Buffer;
var OurUint8Array = global.Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var destroyImpl = require_destroy3();
var _require = require_state();
var getHighWaterMark = _require.getHighWaterMark;
var _require$codes = require_errors().codes;
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;
var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;
var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
var errorOrDestroy = destroyImpl.errorOrDestroy;
require_inherits()(Writable, Stream);
function nop() {
}
function WritableState(options, stream, isDuplex) {
Duplex = Duplex || require_stream_duplex3();
options = options || {};
if (typeof isDuplex !== "boolean")
isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.writableObjectMode;
this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
this.finalCalled = false;
this.needDrain = false;
this.ending = false;
this.ended = false;
this.finished = false;
this.destroyed = false;
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.length = 0;
this.writing = false;
this.corked = 0;
this.sync = true;
this.bufferProcessing = false;
this.onwrite = function(er) {
onwrite(stream, er);
};
this.writecb = null;
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
this.pendingcb = 0;
this.prefinished = false;
this.errorEmitted = false;
this.emitClose = options.emitClose !== false;
this.autoDestroy = !!options.autoDestroy;
this.bufferedRequestCount = 0;
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function() {
try {
Object.defineProperty(WritableState.prototype, "buffer", {
get: internalUtil.deprecate(function writableStateBufferGetter() {
return this.getBuffer();
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
});
} catch (_2) {
}
})();
var realHasInstance;
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function value(object) {
if (realHasInstance.call(this, object))
return true;
if (this !== Writable)
return false;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function realHasInstance2(object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || require_stream_duplex3();
var isDuplex = this instanceof Duplex;
if (!isDuplex && !realHasInstance.call(Writable, this))
return new Writable(options);
this._writableState = new WritableState(options, this, isDuplex);
this.writable = true;
if (options) {
if (typeof options.write === "function")
this._write = options.write;
if (typeof options.writev === "function")
this._writev = options.writev;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
if (typeof options.final === "function")
this._final = options.final;
}
Stream.call(this);
}
Writable.prototype.pipe = function() {
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
};
function writeAfterEnd(stream, cb) {
var er = new ERR_STREAM_WRITE_AFTER_END();
errorOrDestroy(stream, er);
process.nextTick(cb, er);
}
function validChunk(stream, state, chunk, cb) {
var er;
if (chunk === null) {
er = new ERR_STREAM_NULL_VALUES();
} else if (typeof chunk !== "string" && !state.objectMode) {
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
}
if (er) {
errorOrDestroy(stream, er);
process.nextTick(cb, er);
return false;
}
return true;
}
Writable.prototype.write = function(chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
var isBuf = !state.objectMode && _isUint8Array(chunk);
if (isBuf && !Buffer2.isBuffer(chunk)) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (isBuf)
encoding = "buffer";
else if (!encoding)
encoding = state.defaultEncoding;
if (typeof cb !== "function")
cb = nop;
if (state.ending)
writeAfterEnd(this, cb);
else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
return ret;
};
Writable.prototype.cork = function() {
this._writableState.corked++;
};
Writable.prototype.uncork = function() {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest)
clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
if (typeof encoding === "string")
encoding = encoding.toLowerCase();
if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
throw new ERR_UNKNOWN_ENCODING(encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
Object.defineProperty(Writable.prototype, "writableBuffer", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState && this._writableState.getBuffer();
}
});
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
chunk = Buffer2.from(chunk, encoding);
}
return chunk;
}
Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.highWaterMark;
}
});
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state, chunk, encoding);
if (chunk !== newChunk) {
isBuf = true;
encoding = "buffer";
chunk = newChunk;
}
}
var len = state.objectMode ? 1 : chunk.length;
state.length += len;
var ret = state.length < state.highWaterMark;
if (!ret)
state.needDrain = true;
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = {
chunk,
encoding,
isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
return ret;
}
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writelen = len;
state.writecb = cb;
state.writing = true;
state.sync = true;
if (state.destroyed)
state.onwrite(new ERR_STREAM_DESTROYED("write"));
else if (writev)
stream._writev(chunk, state.onwrite);
else
stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync) {
process.nextTick(cb, er);
process.nextTick(finishMaybe, stream, state);
stream._writableState.errorEmitted = true;
errorOrDestroy(stream, er);
} else {
cb(er);
stream._writableState.errorEmitted = true;
errorOrDestroy(stream, er);
finishMaybe(stream, state);
}
}
function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}
function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
if (typeof cb !== "function")
throw new ERR_MULTIPLE_CALLBACK();
onwriteStateUpdate(state);
if (er)
onwriteError(stream, state, sync, er, cb);
else {
var finished = needFinish(state) || stream.destroyed;
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
process.nextTick(afterWrite, stream, state, finished, cb);
} else {
afterWrite(stream, state, finished, cb);
}
}
}
function afterWrite(stream, state, finished, cb) {
if (!finished)
onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
}
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit("drain");
}
}
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && entry && entry.next) {
var l = state.bufferedRequestCount;
var buffer = new Array(l);
var holder = state.corkedRequestsFree;
holder.entry = entry;
var count = 0;
var allBuffers = true;
while (entry) {
buffer[count] = entry;
if (!entry.isBuf)
allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state, true, state.length, buffer, "", holder.finish);
state.pendingcb++;
state.lastBufferedRequest = null;
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
state.bufferedRequestCount = 0;
} else {
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
state.bufferedRequestCount--;
if (state.writing) {
break;
}
}
if (entry === null)
state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
Writable.prototype._write = function(chunk, encoding, cb) {
cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
};
Writable.prototype._writev = null;
Writable.prototype.end = function(chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === "function") {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (chunk !== null && chunk !== void 0)
this.write(chunk, encoding);
if (state.corked) {
state.corked = 1;
this.uncork();
}
if (!state.ending)
endWritable(this, state, cb);
return this;
};
Object.defineProperty(Writable.prototype, "writableLength", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.length;
}
});
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function callFinal(stream, state) {
stream._final(function(err) {
state.pendingcb--;
if (err) {
errorOrDestroy(stream, err);
}
state.prefinished = true;
stream.emit("prefinish");
finishMaybe(stream, state);
});
}
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
if (typeof stream._final === "function" && !state.destroyed) {
state.pendingcb++;
state.finalCalled = true;
process.nextTick(callFinal, stream, state);
} else {
state.prefinished = true;
stream.emit("prefinish");
}
}
}
function finishMaybe(stream, state) {
var need = needFinish(state);
if (need) {
prefinish(stream, state);
if (state.pendingcb === 0) {
state.finished = true;
stream.emit("finish");
if (state.autoDestroy) {
var rState = stream._readableState;
if (!rState || rState.autoDestroy && rState.endEmitted) {
stream.destroy();
}
}
}
}
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
if (state.finished)
process.nextTick(cb);
else
stream.once("finish", cb);
}
state.ended = true;
stream.writable = false;
}
function onCorkedFinish(corkReq, state, err) {
var entry = corkReq.entry;
corkReq.entry = null;
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
}
state.corkedRequestsFree.next = corkReq;
}
Object.defineProperty(Writable.prototype, "destroyed", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
if (this._writableState === void 0) {
return false;
}
return this._writableState.destroyed;
},
set: function set(value) {
if (!this._writableState) {
return;
}
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
Writable.prototype._destroy = function(err, cb) {
cb(err);
};
}
});
// node_modules/readable-stream/lib/_stream_duplex.js
var require_stream_duplex3 = __commonJS({
"node_modules/readable-stream/lib/_stream_duplex.js"(exports, module2) {
"use strict";
var objectKeys = Object.keys || function(obj) {
var keys2 = [];
for (var key in obj) {
keys2.push(key);
}
return keys2;
};
module2.exports = Duplex;
var Readable = require_stream_readable3();
var Writable = require_stream_writable3();
require_inherits()(Duplex, Readable);
{
keys = objectKeys(Writable.prototype);
for (v = 0; v < keys.length; v++) {
method = keys[v];
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
}
}
var keys;
var method;
var v;
function Duplex(options) {
if (!(this instanceof Duplex))
return new Duplex(options);
Readable.call(this, options);
Writable.call(this, options);
this.allowHalfOpen = true;
if (options) {
if (options.readable === false)
this.readable = false;
if (options.writable === false)
this.writable = false;
if (options.allowHalfOpen === false) {
this.allowHalfOpen = false;
this.once("end", onend);
}
}
}
Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.highWaterMark;
}
});
Object.defineProperty(Duplex.prototype, "writableBuffer", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState && this._writableState.getBuffer();
}
});
Object.defineProperty(Duplex.prototype, "writableLength", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._writableState.length;
}
});
function onend() {
if (this._writableState.ended)
return;
process.nextTick(onEndNT, this);
}
function onEndNT(self2) {
self2.end();
}
Object.defineProperty(Duplex.prototype, "destroyed", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
if (this._readableState === void 0 || this._writableState === void 0) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set: function set(value) {
if (this._readableState === void 0 || this._writableState === void 0) {
return;
}
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
}
});
// node_modules/safe-buffer/index.js
var require_safe_buffer3 = __commonJS({
"node_modules/safe-buffer/index.js"(exports, module2) {
var buffer = require("buffer");
var Buffer2 = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
module2.exports = buffer;
} else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer2(arg, encodingOrOffset, length);
}
SafeBuffer.prototype = Object.create(Buffer2.prototype);
copyProps(Buffer2, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
throw new TypeError("Argument must not be a number");
}
return Buffer2(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
var buf = Buffer2(size);
if (fill !== void 0) {
if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return Buffer2(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return buffer.SlowBuffer(size);
};
}
});
// node_modules/string_decoder/lib/string_decoder.js
var require_string_decoder3 = __commonJS({
"node_modules/string_decoder/lib/string_decoder.js"(exports) {
"use strict";
var Buffer2 = require_safe_buffer3().Buffer;
var isEncoding = Buffer2.isEncoding || function(encoding) {
encoding = "" + encoding;
switch (encoding && encoding.toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
case "raw":
return true;
default:
return false;
}
};
function _normalizeEncoding(enc) {
if (!enc)
return "utf8";
var retried;
while (true) {
switch (enc) {
case "utf8":
case "utf-8":
return "utf8";
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return "utf16le";
case "latin1":
case "binary":
return "latin1";
case "base64":
case "ascii":
case "hex":
return enc;
default:
if (retried)
return;
enc = ("" + enc).toLowerCase();
retried = true;
}
}
}
function normalizeEncoding(enc) {
var nenc = _normalizeEncoding(enc);
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc)))
throw new Error("Unknown encoding: " + enc);
return nenc || enc;
}
exports.StringDecoder = StringDecoder;
function StringDecoder(encoding) {
this.encoding = normalizeEncoding(encoding);
var nb;
switch (this.encoding) {
case "utf16le":
this.text = utf16Text;
this.end = utf16End;
nb = 4;
break;
case "utf8":
this.fillLast = utf8FillLast;
nb = 4;
break;
case "base64":
this.text = base64Text;
this.end = base64End;
nb = 3;
break;
default:
this.write = simpleWrite;
this.end = simpleEnd;
return;
}
this.lastNeed = 0;
this.lastTotal = 0;
this.lastChar = Buffer2.allocUnsafe(nb);
}
StringDecoder.prototype.write = function(buf) {
if (buf.length === 0)
return "";
var r;
var i;
if (this.lastNeed) {
r = this.fillLast(buf);
if (r === void 0)
return "";
i = this.lastNeed;
this.lastNeed = 0;
} else {
i = 0;
}
if (i < buf.length)
return r ? r + this.text(buf, i) : this.text(buf, i);
return r || "";
};
StringDecoder.prototype.end = utf8End;
StringDecoder.prototype.text = utf8Text;
StringDecoder.prototype.fillLast = function(buf) {
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
this.lastNeed -= buf.length;
};
function utf8CheckByte(byte) {
if (byte <= 127)
return 0;
else if (byte >> 5 === 6)
return 2;
else if (byte >> 4 === 14)
return 3;
else if (byte >> 3 === 30)
return 4;
return byte >> 6 === 2 ? -1 : -2;
}
function utf8CheckIncomplete(self2, buf, i) {
var j = buf.length - 1;
if (j < i)
return 0;
var nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 1;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0)
self2.lastNeed = nb - 2;
return nb;
}
if (--j < i || nb === -2)
return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) {
if (nb === 2)
nb = 0;
else
self2.lastNeed = nb - 3;
}
return nb;
}
return 0;
}
function utf8CheckExtraBytes(self2, buf, p) {
if ((buf[0] & 192) !== 128) {
self2.lastNeed = 0;
return "\uFFFD";
}
if (self2.lastNeed > 1 && buf.length > 1) {
if ((buf[1] & 192) !== 128) {
self2.lastNeed = 1;
return "\uFFFD";
}
if (self2.lastNeed > 2 && buf.length > 2) {
if ((buf[2] & 192) !== 128) {
self2.lastNeed = 2;
return "\uFFFD";
}
}
}
}
function utf8FillLast(buf) {
var p = this.lastTotal - this.lastNeed;
var r = utf8CheckExtraBytes(this, buf, p);
if (r !== void 0)
return r;
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, p, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, p, 0, buf.length);
this.lastNeed -= buf.length;
}
function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed)
return buf.toString("utf8", i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString("utf8", i, end);
}
function utf8End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + "\uFFFD";
return r;
}
function utf16Text(buf, i) {
if ((buf.length - i) % 2 === 0) {
var r = buf.toString("utf16le", i);
if (r) {
var c = r.charCodeAt(r.length - 1);
if (c >= 55296 && c <= 56319) {
this.lastNeed = 2;
this.lastTotal = 4;
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
return r.slice(0, -1);
}
}
return r;
}
this.lastNeed = 1;
this.lastTotal = 2;
this.lastChar[0] = buf[buf.length - 1];
return buf.toString("utf16le", i, buf.length - 1);
}
function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString("utf16le", 0, end);
}
return r;
}
function base64Text(buf, i) {
var n = (buf.length - i) % 3;
if (n === 0)
return buf.toString("base64", i);
this.lastNeed = 3 - n;
this.lastTotal = 3;
if (n === 1) {
this.lastChar[0] = buf[buf.length - 1];
} else {
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
}
return buf.toString("base64", i, buf.length - n);
}
function base64End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed)
return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
return r;
}
function simpleWrite(buf) {
return buf.toString(this.encoding);
}
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : "";
}
}
});
// node_modules/readable-stream/lib/internal/streams/end-of-stream.js
var require_end_of_stream = __commonJS({
"node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module2) {
"use strict";
var ERR_STREAM_PREMATURE_CLOSE = require_errors().codes.ERR_STREAM_PREMATURE_CLOSE;
function once2(callback) {
var called = false;
return function() {
if (called)
return;
called = true;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
callback.apply(this, args);
};
}
function noop() {
}
function isRequest(stream) {
return stream.setHeader && typeof stream.abort === "function";
}
function eos(stream, opts, callback) {
if (typeof opts === "function")
return eos(stream, null, opts);
if (!opts)
opts = {};
callback = once2(callback || noop);
var readable = opts.readable || opts.readable !== false && stream.readable;
var writable = opts.writable || opts.writable !== false && stream.writable;
var onlegacyfinish = function onlegacyfinish2() {
if (!stream.writable)
onfinish();
};
var writableEnded = stream._writableState && stream._writableState.finished;
var onfinish = function onfinish2() {
writable = false;
writableEnded = true;
if (!readable)
callback.call(stream);
};
var readableEnded = stream._readableState && stream._readableState.endEmitted;
var onend = function onend2() {
readable = false;
readableEnded = true;
if (!writable)
callback.call(stream);
};
var onerror = function onerror2(err) {
callback.call(stream, err);
};
var onclose = function onclose2() {
var err;
if (readable && !readableEnded) {
if (!stream._readableState || !stream._readableState.ended)
err = new ERR_STREAM_PREMATURE_CLOSE();
return callback.call(stream, err);
}
if (writable && !writableEnded) {
if (!stream._writableState || !stream._writableState.ended)
err = new ERR_STREAM_PREMATURE_CLOSE();
return callback.call(stream, err);
}
};
var onrequest = function onrequest2() {
stream.req.on("finish", onfinish);
};
if (isRequest(stream)) {
stream.on("complete", onfinish);
stream.on("abort", onclose);
if (stream.req)
onrequest();
else
stream.on("request", onrequest);
} else if (writable && !stream._writableState) {
stream.on("end", onlegacyfinish);
stream.on("close", onlegacyfinish);
}
stream.on("end", onend);
stream.on("finish", onfinish);
if (opts.error !== false)
stream.on("error", onerror);
stream.on("close", onclose);
return function() {
stream.removeListener("complete", onfinish);
stream.removeListener("abort", onclose);
stream.removeListener("request", onrequest);
if (stream.req)
stream.req.removeListener("finish", onfinish);
stream.removeListener("end", onlegacyfinish);
stream.removeListener("close", onlegacyfinish);
stream.removeListener("finish", onfinish);
stream.removeListener("end", onend);
stream.removeListener("error", onerror);
stream.removeListener("close", onclose);
};
}
module2.exports = eos;
}
});
// node_modules/readable-stream/lib/internal/streams/async_iterator.js
var require_async_iterator = __commonJS({
"node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports, module2) {
"use strict";
var _Object$setPrototypeO;
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
var finished = require_end_of_stream();
var kLastResolve = Symbol("lastResolve");
var kLastReject = Symbol("lastReject");
var kError = Symbol("error");
var kEnded = Symbol("ended");
var kLastPromise = Symbol("lastPromise");
var kHandlePromise = Symbol("handlePromise");
var kStream = Symbol("stream");
function createIterResult(value, done) {
return {
value,
done
};
}
function readAndResolve(iter) {
var resolve = iter[kLastResolve];
if (resolve !== null) {
var data = iter[kStream].read();
if (data !== null) {
iter[kLastPromise] = null;
iter[kLastResolve] = null;
iter[kLastReject] = null;
resolve(createIterResult(data, false));
}
}
}
function onReadable(iter) {
process.nextTick(readAndResolve, iter);
}
function wrapForNext(lastPromise, iter) {
return function(resolve, reject2) {
lastPromise.then(function() {
if (iter[kEnded]) {
resolve(createIterResult(void 0, true));
return;
}
iter[kHandlePromise](resolve, reject2);
}, reject2);
};
}
var AsyncIteratorPrototype = Object.getPrototypeOf(function() {
});
var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
get stream() {
return this[kStream];
},
next: function next() {
var _this = this;
var error = this[kError];
if (error !== null) {
return Promise.reject(error);
}
if (this[kEnded]) {
return Promise.resolve(createIterResult(void 0, true));
}
if (this[kStream].destroyed) {
return new Promise(function(resolve, reject2) {
process.nextTick(function() {
if (_this[kError]) {
reject2(_this[kError]);
} else {
resolve(createIterResult(void 0, true));
}
});
});
}
var lastPromise = this[kLastPromise];
var promise;
if (lastPromise) {
promise = new Promise(wrapForNext(lastPromise, this));
} else {
var data = this[kStream].read();
if (data !== null) {
return Promise.resolve(createIterResult(data, false));
}
promise = new Promise(this[kHandlePromise]);
}
this[kLastPromise] = promise;
return promise;
}
}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {
return this;
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
var _this2 = this;
return new Promise(function(resolve, reject2) {
_this2[kStream].destroy(null, function(err) {
if (err) {
reject2(err);
return;
}
resolve(createIterResult(void 0, true));
});
});
}), _Object$setPrototypeO), AsyncIteratorPrototype);
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {
var _Object$create;
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
value: stream,
writable: true
}), _defineProperty(_Object$create, kLastResolve, {
value: null,
writable: true
}), _defineProperty(_Object$create, kLastReject, {
value: null,
writable: true
}), _defineProperty(_Object$create, kError, {
value: null,
writable: true
}), _defineProperty(_Object$create, kEnded, {
value: stream._readableState.endEmitted,
writable: true
}), _defineProperty(_Object$create, kHandlePromise, {
value: function value(resolve, reject2) {
var data = iterator[kStream].read();
if (data) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(data, false));
} else {
iterator[kLastResolve] = resolve;
iterator[kLastReject] = reject2;
}
},
writable: true
}), _Object$create));
iterator[kLastPromise] = null;
finished(stream, function(err) {
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
var reject2 = iterator[kLastReject];
if (reject2 !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
reject2(err);
}
iterator[kError] = err;
return;
}
var resolve = iterator[kLastResolve];
if (resolve !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(void 0, true));
}
iterator[kEnded] = true;
});
stream.on("readable", onReadable.bind(null, iterator));
return iterator;
};
module2.exports = createReadableStreamAsyncIterator;
}
});
// node_modules/readable-stream/lib/internal/streams/from.js
var require_from = __commonJS({
"node_modules/readable-stream/lib/internal/streams/from.js"(exports, module2) {
"use strict";
function asyncGeneratorStep(gen, resolve, reject2, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject2(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self2 = this, args = arguments;
return new Promise(function(resolve, reject2) {
var gen = fn.apply(self2, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject2, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject2, _next, _throw, "throw", err);
}
_next(void 0);
});
};
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly)
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
var ERR_INVALID_ARG_TYPE = require_errors().codes.ERR_INVALID_ARG_TYPE;
function from(Readable, iterable, opts) {
var iterator;
if (iterable && typeof iterable.next === "function") {
iterator = iterable;
} else if (iterable && iterable[Symbol.asyncIterator])
iterator = iterable[Symbol.asyncIterator]();
else if (iterable && iterable[Symbol.iterator])
iterator = iterable[Symbol.iterator]();
else
throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
var readable = new Readable(_objectSpread({
objectMode: true
}, opts));
var reading = false;
readable._read = function() {
if (!reading) {
reading = true;
next();
}
};
function next() {
return _next2.apply(this, arguments);
}
function _next2() {
_next2 = _asyncToGenerator(function* () {
try {
var _ref = yield iterator.next(), value = _ref.value, done = _ref.done;
if (done) {
readable.push(null);
} else if (readable.push(yield value)) {
next();
} else {
reading = false;
}
} catch (err) {
readable.destroy(err);
}
});
return _next2.apply(this, arguments);
}
return readable;
}
module2.exports = from;
}
});
// node_modules/readable-stream/lib/_stream_readable.js
var require_stream_readable3 = __commonJS({
"node_modules/readable-stream/lib/_stream_readable.js"(exports, module2) {
"use strict";
module2.exports = Readable;
var Duplex;
Readable.ReadableState = ReadableState;
var EE = require("events").EventEmitter;
var EElistenerCount = function EElistenerCount2(emitter, type) {
return emitter.listeners(type).length;
};
var Stream = require_stream3();
var Buffer2 = require("buffer").Buffer;
var OurUint8Array = global.Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var debugUtil = require("util");
var debug;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog("stream");
} else {
debug = function debug2() {
};
}
var BufferList = require_buffer_list();
var destroyImpl = require_destroy3();
var _require = require_state();
var getHighWaterMark = _require.getHighWaterMark;
var _require$codes = require_errors().codes;
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
var StringDecoder;
var createReadableStreamAsyncIterator;
var from;
require_inherits()(Readable, Stream);
var errorOrDestroy = destroyImpl.errorOrDestroy;
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
function prependListener(emitter, event, fn) {
if (typeof emitter.prependListener === "function")
return emitter.prependListener(event, fn);
if (!emitter._events || !emitter._events[event])
emitter.on(event, fn);
else if (Array.isArray(emitter._events[event]))
emitter._events[event].unshift(fn);
else
emitter._events[event] = [fn, emitter._events[event]];
}
function ReadableState(options, stream, isDuplex) {
Duplex = Duplex || require_stream_duplex3();
options = options || {};
if (typeof isDuplex !== "boolean")
isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
this.flowing = null;
this.ended = false;
this.endEmitted = false;
this.reading = false;
this.sync = true;
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
this.paused = true;
this.emitClose = options.emitClose !== false;
this.autoDestroy = !!options.autoDestroy;
this.destroyed = false;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.awaitDrain = 0;
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder)
StringDecoder = require_string_decoder3().StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
Duplex = Duplex || require_stream_duplex3();
if (!(this instanceof Readable))
return new Readable(options);
var isDuplex = this instanceof Duplex;
this._readableState = new ReadableState(options, this, isDuplex);
this.readable = true;
if (options) {
if (typeof options.read === "function")
this._read = options.read;
if (typeof options.destroy === "function")
this._destroy = options.destroy;
}
Stream.call(this);
}
Object.defineProperty(Readable.prototype, "destroyed", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
if (this._readableState === void 0) {
return false;
}
return this._readableState.destroyed;
},
set: function set(value) {
if (!this._readableState) {
return;
}
this._readableState.destroyed = value;
}
});
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
Readable.prototype._destroy = function(err, cb) {
cb(err);
};
Readable.prototype.push = function(chunk, encoding) {
var state = this._readableState;
var skipChunkCheck;
if (!state.objectMode) {
if (typeof chunk === "string") {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
chunk = Buffer2.from(chunk, encoding);
encoding = "";
}
skipChunkCheck = true;
}
} else {
skipChunkCheck = true;
}
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
};
Readable.prototype.unshift = function(chunk) {
return readableAddChunk(this, chunk, null, true, false);
};
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
debug("readableAddChunk", chunk);
var state = stream._readableState;
if (chunk === null) {
state.reading = false;
onEofChunk(stream, state);
} else {
var er;
if (!skipChunkCheck)
er = chunkInvalid(state, chunk);
if (er) {
errorOrDestroy(stream, er);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (addToFront) {
if (state.endEmitted)
errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
else
addChunk(stream, state, chunk, true);
} else if (state.ended) {
errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
} else if (state.destroyed) {
return false;
} else {
state.reading = false;
if (state.decoder && !encoding) {
chunk = state.decoder.write(chunk);
if (state.objectMode || chunk.length !== 0)
addChunk(stream, state, chunk, false);
else
maybeReadMore(stream, state);
} else {
addChunk(stream, state, chunk, false);
}
}
} else if (!addToFront) {
state.reading = false;
maybeReadMore(stream, state);
}
}
return !state.ended && (state.length < state.highWaterMark || state.length === 0);
}
function addChunk(stream, state, chunk, addToFront) {
if (state.flowing && state.length === 0 && !state.sync) {
state.awaitDrain = 0;
stream.emit("data", chunk);
} else {
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront)
state.buffer.unshift(chunk);
else
state.buffer.push(chunk);
if (state.needReadable)
emitReadable(stream);
}
maybeReadMore(stream, state);
}
function chunkInvalid(state, chunk) {
var er;
if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
}
return er;
}
Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
Readable.prototype.setEncoding = function(enc) {
if (!StringDecoder)
StringDecoder = require_string_decoder3().StringDecoder;
var decoder = new StringDecoder(enc);
this._readableState.decoder = decoder;
this._readableState.encoding = this._readableState.decoder.encoding;
var p = this._readableState.buffer.head;
var content = "";
while (p !== null) {
content += decoder.write(p.data);
p = p.next;
}
this._readableState.buffer.clear();
if (content !== "")
this._readableState.buffer.push(content);
this._readableState.length = content.length;
return this;
};
var MAX_HWM = 1073741824;
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
n--;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
n++;
}
return n;
}
function howMuchToRead(n, state) {
if (n <= 0 || state.length === 0 && state.ended)
return 0;
if (state.objectMode)
return 1;
if (n !== n) {
if (state.flowing && state.length)
return state.buffer.head.data.length;
else
return state.length;
}
if (n > state.highWaterMark)
state.highWaterMark = computeNewHighWaterMark(n);
if (n <= state.length)
return n;
if (!state.ended) {
state.needReadable = true;
return 0;
}
return state.length;
}
Readable.prototype.read = function(n) {
debug("read", n);
n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
if (n !== 0)
state.emittedReadable = false;
if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
debug("read: emitReadable", state.length, state.ended);
if (state.length === 0 && state.ended)
endReadable(this);
else
emitReadable(this);
return null;
}
n = howMuchToRead(n, state);
if (n === 0 && state.ended) {
if (state.length === 0)
endReadable(this);
return null;
}
var doRead = state.needReadable;
debug("need readable", doRead);
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug("length less than watermark", doRead);
}
if (state.ended || state.reading) {
doRead = false;
debug("reading or ended", doRead);
} else if (doRead) {
debug("do read");
state.reading = true;
state.sync = true;
if (state.length === 0)
state.needReadable = true;
this._read(state.highWaterMark);
state.sync = false;
if (!state.reading)
n = howMuchToRead(nOrig, state);
}
var ret;
if (n > 0)
ret = fromList(n, state);
else
ret = null;
if (ret === null) {
state.needReadable = state.length <= state.highWaterMark;
n = 0;
} else {
state.length -= n;
state.awaitDrain = 0;
}
if (state.length === 0) {
if (!state.ended)
state.needReadable = true;
if (nOrig !== n && state.ended)
endReadable(this);
}
if (ret !== null)
this.emit("data", ret);
return ret;
};
function onEofChunk(stream, state) {
debug("onEofChunk");
if (state.ended)
return;
if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
}
}
state.ended = true;
if (state.sync) {
emitReadable(stream);
} else {
state.needReadable = false;
if (!state.emittedReadable) {
state.emittedReadable = true;
emitReadable_(stream);
}
}
}
function emitReadable(stream) {
var state = stream._readableState;
debug("emitReadable", state.needReadable, state.emittedReadable);
state.needReadable = false;
if (!state.emittedReadable) {
debug("emitReadable", state.flowing);
state.emittedReadable = true;
process.nextTick(emitReadable_, stream);
}
}
function emitReadable_(stream) {
var state = stream._readableState;
debug("emitReadable_", state.destroyed, state.length, state.ended);
if (!state.destroyed && (state.length || state.ended)) {
stream.emit("readable");
state.emittedReadable = false;
}
state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
flow(stream);
}
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
process.nextTick(maybeReadMore_, stream, state);
}
}
function maybeReadMore_(stream, state) {
while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
var len = state.length;
debug("maybeReadMore read 0");
stream.read(0);
if (len === state.length)
break;
}
state.readingMore = false;
}
Readable.prototype._read = function(n) {
errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
};
Readable.prototype.pipe = function(dest, pipeOpts) {
var src = this;
var state = this._readableState;
switch (state.pipesCount) {
case 0:
state.pipes = dest;
break;
case 1:
state.pipes = [state.pipes, dest];
break;
default:
state.pipes.push(dest);
break;
}
state.pipesCount += 1;
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
var endFn = doEnd ? onend : unpipe;
if (state.endEmitted)
process.nextTick(endFn);
else
src.once("end", endFn);
dest.on("unpipe", onunpipe);
function onunpipe(readable, unpipeInfo) {
debug("onunpipe");
if (readable === src) {
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
unpipeInfo.hasUnpiped = true;
cleanup();
}
}
}
function onend() {
debug("onend");
dest.end();
}
var ondrain = pipeOnDrain(src);
dest.on("drain", ondrain);
var cleanedUp = false;
function cleanup() {
debug("cleanup");
dest.removeListener("close", onclose);
dest.removeListener("finish", onfinish);
dest.removeListener("drain", ondrain);
dest.removeListener("error", onerror);
dest.removeListener("unpipe", onunpipe);
src.removeListener("end", onend);
src.removeListener("end", unpipe);
src.removeListener("data", ondata);
cleanedUp = true;
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
ondrain();
}
src.on("data", ondata);
function ondata(chunk) {
debug("ondata");
var ret = dest.write(chunk);
debug("dest.write", ret);
if (ret === false) {
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug("false write response, pause", state.awaitDrain);
state.awaitDrain++;
}
src.pause();
}
}
function onerror(er) {
debug("onerror", er);
unpipe();
dest.removeListener("error", onerror);
if (EElistenerCount(dest, "error") === 0)
errorOrDestroy(dest, er);
}
prependListener(dest, "error", onerror);
function onclose() {
dest.removeListener("finish", onfinish);
unpipe();
}
dest.once("close", onclose);
function onfinish() {
debug("onfinish");
dest.removeListener("close", onclose);
unpipe();
}
dest.once("finish", onfinish);
function unpipe() {
debug("unpipe");
src.unpipe(dest);
}
dest.emit("pipe", src);
if (!state.flowing) {
debug("pipe resume");
src.resume();
}
return dest;
};
function pipeOnDrain(src) {
return function pipeOnDrainFunctionResult() {
var state = src._readableState;
debug("pipeOnDrain", state.awaitDrain);
if (state.awaitDrain)
state.awaitDrain--;
if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
state.flowing = true;
flow(src);
}
};
}
Readable.prototype.unpipe = function(dest) {
var state = this._readableState;
var unpipeInfo = {
hasUnpiped: false
};
if (state.pipesCount === 0)
return this;
if (state.pipesCount === 1) {
if (dest && dest !== state.pipes)
return this;
if (!dest)
dest = state.pipes;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
if (dest)
dest.emit("unpipe", this, unpipeInfo);
return this;
}
if (!dest) {
var dests = state.pipes;
var len = state.pipesCount;
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
for (var i = 0; i < len; i++) {
dests[i].emit("unpipe", this, {
hasUnpiped: false
});
}
return this;
}
var index2 = indexOf(state.pipes, dest);
if (index2 === -1)
return this;
state.pipes.splice(index2, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1)
state.pipes = state.pipes[0];
dest.emit("unpipe", this, unpipeInfo);
return this;
};
Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
var state = this._readableState;
if (ev === "data") {
state.readableListening = this.listenerCount("readable") > 0;
if (state.flowing !== false)
this.resume();
} else if (ev === "readable") {
if (!state.endEmitted && !state.readableListening) {
state.readableListening = state.needReadable = true;
state.flowing = false;
state.emittedReadable = false;
debug("on readable", state.length, state.reading);
if (state.length) {
emitReadable(this);
} else if (!state.reading) {
process.nextTick(nReadingNextTick, this);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
Readable.prototype.removeListener = function(ev, fn) {
var res = Stream.prototype.removeListener.call(this, ev, fn);
if (ev === "readable") {
process.nextTick(updateReadableListening, this);
}
return res;
};
Readable.prototype.removeAllListeners = function(ev) {
var res = Stream.prototype.removeAllListeners.apply(this, arguments);
if (ev === "readable" || ev === void 0) {
process.nextTick(updateReadableListening, this);
}
return res;
};
function updateReadableListening(self2) {
var state = self2._readableState;
state.readableListening = self2.listenerCount("readable") > 0;
if (state.resumeScheduled && !state.paused) {
state.flowing = true;
} else if (self2.listenerCount("data") > 0) {
self2.resume();
}
}
function nReadingNextTick(self2) {
debug("readable nexttick read 0");
self2.read(0);
}
Readable.prototype.resume = function() {
var state = this._readableState;
if (!state.flowing) {
debug("resume");
state.flowing = !state.readableListening;
resume(this, state);
}
state.paused = false;
return this;
};
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
process.nextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
debug("resume", state.reading);
if (!state.reading) {
stream.read(0);
}
state.resumeScheduled = false;
stream.emit("resume");
flow(stream);
if (state.flowing && !state.reading)
stream.read(0);
}
Readable.prototype.pause = function() {
debug("call pause flowing=%j", this._readableState.flowing);
if (this._readableState.flowing !== false) {
debug("pause");
this._readableState.flowing = false;
this.emit("pause");
}
this._readableState.paused = true;
return this;
};
function flow(stream) {
var state = stream._readableState;
debug("flow", state.flowing);
while (state.flowing && stream.read() !== null) {
;
}
}
Readable.prototype.wrap = function(stream) {
var _this = this;
var state = this._readableState;
var paused = false;
stream.on("end", function() {
debug("wrapped end");
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length)
_this.push(chunk);
}
_this.push(null);
});
stream.on("data", function(chunk) {
debug("wrapped data");
if (state.decoder)
chunk = state.decoder.write(chunk);
if (state.objectMode && (chunk === null || chunk === void 0))
return;
else if (!state.objectMode && (!chunk || !chunk.length))
return;
var ret = _this.push(chunk);
if (!ret) {
paused = true;
stream.pause();
}
});
for (var i in stream) {
if (this[i] === void 0 && typeof stream[i] === "function") {
this[i] = function methodWrap(method) {
return function methodWrapReturnFunction() {
return stream[method].apply(stream, arguments);
};
}(i);
}
}
for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}
this._read = function(n2) {
debug("wrapped _read", n2);
if (paused) {
paused = false;
stream.resume();
}
};
return this;
};
if (typeof Symbol === "function") {
Readable.prototype[Symbol.asyncIterator] = function() {
if (createReadableStreamAsyncIterator === void 0) {
createReadableStreamAsyncIterator = require_async_iterator();
}
return createReadableStreamAsyncIterator(this);
};
}
Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState.highWaterMark;
}
});
Object.defineProperty(Readable.prototype, "readableBuffer", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState && this._readableState.buffer;
}
});
Object.defineProperty(Readable.prototype, "readableFlowing", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState.flowing;
},
set: function set(state) {
if (this._readableState) {
this._readableState.flowing = state;
}
}
});
Readable._fromList = fromList;
Object.defineProperty(Readable.prototype, "readableLength", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get() {
return this._readableState.length;
}
});
function fromList(n, state) {
if (state.length === 0)
return null;
var ret;
if (state.objectMode)
ret = state.buffer.shift();
else if (!n || n >= state.length) {
if (state.decoder)
ret = state.buffer.join("");
else if (state.buffer.length === 1)
ret = state.buffer.first();
else
ret = state.buffer.concat(state.length);
state.buffer.clear();
} else {
ret = state.buffer.consume(n, state.decoder);
}
return ret;
}
function endReadable(stream) {
var state = stream._readableState;
debug("endReadable", state.endEmitted);
if (!state.endEmitted) {
state.ended = true;
process.nextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
debug("endReadableNT", state.endEmitted, state.length);
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit("end");
if (state.autoDestroy) {
var wState = stream._writableState;
if (!wState || wState.autoDestroy && wState.finished) {
stream.destroy();
}
}
}
}
if (typeof Symbol === "function") {
Readable.from = function(iterable, opts) {
if (from === void 0) {
from = require_from();
}
return from(Readable, iterable, opts);
};
}
function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x)
return i;
}
return -1;
}
}
});
// node_modules/readable-stream/lib/_stream_transform.js
var require_stream_transform3 = __commonJS({
"node_modules/readable-stream/lib/_stream_transform.js"(exports, module2) {
"use strict";
module2.exports = Transform;
var _require$codes = require_errors().codes;
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;
var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
var Duplex = require_stream_duplex3();
require_inherits()(Transform, Duplex);
function afterTransform(er, data) {
var ts = this._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (cb === null) {
return this.emit("error", new ERR_MULTIPLE_CALLBACK());
}
ts.writechunk = null;
ts.writecb = null;
if (data != null)
this.push(data);
cb(er);
var rs = this._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
this._read(rs.highWaterMark);
}
}
function Transform(options) {
if (!(this instanceof Transform))
return new Transform(options);
Duplex.call(this, options);
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: null
};
this._readableState.needReadable = true;
this._readableState.sync = false;
if (options) {
if (typeof options.transform === "function")
this._transform = options.transform;
if (typeof options.flush === "function")
this._flush = options.flush;
}
this.on("prefinish", prefinish);
}
function prefinish() {
var _this = this;
if (typeof this._flush === "function" && !this._readableState.destroyed) {
this._flush(function(er, data) {
done(_this, er, data);
});
} else {
done(this, null, null);
}
}
Transform.prototype.push = function(chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
Transform.prototype._transform = function(chunk, encoding, cb) {
cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
};
Transform.prototype._write = function(chunk, encoding, cb) {
var ts = this._transformState;
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
this._read(rs.highWaterMark);
}
};
Transform.prototype._read = function(n) {
var ts = this._transformState;
if (ts.writechunk !== null && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
ts.needTransform = true;
}
};
Transform.prototype._destroy = function(err, cb) {
Duplex.prototype._destroy.call(this, err, function(err2) {
cb(err2);
});
};
function done(stream, er, data) {
if (er)
return stream.emit("error", er);
if (data != null)
stream.push(data);
if (stream._writableState.length)
throw new ERR_TRANSFORM_WITH_LENGTH_0();
if (stream._transformState.transforming)
throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
return stream.push(null);
}
}
});
// node_modules/readable-stream/lib/_stream_passthrough.js
var require_stream_passthrough3 = __commonJS({
"node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module2) {
"use strict";
module2.exports = PassThrough;
var Transform = require_stream_transform3();
require_inherits()(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough))
return new PassThrough(options);
Transform.call(this, options);
}
PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
};
}
});
// node_modules/readable-stream/lib/internal/streams/pipeline.js
var require_pipeline = __commonJS({
"node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module2) {
"use strict";
var eos;
function once2(callback) {
var called = false;
return function() {
if (called)
return;
called = true;
callback.apply(void 0, arguments);
};
}
var _require$codes = require_errors().codes;
var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
function noop(err) {
if (err)
throw err;
}
function isRequest(stream) {
return stream.setHeader && typeof stream.abort === "function";
}
function destroyer(stream, reading, writing, callback) {
callback = once2(callback);
var closed = false;
stream.on("close", function() {
closed = true;
});
if (eos === void 0)
eos = require_end_of_stream();
eos(stream, {
readable: reading,
writable: writing
}, function(err) {
if (err)
return callback(err);
closed = true;
callback();
});
var destroyed = false;
return function(err) {
if (closed)
return;
if (destroyed)
return;
destroyed = true;
if (isRequest(stream))
return stream.abort();
if (typeof stream.destroy === "function")
return stream.destroy();
callback(err || new ERR_STREAM_DESTROYED("pipe"));
};
}
function call(fn) {
fn();
}
function pipe(from, to) {
return from.pipe(to);
}
function popCallback(streams) {
if (!streams.length)
return noop;
if (typeof streams[streams.length - 1] !== "function")
return noop;
return streams.pop();
}
function pipeline() {
for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
streams[_key] = arguments[_key];
}
var callback = popCallback(streams);
if (Array.isArray(streams[0]))
streams = streams[0];
if (streams.length < 2) {
throw new ERR_MISSING_ARGS("streams");
}
var error;
var destroys = streams.map(function(stream, i) {
var reading = i < streams.length - 1;
var writing = i > 0;
return destroyer(stream, reading, writing, function(err) {
if (!error)
error = err;
if (err)
destroys.forEach(call);
if (reading)
return;
destroys.forEach(call);
callback(error);
});
});
return streams.reduce(pipe);
}
module2.exports = pipeline;
}
});
// node_modules/readable-stream/readable.js
var require_readable3 = __commonJS({
"node_modules/readable-stream/readable.js"(exports, module2) {
var Stream = require("stream");
if (process.env.READABLE_STREAM === "disable" && Stream) {
module2.exports = Stream.Readable;
Object.assign(module2.exports, Stream);
module2.exports.Stream = Stream;
} else {
exports = module2.exports = require_stream_readable3();
exports.Stream = Stream || exports;
exports.Readable = exports;
exports.Writable = require_stream_writable3();
exports.Duplex = require_stream_duplex3();
exports.Transform = require_stream_transform3();
exports.PassThrough = require_stream_passthrough3();
exports.finished = require_end_of_stream();
exports.pipeline = require_pipeline();
}
}
});
// node_modules/archiver/lib/core.js
var require_core = __commonJS({
"node_modules/archiver/lib/core.js"(exports, module2) {
var fs = require("fs");
var glob2 = require_readdir_glob();
var async = (init_async(), __toCommonJS(async_exports));
var path3 = require("path");
var util = require_archiver_utils();
var inherits = require("util").inherits;
var ArchiverError = require_error2();
var Transform = require_readable3().Transform;
var win32 = process.platform === "win32";
var Archiver = function(format, options) {
if (!(this instanceof Archiver)) {
return new Archiver(format, options);
}
if (typeof format !== "string") {
options = format;
format = "zip";
}
options = this.options = util.defaults(options, {
highWaterMark: 1024 * 1024,
statConcurrency: 4
});
Transform.call(this, options);
this._format = false;
this._module = false;
this._pending = 0;
this._pointer = 0;
this._entriesCount = 0;
this._entriesProcessedCount = 0;
this._fsEntriesTotalBytes = 0;
this._fsEntriesProcessedBytes = 0;
this._queue = async.queue(this._onQueueTask.bind(this), 1);
this._queue.drain(this._onQueueDrain.bind(this));
this._statQueue = async.queue(this._onStatQueueTask.bind(this), options.statConcurrency);
this._statQueue.drain(this._onQueueDrain.bind(this));
this._state = {
aborted: false,
finalize: false,
finalizing: false,
finalized: false,
modulePiped: false
};
this._streams = [];
};
inherits(Archiver, Transform);
Archiver.prototype._abort = function() {
this._state.aborted = true;
this._queue.kill();
this._statQueue.kill();
if (this._queue.idle()) {
this._shutdown();
}
};
Archiver.prototype._append = function(filepath, data) {
data = data || {};
var task = {
source: null,
filepath
};
if (!data.name) {
data.name = filepath;
}
data.sourcePath = filepath;
task.data = data;
this._entriesCount++;
if (data.stats && data.stats instanceof fs.Stats) {
task = this._updateQueueTaskWithStats(task, data.stats);
if (task) {
if (data.stats.size) {
this._fsEntriesTotalBytes += data.stats.size;
}
this._queue.push(task);
}
} else {
this._statQueue.push(task);
}
};
Archiver.prototype._finalize = function() {
if (this._state.finalizing || this._state.finalized || this._state.aborted) {
return;
}
this._state.finalizing = true;
this._moduleFinalize();
this._state.finalizing = false;
this._state.finalized = true;
};
Archiver.prototype._maybeFinalize = function() {
if (this._state.finalizing || this._state.finalized || this._state.aborted) {
return false;
}
if (this._state.finalize && this._pending === 0 && this._queue.idle() && this._statQueue.idle()) {
this._finalize();
return true;
}
return false;
};
Archiver.prototype._moduleAppend = function(source, data, callback) {
if (this._state.aborted) {
callback();
return;
}
this._module.append(source, data, function(err) {
this._task = null;
if (this._state.aborted) {
this._shutdown();
return;
}
if (err) {
this.emit("error", err);
setImmediate(callback);
return;
}
this.emit("entry", data);
this._entriesProcessedCount++;
if (data.stats && data.stats.size) {
this._fsEntriesProcessedBytes += data.stats.size;
}
this.emit("progress", {
entries: {
total: this._entriesCount,
processed: this._entriesProcessedCount
},
fs: {
totalBytes: this._fsEntriesTotalBytes,
processedBytes: this._fsEntriesProcessedBytes
}
});
setImmediate(callback);
}.bind(this));
};
Archiver.prototype._moduleFinalize = function() {
if (typeof this._module.finalize === "function") {
this._module.finalize();
} else if (typeof this._module.end === "function") {
this._module.end();
} else {
this.emit("error", new ArchiverError("NOENDMETHOD"));
}
};
Archiver.prototype._modulePipe = function() {
this._module.on("error", this._onModuleError.bind(this));
this._module.pipe(this);
this._state.modulePiped = true;
};
Archiver.prototype._moduleSupports = function(key) {
if (!this._module.supports || !this._module.supports[key]) {
return false;
}
return this._module.supports[key];
};
Archiver.prototype._moduleUnpipe = function() {
this._module.unpipe(this);
this._state.modulePiped = false;
};
Archiver.prototype._normalizeEntryData = function(data, stats) {
data = util.defaults(data, {
type: "file",
name: null,
date: null,
mode: null,
prefix: null,
sourcePath: null,
stats: false
});
if (stats && data.stats === false) {
data.stats = stats;
}
var isDir = data.type === "directory";
if (data.name) {
if (typeof data.prefix === "string" && "" !== data.prefix) {
data.name = data.prefix + "/" + data.name;
data.prefix = null;
}
data.name = util.sanitizePath(data.name);
if (data.type !== "symlink" && data.name.slice(-1) === "/") {
isDir = true;
data.type = "directory";
} else if (isDir) {
data.name += "/";
}
}
if (typeof data.mode === "number") {
if (win32) {
data.mode &= 511;
} else {
data.mode &= 4095;
}
} else if (data.stats && data.mode === null) {
if (win32) {
data.mode = data.stats.mode & 511;
} else {
data.mode = data.stats.mode & 4095;
}
if (win32 && isDir) {
data.mode = 493;
}
} else if (data.mode === null) {
data.mode = isDir ? 493 : 420;
}
if (data.stats && data.date === null) {
data.date = data.stats.mtime;
} else {
data.date = util.dateify(data.date);
}
return data;
};
Archiver.prototype._onModuleError = function(err) {
this.emit("error", err);
};
Archiver.prototype._onQueueDrain = function() {
if (this._state.finalizing || this._state.finalized || this._state.aborted) {
return;
}
if (this._state.finalize && this._pending === 0 && this._queue.idle() && this._statQueue.idle()) {
this._finalize();
}
};
Archiver.prototype._onQueueTask = function(task, callback) {
var fullCallback = () => {
if (task.data.callback) {
task.data.callback();
}
callback();
};
if (this._state.finalizing || this._state.finalized || this._state.aborted) {
fullCallback();
return;
}
this._task = task;
this._moduleAppend(task.source, task.data, fullCallback);
};
Archiver.prototype._onStatQueueTask = function(task, callback) {
if (this._state.finalizing || this._state.finalized || this._state.aborted) {
callback();
return;
}
fs.lstat(task.filepath, function(err, stats) {
if (this._state.aborted) {
setImmediate(callback);
return;
}
if (err) {
this._entriesCount--;
this.emit("warning", err);
setImmediate(callback);
return;
}
task = this._updateQueueTaskWithStats(task, stats);
if (task) {
if (stats.size) {
this._fsEntriesTotalBytes += stats.size;
}
this._queue.push(task);
}
setImmediate(callback);
}.bind(this));
};
Archiver.prototype._shutdown = function() {
this._moduleUnpipe();
this.end();
};
Archiver.prototype._transform = function(chunk, encoding, callback) {
if (chunk) {
this._pointer += chunk.length;
}
callback(null, chunk);
};
Archiver.prototype._updateQueueTaskWithStats = function(task, stats) {
if (stats.isFile()) {
task.data.type = "file";
task.data.sourceType = "stream";
task.source = util.lazyReadStream(task.filepath);
} else if (stats.isDirectory() && this._moduleSupports("directory")) {
task.data.name = util.trailingSlashIt(task.data.name);
task.data.type = "directory";
task.data.sourcePath = util.trailingSlashIt(task.filepath);
task.data.sourceType = "buffer";
task.source = Buffer.concat([]);
} else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) {
var linkPath = fs.readlinkSync(task.filepath);
var dirName = path3.dirname(task.filepath);
task.data.type = "symlink";
task.data.linkname = path3.relative(dirName, path3.resolve(dirName, linkPath));
task.data.sourceType = "buffer";
task.source = Buffer.concat([]);
} else {
if (stats.isDirectory()) {
this.emit("warning", new ArchiverError("DIRECTORYNOTSUPPORTED", task.data));
} else if (stats.isSymbolicLink()) {
this.emit("warning", new ArchiverError("SYMLINKNOTSUPPORTED", task.data));
} else {
this.emit("warning", new ArchiverError("ENTRYNOTSUPPORTED", task.data));
}
return null;
}
task.data = this._normalizeEntryData(task.data, stats);
return task;
};
Archiver.prototype.abort = function() {
if (this._state.aborted || this._state.finalized) {
return this;
}
this._abort();
return this;
};
Archiver.prototype.append = function(source, data) {
if (this._state.finalize || this._state.aborted) {
this.emit("error", new ArchiverError("QUEUECLOSED"));
return this;
}
data = this._normalizeEntryData(data);
if (typeof data.name !== "string" || data.name.length === 0) {
this.emit("error", new ArchiverError("ENTRYNAMEREQUIRED"));
return this;
}
if (data.type === "directory" && !this._moduleSupports("directory")) {
this.emit("error", new ArchiverError("DIRECTORYNOTSUPPORTED", { name: data.name }));
return this;
}
source = util.normalizeInputSource(source);
if (Buffer.isBuffer(source)) {
data.sourceType = "buffer";
} else if (util.isStream(source)) {
data.sourceType = "stream";
} else {
this.emit("error", new ArchiverError("INPUTSTEAMBUFFERREQUIRED", { name: data.name }));
return this;
}
this._entriesCount++;
this._queue.push({
data,
source
});
return this;
};
Archiver.prototype.directory = function(dirpath, destpath, data) {
if (this._state.finalize || this._state.aborted) {
this.emit("error", new ArchiverError("QUEUECLOSED"));
return this;
}
if (typeof dirpath !== "string" || dirpath.length === 0) {
this.emit("error", new ArchiverError("DIRECTORYDIRPATHREQUIRED"));
return this;
}
this._pending++;
if (destpath === false) {
destpath = "";
} else if (typeof destpath !== "string") {
destpath = dirpath;
}
var dataFunction = false;
if (typeof data === "function") {
dataFunction = data;
data = {};
} else if (typeof data !== "object") {
data = {};
}
var globOptions = {
stat: true,
dot: true
};
function onGlobEnd() {
this._pending--;
this._maybeFinalize();
}
function onGlobError(err) {
this.emit("error", err);
}
function onGlobMatch(match) {
globber.pause();
var ignoreMatch = false;
var entryData = Object.assign({}, data);
entryData.name = match.relative;
entryData.prefix = destpath;
entryData.stats = match.stat;
entryData.callback = globber.resume.bind(globber);
try {
if (dataFunction) {
entryData = dataFunction(entryData);
if (entryData === false) {
ignoreMatch = true;
} else if (typeof entryData !== "object") {
throw new ArchiverError("DIRECTORYFUNCTIONINVALIDDATA", { dirpath });
}
}
} catch (e) {
this.emit("error", e);
return;
}
if (ignoreMatch) {
globber.resume();
return;
}
this._append(match.absolute, entryData);
}
var globber = glob2(dirpath, globOptions);
globber.on("error", onGlobError.bind(this));
globber.on("match", onGlobMatch.bind(this));
globber.on("end", onGlobEnd.bind(this));
return this;
};
Archiver.prototype.file = function(filepath, data) {
if (this._state.finalize || this._state.aborted) {
this.emit("error", new ArchiverError("QUEUECLOSED"));
return this;
}
if (typeof filepath !== "string" || filepath.length === 0) {
this.emit("error", new ArchiverError("FILEFILEPATHREQUIRED"));
return this;
}
this._append(filepath, data);
return this;
};
Archiver.prototype.glob = function(pattern, options, data) {
this._pending++;
options = util.defaults(options, {
stat: true,
pattern
});
function onGlobEnd() {
this._pending--;
this._maybeFinalize();
}
function onGlobError(err) {
this.emit("error", err);
}
function onGlobMatch(match) {
globber.pause();
var entryData = Object.assign({}, data);
entryData.callback = globber.resume.bind(globber);
entryData.stats = match.stat;
entryData.name = match.relative;
this._append(match.absolute, entryData);
}
var globber = glob2(options.cwd || ".", options);
globber.on("error", onGlobError.bind(this));
globber.on("match", onGlobMatch.bind(this));
globber.on("end", onGlobEnd.bind(this));
return this;
};
Archiver.prototype.finalize = function() {
if (this._state.aborted) {
var abortedError = new ArchiverError("ABORTED");
this.emit("error", abortedError);
return Promise.reject(abortedError);
}
if (this._state.finalize) {
var finalizingError = new ArchiverError("FINALIZING");
this.emit("error", finalizingError);
return Promise.reject(finalizingError);
}
this._state.finalize = true;
if (this._pending === 0 && this._queue.idle() && this._statQueue.idle()) {
this._finalize();
}
var self2 = this;
return new Promise(function(resolve, reject2) {
var errored;
self2._module.on("end", function() {
if (!errored) {
resolve();
}
});
self2._module.on("error", function(err) {
errored = true;
reject2(err);
});
});
};
Archiver.prototype.setFormat = function(format) {
if (this._format) {
this.emit("error", new ArchiverError("FORMATSET"));
return this;
}
this._format = format;
return this;
};
Archiver.prototype.setModule = function(module3) {
if (this._state.aborted) {
this.emit("error", new ArchiverError("ABORTED"));
return this;
}
if (this._state.module) {
this.emit("error", new ArchiverError("MODULESET"));
return this;
}
this._module = module3;
this._modulePipe();
return this;
};
Archiver.prototype.symlink = function(filepath, target, mode) {
if (this._state.finalize || this._state.aborted) {
this.emit("error", new ArchiverError("QUEUECLOSED"));
return this;
}
if (typeof filepath !== "string" || filepath.length === 0) {
this.emit("error", new ArchiverError("SYMLINKFILEPATHREQUIRED"));
return this;
}
if (typeof target !== "string" || target.length === 0) {
this.emit("error", new ArchiverError("SYMLINKTARGETREQUIRED", { filepath }));
return this;
}
if (!this._moduleSupports("symlink")) {
this.emit("error", new ArchiverError("SYMLINKNOTSUPPORTED", { filepath }));
return this;
}
var data = {};
data.type = "symlink";
data.name = filepath.replace(/\\/g, "/");
data.linkname = target.replace(/\\/g, "/");
data.sourceType = "buffer";
if (typeof mode === "number") {
data.mode = mode;
}
this._entriesCount++;
this._queue.push({
data,
source: Buffer.concat([])
});
return this;
};
Archiver.prototype.pointer = function() {
return this._pointer;
};
Archiver.prototype.use = function(plugin) {
this._streams.push(plugin);
return this;
};
module2.exports = Archiver;
}
});
// node_modules/compress-commons/lib/archivers/archive-entry.js
var require_archive_entry = __commonJS({
"node_modules/compress-commons/lib/archivers/archive-entry.js"(exports, module2) {
var ArchiveEntry = module2.exports = function() {
};
ArchiveEntry.prototype.getName = function() {
};
ArchiveEntry.prototype.getSize = function() {
};
ArchiveEntry.prototype.getLastModifiedDate = function() {
};
ArchiveEntry.prototype.isDirectory = function() {
};
}
});
// node_modules/compress-commons/lib/archivers/zip/util.js
var require_util2 = __commonJS({
"node_modules/compress-commons/lib/archivers/zip/util.js"(exports, module2) {
var util = module2.exports = {};
util.dateToDos = function(d, forceLocalTime) {
forceLocalTime = forceLocalTime || false;
var year = forceLocalTime ? d.getFullYear() : d.getUTCFullYear();
if (year < 1980) {
return 2162688;
} else if (year >= 2044) {
return 2141175677;
}
var val = {
year,
month: forceLocalTime ? d.getMonth() : d.getUTCMonth(),
date: forceLocalTime ? d.getDate() : d.getUTCDate(),
hours: forceLocalTime ? d.getHours() : d.getUTCHours(),
minutes: forceLocalTime ? d.getMinutes() : d.getUTCMinutes(),
seconds: forceLocalTime ? d.getSeconds() : d.getUTCSeconds()
};
return val.year - 1980 << 25 | val.month + 1 << 21 | val.date << 16 | val.hours << 11 | val.minutes << 5 | val.seconds / 2;
};
util.dosToDate = function(dos) {
return new Date((dos >> 25 & 127) + 1980, (dos >> 21 & 15) - 1, dos >> 16 & 31, dos >> 11 & 31, dos >> 5 & 63, (dos & 31) << 1);
};
util.fromDosTime = function(buf) {
return util.dosToDate(buf.readUInt32LE(0));
};
util.getEightBytes = function(v) {
var buf = Buffer.alloc(8);
buf.writeUInt32LE(v % 4294967296, 0);
buf.writeUInt32LE(v / 4294967296 | 0, 4);
return buf;
};
util.getShortBytes = function(v) {
var buf = Buffer.alloc(2);
buf.writeUInt16LE((v & 65535) >>> 0, 0);
return buf;
};
util.getShortBytesValue = function(buf, offset) {
return buf.readUInt16LE(offset);
};
util.getLongBytes = function(v) {
var buf = Buffer.alloc(4);
buf.writeUInt32LE((v & 4294967295) >>> 0, 0);
return buf;
};
util.getLongBytesValue = function(buf, offset) {
return buf.readUInt32LE(offset);
};
util.toDosTime = function(d) {
return util.getLongBytes(util.dateToDos(d));
};
}
});
// node_modules/compress-commons/lib/archivers/zip/general-purpose-bit.js
var require_general_purpose_bit = __commonJS({
"node_modules/compress-commons/lib/archivers/zip/general-purpose-bit.js"(exports, module2) {
var zipUtil = require_util2();
var DATA_DESCRIPTOR_FLAG = 1 << 3;
var ENCRYPTION_FLAG = 1 << 0;
var NUMBER_OF_SHANNON_FANO_TREES_FLAG = 1 << 2;
var SLIDING_DICTIONARY_SIZE_FLAG = 1 << 1;
var STRONG_ENCRYPTION_FLAG = 1 << 6;
var UFT8_NAMES_FLAG = 1 << 11;
var GeneralPurposeBit = module2.exports = function() {
if (!(this instanceof GeneralPurposeBit)) {
return new GeneralPurposeBit();
}
this.descriptor = false;
this.encryption = false;
this.utf8 = false;
this.numberOfShannonFanoTrees = 0;
this.strongEncryption = false;
this.slidingDictionarySize = 0;
return this;
};
GeneralPurposeBit.prototype.encode = function() {
return zipUtil.getShortBytes(
(this.descriptor ? DATA_DESCRIPTOR_FLAG : 0) | (this.utf8 ? UFT8_NAMES_FLAG : 0) | (this.encryption ? ENCRYPTION_FLAG : 0) | (this.strongEncryption ? STRONG_ENCRYPTION_FLAG : 0)
);
};
GeneralPurposeBit.prototype.parse = function(buf, offset) {
var flag = zipUtil.getShortBytesValue(buf, offset);
var gbp = new GeneralPurposeBit();
gbp.useDataDescriptor((flag & DATA_DESCRIPTOR_FLAG) !== 0);
gbp.useUTF8ForNames((flag & UFT8_NAMES_FLAG) !== 0);
gbp.useStrongEncryption((flag & STRONG_ENCRYPTION_FLAG) !== 0);
gbp.useEncryption((flag & ENCRYPTION_FLAG) !== 0);
gbp.setSlidingDictionarySize((flag & SLIDING_DICTIONARY_SIZE_FLAG) !== 0 ? 8192 : 4096);
gbp.setNumberOfShannonFanoTrees((flag & NUMBER_OF_SHANNON_FANO_TREES_FLAG) !== 0 ? 3 : 2);
return gbp;
};
GeneralPurposeBit.prototype.setNumberOfShannonFanoTrees = function(n) {
this.numberOfShannonFanoTrees = n;
};
GeneralPurposeBit.prototype.getNumberOfShannonFanoTrees = function() {
return this.numberOfShannonFanoTrees;
};
GeneralPurposeBit.prototype.setSlidingDictionarySize = function(n) {
this.slidingDictionarySize = n;
};
GeneralPurposeBit.prototype.getSlidingDictionarySize = function() {
return this.slidingDictionarySize;
};
GeneralPurposeBit.prototype.useDataDescriptor = function(b) {
this.descriptor = b;
};
GeneralPurposeBit.prototype.usesDataDescriptor = function() {
return this.descriptor;
};
GeneralPurposeBit.prototype.useEncryption = function(b) {
this.encryption = b;
};
GeneralPurposeBit.prototype.usesEncryption = function() {
return this.encryption;
};
GeneralPurposeBit.prototype.useStrongEncryption = function(b) {
this.strongEncryption = b;
};
GeneralPurposeBit.prototype.usesStrongEncryption = function() {
return this.strongEncryption;
};
GeneralPurposeBit.prototype.useUTF8ForNames = function(b) {
this.utf8 = b;
};
GeneralPurposeBit.prototype.usesUTF8ForNames = function() {
return this.utf8;
};
}
});
// node_modules/compress-commons/lib/archivers/zip/unix-stat.js
var require_unix_stat = __commonJS({
"node_modules/compress-commons/lib/archivers/zip/unix-stat.js"(exports, module2) {
module2.exports = {
/**
* Bits used for permissions (and sticky bit)
*/
PERM_MASK: 4095,
// 07777
/**
* Bits used to indicate the filesystem object type.
*/
FILE_TYPE_FLAG: 61440,
// 0170000
/**
* Indicates symbolic links.
*/
LINK_FLAG: 40960,
// 0120000
/**
* Indicates plain files.
*/
FILE_FLAG: 32768,
// 0100000
/**
* Indicates directories.
*/
DIR_FLAG: 16384,
// 040000
// ----------------------------------------------------------
// somewhat arbitrary choices that are quite common for shared
// installations
// -----------------------------------------------------------
/**
* Default permissions for symbolic links.
*/
DEFAULT_LINK_PERM: 511,
// 0777
/**
* Default permissions for directories.
*/
DEFAULT_DIR_PERM: 493,
// 0755
/**
* Default permissions for plain files.
*/
DEFAULT_FILE_PERM: 420
// 0644
};
}
});
// node_modules/compress-commons/lib/archivers/zip/constants.js
var require_constants = __commonJS({
"node_modules/compress-commons/lib/archivers/zip/constants.js"(exports, module2) {
module2.exports = {
WORD: 4,
DWORD: 8,
EMPTY: Buffer.alloc(0),
SHORT: 2,
SHORT_MASK: 65535,
SHORT_SHIFT: 16,
SHORT_ZERO: Buffer.from(Array(2)),
LONG: 4,
LONG_ZERO: Buffer.from(Array(4)),
MIN_VERSION_INITIAL: 10,
MIN_VERSION_DATA_DESCRIPTOR: 20,
MIN_VERSION_ZIP64: 45,
VERSION_MADEBY: 45,
METHOD_STORED: 0,
METHOD_DEFLATED: 8,
PLATFORM_UNIX: 3,
PLATFORM_FAT: 0,
SIG_LFH: 67324752,
SIG_DD: 134695760,
SIG_CFH: 33639248,
SIG_EOCD: 101010256,
SIG_ZIP64_EOCD: 101075792,
SIG_ZIP64_EOCD_LOC: 117853008,
ZIP64_MAGIC_SHORT: 65535,
ZIP64_MAGIC: 4294967295,
ZIP64_EXTRA_ID: 1,
ZLIB_NO_COMPRESSION: 0,
ZLIB_BEST_SPEED: 1,
ZLIB_BEST_COMPRESSION: 9,
ZLIB_DEFAULT_COMPRESSION: -1,
MODE_MASK: 4095,
DEFAULT_FILE_MODE: 33188,
// 010644 = -rw-r--r-- = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
DEFAULT_DIR_MODE: 16877,
// 040755 = drwxr-xr-x = S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
EXT_FILE_ATTR_DIR: 1106051088,
// 010173200020 = drwxr-xr-x = (((S_IFDIR | 0755) << 16) | S_DOS_D)
EXT_FILE_ATTR_FILE: 2175008800,
// 020151000040 = -rw-r--r-- = (((S_IFREG | 0644) << 16) | S_DOS_A) >>> 0
// Unix file types
S_IFMT: 61440,
// 0170000 type of file mask
S_IFIFO: 4096,
// 010000 named pipe (fifo)
S_IFCHR: 8192,
// 020000 character special
S_IFDIR: 16384,
// 040000 directory
S_IFBLK: 24576,
// 060000 block special
S_IFREG: 32768,
// 0100000 regular
S_IFLNK: 40960,
// 0120000 symbolic link
S_IFSOCK: 49152,
// 0140000 socket
// DOS file type flags
S_DOS_A: 32,
// 040 Archive
S_DOS_D: 16,
// 020 Directory
S_DOS_V: 8,
// 010 Volume
S_DOS_S: 4,
// 04 System
S_DOS_H: 2,
// 02 Hidden
S_DOS_R: 1
// 01 Read Only
};
}
});
// node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js
var require_zip_archive_entry = __commonJS({
"node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js"(exports, module2) {
var inherits = require("util").inherits;
var normalizePath = require_normalize_path();
var ArchiveEntry = require_archive_entry();
var GeneralPurposeBit = require_general_purpose_bit();
var UnixStat = require_unix_stat();
var constants = require_constants();
var zipUtil = require_util2();
var ZipArchiveEntry = module2.exports = function(name) {
if (!(this instanceof ZipArchiveEntry)) {
return new ZipArchiveEntry(name);
}
ArchiveEntry.call(this);
this.platform = constants.PLATFORM_FAT;
this.method = -1;
this.name = null;
this.size = 0;
this.csize = 0;
this.gpb = new GeneralPurposeBit();
this.crc = 0;
this.time = -1;
this.minver = constants.MIN_VERSION_INITIAL;
this.mode = -1;
this.extra = null;
this.exattr = 0;
this.inattr = 0;
this.comment = null;
if (name) {
this.setName(name);
}
};
inherits(ZipArchiveEntry, ArchiveEntry);
ZipArchiveEntry.prototype.getCentralDirectoryExtra = function() {
return this.getExtra();
};
ZipArchiveEntry.prototype.getComment = function() {
return this.comment !== null ? this.comment : "";
};
ZipArchiveEntry.prototype.getCompressedSize = function() {
return this.csize;
};
ZipArchiveEntry.prototype.getCrc = function() {
return this.crc;
};
ZipArchiveEntry.prototype.getExternalAttributes = function() {
return this.exattr;
};
ZipArchiveEntry.prototype.getExtra = function() {
return this.extra !== null ? this.extra : constants.EMPTY;
};
ZipArchiveEntry.prototype.getGeneralPurposeBit = function() {
return this.gpb;
};
ZipArchiveEntry.prototype.getInternalAttributes = function() {
return this.inattr;
};
ZipArchiveEntry.prototype.getLastModifiedDate = function() {
return this.getTime();
};
ZipArchiveEntry.prototype.getLocalFileDataExtra = function() {
return this.getExtra();
};
ZipArchiveEntry.prototype.getMethod = function() {
return this.method;
};
ZipArchiveEntry.prototype.getName = function() {
return this.name;
};
ZipArchiveEntry.prototype.getPlatform = function() {
return this.platform;
};
ZipArchiveEntry.prototype.getSize = function() {
return this.size;
};
ZipArchiveEntry.prototype.getTime = function() {
return this.time !== -1 ? zipUtil.dosToDate(this.time) : -1;
};
ZipArchiveEntry.prototype.getTimeDos = function() {
return this.time !== -1 ? this.time : 0;
};
ZipArchiveEntry.prototype.getUnixMode = function() {
return this.platform !== constants.PLATFORM_UNIX ? 0 : this.getExternalAttributes() >> constants.SHORT_SHIFT & constants.SHORT_MASK;
};
ZipArchiveEntry.prototype.getVersionNeededToExtract = function() {
return this.minver;
};
ZipArchiveEntry.prototype.setComment = function(comment) {
if (Buffer.byteLength(comment) !== comment.length) {
this.getGeneralPurposeBit().useUTF8ForNames(true);
}
this.comment = comment;
};
ZipArchiveEntry.prototype.setCompressedSize = function(size) {
if (size < 0) {
throw new Error("invalid entry compressed size");
}
this.csize = size;
};
ZipArchiveEntry.prototype.setCrc = function(crc) {
if (crc < 0) {
throw new Error("invalid entry crc32");
}
this.crc = crc;
};
ZipArchiveEntry.prototype.setExternalAttributes = function(attr) {
this.exattr = attr >>> 0;
};
ZipArchiveEntry.prototype.setExtra = function(extra) {
this.extra = extra;
};
ZipArchiveEntry.prototype.setGeneralPurposeBit = function(gpb) {
if (!(gpb instanceof GeneralPurposeBit)) {
throw new Error("invalid entry GeneralPurposeBit");
}
this.gpb = gpb;
};
ZipArchiveEntry.prototype.setInternalAttributes = function(attr) {
this.inattr = attr;
};
ZipArchiveEntry.prototype.setMethod = function(method) {
if (method < 0) {
throw new Error("invalid entry compression method");
}
this.method = method;
};
ZipArchiveEntry.prototype.setName = function(name, prependSlash = false) {
name = normalizePath(name, false).replace(/^\w+:/, "").replace(/^(\.\.\/|\/)+/, "");
if (prependSlash) {
name = `/${name}`;
}
if (Buffer.byteLength(name) !== name.length) {
this.getGeneralPurposeBit().useUTF8ForNames(true);
}
this.name = name;
};
ZipArchiveEntry.prototype.setPlatform = function(platform) {
this.platform = platform;
};
ZipArchiveEntry.prototype.setSize = function(size) {
if (size < 0) {
throw new Error("invalid entry size");
}
this.size = size;
};
ZipArchiveEntry.prototype.setTime = function(time, forceLocalTime) {
if (!(time instanceof Date)) {
throw new Error("invalid entry time");
}
this.time = zipUtil.dateToDos(time, forceLocalTime);
};
ZipArchiveEntry.prototype.setUnixMode = function(mode) {
mode |= this.isDirectory() ? constants.S_IFDIR : constants.S_IFREG;
var extattr = 0;
extattr |= mode << constants.SHORT_SHIFT | (this.isDirectory() ? constants.S_DOS_D : constants.S_DOS_A);
this.setExternalAttributes(extattr);
this.mode = mode & constants.MODE_MASK;
this.platform = constants.PLATFORM_UNIX;
};
ZipArchiveEntry.prototype.setVersionNeededToExtract = function(minver) {
this.minver = minver;
};
ZipArchiveEntry.prototype.isDirectory = function() {
return this.getName().slice(-1) === "/";
};
ZipArchiveEntry.prototype.isUnixSymlink = function() {
return (this.getUnixMode() & UnixStat.FILE_TYPE_FLAG) === UnixStat.LINK_FLAG;
};
ZipArchiveEntry.prototype.isZip64 = function() {
return this.csize > constants.ZIP64_MAGIC || this.size > constants.ZIP64_MAGIC;
};
}
});
// node_modules/compress-commons/lib/util/index.js
var require_util3 = __commonJS({
"node_modules/compress-commons/lib/util/index.js"(exports, module2) {
var Stream = require("stream").Stream;
var PassThrough = require_readable3().PassThrough;
var util = module2.exports = {};
util.isStream = function(source) {
return source instanceof Stream;
};
util.normalizeInputSource = function(source) {
if (source === null) {
return Buffer.alloc(0);
} else if (typeof source === "string") {
return Buffer.from(source);
} else if (util.isStream(source) && !source._readableState) {
var normalized = new PassThrough();
source.pipe(normalized);
return normalized;
}
return source;
};
}
});
// node_modules/compress-commons/lib/archivers/archive-output-stream.js
var require_archive_output_stream = __commonJS({
"node_modules/compress-commons/lib/archivers/archive-output-stream.js"(exports, module2) {
var inherits = require("util").inherits;
var Transform = require_readable3().Transform;
var ArchiveEntry = require_archive_entry();
var util = require_util3();
var ArchiveOutputStream = module2.exports = function(options) {
if (!(this instanceof ArchiveOutputStream)) {
return new ArchiveOutputStream(options);
}
Transform.call(this, options);
this.offset = 0;
this._archive = {
finish: false,
finished: false,
processing: false
};
};
inherits(ArchiveOutputStream, Transform);
ArchiveOutputStream.prototype._appendBuffer = function(zae, source, callback) {
};
ArchiveOutputStream.prototype._appendStream = function(zae, source, callback) {
};
ArchiveOutputStream.prototype._emitErrorCallback = function(err) {
if (err) {
this.emit("error", err);
}
};
ArchiveOutputStream.prototype._finish = function(ae) {
};
ArchiveOutputStream.prototype._normalizeEntry = function(ae) {
};
ArchiveOutputStream.prototype._transform = function(chunk, encoding, callback) {
callback(null, chunk);
};
ArchiveOutputStream.prototype.entry = function(ae, source, callback) {
source = source || null;
if (typeof callback !== "function") {
callback = this._emitErrorCallback.bind(this);
}
if (!(ae instanceof ArchiveEntry)) {
callback(new Error("not a valid instance of ArchiveEntry"));
return;
}
if (this._archive.finish || this._archive.finished) {
callback(new Error("unacceptable entry after finish"));
return;
}
if (this._archive.processing) {
callback(new Error("already processing an entry"));
return;
}
this._archive.processing = true;
this._normalizeEntry(ae);
this._entry = ae;
source = util.normalizeInputSource(source);
if (Buffer.isBuffer(source)) {
this._appendBuffer(ae, source, callback);
} else if (util.isStream(source)) {
this._appendStream(ae, source, callback);
} else {
this._archive.processing = false;
callback(new Error("input source must be valid Stream or Buffer instance"));
return;
}
return this;
};
ArchiveOutputStream.prototype.finish = function() {
if (this._archive.processing) {
this._archive.finish = true;
return;
}
this._finish();
};
ArchiveOutputStream.prototype.getBytesWritten = function() {
return this.offset;
};
ArchiveOutputStream.prototype.write = function(chunk, cb) {
if (chunk) {
this.offset += chunk.length;
}
return Transform.prototype.write.call(this, chunk, cb);
};
}
});
// node_modules/buffer-crc32/index.js
var require_buffer_crc32 = __commonJS({
"node_modules/buffer-crc32/index.js"(exports, module2) {
var Buffer2 = require("buffer").Buffer;
var CRC_TABLE = [
0,
1996959894,
3993919788,
2567524794,
124634137,
1886057615,
3915621685,
2657392035,
249268274,
2044508324,
3772115230,
2547177864,
162941995,
2125561021,
3887607047,
2428444049,
498536548,
1789927666,
4089016648,
2227061214,
450548861,
1843258603,
4107580753,
2211677639,
325883990,
1684777152,
4251122042,
2321926636,
335633487,
1661365465,
4195302755,
2366115317,
997073096,
1281953886,
3579855332,
2724688242,
1006888145,
1258607687,
3524101629,
2768942443,
901097722,
1119000684,
3686517206,
2898065728,
853044451,
1172266101,
3705015759,
2882616665,
651767980,
1373503546,
3369554304,
3218104598,
565507253,
1454621731,
3485111705,
3099436303,
671266974,
1594198024,
3322730930,
2970347812,
795835527,
1483230225,
3244367275,
3060149565,
1994146192,
31158534,
2563907772,
4023717930,
1907459465,
112637215,
2680153253,
3904427059,
2013776290,
251722036,
2517215374,
3775830040,
2137656763,
141376813,
2439277719,
3865271297,
1802195444,
476864866,
2238001368,
4066508878,
1812370925,
453092731,
2181625025,
4111451223,
1706088902,
314042704,
2344532202,
4240017532,
1658658271,
366619977,
2362670323,
4224994405,
1303535960,
984961486,
2747007092,
3569037538,
1256170817,
1037604311,
2765210733,
3554079995,
1131014506,
879679996,
2909243462,
3663771856,
1141124467,
855842277,
2852801631,
3708648649,
1342533948,
654459306,
3188396048,
3373015174,
1466479909,
544179635,
3110523913,
3462522015,
1591671054,
702138776,
2966460450,
3352799412,
1504918807,
783551873,
3082640443,
3233442989,
3988292384,
2596254646,
62317068,
1957810842,
3939845945,
2647816111,
81470997,
1943803523,
3814918930,
2489596804,
225274430,
2053790376,
3826175755,
2466906013,
167816743,
2097651377,
4027552580,
2265490386,
503444072,
1762050814,
4150417245,
2154129355,
426522225,
1852507879,
4275313526,
2312317920,
282753626,
1742555852,
4189708143,
2394877945,
397917763,
1622183637,
3604390888,
2714866558,
953729732,
1340076626,
3518719985,
2797360999,
1068828381,
1219638859,
3624741850,
2936675148,
906185462,
1090812512,
3747672003,
2825379669,
829329135,
1181335161,
3412177804,
3160834842,
628085408,
1382605366,
3423369109,
3138078467,
570562233,
1426400815,
3317316542,
2998733608,
733239954,
1555261956,
3268935591,
3050360625,
752459403,
1541320221,
2607071920,
3965973030,
1969922972,
40735498,
2617837225,
3943577151,
1913087877,
83908371,
2512341634,
3803740692,
2075208622,
213261112,
2463272603,
3855990285,
2094854071,
198958881,
2262029012,
4057260610,
1759359992,
534414190,
2176718541,
4139329115,
1873836001,
414664567,
2282248934,
4279200368,
1711684554,
285281116,
2405801727,
4167216745,
1634467795,
376229701,
2685067896,
3608007406,
1308918612,
956543938,
2808555105,
3495958263,
1231636301,
1047427035,
2932959818,
3654703836,
1088359270,
936918e3,
2847714899,
3736837829,
1202900863,
817233897,
3183342108,
3401237130,
1404277552,
615818150,
3134207493,
3453421203,
1423857449,
601450431,
3009837614,
3294710456,
1567103746,
711928724,
3020668471,
3272380065,
1510334235,
755167117
];
if (typeof Int32Array !== "undefined") {
CRC_TABLE = new Int32Array(CRC_TABLE);
}
function ensureBuffer(input) {
if (Buffer2.isBuffer(input)) {
return input;
}
var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
if (typeof input === "number") {
return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
} else if (typeof input === "string") {
return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
} else {
throw new Error("input must be buffer, number, or string, received " + typeof input);
}
}
function bufferizeInt(num) {
var tmp = ensureBuffer(4);
tmp.writeInt32BE(num, 0);
return tmp;
}
function _crc32(buf, previous) {
buf = ensureBuffer(buf);
if (Buffer2.isBuffer(previous)) {
previous = previous.readUInt32BE(0);
}
var crc = ~~previous ^ -1;
for (var n = 0; n < buf.length; n++) {
crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
}
return crc ^ -1;
}
function crc32() {
return bufferizeInt(_crc32.apply(null, arguments));
}
crc32.signed = function() {
return _crc32.apply(null, arguments);
};
crc32.unsigned = function() {
return _crc32.apply(null, arguments) >>> 0;
};
module2.exports = crc32;
}
});
// node_modules/crc-32/crc32.js
var require_crc32 = __commonJS({
"node_modules/crc-32/crc32.js"(exports) {
var CRC32;
(function(factory) {
if (typeof DO_NOT_EXPORT_CRC === "undefined") {
if ("object" === typeof exports) {
factory(exports);
} else if ("function" === typeof define && define.amd) {
define(function() {
var module3 = {};
factory(module3);
return module3;
});
} else {
factory(CRC32 = {});
}
} else {
factory(CRC32 = {});
}
})(function(CRC322) {
CRC322.version = "1.2.2";
function signed_crc_table() {
var c = 0, table = new Array(256);
for (var n = 0; n != 256; ++n) {
c = n;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
table[n] = c;
}
return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;
}
var T0 = signed_crc_table();
function slice_by_16_tables(T) {
var c = 0, v = 0, n = 0, table = typeof Int32Array !== "undefined" ? new Int32Array(4096) : new Array(4096);
for (n = 0; n != 256; ++n)
table[n] = T[n];
for (n = 0; n != 256; ++n) {
v = T[n];
for (c = 256 + n; c < 4096; c += 256)
v = table[c] = v >>> 8 ^ T[v & 255];
}
var out = [];
for (n = 1; n != 16; ++n)
out[n - 1] = typeof Int32Array !== "undefined" ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256);
return out;
}
var TT = slice_by_16_tables(T0);
var T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4];
var T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9];
var Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14];
function crc32_bstr(bstr, seed) {
var C = seed ^ -1;
for (var i = 0, L = bstr.length; i < L; )
C = C >>> 8 ^ T0[(C ^ bstr.charCodeAt(i++)) & 255];
return ~C;
}
function crc32_buf(B, seed) {
var C = seed ^ -1, L = B.length - 15, i = 0;
for (; i < L; )
C = Tf[B[i++] ^ C & 255] ^ Te[B[i++] ^ C >> 8 & 255] ^ Td[B[i++] ^ C >> 16 & 255] ^ Tc[B[i++] ^ C >>> 24] ^ Tb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^ T7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^ T3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]];
L += 15;
while (i < L)
C = C >>> 8 ^ T0[(C ^ B[i++]) & 255];
return ~C;
}
function crc32_str(str, seed) {
var C = seed ^ -1;
for (var i = 0, L = str.length, c = 0, d = 0; i < L; ) {
c = str.charCodeAt(i++);
if (c < 128) {
C = C >>> 8 ^ T0[(C ^ c) & 255];
} else if (c < 2048) {
C = C >>> 8 ^ T0[(C ^ (192 | c >> 6 & 31)) & 255];
C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255];
} else if (c >= 55296 && c < 57344) {
c = (c & 1023) + 64;
d = str.charCodeAt(i++) & 1023;
C = C >>> 8 ^ T0[(C ^ (240 | c >> 8 & 7)) & 255];
C = C >>> 8 ^ T0[(C ^ (128 | c >> 2 & 63)) & 255];
C = C >>> 8 ^ T0[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255];
C = C >>> 8 ^ T0[(C ^ (128 | d & 63)) & 255];
} else {
C = C >>> 8 ^ T0[(C ^ (224 | c >> 12 & 15)) & 255];
C = C >>> 8 ^ T0[(C ^ (128 | c >> 6 & 63)) & 255];
C = C >>> 8 ^ T0[(C ^ (128 | c & 63)) & 255];
}
}
return ~C;
}
CRC322.table = T0;
CRC322.bstr = crc32_bstr;
CRC322.buf = crc32_buf;
CRC322.str = crc32_str;
});
}
});
// node_modules/compress-commons/node_modules/crc32-stream/lib/crc32-stream.js
var require_crc32_stream = __commonJS({
"node_modules/compress-commons/node_modules/crc32-stream/lib/crc32-stream.js"(exports, module2) {
"use strict";
var { Transform } = require_readable3();
var crc32 = require_crc32();
var CRC32Stream = class extends Transform {
constructor(options) {
super(options);
this.checksum = Buffer.allocUnsafe(4);
this.checksum.writeInt32BE(0, 0);
this.rawSize = 0;
}
_transform(chunk, encoding, callback) {
if (chunk) {
this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
this.rawSize += chunk.length;
}
callback(null, chunk);
}
digest(encoding) {
const checksum = Buffer.allocUnsafe(4);
checksum.writeUInt32BE(this.checksum >>> 0, 0);
return encoding ? checksum.toString(encoding) : checksum;
}
hex() {
return this.digest("hex").toUpperCase();
}
size() {
return this.rawSize;
}
};
module2.exports = CRC32Stream;
}
});
// node_modules/compress-commons/node_modules/crc32-stream/lib/deflate-crc32-stream.js
var require_deflate_crc32_stream = __commonJS({
"node_modules/compress-commons/node_modules/crc32-stream/lib/deflate-crc32-stream.js"(exports, module2) {
"use strict";
var { DeflateRaw } = require("zlib");
var crc32 = require_crc32();
var DeflateCRC32Stream = class extends DeflateRaw {
constructor(options) {
super(options);
this.checksum = Buffer.allocUnsafe(4);
this.checksum.writeInt32BE(0, 0);
this.rawSize = 0;
this.compressedSize = 0;
}
push(chunk, encoding) {
if (chunk) {
this.compressedSize += chunk.length;
}
return super.push(chunk, encoding);
}
_transform(chunk, encoding, callback) {
if (chunk) {
this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
this.rawSize += chunk.length;
}
super._transform(chunk, encoding, callback);
}
digest(encoding) {
const checksum = Buffer.allocUnsafe(4);
checksum.writeUInt32BE(this.checksum >>> 0, 0);
return encoding ? checksum.toString(encoding) : checksum;
}
hex() {
return this.digest("hex").toUpperCase();
}
size(compressed = false) {
if (compressed) {
return this.compressedSize;
} else {
return this.rawSize;
}
}
};
module2.exports = DeflateCRC32Stream;
}
});
// node_modules/compress-commons/node_modules/crc32-stream/lib/index.js
var require_lib = __commonJS({
"node_modules/compress-commons/node_modules/crc32-stream/lib/index.js"(exports, module2) {
"use strict";
module2.exports = {
CRC32Stream: require_crc32_stream(),
DeflateCRC32Stream: require_deflate_crc32_stream()
};
}
});
// node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js
var require_zip_archive_output_stream = __commonJS({
"node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js"(exports, module2) {
var inherits = require("util").inherits;
var crc32 = require_buffer_crc32();
var { CRC32Stream } = require_lib();
var { DeflateCRC32Stream } = require_lib();
var ArchiveOutputStream = require_archive_output_stream();
var ZipArchiveEntry = require_zip_archive_entry();
var GeneralPurposeBit = require_general_purpose_bit();
var constants = require_constants();
var util = require_util3();
var zipUtil = require_util2();
var ZipArchiveOutputStream = module2.exports = function(options) {
if (!(this instanceof ZipArchiveOutputStream)) {
return new ZipArchiveOutputStream(options);
}
options = this.options = this._defaults(options);
ArchiveOutputStream.call(this, options);
this._entry = null;
this._entries = [];
this._archive = {
centralLength: 0,
centralOffset: 0,
comment: "",
finish: false,
finished: false,
processing: false,
forceZip64: options.forceZip64,
forceLocalTime: options.forceLocalTime
};
};
inherits(ZipArchiveOutputStream, ArchiveOutputStream);
ZipArchiveOutputStream.prototype._afterAppend = function(ae) {
this._entries.push(ae);
if (ae.getGeneralPurposeBit().usesDataDescriptor()) {
this._writeDataDescriptor(ae);
}
this._archive.processing = false;
this._entry = null;
if (this._archive.finish && !this._archive.finished) {
this._finish();
}
};
ZipArchiveOutputStream.prototype._appendBuffer = function(ae, source, callback) {
if (source.length === 0) {
ae.setMethod(constants.METHOD_STORED);
}
var method = ae.getMethod();
if (method === constants.METHOD_STORED) {
ae.setSize(source.length);
ae.setCompressedSize(source.length);
ae.setCrc(crc32.unsigned(source));
}
this._writeLocalFileHeader(ae);
if (method === constants.METHOD_STORED) {
this.write(source);
this._afterAppend(ae);
callback(null, ae);
return;
} else if (method === constants.METHOD_DEFLATED) {
this._smartStream(ae, callback).end(source);
return;
} else {
callback(new Error("compression method " + method + " not implemented"));
return;
}
};
ZipArchiveOutputStream.prototype._appendStream = function(ae, source, callback) {
ae.getGeneralPurposeBit().useDataDescriptor(true);
ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
this._writeLocalFileHeader(ae);
var smart = this._smartStream(ae, callback);
source.once("error", function(err) {
smart.emit("error", err);
smart.end();
});
source.pipe(smart);
};
ZipArchiveOutputStream.prototype._defaults = function(o) {
if (typeof o !== "object") {
o = {};
}
if (typeof o.zlib !== "object") {
o.zlib = {};
}
if (typeof o.zlib.level !== "number") {
o.zlib.level = constants.ZLIB_BEST_SPEED;
}
o.forceZip64 = !!o.forceZip64;
o.forceLocalTime = !!o.forceLocalTime;
return o;
};
ZipArchiveOutputStream.prototype._finish = function() {
this._archive.centralOffset = this.offset;
this._entries.forEach(function(ae) {
this._writeCentralFileHeader(ae);
}.bind(this));
this._archive.centralLength = this.offset - this._archive.centralOffset;
if (this.isZip64()) {
this._writeCentralDirectoryZip64();
}
this._writeCentralDirectoryEnd();
this._archive.processing = false;
this._archive.finish = true;
this._archive.finished = true;
this.end();
};
ZipArchiveOutputStream.prototype._normalizeEntry = function(ae) {
if (ae.getMethod() === -1) {
ae.setMethod(constants.METHOD_DEFLATED);
}
if (ae.getMethod() === constants.METHOD_DEFLATED) {
ae.getGeneralPurposeBit().useDataDescriptor(true);
ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
}
if (ae.getTime() === -1) {
ae.setTime(/* @__PURE__ */ new Date(), this._archive.forceLocalTime);
}
ae._offsets = {
file: 0,
data: 0,
contents: 0
};
};
ZipArchiveOutputStream.prototype._smartStream = function(ae, callback) {
var deflate = ae.getMethod() === constants.METHOD_DEFLATED;
var process2 = deflate ? new DeflateCRC32Stream(this.options.zlib) : new CRC32Stream();
var error = null;
function handleStuff() {
var digest = process2.digest().readUInt32BE(0);
ae.setCrc(digest);
ae.setSize(process2.size());
ae.setCompressedSize(process2.size(true));
this._afterAppend(ae);
callback(error, ae);
}
process2.once("end", handleStuff.bind(this));
process2.once("error", function(err) {
error = err;
});
process2.pipe(this, { end: false });
return process2;
};
ZipArchiveOutputStream.prototype._writeCentralDirectoryEnd = function() {
var records = this._entries.length;
var size = this._archive.centralLength;
var offset = this._archive.centralOffset;
if (this.isZip64()) {
records = constants.ZIP64_MAGIC_SHORT;
size = constants.ZIP64_MAGIC;
offset = constants.ZIP64_MAGIC;
}
this.write(zipUtil.getLongBytes(constants.SIG_EOCD));
this.write(constants.SHORT_ZERO);
this.write(constants.SHORT_ZERO);
this.write(zipUtil.getShortBytes(records));
this.write(zipUtil.getShortBytes(records));
this.write(zipUtil.getLongBytes(size));
this.write(zipUtil.getLongBytes(offset));
var comment = this.getComment();
var commentLength = Buffer.byteLength(comment);
this.write(zipUtil.getShortBytes(commentLength));
this.write(comment);
};
ZipArchiveOutputStream.prototype._writeCentralDirectoryZip64 = function() {
this.write(zipUtil.getLongBytes(constants.SIG_ZIP64_EOCD));
this.write(zipUtil.getEightBytes(44));
this.write(zipUtil.getShortBytes(constants.MIN_VERSION_ZIP64));
this.write(zipUtil.getShortBytes(constants.MIN_VERSION_ZIP64));
this.write(constants.LONG_ZERO);
this.write(constants.LONG_ZERO);
this.write(zipUtil.getEightBytes(this._entries.length));
this.write(zipUtil.getEightBytes(this._entries.length));
this.write(zipUtil.getEightBytes(this._archive.centralLength));
this.write(zipUtil.getEightBytes(this._archive.centralOffset));
this.write(zipUtil.getLongBytes(constants.SIG_ZIP64_EOCD_LOC));
this.write(constants.LONG_ZERO);
this.write(zipUtil.getEightBytes(this._archive.centralOffset + this._archive.centralLength));
this.write(zipUtil.getLongBytes(1));
};
ZipArchiveOutputStream.prototype._writeCentralFileHeader = function(ae) {
var gpb = ae.getGeneralPurposeBit();
var method = ae.getMethod();
var offsets = ae._offsets;
var size = ae.getSize();
var compressedSize = ae.getCompressedSize();
if (ae.isZip64() || offsets.file > constants.ZIP64_MAGIC) {
size = constants.ZIP64_MAGIC;
compressedSize = constants.ZIP64_MAGIC;
ae.setVersionNeededToExtract(constants.MIN_VERSION_ZIP64);
var extraBuf = Buffer.concat([
zipUtil.getShortBytes(constants.ZIP64_EXTRA_ID),
zipUtil.getShortBytes(24),
zipUtil.getEightBytes(ae.getSize()),
zipUtil.getEightBytes(ae.getCompressedSize()),
zipUtil.getEightBytes(offsets.file)
], 28);
ae.setExtra(extraBuf);
}
this.write(zipUtil.getLongBytes(constants.SIG_CFH));
this.write(zipUtil.getShortBytes(ae.getPlatform() << 8 | constants.VERSION_MADEBY));
this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
this.write(gpb.encode());
this.write(zipUtil.getShortBytes(method));
this.write(zipUtil.getLongBytes(ae.getTimeDos()));
this.write(zipUtil.getLongBytes(ae.getCrc()));
this.write(zipUtil.getLongBytes(compressedSize));
this.write(zipUtil.getLongBytes(size));
var name = ae.getName();
var comment = ae.getComment();
var extra = ae.getCentralDirectoryExtra();
if (gpb.usesUTF8ForNames()) {
name = Buffer.from(name);
comment = Buffer.from(comment);
}
this.write(zipUtil.getShortBytes(name.length));
this.write(zipUtil.getShortBytes(extra.length));
this.write(zipUtil.getShortBytes(comment.length));
this.write(constants.SHORT_ZERO);
this.write(zipUtil.getShortBytes(ae.getInternalAttributes()));
this.write(zipUtil.getLongBytes(ae.getExternalAttributes()));
if (offsets.file > constants.ZIP64_MAGIC) {
this.write(zipUtil.getLongBytes(constants.ZIP64_MAGIC));
} else {
this.write(zipUtil.getLongBytes(offsets.file));
}
this.write(name);
this.write(extra);
this.write(comment);
};
ZipArchiveOutputStream.prototype._writeDataDescriptor = function(ae) {
this.write(zipUtil.getLongBytes(constants.SIG_DD));
this.write(zipUtil.getLongBytes(ae.getCrc()));
if (ae.isZip64()) {
this.write(zipUtil.getEightBytes(ae.getCompressedSize()));
this.write(zipUtil.getEightBytes(ae.getSize()));
} else {
this.write(zipUtil.getLongBytes(ae.getCompressedSize()));
this.write(zipUtil.getLongBytes(ae.getSize()));
}
};
ZipArchiveOutputStream.prototype._writeLocalFileHeader = function(ae) {
var gpb = ae.getGeneralPurposeBit();
var method = ae.getMethod();
var name = ae.getName();
var extra = ae.getLocalFileDataExtra();
if (ae.isZip64()) {
gpb.useDataDescriptor(true);
ae.setVersionNeededToExtract(constants.MIN_VERSION_ZIP64);
}
if (gpb.usesUTF8ForNames()) {
name = Buffer.from(name);
}
ae._offsets.file = this.offset;
this.write(zipUtil.getLongBytes(constants.SIG_LFH));
this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
this.write(gpb.encode());
this.write(zipUtil.getShortBytes(method));
this.write(zipUtil.getLongBytes(ae.getTimeDos()));
ae._offsets.data = this.offset;
if (gpb.usesDataDescriptor()) {
this.write(constants.LONG_ZERO);
this.write(constants.LONG_ZERO);
this.write(constants.LONG_ZERO);
} else {
this.write(zipUtil.getLongBytes(ae.getCrc()));
this.write(zipUtil.getLongBytes(ae.getCompressedSize()));
this.write(zipUtil.getLongBytes(ae.getSize()));
}
this.write(zipUtil.getShortBytes(name.length));
this.write(zipUtil.getShortBytes(extra.length));
this.write(name);
this.write(extra);
ae._offsets.contents = this.offset;
};
ZipArchiveOutputStream.prototype.getComment = function(comment) {
return this._archive.comment !== null ? this._archive.comment : "";
};
ZipArchiveOutputStream.prototype.isZip64 = function() {
return this._archive.forceZip64 || this._entries.length > constants.ZIP64_MAGIC_SHORT || this._archive.centralLength > constants.ZIP64_MAGIC || this._archive.centralOffset > constants.ZIP64_MAGIC;
};
ZipArchiveOutputStream.prototype.setComment = function(comment) {
this._archive.comment = comment;
};
}
});
// node_modules/compress-commons/lib/compress-commons.js
var require_compress_commons = __commonJS({
"node_modules/compress-commons/lib/compress-commons.js"(exports, module2) {
module2.exports = {
ArchiveEntry: require_archive_entry(),
ZipArchiveEntry: require_zip_archive_entry(),
ArchiveOutputStream: require_archive_output_stream(),
ZipArchiveOutputStream: require_zip_archive_output_stream()
};
}
});
// node_modules/zip-stream/index.js
var require_zip_stream = __commonJS({
"node_modules/zip-stream/index.js"(exports, module2) {
var inherits = require("util").inherits;
var ZipArchiveOutputStream = require_compress_commons().ZipArchiveOutputStream;
var ZipArchiveEntry = require_compress_commons().ZipArchiveEntry;
var util = require_archiver_utils();
var ZipStream = module2.exports = function(options) {
if (!(this instanceof ZipStream)) {
return new ZipStream(options);
}
options = this.options = options || {};
options.zlib = options.zlib || {};
ZipArchiveOutputStream.call(this, options);
if (typeof options.level === "number" && options.level >= 0) {
options.zlib.level = options.level;
delete options.level;
}
if (!options.forceZip64 && typeof options.zlib.level === "number" && options.zlib.level === 0) {
options.store = true;
}
options.namePrependSlash = options.namePrependSlash || false;
if (options.comment && options.comment.length > 0) {
this.setComment(options.comment);
}
};
inherits(ZipStream, ZipArchiveOutputStream);
ZipStream.prototype._normalizeFileData = function(data) {
data = util.defaults(data, {
type: "file",
name: null,
namePrependSlash: this.options.namePrependSlash,
linkname: null,
date: null,
mode: null,
store: this.options.store,
comment: ""
});
var isDir = data.type === "directory";
var isSymlink = data.type === "symlink";
if (data.name) {
data.name = util.sanitizePath(data.name);
if (!isSymlink && data.name.slice(-1) === "/") {
isDir = true;
data.type = "directory";
} else if (isDir) {
data.name += "/";
}
}
if (isDir || isSymlink) {
data.store = true;
}
data.date = util.dateify(data.date);
return data;
};
ZipStream.prototype.entry = function(source, data, callback) {
if (typeof callback !== "function") {
callback = this._emitErrorCallback.bind(this);
}
data = this._normalizeFileData(data);
if (data.type !== "file" && data.type !== "directory" && data.type !== "symlink") {
callback(new Error(data.type + " entries not currently supported"));
return;
}
if (typeof data.name !== "string" || data.name.length === 0) {
callback(new Error("entry name must be a non-empty string value"));
return;
}
if (data.type === "symlink" && typeof data.linkname !== "string") {
callback(new Error("entry linkname must be a non-empty string value when type equals symlink"));
return;
}
var entry = new ZipArchiveEntry(data.name);
entry.setTime(data.date, this.options.forceLocalTime);
if (data.namePrependSlash) {
entry.setName(data.name, true);
}
if (data.store) {
entry.setMethod(0);
}
if (data.comment.length > 0) {
entry.setComment(data.comment);
}
if (data.type === "symlink" && typeof data.mode !== "number") {
data.mode = 40960;
}
if (typeof data.mode === "number") {
if (data.type === "symlink") {
data.mode |= 40960;
}
entry.setUnixMode(data.mode);
}
if (data.type === "symlink" && typeof data.linkname === "string") {
source = Buffer.from(data.linkname);
}
return ZipArchiveOutputStream.prototype.entry.call(this, entry, source, callback);
};
ZipStream.prototype.finalize = function() {
this.finish();
};
}
});
// node_modules/archiver/lib/plugins/zip.js
var require_zip = __commonJS({
"node_modules/archiver/lib/plugins/zip.js"(exports, module2) {
var engine = require_zip_stream();
var util = require_archiver_utils();
var Zip = function(options) {
if (!(this instanceof Zip)) {
return new Zip(options);
}
options = this.options = util.defaults(options, {
comment: "",
forceUTC: false,
namePrependSlash: false,
store: false
});
this.supports = {
directory: true,
symlink: true
};
this.engine = new engine(options);
};
Zip.prototype.append = function(source, data, callback) {
this.engine.entry(source, data, callback);
};
Zip.prototype.finalize = function() {
this.engine.finalize();
};
Zip.prototype.on = function() {
return this.engine.on.apply(this.engine, arguments);
};
Zip.prototype.pipe = function() {
return this.engine.pipe.apply(this.engine, arguments);
};
Zip.prototype.unpipe = function() {
return this.engine.unpipe.apply(this.engine, arguments);
};
module2.exports = Zip;
}
});
// node_modules/bl/BufferList.js
var require_BufferList3 = __commonJS({
"node_modules/bl/BufferList.js"(exports, module2) {
"use strict";
var { Buffer: Buffer2 } = require("buffer");
var symbol = Symbol.for("BufferList");
function BufferList(buf) {
if (!(this instanceof BufferList)) {
return new BufferList(buf);
}
BufferList._init.call(this, buf);
}
BufferList._init = function _init(buf) {
Object.defineProperty(this, symbol, { value: true });
this._bufs = [];
this.length = 0;
if (buf) {
this.append(buf);
}
};
BufferList.prototype._new = function _new(buf) {
return new BufferList(buf);
};
BufferList.prototype._offset = function _offset(offset) {
if (offset === 0) {
return [0, 0];
}
let tot = 0;
for (let i = 0; i < this._bufs.length; i++) {
const _t = tot + this._bufs[i].length;
if (offset < _t || i === this._bufs.length - 1) {
return [i, offset - tot];
}
tot = _t;
}
};
BufferList.prototype._reverseOffset = function(blOffset) {
const bufferId = blOffset[0];
let offset = blOffset[1];
for (let i = 0; i < bufferId; i++) {
offset += this._bufs[i].length;
}
return offset;
};
BufferList.prototype.get = function get(index2) {
if (index2 > this.length || index2 < 0) {
return void 0;
}
const offset = this._offset(index2);
return this._bufs[offset[0]][offset[1]];
};
BufferList.prototype.slice = function slice(start, end) {
if (typeof start === "number" && start < 0) {
start += this.length;
}
if (typeof end === "number" && end < 0) {
end += this.length;
}
return this.copy(null, 0, start, end);
};
BufferList.prototype.copy = function copy(dst, dstStart, srcStart, srcEnd) {
if (typeof srcStart !== "number" || srcStart < 0) {
srcStart = 0;
}
if (typeof srcEnd !== "number" || srcEnd > this.length) {
srcEnd = this.length;
}
if (srcStart >= this.length) {
return dst || Buffer2.alloc(0);
}
if (srcEnd <= 0) {
return dst || Buffer2.alloc(0);
}
const copy2 = !!dst;
const off = this._offset(srcStart);
const len = srcEnd - srcStart;
let bytes = len;
let bufoff = copy2 && dstStart || 0;
let start = off[1];
if (srcStart === 0 && srcEnd === this.length) {
if (!copy2) {
return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
}
for (let i = 0; i < this._bufs.length; i++) {
this._bufs[i].copy(dst, bufoff);
bufoff += this._bufs[i].length;
}
return dst;
}
if (bytes <= this._bufs[off[0]].length - start) {
return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
}
if (!copy2) {
dst = Buffer2.allocUnsafe(len);
}
for (let i = off[0]; i < this._bufs.length; i++) {
const l = this._bufs[i].length - start;
if (bytes > l) {
this._bufs[i].copy(dst, bufoff, start);
bufoff += l;
} else {
this._bufs[i].copy(dst, bufoff, start, start + bytes);
bufoff += l;
break;
}
bytes -= l;
if (start) {
start = 0;
}
}
if (dst.length > bufoff)
return dst.slice(0, bufoff);
return dst;
};
BufferList.prototype.shallowSlice = function shallowSlice(start, end) {
start = start || 0;
end = typeof end !== "number" ? this.length : end;
if (start < 0) {
start += this.length;
}
if (end < 0) {
end += this.length;
}
if (start === end) {
return this._new();
}
const startOffset = this._offset(start);
const endOffset = this._offset(end);
const buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1);
if (endOffset[1] === 0) {
buffers.pop();
} else {
buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1]);
}
if (startOffset[1] !== 0) {
buffers[0] = buffers[0].slice(startOffset[1]);
}
return this._new(buffers);
};
BufferList.prototype.toString = function toString(encoding, start, end) {
return this.slice(start, end).toString(encoding);
};
BufferList.prototype.consume = function consume(bytes) {
bytes = Math.trunc(bytes);
if (Number.isNaN(bytes) || bytes <= 0)
return this;
while (this._bufs.length) {
if (bytes >= this._bufs[0].length) {
bytes -= this._bufs[0].length;
this.length -= this._bufs[0].length;
this._bufs.shift();
} else {
this._bufs[0] = this._bufs[0].slice(bytes);
this.length -= bytes;
break;
}
}
return this;
};
BufferList.prototype.duplicate = function duplicate() {
const copy = this._new();
for (let i = 0; i < this._bufs.length; i++) {
copy.append(this._bufs[i]);
}
return copy;
};
BufferList.prototype.append = function append(buf) {
if (buf == null) {
return this;
}
if (buf.buffer) {
this._appendBuffer(Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength));
} else if (Array.isArray(buf)) {
for (let i = 0; i < buf.length; i++) {
this.append(buf[i]);
}
} else if (this._isBufferList(buf)) {
for (let i = 0; i < buf._bufs.length; i++) {
this.append(buf._bufs[i]);
}
} else {
if (typeof buf === "number") {
buf = buf.toString();
}
this._appendBuffer(Buffer2.from(buf));
}
return this;
};
BufferList.prototype._appendBuffer = function appendBuffer(buf) {
this._bufs.push(buf);
this.length += buf.length;
};
BufferList.prototype.indexOf = function(search, offset, encoding) {
if (encoding === void 0 && typeof offset === "string") {
encoding = offset;
offset = void 0;
}
if (typeof search === "function" || Array.isArray(search)) {
throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
} else if (typeof search === "number") {
search = Buffer2.from([search]);
} else if (typeof search === "string") {
search = Buffer2.from(search, encoding);
} else if (this._isBufferList(search)) {
search = search.slice();
} else if (Array.isArray(search.buffer)) {
search = Buffer2.from(search.buffer, search.byteOffset, search.byteLength);
} else if (!Buffer2.isBuffer(search)) {
search = Buffer2.from(search);
}
offset = Number(offset || 0);
if (isNaN(offset)) {
offset = 0;
}
if (offset < 0) {
offset = this.length + offset;
}
if (offset < 0) {
offset = 0;
}
if (search.length === 0) {
return offset > this.length ? this.length : offset;
}
const blOffset = this._offset(offset);
let blIndex = blOffset[0];
let buffOffset = blOffset[1];
for (; blIndex < this._bufs.length; blIndex++) {
const buff = this._bufs[blIndex];
while (buffOffset < buff.length) {
const availableWindow = buff.length - buffOffset;
if (availableWindow >= search.length) {
const nativeSearchResult = buff.indexOf(search, buffOffset);
if (nativeSearchResult !== -1) {
return this._reverseOffset([blIndex, nativeSearchResult]);
}
buffOffset = buff.length - search.length + 1;
} else {
const revOffset = this._reverseOffset([blIndex, buffOffset]);
if (this._match(revOffset, search)) {
return revOffset;
}
buffOffset++;
}
}
buffOffset = 0;
}
return -1;
};
BufferList.prototype._match = function(offset, search) {
if (this.length - offset < search.length) {
return false;
}
for (let searchOffset = 0; searchOffset < search.length; searchOffset++) {
if (this.get(offset + searchOffset) !== search[searchOffset]) {
return false;
}
}
return true;
};
(function() {
const methods = {
readDoubleBE: 8,
readDoubleLE: 8,
readFloatBE: 4,
readFloatLE: 4,
readInt32BE: 4,
readInt32LE: 4,
readUInt32BE: 4,
readUInt32LE: 4,
readInt16BE: 2,
readInt16LE: 2,
readUInt16BE: 2,
readUInt16LE: 2,
readInt8: 1,
readUInt8: 1,
readIntBE: null,
readIntLE: null,
readUIntBE: null,
readUIntLE: null
};
for (const m in methods) {
(function(m2) {
if (methods[m2] === null) {
BufferList.prototype[m2] = function(offset, byteLength) {
return this.slice(offset, offset + byteLength)[m2](0, byteLength);
};
} else {
BufferList.prototype[m2] = function(offset = 0) {
return this.slice(offset, offset + methods[m2])[m2](0);
};
}
})(m);
}
})();
BufferList.prototype._isBufferList = function _isBufferList(b) {
return b instanceof BufferList || BufferList.isBufferList(b);
};
BufferList.isBufferList = function isBufferList(b) {
return b != null && b[symbol];
};
module2.exports = BufferList;
}
});
// node_modules/bl/bl.js
var require_bl = __commonJS({
"node_modules/bl/bl.js"(exports, module2) {
"use strict";
var DuplexStream = require_readable3().Duplex;
var inherits = require_inherits();
var BufferList = require_BufferList3();
function BufferListStream(callback) {
if (!(this instanceof BufferListStream)) {
return new BufferListStream(callback);
}
if (typeof callback === "function") {
this._callback = callback;
const piper = function piper2(err) {
if (this._callback) {
this._callback(err);
this._callback = null;
}
}.bind(this);
this.on("pipe", function onPipe(src) {
src.on("error", piper);
});
this.on("unpipe", function onUnpipe(src) {
src.removeListener("error", piper);
});
callback = null;
}
BufferList._init.call(this, callback);
DuplexStream.call(this);
}
inherits(BufferListStream, DuplexStream);
Object.assign(BufferListStream.prototype, BufferList.prototype);
BufferListStream.prototype._new = function _new(callback) {
return new BufferListStream(callback);
};
BufferListStream.prototype._write = function _write(buf, encoding, callback) {
this._appendBuffer(buf);
if (typeof callback === "function") {
callback();
}
};
BufferListStream.prototype._read = function _read(size) {
if (!this.length) {
return this.push(null);
}
size = Math.min(size, this.length);
this.push(this.slice(0, size));
this.consume(size);
};
BufferListStream.prototype.end = function end(chunk) {
DuplexStream.prototype.end.call(this, chunk);
if (this._callback) {
this._callback(null, this.slice());
this._callback = null;
}
};
BufferListStream.prototype._destroy = function _destroy(err, cb) {
this._bufs.length = 0;
this.length = 0;
cb(err);
};
BufferListStream.prototype._isBufferList = function _isBufferList(b) {
return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b);
};
BufferListStream.isBufferList = BufferList.isBufferList;
module2.exports = BufferListStream;
module2.exports.BufferListStream = BufferListStream;
module2.exports.BufferList = BufferList;
}
});
// node_modules/tar-stream/headers.js
var require_headers = __commonJS({
"node_modules/tar-stream/headers.js"(exports) {
var alloc = Buffer.alloc;
var ZEROS = "0000000000000000000";
var SEVENS = "7777777777777777777";
var ZERO_OFFSET = "0".charCodeAt(0);
var USTAR_MAGIC = Buffer.from("ustar\0", "binary");
var USTAR_VER = Buffer.from("00", "binary");
var GNU_MAGIC = Buffer.from("ustar ", "binary");
var GNU_VER = Buffer.from(" \0", "binary");
var MASK = parseInt("7777", 8);
var MAGIC_OFFSET = 257;
var VERSION_OFFSET = 263;
var clamp = function(index2, len, defaultValue) {
if (typeof index2 !== "number")
return defaultValue;
index2 = ~~index2;
if (index2 >= len)
return len;
if (index2 >= 0)
return index2;
index2 += len;
if (index2 >= 0)
return index2;
return 0;
};
var toType = function(flag) {
switch (flag) {
case 0:
return "file";
case 1:
return "link";
case 2:
return "symlink";
case 3:
return "character-device";
case 4:
return "block-device";
case 5:
return "directory";
case 6:
return "fifo";
case 7:
return "contiguous-file";
case 72:
return "pax-header";
case 55:
return "pax-global-header";
case 27:
return "gnu-long-link-path";
case 28:
case 30:
return "gnu-long-path";
}
return null;
};
var toTypeflag = function(flag) {
switch (flag) {
case "file":
return 0;
case "link":
return 1;
case "symlink":
return 2;
case "character-device":
return 3;
case "block-device":
return 4;
case "directory":
return 5;
case "fifo":
return 6;
case "contiguous-file":
return 7;
case "pax-header":
return 72;
}
return 0;
};
var indexOf = function(block, num, offset, end) {
for (; offset < end; offset++) {
if (block[offset] === num)
return offset;
}
return end;
};
var cksum = function(block) {
var sum = 8 * 32;
for (var i = 0; i < 148; i++)
sum += block[i];
for (var j = 156; j < 512; j++)
sum += block[j];
return sum;
};
var encodeOct = function(val, n) {
val = val.toString(8);
if (val.length > n)
return SEVENS.slice(0, n) + " ";
else
return ZEROS.slice(0, n - val.length) + val + " ";
};
function parse256(buf) {
var positive;
if (buf[0] === 128)
positive = true;
else if (buf[0] === 255)
positive = false;
else
return null;
var tuple = [];
for (var i = buf.length - 1; i > 0; i--) {
var byte = buf[i];
if (positive)
tuple.push(byte);
else
tuple.push(255 - byte);
}
var sum = 0;
var l = tuple.length;
for (i = 0; i < l; i++) {
sum += tuple[i] * Math.pow(256, i);
}
return positive ? sum : -1 * sum;
}
var decodeOct = function(val, offset, length) {
val = val.slice(offset, offset + length);
offset = 0;
if (val[offset] & 128) {
return parse256(val);
} else {
while (offset < val.length && val[offset] === 32)
offset++;
var end = clamp(indexOf(val, 32, offset, val.length), val.length, val.length);
while (offset < end && val[offset] === 0)
offset++;
if (end === offset)
return 0;
return parseInt(val.slice(offset, end).toString(), 8);
}
};
var decodeStr = function(val, offset, length, encoding) {
return val.slice(offset, indexOf(val, 0, offset, offset + length)).toString(encoding);
};
var addLength = function(str) {
var len = Buffer.byteLength(str);
var digits = Math.floor(Math.log(len) / Math.log(10)) + 1;
if (len + digits >= Math.pow(10, digits))
digits++;
return len + digits + str;
};
exports.decodeLongPath = function(buf, encoding) {
return decodeStr(buf, 0, buf.length, encoding);
};
exports.encodePax = function(opts) {
var result = "";
if (opts.name)
result += addLength(" path=" + opts.name + "\n");
if (opts.linkname)
result += addLength(" linkpath=" + opts.linkname + "\n");
var pax = opts.pax;
if (pax) {
for (var key in pax) {
result += addLength(" " + key + "=" + pax[key] + "\n");
}
}
return Buffer.from(result);
};
exports.decodePax = function(buf) {
var result = {};
while (buf.length) {
var i = 0;
while (i < buf.length && buf[i] !== 32)
i++;
var len = parseInt(buf.slice(0, i).toString(), 10);
if (!len)
return result;
var b = buf.slice(i + 1, len - 1).toString();
var keyIndex = b.indexOf("=");
if (keyIndex === -1)
return result;
result[b.slice(0, keyIndex)] = b.slice(keyIndex + 1);
buf = buf.slice(len);
}
return result;
};
exports.encode = function(opts) {
var buf = alloc(512);
var name = opts.name;
var prefix = "";
if (opts.typeflag === 5 && name[name.length - 1] !== "/")
name += "/";
if (Buffer.byteLength(name) !== name.length)
return null;
while (Buffer.byteLength(name) > 100) {
var i = name.indexOf("/");
if (i === -1)
return null;
prefix += prefix ? "/" + name.slice(0, i) : name.slice(0, i);
name = name.slice(i + 1);
}
if (Buffer.byteLength(name) > 100 || Buffer.byteLength(prefix) > 155)
return null;
if (opts.linkname && Buffer.byteLength(opts.linkname) > 100)
return null;
buf.write(name);
buf.write(encodeOct(opts.mode & MASK, 6), 100);
buf.write(encodeOct(opts.uid, 6), 108);
buf.write(encodeOct(opts.gid, 6), 116);
buf.write(encodeOct(opts.size, 11), 124);
buf.write(encodeOct(opts.mtime.getTime() / 1e3 | 0, 11), 136);
buf[156] = ZERO_OFFSET + toTypeflag(opts.type);
if (opts.linkname)
buf.write(opts.linkname, 157);
USTAR_MAGIC.copy(buf, MAGIC_OFFSET);
USTAR_VER.copy(buf, VERSION_OFFSET);
if (opts.uname)
buf.write(opts.uname, 265);
if (opts.gname)
buf.write(opts.gname, 297);
buf.write(encodeOct(opts.devmajor || 0, 6), 329);
buf.write(encodeOct(opts.devminor || 0, 6), 337);
if (prefix)
buf.write(prefix, 345);
buf.write(encodeOct(cksum(buf), 6), 148);
return buf;
};
exports.decode = function(buf, filenameEncoding, allowUnknownFormat) {
var typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET;
var name = decodeStr(buf, 0, 100, filenameEncoding);
var mode = decodeOct(buf, 100, 8);
var uid = decodeOct(buf, 108, 8);
var gid = decodeOct(buf, 116, 8);
var size = decodeOct(buf, 124, 12);
var mtime = decodeOct(buf, 136, 12);
var type = toType(typeflag);
var linkname = buf[157] === 0 ? null : decodeStr(buf, 157, 100, filenameEncoding);
var uname = decodeStr(buf, 265, 32);
var gname = decodeStr(buf, 297, 32);
var devmajor = decodeOct(buf, 329, 8);
var devminor = decodeOct(buf, 337, 8);
var c = cksum(buf);
if (c === 8 * 32)
return null;
if (c !== decodeOct(buf, 148, 8))
throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");
if (USTAR_MAGIC.compare(buf, MAGIC_OFFSET, MAGIC_OFFSET + 6) === 0) {
if (buf[345])
name = decodeStr(buf, 345, 155, filenameEncoding) + "/" + name;
} else if (GNU_MAGIC.compare(buf, MAGIC_OFFSET, MAGIC_OFFSET + 6) === 0 && GNU_VER.compare(buf, VERSION_OFFSET, VERSION_OFFSET + 2) === 0) {
} else {
if (!allowUnknownFormat) {
throw new Error("Invalid tar header: unknown format.");
}
}
if (typeflag === 0 && name && name[name.length - 1] === "/")
typeflag = 5;
return {
name,
mode,
uid,
gid,
size,
mtime: new Date(1e3 * mtime),
type,
linkname,
uname,
gname,
devmajor,
devminor
};
};
}
});
// node_modules/tar-stream/extract.js
var require_extract = __commonJS({
"node_modules/tar-stream/extract.js"(exports, module2) {
var util = require("util");
var bl = require_bl();
var headers = require_headers();
var Writable = require_readable3().Writable;
var PassThrough = require_readable3().PassThrough;
var noop = function() {
};
var overflow = function(size) {
size &= 511;
return size && 512 - size;
};
var emptyStream = function(self2, offset) {
var s = new Source(self2, offset);
s.end();
return s;
};
var mixinPax = function(header, pax) {
if (pax.path)
header.name = pax.path;
if (pax.linkpath)
header.linkname = pax.linkpath;
if (pax.size)
header.size = parseInt(pax.size, 10);
header.pax = pax;
return header;
};
var Source = function(self2, offset) {
this._parent = self2;
this.offset = offset;
PassThrough.call(this, { autoDestroy: false });
};
util.inherits(Source, PassThrough);
Source.prototype.destroy = function(err) {
this._parent.destroy(err);
};
var Extract = function(opts) {
if (!(this instanceof Extract))
return new Extract(opts);
Writable.call(this, opts);
opts = opts || {};
this._offset = 0;
this._buffer = bl();
this._missing = 0;
this._partial = false;
this._onparse = noop;
this._header = null;
this._stream = null;
this._overflow = null;
this._cb = null;
this._locked = false;
this._destroyed = false;
this._pax = null;
this._paxGlobal = null;
this._gnuLongPath = null;
this._gnuLongLinkPath = null;
var self2 = this;
var b = self2._buffer;
var oncontinue = function() {
self2._continue();
};
var onunlock = function(err) {
self2._locked = false;
if (err)
return self2.destroy(err);
if (!self2._stream)
oncontinue();
};
var onstreamend = function() {
self2._stream = null;
var drain = overflow(self2._header.size);
if (drain)
self2._parse(drain, ondrain);
else
self2._parse(512, onheader);
if (!self2._locked)
oncontinue();
};
var ondrain = function() {
self2._buffer.consume(overflow(self2._header.size));
self2._parse(512, onheader);
oncontinue();
};
var onpaxglobalheader = function() {
var size = self2._header.size;
self2._paxGlobal = headers.decodePax(b.slice(0, size));
b.consume(size);
onstreamend();
};
var onpaxheader = function() {
var size = self2._header.size;
self2._pax = headers.decodePax(b.slice(0, size));
if (self2._paxGlobal)
self2._pax = Object.assign({}, self2._paxGlobal, self2._pax);
b.consume(size);
onstreamend();
};
var ongnulongpath = function() {
var size = self2._header.size;
this._gnuLongPath = headers.decodeLongPath(b.slice(0, size), opts.filenameEncoding);
b.consume(size);
onstreamend();
};
var ongnulonglinkpath = function() {
var size = self2._header.size;
this._gnuLongLinkPath = headers.decodeLongPath(b.slice(0, size), opts.filenameEncoding);
b.consume(size);
onstreamend();
};
var onheader = function() {
var offset = self2._offset;
var header;
try {
header = self2._header = headers.decode(b.slice(0, 512), opts.filenameEncoding, opts.allowUnknownFormat);
} catch (err) {
self2.emit("error", err);
}
b.consume(512);
if (!header) {
self2._parse(512, onheader);
oncontinue();
return;
}
if (header.type === "gnu-long-path") {
self2._parse(header.size, ongnulongpath);
oncontinue();
return;
}
if (header.type === "gnu-long-link-path") {
self2._parse(header.size, ongnulonglinkpath);
oncontinue();
return;
}
if (header.type === "pax-global-header") {
self2._parse(header.size, onpaxglobalheader);
oncontinue();
return;
}
if (header.type === "pax-header") {
self2._parse(header.size, onpaxheader);
oncontinue();
return;
}
if (self2._gnuLongPath) {
header.name = self2._gnuLongPath;
self2._gnuLongPath = null;
}
if (self2._gnuLongLinkPath) {
header.linkname = self2._gnuLongLinkPath;
self2._gnuLongLinkPath = null;
}
if (self2._pax) {
self2._header = header = mixinPax(header, self2._pax);
self2._pax = null;
}
self2._locked = true;
if (!header.size || header.type === "directory") {
self2._parse(512, onheader);
self2.emit("entry", header, emptyStream(self2, offset), onunlock);
return;
}
self2._stream = new Source(self2, offset);
self2.emit("entry", header, self2._stream, onunlock);
self2._parse(header.size, onstreamend);
oncontinue();
};
this._onheader = onheader;
this._parse(512, onheader);
};
util.inherits(Extract, Writable);
Extract.prototype.destroy = function(err) {
if (this._destroyed)
return;
this._destroyed = true;
if (err)
this.emit("error", err);
this.emit("close");
if (this._stream)
this._stream.emit("close");
};
Extract.prototype._parse = function(size, onparse) {
if (this._destroyed)
return;
this._offset += size;
this._missing = size;
if (onparse === this._onheader)
this._partial = false;
this._onparse = onparse;
};
Extract.prototype._continue = function() {
if (this._destroyed)
return;
var cb = this._cb;
this._cb = noop;
if (this._overflow)
this._write(this._overflow, void 0, cb);
else
cb();
};
Extract.prototype._write = function(data, enc, cb) {
if (this._destroyed)
return;
var s = this._stream;
var b = this._buffer;
var missing = this._missing;
if (data.length)
this._partial = true;
if (data.length < missing) {
this._missing -= data.length;
this._overflow = null;
if (s)
return s.write(data, cb);
b.append(data);
return cb();
}
this._cb = cb;
this._missing = 0;
var overflow2 = null;
if (data.length > missing) {
overflow2 = data.slice(missing);
data = data.slice(0, missing);
}
if (s)
s.end(data);
else
b.append(data);
this._overflow = overflow2;
this._onparse();
};
Extract.prototype._final = function(cb) {
if (this._partial)
return this.destroy(new Error("Unexpected end of data"));
cb();
};
module2.exports = Extract;
}
});
// node_modules/fs-constants/index.js
var require_fs_constants = __commonJS({
"node_modules/fs-constants/index.js"(exports, module2) {
module2.exports = require("fs").constants || require("constants");
}
});
// node_modules/end-of-stream/index.js
var require_end_of_stream2 = __commonJS({
"node_modules/end-of-stream/index.js"(exports, module2) {
var once2 = require_once();
var noop = function() {
};
var isRequest = function(stream) {
return stream.setHeader && typeof stream.abort === "function";
};
var isChildProcess = function(stream) {
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
};
var eos = function(stream, opts, callback) {
if (typeof opts === "function")
return eos(stream, null, opts);
if (!opts)
opts = {};
callback = once2(callback || noop);
var ws = stream._writableState;
var rs = stream._readableState;
var readable = opts.readable || opts.readable !== false && stream.readable;
var writable = opts.writable || opts.writable !== false && stream.writable;
var cancelled = false;
var onlegacyfinish = function() {
if (!stream.writable)
onfinish();
};
var onfinish = function() {
writable = false;
if (!readable)
callback.call(stream);
};
var onend = function() {
readable = false;
if (!writable)
callback.call(stream);
};
var onexit = function(exitCode) {
callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
};
var onerror = function(err) {
callback.call(stream, err);
};
var onclose = function() {
process.nextTick(onclosenexttick);
};
var onclosenexttick = function() {
if (cancelled)
return;
if (readable && !(rs && (rs.ended && !rs.destroyed)))
return callback.call(stream, new Error("premature close"));
if (writable && !(ws && (ws.ended && !ws.destroyed)))
return callback.call(stream, new Error("premature close"));
};
var onrequest = function() {
stream.req.on("finish", onfinish);
};
if (isRequest(stream)) {
stream.on("complete", onfinish);
stream.on("abort", onclose);
if (stream.req)
onrequest();
else
stream.on("request", onrequest);
} else if (writable && !ws) {
stream.on("end", onlegacyfinish);
stream.on("close", onlegacyfinish);
}
if (isChildProcess(stream))
stream.on("exit", onexit);
stream.on("end", onend);
stream.on("finish", onfinish);
if (opts.error !== false)
stream.on("error", onerror);
stream.on("close", onclose);
return function() {
cancelled = true;
stream.removeListener("complete", onfinish);
stream.removeListener("abort", onclose);
stream.removeListener("request", onrequest);
if (stream.req)
stream.req.removeListener("finish", onfinish);
stream.removeListener("end", onlegacyfinish);
stream.removeListener("close", onlegacyfinish);
stream.removeListener("finish", onfinish);
stream.removeListener("exit", onexit);
stream.removeListener("end", onend);
stream.removeListener("error", onerror);
stream.removeListener("close", onclose);
};
};
module2.exports = eos;
}
});
// node_modules/tar-stream/pack.js
var require_pack = __commonJS({
"node_modules/tar-stream/pack.js"(exports, module2) {
var constants = require_fs_constants();
var eos = require_end_of_stream2();
var inherits = require_inherits();
var alloc = Buffer.alloc;
var Readable = require_readable3().Readable;
var Writable = require_readable3().Writable;
var StringDecoder = require("string_decoder").StringDecoder;
var headers = require_headers();
var DMODE = parseInt("755", 8);
var FMODE = parseInt("644", 8);
var END_OF_TAR = alloc(1024);
var noop = function() {
};
var overflow = function(self2, size) {
size &= 511;
if (size)
self2.push(END_OF_TAR.slice(0, 512 - size));
};
function modeToType(mode) {
switch (mode & constants.S_IFMT) {
case constants.S_IFBLK:
return "block-device";
case constants.S_IFCHR:
return "character-device";
case constants.S_IFDIR:
return "directory";
case constants.S_IFIFO:
return "fifo";
case constants.S_IFLNK:
return "symlink";
}
return "file";
}
var Sink = function(to) {
Writable.call(this);
this.written = 0;
this._to = to;
this._destroyed = false;
};
inherits(Sink, Writable);
Sink.prototype._write = function(data, enc, cb) {
this.written += data.length;
if (this._to.push(data))
return cb();
this._to._drain = cb;
};
Sink.prototype.destroy = function() {
if (this._destroyed)
return;
this._destroyed = true;
this.emit("close");
};
var LinkSink = function() {
Writable.call(this);
this.linkname = "";
this._decoder = new StringDecoder("utf-8");
this._destroyed = false;
};
inherits(LinkSink, Writable);
LinkSink.prototype._write = function(data, enc, cb) {
this.linkname += this._decoder.write(data);
cb();
};
LinkSink.prototype.destroy = function() {
if (this._destroyed)
return;
this._destroyed = true;
this.emit("close");
};
var Void = function() {
Writable.call(this);
this._destroyed = false;
};
inherits(Void, Writable);
Void.prototype._write = function(data, enc, cb) {
cb(new Error("No body allowed for this entry"));
};
Void.prototype.destroy = function() {
if (this._destroyed)
return;
this._destroyed = true;
this.emit("close");
};
var Pack = function(opts) {
if (!(this instanceof Pack))
return new Pack(opts);
Readable.call(this, opts);
this._drain = noop;
this._finalized = false;
this._finalizing = false;
this._destroyed = false;
this._stream = null;
};
inherits(Pack, Readable);
Pack.prototype.entry = function(header, buffer, callback) {
if (this._stream)
throw new Error("already piping an entry");
if (this._finalized || this._destroyed)
return;
if (typeof buffer === "function") {
callback = buffer;
buffer = null;
}
if (!callback)
callback = noop;
var self2 = this;
if (!header.size || header.type === "symlink")
header.size = 0;
if (!header.type)
header.type = modeToType(header.mode);
if (!header.mode)
header.mode = header.type === "directory" ? DMODE : FMODE;
if (!header.uid)
header.uid = 0;
if (!header.gid)
header.gid = 0;
if (!header.mtime)
header.mtime = /* @__PURE__ */ new Date();
if (typeof buffer === "string")
buffer = Buffer.from(buffer);
if (Buffer.isBuffer(buffer)) {
header.size = buffer.length;
this._encode(header);
var ok = this.push(buffer);
overflow(self2, header.size);
if (ok)
process.nextTick(callback);
else
this._drain = callback;
return new Void();
}
if (header.type === "symlink" && !header.linkname) {
var linkSink = new LinkSink();
eos(linkSink, function(err) {
if (err) {
self2.destroy();
return callback(err);
}
header.linkname = linkSink.linkname;
self2._encode(header);
callback();
});
return linkSink;
}
this._encode(header);
if (header.type !== "file" && header.type !== "contiguous-file") {
process.nextTick(callback);
return new Void();
}
var sink = new Sink(this);
this._stream = sink;
eos(sink, function(err) {
self2._stream = null;
if (err) {
self2.destroy();
return callback(err);
}
if (sink.written !== header.size) {
self2.destroy();
return callback(new Error("size mismatch"));
}
overflow(self2, header.size);
if (self2._finalizing)
self2.finalize();
callback();
});
return sink;
};
Pack.prototype.finalize = function() {
if (this._stream) {
this._finalizing = true;
return;
}
if (this._finalized)
return;
this._finalized = true;
this.push(END_OF_TAR);
this.push(null);
};
Pack.prototype.destroy = function(err) {
if (this._destroyed)
return;
this._destroyed = true;
if (err)
this.emit("error", err);
this.emit("close");
if (this._stream && this._stream.destroy)
this._stream.destroy();
};
Pack.prototype._encode = function(header) {
if (!header.pax) {
var buf = headers.encode(header);
if (buf) {
this.push(buf);
return;
}
}
this._encodePax(header);
};
Pack.prototype._encodePax = function(header) {
var paxHeader = headers.encodePax({
name: header.name,
linkname: header.linkname,
pax: header.pax
});
var newHeader = {
name: "PaxHeader",
mode: header.mode,
uid: header.uid,
gid: header.gid,
size: paxHeader.length,
mtime: header.mtime,
type: "pax-header",
linkname: header.linkname && "PaxHeader",
uname: header.uname,
gname: header.gname,
devmajor: header.devmajor,
devminor: header.devminor
};
this.push(headers.encode(newHeader));
this.push(paxHeader);
overflow(this, paxHeader.length);
newHeader.size = header.size;
newHeader.type = header.type;
this.push(headers.encode(newHeader));
};
Pack.prototype._read = function(n) {
var drain = this._drain;
this._drain = noop;
drain();
};
module2.exports = Pack;
}
});
// node_modules/tar-stream/index.js
var require_tar_stream = __commonJS({
"node_modules/tar-stream/index.js"(exports) {
exports.extract = require_extract();
exports.pack = require_pack();
}
});
// node_modules/archiver/lib/plugins/tar.js
var require_tar = __commonJS({
"node_modules/archiver/lib/plugins/tar.js"(exports, module2) {
var zlib = require("zlib");
var engine = require_tar_stream();
var util = require_archiver_utils();
var Tar = function(options) {
if (!(this instanceof Tar)) {
return new Tar(options);
}
options = this.options = util.defaults(options, {
gzip: false
});
if (typeof options.gzipOptions !== "object") {
options.gzipOptions = {};
}
this.supports = {
directory: true,
symlink: true
};
this.engine = engine.pack(options);
this.compressor = false;
if (options.gzip) {
this.compressor = zlib.createGzip(options.gzipOptions);
this.compressor.on("error", this._onCompressorError.bind(this));
}
};
Tar.prototype._onCompressorError = function(err) {
this.engine.emit("error", err);
};
Tar.prototype.append = function(source, data, callback) {
var self2 = this;
data.mtime = data.date;
function append(err, sourceBuffer) {
if (err) {
callback(err);
return;
}
self2.engine.entry(data, sourceBuffer, function(err2) {
callback(err2, data);
});
}
if (data.sourceType === "buffer") {
append(null, source);
} else if (data.sourceType === "stream" && data.stats) {
data.size = data.stats.size;
var entry = self2.engine.entry(data, function(err) {
callback(err, data);
});
source.pipe(entry);
} else if (data.sourceType === "stream") {
util.collectStream(source, append);
}
};
Tar.prototype.finalize = function() {
this.engine.finalize();
};
Tar.prototype.on = function() {
return this.engine.on.apply(this.engine, arguments);
};
Tar.prototype.pipe = function(destination, options) {
if (this.compressor) {
return this.engine.pipe.apply(this.engine, [this.compressor]).pipe(destination, options);
} else {
return this.engine.pipe.apply(this.engine, arguments);
}
};
Tar.prototype.unpipe = function() {
if (this.compressor) {
return this.compressor.unpipe.apply(this.compressor, arguments);
} else {
return this.engine.unpipe.apply(this.engine, arguments);
}
};
module2.exports = Tar;
}
});
// node_modules/archiver/lib/plugins/json.js
var require_json = __commonJS({
"node_modules/archiver/lib/plugins/json.js"(exports, module2) {
var inherits = require("util").inherits;
var Transform = require_readable3().Transform;
var crc32 = require_buffer_crc32();
var util = require_archiver_utils();
var Json = function(options) {
if (!(this instanceof Json)) {
return new Json(options);
}
options = this.options = util.defaults(options, {});
Transform.call(this, options);
this.supports = {
directory: true,
symlink: true
};
this.files = [];
};
inherits(Json, Transform);
Json.prototype._transform = function(chunk, encoding, callback) {
callback(null, chunk);
};
Json.prototype._writeStringified = function() {
var fileString = JSON.stringify(this.files);
this.write(fileString);
};
Json.prototype.append = function(source, data, callback) {
var self2 = this;
data.crc32 = 0;
function onend(err, sourceBuffer) {
if (err) {
callback(err);
return;
}
data.size = sourceBuffer.length || 0;
data.crc32 = crc32.unsigned(sourceBuffer);
self2.files.push(data);
callback(null, data);
}
if (data.sourceType === "buffer") {
onend(null, source);
} else if (data.sourceType === "stream") {
util.collectStream(source, onend);
}
};
Json.prototype.finalize = function() {
this._writeStringified();
this.end();
};
module2.exports = Json;
}
});
// node_modules/archiver/index.js
var require_archiver = __commonJS({
"node_modules/archiver/index.js"(exports, module2) {
var Archiver = require_core();
var formats = {};
var vending = function(format, options) {
return vending.create(format, options);
};
vending.create = function(format, options) {
if (formats[format]) {
var instance = new Archiver(format, options);
instance.setFormat(format);
instance.setModule(new formats[format](options));
return instance;
} else {
throw new Error("create(" + format + "): format not registered");
}
};
vending.registerFormat = function(format, module3) {
if (formats[format]) {
throw new Error("register(" + format + "): format already registered");
}
if (typeof module3 !== "function") {
throw new Error("register(" + format + "): format module invalid");
}
if (typeof module3.prototype.append !== "function" || typeof module3.prototype.finalize !== "function") {
throw new Error("register(" + format + "): format module missing methods");
}
formats[format] = module3;
};
vending.isRegisteredFormat = function(format) {
if (formats[format]) {
return true;
}
return false;
};
vending.registerFormat("zip", require_zip());
vending.registerFormat("tar", require_tar());
vending.registerFormat("json", require_json());
module2.exports = vending;
}
});
// node_modules/commander/esm.mjs
var import_index = __toESM(require_commander(), 1);
var {
program,
createCommand,
createArgument,
createOption,
CommanderError,
InvalidArgumentError,
InvalidOptionArgumentError,
// deprecated old name
Command,
Argument,
Option,
Help
} = import_index.default;
// lib/cli.ts
var import_path2 = __toESM(require("path"));
// package.json
var package_default = {
name: "@sladg/nextjs-lambda",
version: "7.4.0",
description: "Plug-and-play lambda for replacing default NextJS image optimization handler.",
repository: {
type: "git",
url: "https://github.com/sladg/nextjs-lambda"
},
license: "MIT",
author: "Jan Soukup <jan@ssoukup.com>",
exports: "./dist/index.js",
types: "./dist/index.d.ts",
bin: {
cli: "./dist/cli.js"
},
files: [
"dist"
],
scripts: {
"lint:check": "eslint ./lib/** --ext .ts",
"lint:fix": "eslint --fix ./lib/** --ext .ts",
prebuild: "rm -rf dist",
build: "npm run build:cli && npm run build:main && npm run build:cdk && npm run build:handler",
"build:cdk": "tsup lib/cdk/app.ts --out-dir dist/cdk",
"build:cli": "tsup lib/cli.ts",
"build:handler": "tsup lib/server-handler/index.ts --out-dir dist/server-handler",
"build:main": "tsup lib/index.ts --dts lib/index.ts",
commit: "npx --package cz-emoji-conventional --package commitizen -- cz",
release: "npx --package @sladg/release-utils utils shipit --gitUser @sladg --gitEmail jan@ssoukup.com --changelog"
},
dependencies: {
"@sladg/imaginex-lambda": "0.17.0"
},
devDependencies: {
"@types/node": "^18.14.1",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
archiver: "^5.3.1",
commander: "^10.0.0",
eslint: "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
prettier: "^2.8.4",
"serverless-http": "^3.1.1",
tsup: "^6.6.3",
typescript: "^4.9.5"
},
peerDependencies: {
"@aws-cdk/aws-apigatewayv2-alpha": "^2.66.1-alpha.0",
"@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.66.1-alpha.0",
"@types/archiver": "^5.3.1",
"@types/node": "^18.13.0",
"aws-cdk": "^2.66.1",
"aws-cdk-lib": "^2.66.1",
envalid: "^7.3.1",
next: "^12.2 || ^13"
},
engines: {
node: ">=16.15"
},
engineStrict: true,
keywords: [
"nextjs",
"next12",
"next13",
"lambda",
"deployment",
"serverless",
"aws-cdk",
"api-gateway-v2",
"httpapi",
"caching",
"cloudfront",
"image",
"optimization",
"components"
]
};
// lib/cdk/utils/imageLambda.ts
var import_aws_cdk_lib = require("aws-cdk-lib");
var import_aws_lambda = require("aws-cdk-lib/aws-lambda");
var DEFAULT_MEMORY = 512;
var DEFAULT_TIMEOUT = 10;
// lib/utils.ts
var import_archiver = __toESM(require_archiver());
var import_child_process = require("child_process");
var import_fs = require("fs");
var import_glob = __toESM(require_glob());
var findObjectInFile = (filePath, regexes) => {
const content = (0, import_fs.readFileSync)(filePath, "utf-8");
const data = regexes.reduce((acc, regex) => {
var _a, _b;
if (acc) {
return acc;
}
return (_b = (_a = content.match(regex)) == null ? void 0 : _a[0]) != null ? _b : null;
}, null);
if (!data) {
throw new Error("Unable to match Next server configuration. Report this issue in Github.");
}
try {
JSON.parse(data);
} catch (err) {
console.warn(err);
throw new Error("Unable to parse Next server configuration. Report this issue in Github.");
}
return data;
};
var zipMultipleFoldersOrFiles = async ({ outputName, inputDefinition }) => {
const archive = (0, import_archiver.default)("zip", { zlib: { level: 5 } });
const stream = (0, import_fs.createWriteStream)(outputName);
return new Promise((resolve, reject2) => {
inputDefinition.forEach((props) => {
var _a;
if ("isFile" in props) {
archive.file(props.path, { name: props.name });
} else if ("isSymlink" in props) {
archive.symlink(props.source, props.target);
} else if ("isGlob" in props) {
archive.glob(props.path, props);
} else {
archive.directory(props.path, (_a = props.dir) != null ? _a : false);
}
});
archive.on("error", (err) => reject2(err)).pipe(stream);
stream.on("close", resolve);
archive.finalize();
});
};
var executeAsyncCmd = async ({ cmd, path: path3, env }) => {
if (path3) {
process.chdir(path3);
}
return new Promise((resolve, reject2) => {
var _a, _b;
console.log("Executing command: ", cmd);
const sh = (0, import_child_process.exec)(cmd, { env: { ...process.env, ...env } }, (error, stdout) => {
if (error) {
reject2(error);
} else {
resolve(stdout);
}
});
(_a = sh.stdout) == null ? void 0 : _a.on("data", (data) => {
console.log(`stdout: ${data}`);
});
(_b = sh.stderr) == null ? void 0 : _b.on("data", (data) => {
console.error(`stderr: ${data}`);
});
});
};
var wrapProcess = async (fn) => {
try {
await fn;
} catch (e) {
console.error("Process failed with error:", e);
process.exit(1);
}
};
var findPathToNestedFile = (filename, inPath) => {
const results = import_glob.default.sync(`**/${filename}`, { cwd: inPath, ignore: ["**/node_modules/**"], realpath: true });
if (!results[0]) {
throw new Error(`Could not find file: ${filename} in your Next output.`);
}
return results[0].replace(filename, "");
};
var validatePublicFolderStructure = (publicFolderPath) => {
if (!(0, import_fs.existsSync)(publicFolderPath)) {
return;
}
const paths = (0, import_fs.readdirSync)(publicFolderPath);
paths.forEach((publicPath) => {
if (publicPath !== "assets") {
throw new Error("Public folder assets must be nested in public/assets folder.");
}
});
};
var validateFolderExists = (folderPath) => {
const exists = (0, import_fs.existsSync)(folderPath);
if (!exists) {
throw new Error(`Folder: ${folderPath} does not exist!`);
}
};
// lib/cli/deploy.ts
var cdkExecutable = require.resolve("aws-cdk/bin/cdk");
var deployHandler = async ({
stackName,
appPath,
bootstrap,
region,
lambdaMemory,
lambdaTimeout,
lambdaRuntime,
imageLambdaMemory,
imageLambdaTimeout,
domainNames,
customApiDomain,
redirectFromApex,
hotswap,
profile
}) => {
const cdkBootstrapArgs = [`--app "node ${appPath}"`];
const cdkDeployArgs = [`--app "node ${appPath}"`, "--require-approval never", "--ci"];
if (hotswap) {
cdkDeployArgs.push(`--hotswap`);
}
if (profile) {
cdkDeployArgs.push(`--profile ${profile}`);
cdkBootstrapArgs.push(`--profile ${profile}`);
}
const variables = {
STACK_NAME: stackName,
...region && { AWS_REGION: region },
...lambdaMemory && { LAMBDA_MEMORY: lambdaMemory.toString() },
...lambdaTimeout && { LAMBDA_TIMEOUT: lambdaTimeout.toString() },
...lambdaRuntime && { LAMBDA_RUNTIME: lambdaRuntime.toString() },
...imageLambdaMemory && { IMAGE_LAMBDA_MEMORY: imageLambdaMemory.toString() },
...imageLambdaTimeout && { IMAGE_LAMBDA_TIMEOUT: imageLambdaTimeout.toString() },
...domainNames && { DOMAIN_NAMES: domainNames },
...customApiDomain && { CUSTOM_API_DOMAIN: customApiDomain },
...redirectFromApex && { REDIRECT_FROM_APEX: redirectFromApex.toString() }
};
if (bootstrap) {
await executeAsyncCmd({
cmd: `${cdkExecutable} bootstrap ${cdkBootstrapArgs.join(" ")}`,
env: variables
});
}
await executeAsyncCmd({
cmd: `${cdkExecutable} deploy ${cdkDeployArgs.join(" ")}`,
env: variables
});
};
// lib/cli/pack.ts
var import_fs2 = require("fs");
var import_os = require("os");
var import_path = __toESM(require("path"));
// lib/consts.ts
var nextServerConfigRegex = /(?<=conf: )(.*)(?=,)/;
var nextServerConfigRegex13_3 = /(?<=nextConfig = )(.*)/;
// lib/cli/pack.ts
var staticNames = {
nodeFolder: "node_modules",
nextServer: "server.js",
packageJson: "package.json",
dependenciesZip: "dependenciesLayer.zip",
assetsZip: "assetsLayer.zip",
codeZip: "code.zip"
};
var packHandler = async ({ handlerPath, outputFolder, publicFolder, standaloneFolder, commandCwd: commandCwd2 }) => {
validatePublicFolderStructure(publicFolder);
validateFolderExists(standaloneFolder);
const pathToNextOutput = findPathToNestedFile(staticNames.nextServer, standaloneFolder);
const nodeModulesFolderPath = import_path.default.resolve(standaloneFolder, staticNames.nodeFolder);
const depsLambdaFolder = "nodejs/node_modules";
const dependenciesOutputPath = import_path.default.resolve(outputFolder, staticNames.dependenciesZip);
const nestedDependenciesOutputPath = dependenciesOutputPath.includes(pathToNextOutput) ? null : import_path.default.resolve(pathToNextOutput, staticNames.nodeFolder);
const buildIdPath = import_path.default.resolve(commandCwd2, "./.next/BUILD_ID");
const generatedStaticContentPath = import_path.default.resolve(commandCwd2, ".next/static");
const generatedStaticRemapping = "_next/static";
const assetsOutputPath = import_path.default.resolve(outputFolder, staticNames.assetsZip);
const generatedNextServerPath = import_path.default.resolve(pathToNextOutput, staticNames.nextServer);
const packageJsonPath = import_path.default.resolve(standaloneFolder, staticNames.packageJson);
const codeOutputPath = import_path.default.resolve(outputFolder, staticNames.codeZip);
(0, import_fs2.rmSync)(outputFolder, { force: true, recursive: true });
(0, import_fs2.mkdirSync)(outputFolder);
await zipMultipleFoldersOrFiles({
outputName: dependenciesOutputPath,
inputDefinition: [
{
path: nodeModulesFolderPath,
dir: depsLambdaFolder
},
...nestedDependenciesOutputPath ? [
{
path: nestedDependenciesOutputPath,
dir: depsLambdaFolder
}
] : []
]
});
await zipMultipleFoldersOrFiles({
outputName: assetsOutputPath,
inputDefinition: [
{
isFile: true,
name: "BUILD_ID",
path: buildIdPath
},
{
path: publicFolder
},
{
path: generatedStaticContentPath,
dir: generatedStaticRemapping
}
]
});
const tmpFolder = (0, import_os.tmpdir)();
const nextConfig = findObjectInFile(generatedNextServerPath, [nextServerConfigRegex13_3, nextServerConfigRegex]);
const configPath = import_path.default.resolve(tmpFolder, `./config.json_${Math.random()}`);
(0, import_fs2.writeFileSync)(configPath, nextConfig, "utf-8");
await zipMultipleFoldersOrFiles({
outputName: codeOutputPath,
inputDefinition: [
{
isFile: true,
path: packageJsonPath,
name: "package.json"
},
{
isGlob: true,
dot: true,
cwd: pathToNextOutput,
path: "**/*",
ignore: ["**/node_modules/**", "*.zip", "**/package.json"]
},
{
isFile: true,
path: handlerPath,
name: "index.js"
},
{
isFile: true,
path: configPath,
name: "config.json"
}
]
});
console.log("Your NextJS project was succefully prepared for Lambda.");
};
// lib/cli/remove.ts
var cdkExecutable2 = require.resolve("aws-cdk/bin/cdk");
var removeHandler = async ({ appPath, stackName, region, profile }) => {
const cdkRemoveArgs = [`--app "node ${appPath}"`, "--force", "--require-approval never", "--ci"];
if (profile) {
cdkRemoveArgs.push(`--profile ${profile}`);
}
const variables = {
STACK_NAME: stackName,
...region && { AWS_REGION: region }
};
await executeAsyncCmd({
cmd: `${cdkExecutable2} destroy ${cdkRemoveArgs.join(" ")}`,
env: variables
});
};
// lib/cli.ts
var commandCwd = process.cwd();
var program2 = new Command();
program2.name(package_default.name).description(package_default.description).version(package_default.version);
program2.command("pack").description("Package standalone Next12 build into Lambda compatible ZIPs.").option(
"--standaloneFolder <path>",
"Folder including NextJS standalone build. Parental folder should include more folders as well.",
import_path2.default.resolve(commandCwd, ".next/standalone")
).option(
"--publicFolder <path>",
"Folder where public assets are located, typically this folder is located in root of the project.",
import_path2.default.resolve(commandCwd, "./public")
).option(
"--handlerPath <path>",
"Path to custom handler to be used to handle ApiGw events. By default this is provided for you.",
import_path2.default.resolve(import_path2.default.dirname(__filename), "./server-handler/index.js")
).option(
"--outputFolder <path>",
"Path to folder which should be used for outputting bundled ZIP files for your Lambda. It will be cleared before every script run.",
import_path2.default.resolve(commandCwd, "./next.out")
).action(async (options) => {
console.log("Our config is: ", options);
const { standaloneFolder, publicFolder, handlerPath, outputFolder } = options;
wrapProcess(packHandler({ commandCwd, handlerPath, outputFolder, publicFolder, standaloneFolder }));
});
program2.command("deploy").description("Deploy Next application via CDK").option("--stackName <name>", "Name of the stack to be deployed.", "StandaloneNextjsStack-Temporary").option("--appPath <path>", "Absolute path to app.", import_path2.default.resolve(__dirname, "../dist/cdk/app.js")).option("--bootstrap", "Bootstrap CDK stack.", false).option("--region <region>", "AWS region to deploy to.", void 0).option("--lambdaTimeout <sec>", "Set timeout for lambda function handling server requests.", Number, 15).option("--lambdaMemory <mb>", "Set memory for lambda function handling server requests.", Number, 512).option("--imageLambdaTimeout <sec>", "Set timeout for lambda function handling image optimization.", Number, DEFAULT_TIMEOUT).option("--imageLambdaMemory <mb>", "Set memory for lambda function handling image optimization.", Number, DEFAULT_MEMORY).option("--lambdaRuntime <runtime>", "Specify version of NodeJS to use as Lambda's runtime. Options: node14, node16, node18.", "node16").option("--domainNames <domainList>", "Comma-separated list of domains to use. (example: mydomain.com,mydonain.au,other.domain.com)", void 0).option("--customApiDomain <domain>", "Domain to forward the requests to /api routes, by default API routes will be handled by the server lambda.", void 0).option("--redirectFromApex", "Redirect from apex domain to specified address.", false).option("--profile <name>", "AWS profile to use with CDK.", void 0).option("--hotswap", "Hotswap stack to speedup deployment.", false).action(async (options) => {
console.log("Our config is: ", options);
const {
stackName,
appPath,
bootstrap,
region,
lambdaTimeout,
lambdaMemory,
lambdaRuntime,
imageLambdaMemory,
imageLambdaTimeout,
customApiDomain,
redirectFromApex,
domainNames,
hotswap,
profile
} = options;
wrapProcess(
deployHandler({
stackName,
appPath,
bootstrap,
region,
lambdaTimeout,
lambdaMemory,
lambdaRuntime,
imageLambdaMemory,
imageLambdaTimeout,
customApiDomain,
redirectFromApex,
domainNames,
hotswap,
profile
})
);
});
program2.command("remove").description("Remove Next application via CDK").option("--stackName <name>", "Name of the stack to be deployed.", "StandaloneNextjsStack-Temporary").option("--appPath <path>", "Absolute path to app.", import_path2.default.resolve(__dirname, "../dist/cdk/app.js")).option("--region <region>", "AWS region to deploy to.", void 0).option("--profile <name>", "AWS profile to use with CDK", void 0).action(async (options) => {
console.log("Our config is: ", options);
const { stackName, appPath, region, profile } = options;
wrapProcess(removeHandler({ stackName, appPath, region, profile }));
});
program2.parse(process.argv);
/*! Bundled license information:
normalize-path/index.js:
(*!
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*)
archiver/lib/error.js:
(**
* Archiver Core
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
archiver/lib/core.js:
(**
* Archiver Core
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*)
crc-32/crc32.js:
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
zip-stream/index.js:
(**
* ZipStream
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-zip-stream/blob/master/LICENSE}
* @copyright (c) 2014 Chris Talkington, contributors.
*)
archiver/lib/plugins/zip.js:
(**
* ZIP Format Plugin
*
* @module plugins/zip
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*)
archiver/lib/plugins/tar.js:
(**
* TAR Format Plugin
*
* @module plugins/tar
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*)
archiver/lib/plugins/json.js:
(**
* JSON Format Plugin
*
* @module plugins/json
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*)
archiver/index.js:
(**
* Archiver Vending
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*)
*/