aws-delivlib
Version:
A fabulous library for defining continuous pipelines for building, testing and releasing code libraries.
1,424 lines (1,409 loc) • 4.53 MB
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/adm-zip/util/constants.js
var require_constants = __commonJS({
"node_modules/adm-zip/util/constants.js"(exports2, module2) {
module2.exports = {
/* The local file header */
LOCHDR: 30,
// LOC header size
LOCSIG: 67324752,
// "PK\003\004"
LOCVER: 4,
// version needed to extract
LOCFLG: 6,
// general purpose bit flag
LOCHOW: 8,
// compression method
LOCTIM: 10,
// modification time (2 bytes time, 2 bytes date)
LOCCRC: 14,
// uncompressed file crc-32 value
LOCSIZ: 18,
// compressed size
LOCLEN: 22,
// uncompressed size
LOCNAM: 26,
// filename length
LOCEXT: 28,
// extra field length
/* The Data descriptor */
EXTSIG: 134695760,
// "PK\007\008"
EXTHDR: 16,
// EXT header size
EXTCRC: 4,
// uncompressed file crc-32 value
EXTSIZ: 8,
// compressed size
EXTLEN: 12,
// uncompressed size
/* The central directory file header */
CENHDR: 46,
// CEN header size
CENSIG: 33639248,
// "PK\001\002"
CENVEM: 4,
// version made by
CENVER: 6,
// version needed to extract
CENFLG: 8,
// encrypt, decrypt flags
CENHOW: 10,
// compression method
CENTIM: 12,
// modification time (2 bytes time, 2 bytes date)
CENCRC: 16,
// uncompressed file crc-32 value
CENSIZ: 20,
// compressed size
CENLEN: 24,
// uncompressed size
CENNAM: 28,
// filename length
CENEXT: 30,
// extra field length
CENCOM: 32,
// file comment length
CENDSK: 34,
// volume number start
CENATT: 36,
// internal file attributes
CENATX: 38,
// external file attributes (host system dependent)
CENOFF: 42,
// LOC header offset
/* The entries in the end of central directory */
ENDHDR: 22,
// END header size
ENDSIG: 101010256,
// "PK\005\006"
ENDSUB: 8,
// number of entries on this disk
ENDTOT: 10,
// total number of entries
ENDSIZ: 12,
// central directory size in bytes
ENDOFF: 16,
// offset of first CEN header
ENDCOM: 20,
// zip file comment length
END64HDR: 20,
// zip64 END header size
END64SIG: 117853008,
// zip64 Locator signature, "PK\006\007"
END64START: 4,
// number of the disk with the start of the zip64
END64OFF: 8,
// relative offset of the zip64 end of central directory
END64NUMDISKS: 16,
// total number of disks
ZIP64SIG: 101075792,
// zip64 signature, "PK\006\006"
ZIP64HDR: 56,
// zip64 record minimum size
ZIP64LEAD: 12,
// leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
ZIP64SIZE: 4,
// zip64 size of the central directory record
ZIP64VEM: 12,
// zip64 version made by
ZIP64VER: 14,
// zip64 version needed to extract
ZIP64DSK: 16,
// zip64 number of this disk
ZIP64DSKDIR: 20,
// number of the disk with the start of the record directory
ZIP64SUB: 24,
// number of entries on this disk
ZIP64TOT: 32,
// total number of entries
ZIP64SIZB: 40,
// zip64 central directory size in bytes
ZIP64OFF: 48,
// offset of start of central directory with respect to the starting disk number
ZIP64EXTRA: 56,
// extensible data sector
/* Compression methods */
STORED: 0,
// no compression
SHRUNK: 1,
// shrunk
REDUCED1: 2,
// reduced with compression factor 1
REDUCED2: 3,
// reduced with compression factor 2
REDUCED3: 4,
// reduced with compression factor 3
REDUCED4: 5,
// reduced with compression factor 4
IMPLODED: 6,
// imploded
// 7 reserved for Tokenizing compression algorithm
DEFLATED: 8,
// deflated
ENHANCED_DEFLATED: 9,
// enhanced deflated
PKWARE: 10,
// PKWare DCL imploded
// 11 reserved by PKWARE
BZIP2: 12,
// compressed using BZIP2
// 13 reserved by PKWARE
LZMA: 14,
// LZMA
// 15-17 reserved by PKWARE
IBM_TERSE: 18,
// compressed using IBM TERSE
IBM_LZ77: 19,
// IBM LZ77 z
AES_ENCRYPT: 99,
// WinZIP AES encryption method
/* General purpose bit flag */
// values can obtained with expression 2**bitnr
FLG_ENC: 1,
// Bit 0: encrypted file
FLG_COMP1: 2,
// Bit 1, compression option
FLG_COMP2: 4,
// Bit 2, compression option
FLG_DESC: 8,
// Bit 3, data descriptor
FLG_ENH: 16,
// Bit 4, enhanced deflating
FLG_PATCH: 32,
// Bit 5, indicates that the file is compressed patched data.
FLG_STR: 64,
// Bit 6, strong encryption (patented)
// Bits 7-10: Currently unused.
FLG_EFS: 2048,
// Bit 11: Language encoding flag (EFS)
// Bit 12: Reserved by PKWARE for enhanced compression.
// Bit 13: encrypted the Central Directory (patented).
// Bits 14-15: Reserved by PKWARE.
FLG_MSK: 4096,
// mask header values
/* Load type */
FILE: 2,
BUFFER: 1,
NONE: 0,
/* 4.5 Extensible data fields */
EF_ID: 0,
EF_SIZE: 2,
/* Header IDs */
ID_ZIP64: 1,
ID_AVINFO: 7,
ID_PFS: 8,
ID_OS2: 9,
ID_NTFS: 10,
ID_OPENVMS: 12,
ID_UNIX: 13,
ID_FORK: 14,
ID_PATCH: 15,
ID_X509_PKCS7: 20,
ID_X509_CERTID_F: 21,
ID_X509_CERTID_C: 22,
ID_STRONGENC: 23,
ID_RECORD_MGT: 24,
ID_X509_PKCS7_RL: 25,
ID_IBM1: 101,
ID_IBM2: 102,
ID_POSZIP: 18064,
EF_ZIP64_OR_32: 4294967295,
EF_ZIP64_OR_16: 65535,
EF_ZIP64_SUNCOMP: 0,
EF_ZIP64_SCOMP: 8,
EF_ZIP64_RHO: 16,
EF_ZIP64_DSN: 24
};
}
});
// node_modules/adm-zip/util/errors.js
var require_errors = __commonJS({
"node_modules/adm-zip/util/errors.js"(exports2) {
var errors = {
/* Header error messages */
INVALID_LOC: "Invalid LOC header (bad signature)",
INVALID_CEN: "Invalid CEN header (bad signature)",
INVALID_END: "Invalid END header (bad signature)",
/* Descriptor */
DESCRIPTOR_NOT_EXIST: "No descriptor present",
DESCRIPTOR_UNKNOWN: "Unknown descriptor format",
DESCRIPTOR_FAULTY: "Descriptor data is malformed",
/* ZipEntry error messages*/
NO_DATA: "Nothing to decompress",
BAD_CRC: "CRC32 checksum failed {0}",
FILE_IN_THE_WAY: "There is a file in the way: {0}",
UNKNOWN_METHOD: "Invalid/unsupported compression method",
/* Inflater error messages */
AVAIL_DATA: "inflate::Available inflate data did not terminate",
INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
/* ADM-ZIP error messages */
CANT_EXTRACT_FILE: "Could not extract the file",
CANT_OVERRIDE: "Target file already exists",
DISK_ENTRY_TOO_LARGE: "Number of disk entries is too large",
NO_ZIP: "No zip file was loaded",
NO_ENTRY: "Entry doesn't exist",
DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
FILE_NOT_FOUND: 'File not found: "{0}"',
NOT_IMPLEMENTED: "Not implemented",
INVALID_FILENAME: "Invalid filename",
INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
INVALID_PASS_PARAM: "Incompatible password parameter",
WRONG_PASSWORD: "Wrong Password",
/* ADM-ZIP */
COMMENT_TOO_LONG: "Comment is too long",
// Comment can be max 65535 bytes long (NOTE: some non-US characters may take more space)
EXTRA_FIELD_PARSE_ERROR: "Extra field parsing error"
};
function E2(message) {
return function(...args) {
if (args.length) {
message = message.replace(/\{(\d)\}/g, (_2, n3) => args[n3] || "");
}
return new Error("ADM-ZIP: " + message);
};
}
for (const msg of Object.keys(errors)) {
exports2[msg] = E2(errors[msg]);
}
}
});
// node_modules/adm-zip/util/utils.js
var require_utils = __commonJS({
"node_modules/adm-zip/util/utils.js"(exports2, module2) {
var fsystem = require("fs");
var pth = require("path");
var Constants = require_constants();
var Errors = require_errors();
var isWin = typeof process === "object" && "win32" === process.platform;
var is_Obj = (obj) => typeof obj === "object" && obj !== null;
var crcTable = new Uint32Array(256).map((t3, c3) => {
for (let k3 = 0; k3 < 8; k3++) {
if ((c3 & 1) !== 0) {
c3 = 3988292384 ^ c3 >>> 1;
} else {
c3 >>>= 1;
}
}
return c3 >>> 0;
});
function Utils(opts) {
this.sep = pth.sep;
this.fs = fsystem;
if (is_Obj(opts)) {
if (is_Obj(opts.fs) && typeof opts.fs.statSync === "function") {
this.fs = opts.fs;
}
}
}
module2.exports = Utils;
Utils.prototype.makeDir = function(folder) {
const self = this;
function mkdirSync2(fpath) {
let resolvedPath3 = fpath.split(self.sep)[0];
fpath.split(self.sep).forEach(function(name) {
if (!name || name.substr(-1, 1) === ":") return;
resolvedPath3 += self.sep + name;
var stat;
try {
stat = self.fs.statSync(resolvedPath3);
} catch (e3) {
self.fs.mkdirSync(resolvedPath3);
}
if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY(`"${resolvedPath3}"`);
});
}
mkdirSync2(folder);
};
Utils.prototype.writeFileTo = function(path3, content, overwrite, attr) {
const self = this;
if (self.fs.existsSync(path3)) {
if (!overwrite) return false;
var stat = self.fs.statSync(path3);
if (stat.isDirectory()) {
return false;
}
}
var folder = pth.dirname(path3);
if (!self.fs.existsSync(folder)) {
self.makeDir(folder);
}
var fd;
try {
fd = self.fs.openSync(path3, "w", 438);
} catch (e3) {
self.fs.chmodSync(path3, 438);
fd = self.fs.openSync(path3, "w", 438);
}
if (fd) {
try {
self.fs.writeSync(fd, content, 0, content.length, 0);
} finally {
self.fs.closeSync(fd);
}
}
self.fs.chmodSync(path3, attr || 438);
return true;
};
Utils.prototype.writeFileToAsync = function(path3, content, overwrite, attr, callback) {
if (typeof attr === "function") {
callback = attr;
attr = void 0;
}
const self = this;
self.fs.exists(path3, function(exist) {
if (exist && !overwrite) return callback(false);
self.fs.stat(path3, function(err, stat) {
if (exist && stat.isDirectory()) {
return callback(false);
}
var folder = pth.dirname(path3);
self.fs.exists(folder, function(exists) {
if (!exists) self.makeDir(folder);
self.fs.open(path3, "w", 438, function(err2, fd) {
if (err2) {
self.fs.chmod(path3, 438, function() {
self.fs.open(path3, "w", 438, function(err3, fd2) {
self.fs.write(fd2, content, 0, content.length, 0, function() {
self.fs.close(fd2, function() {
self.fs.chmod(path3, attr || 438, function() {
callback(true);
});
});
});
});
});
} else if (fd) {
self.fs.write(fd, content, 0, content.length, 0, function() {
self.fs.close(fd, function() {
self.fs.chmod(path3, attr || 438, function() {
callback(true);
});
});
});
} else {
self.fs.chmod(path3, attr || 438, function() {
callback(true);
});
}
});
});
});
});
};
Utils.prototype.findFiles = function(path3) {
const self = this;
function findSync(dir, pattern, recursive) {
if (typeof pattern === "boolean") {
recursive = pattern;
pattern = void 0;
}
let files = [];
self.fs.readdirSync(dir).forEach(function(file) {
const path4 = pth.join(dir, file);
const stat = self.fs.statSync(path4);
if (!pattern || pattern.test(path4)) {
files.push(pth.normalize(path4) + (stat.isDirectory() ? self.sep : ""));
}
if (stat.isDirectory() && recursive) files = files.concat(findSync(path4, pattern, recursive));
});
return files;
}
return findSync(path3, void 0, true);
};
Utils.prototype.findFilesAsync = function(dir, cb) {
const self = this;
let results = [];
self.fs.readdir(dir, function(err, list) {
if (err) return cb(err);
let list_length = list.length;
if (!list_length) return cb(null, results);
list.forEach(function(file) {
file = pth.join(dir, file);
self.fs.stat(file, function(err2, stat) {
if (err2) return cb(err2);
if (stat) {
results.push(pth.normalize(file) + (stat.isDirectory() ? self.sep : ""));
if (stat.isDirectory()) {
self.findFilesAsync(file, function(err3, res) {
if (err3) return cb(err3);
results = results.concat(res);
if (!--list_length) cb(null, results);
});
} else {
if (!--list_length) cb(null, results);
}
}
});
});
});
};
Utils.prototype.getAttributes = function() {
};
Utils.prototype.setAttributes = function() {
};
Utils.crc32update = function(crc, byte) {
return crcTable[(crc ^ byte) & 255] ^ crc >>> 8;
};
Utils.crc32 = function(buf) {
if (typeof buf === "string") {
buf = Buffer.from(buf, "utf8");
}
let len = buf.length;
let crc = ~0;
for (let off = 0; off < len; ) crc = Utils.crc32update(crc, buf[off++]);
return ~crc >>> 0;
};
Utils.methodToString = function(method) {
switch (method) {
case Constants.STORED:
return "STORED (" + method + ")";
case Constants.DEFLATED:
return "DEFLATED (" + method + ")";
default:
return "UNSUPPORTED (" + method + ")";
}
};
Utils.canonical = function(path3) {
if (!path3) return "";
const safeSuffix = pth.posix.normalize("/" + path3.split("\\").join("/"));
return pth.join(".", safeSuffix);
};
Utils.zipnamefix = function(path3) {
if (!path3) return "";
const safeSuffix = pth.posix.normalize("/" + path3.split("\\").join("/"));
return pth.posix.join(".", safeSuffix);
};
Utils.findLast = function(arr, callback) {
if (!Array.isArray(arr)) throw new TypeError("arr is not array");
const len = arr.length >>> 0;
for (let i3 = len - 1; i3 >= 0; i3--) {
if (callback(arr[i3], i3, arr)) {
return arr[i3];
}
}
return void 0;
};
Utils.sanitize = function(prefix, name) {
prefix = pth.resolve(pth.normalize(prefix));
var parts = name.split("/");
for (var i3 = 0, l3 = parts.length; i3 < l3; i3++) {
var path3 = pth.normalize(pth.join(prefix, parts.slice(i3, l3).join(pth.sep)));
if (path3.indexOf(prefix) === 0) {
return path3;
}
}
return pth.normalize(pth.join(prefix, pth.basename(name)));
};
Utils.toBuffer = function toBuffer(input, encoder) {
if (Buffer.isBuffer(input)) {
return input;
} else if (input instanceof Uint8Array) {
return Buffer.from(input);
} else {
return typeof input === "string" ? encoder(input) : Buffer.alloc(0);
}
};
Utils.readBigUInt64LE = function(buffer, index) {
var slice = Buffer.from(buffer.slice(index, index + 8));
slice.swap64();
return parseInt(`0x${slice.toString("hex")}`);
};
Utils.fromDOS2Date = function(val) {
return new Date((val >> 25 & 127) + 1980, Math.max((val >> 21 & 15) - 1, 0), Math.max(val >> 16 & 31, 1), val >> 11 & 31, val >> 5 & 63, (val & 31) << 1);
};
Utils.fromDate2DOS = function(val) {
let date = 0;
let time = 0;
if (val.getFullYear() > 1979) {
date = (val.getFullYear() - 1980 & 127) << 9 | val.getMonth() + 1 << 5 | val.getDate();
time = val.getHours() << 11 | val.getMinutes() << 5 | val.getSeconds() >> 1;
}
return date << 16 | time;
};
Utils.isWin = isWin;
Utils.crcTable = crcTable;
}
});
// node_modules/adm-zip/util/fattr.js
var require_fattr = __commonJS({
"node_modules/adm-zip/util/fattr.js"(exports2, module2) {
var pth = require("path");
module2.exports = function(path3, { fs: fs3 }) {
var _path = path3 || "", _obj = newAttr(), _stat = null;
function newAttr() {
return {
directory: false,
readonly: false,
hidden: false,
executable: false,
mtime: 0,
atime: 0
};
}
if (_path && fs3.existsSync(_path)) {
_stat = fs3.statSync(_path);
_obj.directory = _stat.isDirectory();
_obj.mtime = _stat.mtime;
_obj.atime = _stat.atime;
_obj.executable = (73 & _stat.mode) !== 0;
_obj.readonly = (128 & _stat.mode) === 0;
_obj.hidden = pth.basename(_path)[0] === ".";
} else {
console.warn("Invalid path: " + _path);
}
return {
get directory() {
return _obj.directory;
},
get readOnly() {
return _obj.readonly;
},
get hidden() {
return _obj.hidden;
},
get mtime() {
return _obj.mtime;
},
get atime() {
return _obj.atime;
},
get executable() {
return _obj.executable;
},
decodeAttributes: function() {
},
encodeAttributes: function() {
},
toJSON: function() {
return {
path: _path,
isDirectory: _obj.directory,
isReadOnly: _obj.readonly,
isHidden: _obj.hidden,
isExecutable: _obj.executable,
mTime: _obj.mtime,
aTime: _obj.atime
};
},
toString: function() {
return JSON.stringify(this.toJSON(), null, " ");
}
};
};
}
});
// node_modules/adm-zip/util/decoder.js
var require_decoder = __commonJS({
"node_modules/adm-zip/util/decoder.js"(exports2, module2) {
module2.exports = {
efs: true,
encode: (data) => Buffer.from(data, "utf8"),
decode: (data) => data.toString("utf8")
};
}
});
// node_modules/adm-zip/util/index.js
var require_util = __commonJS({
"node_modules/adm-zip/util/index.js"(exports2, module2) {
module2.exports = require_utils();
module2.exports.Constants = require_constants();
module2.exports.Errors = require_errors();
module2.exports.FileAttr = require_fattr();
module2.exports.decoder = require_decoder();
}
});
// node_modules/adm-zip/headers/entryHeader.js
var require_entryHeader = __commonJS({
"node_modules/adm-zip/headers/entryHeader.js"(exports2, module2) {
var Utils = require_util();
var Constants = Utils.Constants;
module2.exports = function() {
var _verMade = 20, _version = 10, _flags = 0, _method = 0, _time = 0, _crc = 0, _compressedSize = 0, _size = 0, _fnameLen = 0, _extraLen = 0, _comLen = 0, _diskStart = 0, _inattr = 0, _attr = 0, _offset = 0;
_verMade |= Utils.isWin ? 2560 : 768;
_flags |= Constants.FLG_EFS;
const _localHeader = {
extraLen: 0
};
const uint32 = (val) => Math.max(0, val) >>> 0;
const uint16 = (val) => Math.max(0, val) & 65535;
const uint8 = (val) => Math.max(0, val) & 255;
_time = Utils.fromDate2DOS(/* @__PURE__ */ new Date());
return {
get made() {
return _verMade;
},
set made(val) {
_verMade = val;
},
get version() {
return _version;
},
set version(val) {
_version = val;
},
get flags() {
return _flags;
},
set flags(val) {
_flags = val;
},
get flags_efs() {
return (_flags & Constants.FLG_EFS) > 0;
},
set flags_efs(val) {
if (val) {
_flags |= Constants.FLG_EFS;
} else {
_flags &= ~Constants.FLG_EFS;
}
},
get flags_desc() {
return (_flags & Constants.FLG_DESC) > 0;
},
set flags_desc(val) {
if (val) {
_flags |= Constants.FLG_DESC;
} else {
_flags &= ~Constants.FLG_DESC;
}
},
get method() {
return _method;
},
set method(val) {
switch (val) {
case Constants.STORED:
this.version = 10;
case Constants.DEFLATED:
default:
this.version = 20;
}
_method = val;
},
get time() {
return Utils.fromDOS2Date(this.timeval);
},
set time(val) {
this.timeval = Utils.fromDate2DOS(val);
},
get timeval() {
return _time;
},
set timeval(val) {
_time = uint32(val);
},
get timeHighByte() {
return uint8(_time >>> 8);
},
get crc() {
return _crc;
},
set crc(val) {
_crc = uint32(val);
},
get compressedSize() {
return _compressedSize;
},
set compressedSize(val) {
_compressedSize = uint32(val);
},
get size() {
return _size;
},
set size(val) {
_size = uint32(val);
},
get fileNameLength() {
return _fnameLen;
},
set fileNameLength(val) {
_fnameLen = val;
},
get extraLength() {
return _extraLen;
},
set extraLength(val) {
_extraLen = val;
},
get extraLocalLength() {
return _localHeader.extraLen;
},
set extraLocalLength(val) {
_localHeader.extraLen = val;
},
get commentLength() {
return _comLen;
},
set commentLength(val) {
_comLen = val;
},
get diskNumStart() {
return _diskStart;
},
set diskNumStart(val) {
_diskStart = uint32(val);
},
get inAttr() {
return _inattr;
},
set inAttr(val) {
_inattr = uint32(val);
},
get attr() {
return _attr;
},
set attr(val) {
_attr = uint32(val);
},
// get Unix file permissions
get fileAttr() {
return (_attr || 0) >> 16 & 4095;
},
get offset() {
return _offset;
},
set offset(val) {
_offset = uint32(val);
},
get encrypted() {
return (_flags & Constants.FLG_ENC) === Constants.FLG_ENC;
},
get centralHeaderSize() {
return Constants.CENHDR + _fnameLen + _extraLen + _comLen;
},
get realDataOffset() {
return _offset + Constants.LOCHDR + _localHeader.fnameLen + _localHeader.extraLen;
},
get localHeader() {
return _localHeader;
},
loadLocalHeaderFromBinary: function(input) {
var data = input.slice(_offset, _offset + Constants.LOCHDR);
if (data.readUInt32LE(0) !== Constants.LOCSIG) {
throw Utils.Errors.INVALID_LOC();
}
_localHeader.version = data.readUInt16LE(Constants.LOCVER);
_localHeader.flags = data.readUInt16LE(Constants.LOCFLG);
_localHeader.method = data.readUInt16LE(Constants.LOCHOW);
_localHeader.time = data.readUInt32LE(Constants.LOCTIM);
_localHeader.crc = data.readUInt32LE(Constants.LOCCRC);
_localHeader.compressedSize = data.readUInt32LE(Constants.LOCSIZ);
_localHeader.size = data.readUInt32LE(Constants.LOCLEN);
_localHeader.fnameLen = data.readUInt16LE(Constants.LOCNAM);
_localHeader.extraLen = data.readUInt16LE(Constants.LOCEXT);
const extraStart = _offset + Constants.LOCHDR + _localHeader.fnameLen;
const extraEnd = extraStart + _localHeader.extraLen;
return input.slice(extraStart, extraEnd);
},
loadFromBinary: function(data) {
if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) {
throw Utils.Errors.INVALID_CEN();
}
_verMade = data.readUInt16LE(Constants.CENVEM);
_version = data.readUInt16LE(Constants.CENVER);
_flags = data.readUInt16LE(Constants.CENFLG);
_method = data.readUInt16LE(Constants.CENHOW);
_time = data.readUInt32LE(Constants.CENTIM);
_crc = data.readUInt32LE(Constants.CENCRC);
_compressedSize = data.readUInt32LE(Constants.CENSIZ);
_size = data.readUInt32LE(Constants.CENLEN);
_fnameLen = data.readUInt16LE(Constants.CENNAM);
_extraLen = data.readUInt16LE(Constants.CENEXT);
_comLen = data.readUInt16LE(Constants.CENCOM);
_diskStart = data.readUInt16LE(Constants.CENDSK);
_inattr = data.readUInt16LE(Constants.CENATT);
_attr = data.readUInt32LE(Constants.CENATX);
_offset = data.readUInt32LE(Constants.CENOFF);
},
localHeaderToBinary: function() {
var data = Buffer.alloc(Constants.LOCHDR);
data.writeUInt32LE(Constants.LOCSIG, 0);
data.writeUInt16LE(_version, Constants.LOCVER);
data.writeUInt16LE(_flags, Constants.LOCFLG);
data.writeUInt16LE(_method, Constants.LOCHOW);
data.writeUInt32LE(_time, Constants.LOCTIM);
data.writeUInt32LE(_crc, Constants.LOCCRC);
data.writeUInt32LE(_compressedSize, Constants.LOCSIZ);
data.writeUInt32LE(_size, Constants.LOCLEN);
data.writeUInt16LE(_fnameLen, Constants.LOCNAM);
data.writeUInt16LE(_localHeader.extraLen, Constants.LOCEXT);
return data;
},
centralHeaderToBinary: function() {
var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen);
data.writeUInt32LE(Constants.CENSIG, 0);
data.writeUInt16LE(_verMade, Constants.CENVEM);
data.writeUInt16LE(_version, Constants.CENVER);
data.writeUInt16LE(_flags, Constants.CENFLG);
data.writeUInt16LE(_method, Constants.CENHOW);
data.writeUInt32LE(_time, Constants.CENTIM);
data.writeUInt32LE(_crc, Constants.CENCRC);
data.writeUInt32LE(_compressedSize, Constants.CENSIZ);
data.writeUInt32LE(_size, Constants.CENLEN);
data.writeUInt16LE(_fnameLen, Constants.CENNAM);
data.writeUInt16LE(_extraLen, Constants.CENEXT);
data.writeUInt16LE(_comLen, Constants.CENCOM);
data.writeUInt16LE(_diskStart, Constants.CENDSK);
data.writeUInt16LE(_inattr, Constants.CENATT);
data.writeUInt32LE(_attr, Constants.CENATX);
data.writeUInt32LE(_offset, Constants.CENOFF);
return data;
},
toJSON: function() {
const bytes = function(nr) {
return nr + " bytes";
};
return {
made: _verMade,
version: _version,
flags: _flags,
method: Utils.methodToString(_method),
time: this.time,
crc: "0x" + _crc.toString(16).toUpperCase(),
compressedSize: bytes(_compressedSize),
size: bytes(_size),
fileNameLength: bytes(_fnameLen),
extraLength: bytes(_extraLen),
commentLength: bytes(_comLen),
diskNumStart: _diskStart,
inAttr: _inattr,
attr: _attr,
offset: _offset,
centralHeaderSize: bytes(Constants.CENHDR + _fnameLen + _extraLen + _comLen)
};
},
toString: function() {
return JSON.stringify(this.toJSON(), null, " ");
}
};
};
}
});
// node_modules/adm-zip/headers/mainHeader.js
var require_mainHeader = __commonJS({
"node_modules/adm-zip/headers/mainHeader.js"(exports2, module2) {
var Utils = require_util();
var Constants = Utils.Constants;
module2.exports = function() {
var _volumeEntries = 0, _totalEntries = 0, _size = 0, _offset = 0, _commentLength = 0;
return {
get diskEntries() {
return _volumeEntries;
},
set diskEntries(val) {
_volumeEntries = _totalEntries = val;
},
get totalEntries() {
return _totalEntries;
},
set totalEntries(val) {
_totalEntries = _volumeEntries = val;
},
get size() {
return _size;
},
set size(val) {
_size = val;
},
get offset() {
return _offset;
},
set offset(val) {
_offset = val;
},
get commentLength() {
return _commentLength;
},
set commentLength(val) {
_commentLength = val;
},
get mainHeaderSize() {
return Constants.ENDHDR + _commentLength;
},
loadFromBinary: function(data) {
if ((data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) && (data.length < Constants.ZIP64HDR || data.readUInt32LE(0) !== Constants.ZIP64SIG)) {
throw Utils.Errors.INVALID_END();
}
if (data.readUInt32LE(0) === Constants.ENDSIG) {
_volumeEntries = data.readUInt16LE(Constants.ENDSUB);
_totalEntries = data.readUInt16LE(Constants.ENDTOT);
_size = data.readUInt32LE(Constants.ENDSIZ);
_offset = data.readUInt32LE(Constants.ENDOFF);
_commentLength = data.readUInt16LE(Constants.ENDCOM);
} else {
_volumeEntries = Utils.readBigUInt64LE(data, Constants.ZIP64SUB);
_totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT);
_size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZE);
_offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF);
_commentLength = 0;
}
},
toBinary: function() {
var b3 = Buffer.alloc(Constants.ENDHDR + _commentLength);
b3.writeUInt32LE(Constants.ENDSIG, 0);
b3.writeUInt32LE(0, 4);
b3.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
b3.writeUInt16LE(_totalEntries, Constants.ENDTOT);
b3.writeUInt32LE(_size, Constants.ENDSIZ);
b3.writeUInt32LE(_offset, Constants.ENDOFF);
b3.writeUInt16LE(_commentLength, Constants.ENDCOM);
b3.fill(" ", Constants.ENDHDR);
return b3;
},
toJSON: function() {
const offset = function(nr, len) {
let offs = nr.toString(16).toUpperCase();
while (offs.length < len) offs = "0" + offs;
return "0x" + offs;
};
return {
diskEntries: _volumeEntries,
totalEntries: _totalEntries,
size: _size + " bytes",
offset: offset(_offset, 4),
commentLength: _commentLength
};
},
toString: function() {
return JSON.stringify(this.toJSON(), null, " ");
}
};
};
}
});
// node_modules/adm-zip/headers/index.js
var require_headers = __commonJS({
"node_modules/adm-zip/headers/index.js"(exports2) {
exports2.EntryHeader = require_entryHeader();
exports2.MainHeader = require_mainHeader();
}
});
// node_modules/adm-zip/methods/deflater.js
var require_deflater = __commonJS({
"node_modules/adm-zip/methods/deflater.js"(exports2, module2) {
module2.exports = function(inbuf) {
var zlib = require("zlib");
var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };
return {
deflate: function() {
return zlib.deflateRawSync(inbuf, opts);
},
deflateAsync: function(callback) {
var tmp = zlib.createDeflateRaw(opts), parts = [], total = 0;
tmp.on("data", function(data) {
parts.push(data);
total += data.length;
});
tmp.on("end", function() {
var buf = Buffer.alloc(total), written = 0;
buf.fill(0);
for (var i3 = 0; i3 < parts.length; i3++) {
var part = parts[i3];
part.copy(buf, written);
written += part.length;
}
callback && callback(buf);
});
tmp.end(inbuf);
}
};
};
}
});
// node_modules/adm-zip/methods/inflater.js
var require_inflater = __commonJS({
"node_modules/adm-zip/methods/inflater.js"(exports2, module2) {
var version2 = +(process.versions ? process.versions.node : "").split(".")[0] || 0;
module2.exports = function(inbuf, expectedLength) {
var zlib = require("zlib");
const option = version2 >= 15 && expectedLength > 0 ? { maxOutputLength: expectedLength } : {};
return {
inflate: function() {
return zlib.inflateRawSync(inbuf, option);
},
inflateAsync: function(callback) {
var tmp = zlib.createInflateRaw(option), parts = [], total = 0;
tmp.on("data", function(data) {
parts.push(data);
total += data.length;
});
tmp.on("end", function() {
var buf = Buffer.alloc(total), written = 0;
buf.fill(0);
for (var i3 = 0; i3 < parts.length; i3++) {
var part = parts[i3];
part.copy(buf, written);
written += part.length;
}
callback && callback(buf);
});
tmp.end(inbuf);
}
};
};
}
});
// node_modules/adm-zip/methods/zipcrypto.js
var require_zipcrypto = __commonJS({
"node_modules/adm-zip/methods/zipcrypto.js"(exports2, module2) {
"use strict";
var { randomFillSync } = require("crypto");
var Errors = require_errors();
var crctable = new Uint32Array(256).map((t3, crc) => {
for (let j3 = 0; j3 < 8; j3++) {
if (0 !== (crc & 1)) {
crc = crc >>> 1 ^ 3988292384;
} else {
crc >>>= 1;
}
}
return crc >>> 0;
});
var uMul = (a3, b3) => Math.imul(a3, b3) >>> 0;
var crc32update = (pCrc32, bval) => {
return crctable[(pCrc32 ^ bval) & 255] ^ pCrc32 >>> 8;
};
var genSalt = () => {
if ("function" === typeof randomFillSync) {
return randomFillSync(Buffer.alloc(12));
} else {
return genSalt.node();
}
};
genSalt.node = () => {
const salt = Buffer.alloc(12);
const len = salt.length;
for (let i3 = 0; i3 < len; i3++) salt[i3] = Math.random() * 256 & 255;
return salt;
};
var config = {
genSalt
};
function Initkeys(pw) {
const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw);
this.keys = new Uint32Array([305419896, 591751049, 878082192]);
for (let i3 = 0; i3 < pass.length; i3++) {
this.updateKeys(pass[i3]);
}
}
Initkeys.prototype.updateKeys = function(byteValue) {
const keys = this.keys;
keys[0] = crc32update(keys[0], byteValue);
keys[1] += keys[0] & 255;
keys[1] = uMul(keys[1], 134775813) + 1;
keys[2] = crc32update(keys[2], keys[1] >>> 24);
return byteValue;
};
Initkeys.prototype.next = function() {
const k3 = (this.keys[2] | 2) >>> 0;
return uMul(k3, k3 ^ 1) >> 8 & 255;
};
function make_decrypter(pwd) {
const keys = new Initkeys(pwd);
return function(data) {
const result = Buffer.alloc(data.length);
let pos = 0;
for (let c3 of data) {
result[pos++] = keys.updateKeys(c3 ^ keys.next());
}
return result;
};
}
function make_encrypter(pwd) {
const keys = new Initkeys(pwd);
return function(data, result, pos = 0) {
if (!result) result = Buffer.alloc(data.length);
for (let c3 of data) {
const k3 = keys.next();
result[pos++] = c3 ^ k3;
keys.updateKeys(c3);
}
return result;
};
}
function decrypt(data, header, pwd) {
if (!data || !Buffer.isBuffer(data) || data.length < 12) {
return Buffer.alloc(0);
}
const decrypter = make_decrypter(pwd);
const salt = decrypter(data.slice(0, 12));
const verifyByte = (header.flags & 8) === 8 ? header.timeHighByte : header.crc >>> 24;
if (salt[11] !== verifyByte) {
throw Errors.WRONG_PASSWORD();
}
return decrypter(data.slice(12));
}
function _salter(data) {
if (Buffer.isBuffer(data) && data.length >= 12) {
config.genSalt = function() {
return data.slice(0, 12);
};
} else if (data === "node") {
config.genSalt = genSalt.node;
} else {
config.genSalt = genSalt;
}
}
function encrypt(data, header, pwd, oldlike = false) {
if (data == null) data = Buffer.alloc(0);
if (!Buffer.isBuffer(data)) data = Buffer.from(data.toString());
const encrypter = make_encrypter(pwd);
const salt = config.genSalt();
salt[11] = header.crc >>> 24 & 255;
if (oldlike) salt[10] = header.crc >>> 16 & 255;
const result = Buffer.alloc(data.length + 12);
encrypter(salt, result);
return encrypter(data, result, 12);
}
module2.exports = { decrypt, encrypt, _salter };
}
});
// node_modules/adm-zip/methods/index.js
var require_methods = __commonJS({
"node_modules/adm-zip/methods/index.js"(exports2) {
exports2.Deflater = require_deflater();
exports2.Inflater = require_inflater();
exports2.ZipCrypto = require_zipcrypto();
}
});
// node_modules/adm-zip/zipEntry.js
var require_zipEntry = __commonJS({
"node_modules/adm-zip/zipEntry.js"(exports2, module2) {
var Utils = require_util();
var Headers2 = require_headers();
var Constants = Utils.Constants;
var Methods = require_methods();
module2.exports = function(options, input) {
var _centralHeader = new Headers2.EntryHeader(), _entryName = Buffer.alloc(0), _comment = Buffer.alloc(0), _isDirectory = false, uncompressedData = null, _extra = Buffer.alloc(0), _extralocal = Buffer.alloc(0), _efs = true;
const opts = options;
const decoder = typeof opts.decoder === "object" ? opts.decoder : Utils.decoder;
_efs = decoder.hasOwnProperty("efs") ? decoder.efs : false;
function getCompressedDataFromZip() {
if (!input || !(input instanceof Uint8Array)) {
return Buffer.alloc(0);
}
_extralocal = _centralHeader.loadLocalHeaderFromBinary(input);
return input.slice(_centralHeader.realDataOffset, _centralHeader.realDataOffset + _centralHeader.compressedSize);
}
function crc32OK(data) {
if (!_centralHeader.flags_desc) {
if (Utils.crc32(data) !== _centralHeader.localHeader.crc) {
return false;
}
} else {
const descriptor = {};
const dataEndOffset = _centralHeader.realDataOffset + _centralHeader.compressedSize;
if (input.readUInt32LE(dataEndOffset) == Constants.LOCSIG || input.readUInt32LE(dataEndOffset) == Constants.CENSIG) {
throw Utils.Errors.DESCRIPTOR_NOT_EXIST();
}
if (input.readUInt32LE(dataEndOffset) == Constants.EXTSIG) {
descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC);
descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ);
descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN);
} else if (input.readUInt16LE(dataEndOffset + 12) === 19280) {
descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC - 4);
descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ - 4);
descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN - 4);
} else {
throw Utils.Errors.DESCRIPTOR_UNKNOWN();
}
if (descriptor.compressedSize !== _centralHeader.compressedSize || descriptor.size !== _centralHeader.size || descriptor.crc !== _centralHeader.crc) {
throw Utils.Errors.DESCRIPTOR_FAULTY();
}
if (Utils.crc32(data) !== descriptor.crc) {
return false;
}
}
return true;
}
function decompress(async, callback, pass) {
if (typeof callback === "undefined" && typeof async === "string") {
pass = async;
async = void 0;
}
if (_isDirectory) {
if (async && callback) {
callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR());
}
return Buffer.alloc(0);
}
var compressedData = getCompressedDataFromZip();
if (compressedData.length === 0) {
if (async && callback) callback(compressedData);
return compressedData;
}
if (_centralHeader.encrypted) {
if ("string" !== typeof pass && !Buffer.isBuffer(pass)) {
throw Utils.Errors.INVALID_PASS_PARAM();
}
compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass);
}
var data = Buffer.alloc(_centralHeader.size);
switch (_centralHeader.method) {
case Utils.Constants.STORED:
compressedData.copy(data);
if (!crc32OK(data)) {
if (async && callback) callback(data, Utils.Errors.BAD_CRC());
throw Utils.Errors.BAD_CRC();
} else {
if (async && callback) callback(data);
return data;
}
case Utils.Constants.DEFLATED:
var inflater = new Methods.Inflater(compressedData, _centralHeader.size);
if (!async) {
const result = inflater.inflate(data);
result.copy(data, 0);
if (!crc32OK(data)) {
throw Utils.Errors.BAD_CRC(`"${decoder.decode(_entryName)}"`);
}
return data;
} else {
inflater.inflateAsync(function(result) {
result.copy(result, 0);
if (callback) {
if (!crc32OK(result)) {
callback(result, Utils.Errors.BAD_CRC());
} else {
callback(result);
}
}
});
}
break;
default:
if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD());
throw Utils.Errors.UNKNOWN_METHOD();
}
}
function compress2(async, callback) {
if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) {
if (async && callback) callback(getCompressedDataFromZip());
return getCompressedDataFromZip();
}
if (uncompressedData.length && !_isDirectory) {
var compressedData;
switch (_centralHeader.method) {
case Utils.Constants.STORED:
_centralHeader.compressedSize = _centralHeader.size;
compressedData = Buffer.alloc(uncompressedData.length);
uncompressedData.copy(compressedData);
if (async && callback) callback(compressedData);
return compressedData;
default:
case Utils.Constants.DEFLATED:
var deflater = new Methods.Deflater(uncompressedData);
if (!async) {
var deflated = deflater.deflate();
_centralHeader.compressedSize = deflated.length;
return deflated;
} else {
deflater.deflateAsync(function(data) {
compressedData = Buffer.alloc(data.length);
_centralHeader.compressedSize = data.length;
data.copy(compressedData);
callback && callback(compressedData);
});
}
deflater = null;
break;
}
} else if (async && callback) {
callback(Buffer.alloc(0));
} else {
return Buffer.alloc(0);
}
}
function readUInt64LE(buffer, offset) {
return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset);
}
function parseExtra(data) {
try {
var offset = 0;
var signature, size, part;
while (offset + 4 < data.length) {
signature = data.readUInt16LE(offset);
offset += 2;
size = data.readUInt16LE(offset);
offset += 2;
part = data.slice(offset, offset + size);
offset += size;
if (Constants.ID_ZIP64 === signature) {
parseZip64ExtendedInformation(part);
}
}
} catch (error) {
throw Utils.Errors.EXTRA_FIELD_PARSE_ERROR();
}
}
function parseZip64ExtendedInformation(data) {
var size, compressedSize, offset, diskNumStart;
if (data.length >= Constants.EF_ZIP64_SCOMP) {
size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP);
if (_centralHeader.size === Constants.EF_ZIP64_OR_32) {
_centralHeader.size = size;
}
}
if (data.length >= Constants.EF_ZIP64_RHO) {
compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP);
if (_centralHeader.compressedSize === Constants.EF_ZIP64_OR_32) {
_centralHeader.compressedSize = compressedSize;
}
}
if (data.length >= Constants.EF_ZIP64_DSN) {
offset = readUInt64LE(data, Constants.EF_ZIP64_RHO);
if (_centralHeader.offset === Constants.EF_ZIP64_OR_32) {
_centralHeader.offset = offset;
}
}
if (data.length >= Constants.EF_ZIP64_DSN + 4) {
diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN);
if (_centralHeader.diskNumStart === Constants.EF_ZIP64_OR_16) {
_centralHeader.diskNumStart = diskNumStart;
}
}
}
return {