Skip to content

Commit

Permalink
update built scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Jan 30, 2025
1 parent 1d43281 commit 98a8867
Show file tree
Hide file tree
Showing 13 changed files with 437 additions and 262 deletions.
145 changes: 89 additions & 56 deletions dist/zip-fs-full.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-fs-full.min.js

Large diffs are not rendered by default.

137 changes: 89 additions & 48 deletions dist/zip-fs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-fs.min.js

Large diffs are not rendered by default.

132 changes: 81 additions & 51 deletions dist/zip-full.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-full.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-no-worker-deflate.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-no-worker-inflate.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/zip-no-worker.min.js

Large diffs are not rendered by default.

124 changes: 81 additions & 43 deletions dist/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
const BITFLAG_DATA_DESCRIPTOR = 0x0008;
const BITFLAG_LANG_ENCODING_FLAG = 0x0800;
const FILE_ATTR_MSDOS_DIR_MASK = 0x10;
const FILE_ATTR_UNIX_DIR_MASK = 0x4000;
const FILE_ATTR_UNIX_EXECUTABLE_MASK = 0o111;

const VERSION_DEFLATE = 0x14;
const VERSION_ZIP64 = 0x2D;
Expand Down Expand Up @@ -167,7 +169,8 @@
if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
maxWorkers = navigator.hardwareConcurrency;
}
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
const DEFAULT_CONFIGURATION = {
Expand Down Expand Up @@ -1605,7 +1608,8 @@
if (IMPORT_KEY_SUPPORTED) {
try {
return await subtle.importKey(format, password, algorithm, extractable, keyUsages);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
IMPORT_KEY_SUPPORTED = false;
return misc.importKey(password);
}
Expand All @@ -1618,7 +1622,8 @@
if (DERIVE_BITS_SUPPORTED) {
try {
return await subtle.deriveBits(algorithm, baseKey, length);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
DERIVE_BITS_SUPPORTED = false;
return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
}
Expand Down Expand Up @@ -1936,11 +1941,13 @@
try {
const CompressionStream = useCompressionStream && CodecStreamNative ? CodecStreamNative : CodecStream;
readable = pipeThrough(readable, new CompressionStream(COMPRESSION_FORMAT, options));
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
if (useCompressionStream) {
try {
readable = pipeThrough(readable, new CodecStream(COMPRESSION_FORMAT, options));
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
return readable;
}
} else {
Expand Down Expand Up @@ -2183,7 +2190,8 @@
async function callHandler(handler, ...parameters) {
try {
await handler(...parameters);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
}
Expand All @@ -2200,7 +2208,8 @@
let worker;
try {
worker = getWebWorker(workerData.scripts[0], baseURL, workerData);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
WEB_WORKERS_SUPPORTED = false;
return createWorkerInterface(workerData, config);
}
Expand Down Expand Up @@ -2303,13 +2312,15 @@
}
try {
scriptUrl = new URL(url, baseURL);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
scriptUrl = url;
}
if (classicWorkersSupported) {
try {
worker = new Worker(scriptUrl);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
classicWorkersSupported = false;
worker = new Worker(scriptUrl, workerOptions);
}
Expand Down Expand Up @@ -2347,7 +2358,8 @@
try {
worker.postMessage(message, transferables);
return true;
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
transferStreamsSupported = false;
message.readable = message.writable = null;
worker.postMessage(message);
Expand Down Expand Up @@ -2490,7 +2502,8 @@
pool = pool.filter(data => data != workerData);
try {
await workerData.terminate();
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
}, terminateWorkerTimeout);
Expand Down Expand Up @@ -2831,7 +2844,7 @@
combineSizeEocd
} = httpReader;
if (isHttpFamily(url) && (useRangeHeader || forceRangeRequests) && (typeof preventHeadRequest == "undefined" || preventHeadRequest)) {
const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -END_OF_CENTRAL_DIR_LENGTH : undefined));
const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -22 : undefined));
if (!forceRangeRequests && response.headers.get(HTTP_HEADER_ACCEPT_RANGES) != HTTP_RANGE_UNIT) {
throw new Error(ERR_HTTP_RANGE);
} else {
Expand Down Expand Up @@ -3354,7 +3367,9 @@
const PROPERTY_NAME_CREATION_DATE = "creationDate";
const PROPERTY_NAME_RAW_CREATION_DATE = "rawCreationDate";
const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE = "internalFileAttribute";
const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES = "internalFileAttributes";
const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE = "externalFileAttribute";
const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES = "externalFileAttributes";
const PROPERTY_NAME_MS_DOS_COMPATIBLE = "msDosCompatible";
const PROPERTY_NAME_ZIP64 = "zip64";
const PROPERTY_NAME_ENCRYPTED = "encrypted";
Expand All @@ -3366,10 +3381,7 @@
PROPERTY_NAME_FILENAME, PROPERTY_NAME_RAW_FILENAME, PROPERTY_NAME_COMPPRESSED_SIZE, PROPERTY_NAME_UNCOMPPRESSED_SIZE,
PROPERTY_NAME_LAST_MODIFICATION_DATE, PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE, PROPERTY_NAME_COMMENT, PROPERTY_NAME_RAW_COMMENT,
PROPERTY_NAME_LAST_ACCESS_DATE, PROPERTY_NAME_CREATION_DATE, PROPERTY_NAME_OFFSET, PROPERTY_NAME_DISK_NUMBER_START,
PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY,
PROPERTY_NAME_ZIPCRYPTO, "directory", "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField",
"extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY, PROPERTY_NAME_ZIPCRYPTO, "directory", "executable", "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField", "extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];

class Entry {

Expand Down Expand Up @@ -3560,14 +3572,20 @@
const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
const versionMadeBy = getUint16(directoryView, offset + 4);
const msDosCompatible = (versionMadeBy & 0) == 0;
const msDosCompatible = versionMadeBy >> 8 == 0;
const unixCompatible = versionMadeBy >> 8 == 3;
const rawFilename = directoryArray.subarray(filenameOffset, extraFieldOffset);
const commentLength = getUint16(directoryView, offset + 32);
const endOffset = commentOffset + commentLength;
const rawComment = directoryArray.subarray(commentOffset, endOffset);
const filenameUTF8 = languageEncodingFlag;
const commentUTF8 = languageEncodingFlag;
const directory = msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK);
const externalFileAttributes = getUint32(directoryView, offset + 38);
const directory =
(msDosCompatible && ((getUint8(directoryView, offset + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK)) ||
(unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_DIR_MASK) == FILE_ATTR_UNIX_DIR_MASK)) ||
(rawFilename.length && rawFilename[rawFilename.length - 1] == DIRECTORY_SIGNATURE.charCodeAt(0));
const executable = (unixCompatible && (((externalFileAttributes >> 16) & FILE_ATTR_UNIX_EXECUTABLE_MASK) == FILE_ATTR_UNIX_EXECUTABLE_MASK));
const offsetFileEntry = getUint32(directoryView, offset + 42) + prependedDataLength;
Object.assign(fileEntry, {
versionMadeBy,
Expand All @@ -3578,13 +3596,16 @@
directory,
offset: offsetFileEntry,
diskNumberStart: getUint16(directoryView, offset + 34),
internalFileAttribute: getUint16(directoryView, offset + 36),
externalFileAttribute: getUint32(directoryView, offset + 38),
internalFileAttributes: getUint16(directoryView, offset + 36),
externalFileAttributes,
rawFilename,
filenameUTF8,
commentUTF8,
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset),
executable
});
fileEntry.internalFileAttribute = fileEntry.internalFileAttributes;
fileEntry.externalFileAttribute = fileEntry.externalFileAttributes;
const decode = getOptionValue$1(zipReader, options, "decodeText") || decodeText;
const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
Expand Down Expand Up @@ -3612,7 +3633,8 @@
if (onprogress) {
try {
await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
}
Expand Down Expand Up @@ -3824,7 +3846,8 @@
});
offsetExtraField += 4 + size;
}
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
const compressionMethod = getUint16(dataView, offset + 4);
Expand Down Expand Up @@ -3931,7 +3954,8 @@
}
offsetExtraField += 4 + attributeSize;
}
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
try {
Expand All @@ -3952,7 +3976,8 @@
Object.assign(extraFieldNTFS, extraFieldData);
Object.assign(directory, extraFieldData);
}
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
}
Expand Down Expand Up @@ -4021,7 +4046,8 @@
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
try {
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
}
Expand Down Expand Up @@ -4233,8 +4259,14 @@
const lastAccessDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
const creationDate = getOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE, true);
const internalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
const externalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
let internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
if (internalFileAttributes === 0) {
internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
}
let externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, 0);
if (externalFileAttributes === 0) {
externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
}
const passThrough = getOptionValue(zipWriter, options, "passThrough");
let password, rawPassword;
if (!passThrough) {
Expand Down Expand Up @@ -4350,8 +4382,10 @@
dataDescriptorSignature,
signal,
msDosCompatible,
internalFileAttribute,
externalFileAttribute,
internalFileAttribute: internalFileAttributes,
internalFileAttributes,
externalFileAttribute: externalFileAttributes,
externalFileAttributes,
useCompressionStream,
passThrough,
encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
Expand Down Expand Up @@ -4472,7 +4506,8 @@
if (error) {
try {
error.corruptedEntry = true;
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
}
Expand Down Expand Up @@ -4565,8 +4600,8 @@
encryptionStrength,
extendedTimestamp,
msDosCompatible,
internalFileAttribute,
externalFileAttribute,
internalFileAttributes,
externalFileAttributes,
useCompressionStream,
passThrough
} = options;
Expand All @@ -4585,8 +4620,8 @@
rawExtraField,
extendedTimestamp,
msDosCompatible,
internalFileAttribute,
externalFileAttribute,
internalFileAttributes,
externalFileAttributes,
diskNumberStart
};
let {
Expand Down Expand Up @@ -4746,7 +4781,8 @@
setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
rawExtraFieldNTFS = new Uint8Array();
}
} else {
Expand Down Expand Up @@ -5041,8 +5077,8 @@
zip64DiskNumberStart,
zip64Offset,
msDosCompatible,
internalFileAttribute,
externalFileAttribute,
internalFileAttributes,
externalFileAttributes,
diskNumberStart,
uncompressedSize,
compressedSize
Expand All @@ -5061,9 +5097,9 @@
setUint16(directoryView, offset + 30, extraFieldLength);
setUint16(directoryView, offset + 32, getLength(rawComment));
setUint16(directoryView, offset + 34, zip64 && zip64DiskNumberStart ? MAX_16_BITS : diskNumberStart);
setUint16(directoryView, offset + 36, internalFileAttribute);
if (externalFileAttribute) {
setUint32(directoryView, offset + 38, externalFileAttribute);
setUint16(directoryView, offset + 36, internalFileAttributes);
if (externalFileAttributes) {
setUint32(directoryView, offset + 38, externalFileAttributes);
} else if (directory && msDosCompatible) {
setUint8(directoryView, offset + 38, FILE_ATTR_MSDOS_DIR_MASK);
}
Expand All @@ -5085,7 +5121,8 @@
if (options.onprogress) {
try {
await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
}
Expand Down Expand Up @@ -5240,7 +5277,8 @@
let baseURL;
try {
baseURL = (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('zip.js', document.baseURI).href));
} catch (_error) {
// eslint-disable-next-line no-unused-vars
} catch (_) {
// ignored
}
configure({ baseURL });
Expand Down
2 changes: 1 addition & 1 deletion dist/zip.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 98a8867

Please sign in to comment.