aboutsummaryrefslogtreecommitdiff
path: root/node_modules/compress-commons
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /node_modules/compress-commons
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'node_modules/compress-commons')
-rw-r--r--node_modules/compress-commons/README.md2
-rw-r--r--node_modules/compress-commons/lib/archivers/zip/constants.js2
-rw-r--r--node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js186
-rw-r--r--node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js3
-rw-r--r--node_modules/compress-commons/package.json6
5 files changed, 189 insertions, 10 deletions
diff --git a/node_modules/compress-commons/README.md b/node_modules/compress-commons/README.md
index 258e68acc..80055ca32 100644
--- a/node_modules/compress-commons/README.md
+++ b/node_modules/compress-commons/README.md
@@ -1,4 +1,4 @@
-# Compress Commons v1.0.0 [![Build Status](https://travis-ci.org/archiverjs/node-compress-commons.svg?branch=master)](https://travis-ci.org/archiverjs/node-compress-commons) [![Build status](https://ci.appveyor.com/api/projects/status/fx3066dufdpar0it/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-compress-commons/branch/master)
+# Compress Commons v1.2.0 [![Build Status](https://travis-ci.org/archiverjs/node-compress-commons.svg?branch=master)](https://travis-ci.org/archiverjs/node-compress-commons) [![Build status](https://ci.appveyor.com/api/projects/status/fx3066dufdpar0it/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-compress-commons/branch/master)
Compress Commons is a library that defines a common interface for working with archive formats within node.
diff --git a/node_modules/compress-commons/lib/archivers/zip/constants.js b/node_modules/compress-commons/lib/archivers/zip/constants.js
index d17b16e7b..34181ecf8 100644
--- a/node_modules/compress-commons/lib/archivers/zip/constants.js
+++ b/node_modules/compress-commons/lib/archivers/zip/constants.js
@@ -68,4 +68,4 @@ module.exports = {
S_DOS_S: 4, // 04 System
S_DOS_H: 2, // 02 Hidden
S_DOS_R: 1 // 01 Read Only
-}; \ No newline at end of file
+};
diff --git a/node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js b/node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js
index 03d2b7dcf..e5b0d69a7 100644
--- a/node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js
+++ b/node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js
@@ -10,6 +10,7 @@ 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('./util');
@@ -45,78 +46,173 @@ var ZipArchiveEntry = module.exports = function(name) {
inherits(ZipArchiveEntry, ArchiveEntry);
+/**
+ * Returns the extra fields related to the entry.
+ *
+ * @returns {Buffer}
+ */
ZipArchiveEntry.prototype.getCentralDirectoryExtra = function() {
return this.getExtra();
};
+/**
+ * Returns the comment set for the entry.
+ *
+ * @returns {string}
+ */
ZipArchiveEntry.prototype.getComment = function() {
return this.comment !== null ? this.comment : '';
};
+/**
+ * Returns the compressed size of the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getCompressedSize = function() {
return this.csize;
};
+/**
+ * Returns the CRC32 digest for the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getCrc = function() {
return this.crc;
};
+/**
+ * Returns the external file attributes for the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getExternalAttributes = function() {
return this.exattr;
};
+/**
+ * Returns the extra fields related to the entry.
+ *
+ * @returns {Buffer}
+ */
ZipArchiveEntry.prototype.getExtra = function() {
return this.extra !== null ? this.extra : constants.EMPTY;
};
+/**
+ * Returns the general purpose bits related to the entry.
+ *
+ * @returns {GeneralPurposeBit}
+ */
ZipArchiveEntry.prototype.getGeneralPurposeBit = function() {
return this.gpb;
};
+/**
+ * Returns the internal file attributes for the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getInternalAttributes = function() {
return this.inattr;
};
+/**
+ * Returns the last modified date of the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getLastModifiedDate = function() {
return this.getTime();
};
+/**
+ * Returns the extra fields related to the entry.
+ *
+ * @returns {Buffer}
+ */
ZipArchiveEntry.prototype.getLocalFileDataExtra = function() {
return this.getExtra();
};
+/**
+ * Returns the compression method used on the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getMethod = function() {
return this.method;
};
+/**
+ * Returns the filename of the entry.
+ *
+ * @returns {string}
+ */
ZipArchiveEntry.prototype.getName = function() {
return this.name;
};
+/**
+ * Returns the platform on which the entry was made.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getPlatform = function() {
return this.platform;
};
+/**
+ * Returns the size of the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getSize = function() {
return this.size;
};
+/**
+ * Returns a date object representing the last modified date of the entry.
+ *
+ * @returns {number|Date}
+ */
ZipArchiveEntry.prototype.getTime = function() {
return this.time !== -1 ? zipUtil.dosToDate(this.time) : -1;
};
+/**
+ * Returns the DOS timestamp for the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getTimeDos = function() {
return this.time !== -1 ? this.time : 0;
};
+/**
+ * Returns the UNIX file permissions for the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getUnixMode = function() {
- return this.platform !== constants.PLATFORM_UNIX ? 0 : ((this.getExternalAttributes() >> constants.SHORT_SHIFT) & constants.SHORT_MASK) & constants.MODE_MASK;
+ return this.platform !== constants.PLATFORM_UNIX ? 0 : ((this.getExternalAttributes() >> constants.SHORT_SHIFT) & constants.SHORT_MASK);
};
+/**
+ * Returns the version of ZIP needed to extract the entry.
+ *
+ * @returns {number}
+ */
ZipArchiveEntry.prototype.getVersionNeededToExtract = function() {
return this.minver;
};
+/**
+ * Sets the comment of the entry.
+ *
+ * @param comment
+ */
ZipArchiveEntry.prototype.setComment = function(comment) {
if (Buffer.byteLength(comment) !== comment.length) {
this.getGeneralPurposeBit().useUTF8ForNames(true);
@@ -125,6 +221,11 @@ ZipArchiveEntry.prototype.setComment = function(comment) {
this.comment = comment;
};
+/**
+ * Sets the compressed size of the entry.
+ *
+ * @param size
+ */
ZipArchiveEntry.prototype.setCompressedSize = function(size) {
if (size < 0) {
throw new Error('invalid entry compressed size');
@@ -133,6 +234,11 @@ ZipArchiveEntry.prototype.setCompressedSize = function(size) {
this.csize = size;
};
+/**
+ * Sets the checksum of the entry.
+ *
+ * @param crc
+ */
ZipArchiveEntry.prototype.setCrc = function(crc) {
if (crc < 0) {
throw new Error('invalid entry crc32');
@@ -141,14 +247,29 @@ ZipArchiveEntry.prototype.setCrc = function(crc) {
this.crc = crc;
};
+/**
+ * Sets the external file attributes of the entry.
+ *
+ * @param attr
+ */
ZipArchiveEntry.prototype.setExternalAttributes = function(attr) {
this.exattr = attr >>> 0;
};
+/**
+ * Sets the extra fields related to the entry.
+ *
+ * @param extra
+ */
ZipArchiveEntry.prototype.setExtra = function(extra) {
this.extra = extra;
};
+/**
+ * Sets the general purpose bits related to the entry.
+ *
+ * @param gpb
+ */
ZipArchiveEntry.prototype.setGeneralPurposeBit = function(gpb) {
if (!(gpb instanceof GeneralPurposeBit)) {
throw new Error('invalid entry GeneralPurposeBit');
@@ -157,10 +278,20 @@ ZipArchiveEntry.prototype.setGeneralPurposeBit = function(gpb) {
this.gpb = gpb;
};
+/**
+ * Sets the internal file attributes of the entry.
+ *
+ * @param attr
+ */
ZipArchiveEntry.prototype.setInternalAttributes = function(attr) {
this.inattr = attr;
};
+/**
+ * Sets the compression method of the entry.
+ *
+ * @param method
+ */
ZipArchiveEntry.prototype.setMethod = function(method) {
if (method < 0) {
throw new Error('invalid entry compression method');
@@ -169,6 +300,11 @@ ZipArchiveEntry.prototype.setMethod = function(method) {
this.method = method;
};
+/**
+ * Sets the name of the entry.
+ *
+ * @param name
+ */
ZipArchiveEntry.prototype.setName = function(name) {
name = normalizePath(name, false).replace(/^\w+:/, '').replace(/^(\.\.\/|\/)+/, '');
@@ -179,10 +315,20 @@ ZipArchiveEntry.prototype.setName = function(name) {
this.name = name;
};
+/**
+ * Sets the platform on which the entry was made.
+ *
+ * @param platform
+ */
ZipArchiveEntry.prototype.setPlatform = function(platform) {
this.platform = platform;
};
+/**
+ * Sets the size of the entry.
+ *
+ * @param size
+ */
ZipArchiveEntry.prototype.setSize = function(size) {
if (size < 0) {
throw new Error('invalid entry size');
@@ -191,6 +337,12 @@ ZipArchiveEntry.prototype.setSize = function(size) {
this.size = size;
};
+/**
+ * Sets the time of the entry.
+ *
+ * @param time
+ * @param forceLocalTime
+ */
ZipArchiveEntry.prototype.setTime = function(time, forceLocalTime) {
if (!(time instanceof Date)) {
throw new Error('invalid entry time');
@@ -199,8 +351,12 @@ ZipArchiveEntry.prototype.setTime = function(time, forceLocalTime) {
this.time = zipUtil.dateToDos(time, forceLocalTime);
};
+/**
+ * Sets the UNIX file permissions for the entry.
+ *
+ * @param mode
+ */
ZipArchiveEntry.prototype.setUnixMode = function(mode) {
- mode &= ~constants.S_IFMT;
mode |= this.isDirectory() ? constants.S_IFDIR : constants.S_IFREG;
var extattr = 0;
@@ -211,18 +367,40 @@ ZipArchiveEntry.prototype.setUnixMode = function(mode) {
this.platform = constants.PLATFORM_UNIX;
};
+/**
+ * Sets the version of ZIP needed to extract this entry.
+ *
+ * @param minver
+ */
ZipArchiveEntry.prototype.setVersionNeededToExtract = function(minver) {
this.minver = minver;
};
+/**
+ * Returns true if this entry represents a directory.
+ *
+ * @returns {boolean}
+ */
ZipArchiveEntry.prototype.isDirectory = function() {
return this.getName().slice(-1) === '/';
};
+/**
+ * Returns true if this entry represents a unix symlink,
+ * in which case the entry's content contains the target path
+ * for the symlink.
+ *
+ * @returns {boolean}
+ */
ZipArchiveEntry.prototype.isUnixSymlink = function() {
- return (this.getUnixMode() & constants.S_IFLINK) === constants.S_IFLINK;
+ return (this.getUnixMode() & UnixStat.FILE_TYPE_FLAG) === UnixStat.LINK_FLAG;
};
+/**
+ * Returns true if this entry is using the ZIP64 extension of ZIP.
+ *
+ * @returns {boolean}
+ */
ZipArchiveEntry.prototype.isZip64 = function() {
return this.csize > constants.ZIP64_MAGIC || this.size > constants.ZIP64_MAGIC;
-}; \ No newline at end of file
+};
diff --git a/node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js b/node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js
index 02cb8b36c..d74c1e770 100644
--- a/node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js
+++ b/node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js
@@ -168,7 +168,8 @@ ZipArchiveOutputStream.prototype._smartStream = function(ae, callback) {
var error = null;
function handleStuff() {
- ae.setCrc(process.digest());
+ var digest = process.digest().readUInt32BE(0);
+ ae.setCrc(digest);
ae.setSize(process.size());
ae.setCompressedSize(process.size(true));
this._afterAppend(ae);
diff --git a/node_modules/compress-commons/package.json b/node_modules/compress-commons/package.json
index 48fd81a29..2058d0778 100644
--- a/node_modules/compress-commons/package.json
+++ b/node_modules/compress-commons/package.json
@@ -1,6 +1,6 @@
{
"name": "compress-commons",
- "version": "1.1.0",
+ "version": "1.2.0",
"description": "a library that defines a common interface for working with archive formats within node",
"homepage": "https://github.com/archiverjs/node-compress-commons",
"author": {
@@ -27,13 +27,13 @@
},
"dependencies": {
"buffer-crc32": "^0.2.1",
- "crc32-stream": "^1.0.0",
+ "crc32-stream": "^2.0.0",
"normalize-path": "^2.0.0",
"readable-stream": "^2.0.0"
},
"devDependencies": {
"chai": "^3.4.0",
- "mocha": "^2.3.3",
+ "mocha": "^3.2.0",
"rimraf": "^2.4.3",
"mkdirp": "^0.5.0"
},