aboutsummaryrefslogtreecommitdiff
path: root/node_modules/archiver
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/archiver
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
downloadwallet-core-82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8.tar.xz
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/archiver')
-rw-r--r--node_modules/archiver/CHANGELOG.md6
-rw-r--r--node_modules/archiver/README.md50
-rw-r--r--node_modules/archiver/lib/core.js111
-rw-r--r--node_modules/archiver/package.json7
4 files changed, 119 insertions, 55 deletions
diff --git a/node_modules/archiver/CHANGELOG.md b/node_modules/archiver/CHANGELOG.md
index d98d1e930..3b8e106b9 100644
--- a/node_modules/archiver/CHANGELOG.md
+++ b/node_modules/archiver/CHANGELOG.md
@@ -1,5 +1,11 @@
## Changelog
+**1.3.0** — <small> December 13, 2016_</small> — [Diff](https://github.com/archiverjs/node-archiver/compare/1.2.0...1.3.0)
+
+- improve `directory` and `glob` methods to use events rather than callbacks. (#203)
+- fix bulk warning spam (#208)
+- updated mocha (#205)
+
**1.2.0** — <small> November 2, 2016_</small> — [Diff](https://github.com/archiverjs/node-archiver/compare/1.1.0...1.2.0)
- Add a `process.emitWarning` for `deprecated` (#202)
diff --git a/node_modules/archiver/README.md b/node_modules/archiver/README.md
index 0eaa2b725..654d7db34 100644
--- a/node_modules/archiver/README.md
+++ b/node_modules/archiver/README.md
@@ -1,4 +1,4 @@
-# Archiver v1.2.0
+# Archiver v1.3.0
[![Build Status](https://travis-ci.org/archiverjs/node-archiver.svg?branch=master)](https://travis-ci.org/archiverjs/node-archiver) [![Build status](https://ci.appveyor.com/api/projects/status/38kqu3yp159nodxe/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-archiver/branch/master)
@@ -12,11 +12,55 @@ Visit the [API documentation](http://archiverjs.com/docs) for a list of all meth
npm install archiver --save
```
-## Usage
+## Quick Start
```js
+// require modules
+var fs = require('fs');
var archiver = require('archiver');
-var archive = archiver.create('zip', {}); // or archiver('zip', {});
+
+// create a file to stream archive data to.
+var output = fs.createWriteStream(__dirname + '/example.zip');
+var archive = archiver('zip', {
+ store: true // Sets the compression method to STORE.
+});
+
+// listen for all archive data to be written
+output.on('close', function() {
+ console.log(archive.pointer() + ' total bytes');
+ console.log('archiver has been finalized and the output file descriptor has closed.');
+});
+
+// good practice to catch this error explicitly
+archive.on('error', function(err) {
+ throw err;
+});
+
+// pipe archive data to the file
+archive.pipe(output);
+
+// append a file from stream
+var file1 = __dirname + '/file1.txt';
+archive.append(fs.createReadStream(file1), { name: 'file1.txt' });
+
+// append a file from string
+archive.append('string cheese!', { name: 'file2.txt' });
+
+// append a file from buffer
+var buffer3 = new Buffer('buff it!');
+archive.append(buffer3, { name: 'file3.txt' });
+
+// append a file
+archive.file('file1.txt', { name: 'file4.txt' });
+
+// append files from a directory
+archive.directory('subdir/');
+
+// append files from a glob pattern
+archive.glob('subdir/*.txt');
+
+// finalize the archive (ie we are done appending files but streams have to finish yet)
+archive.finalize();
```
## Formats
diff --git a/node_modules/archiver/lib/core.js b/node_modules/archiver/lib/core.js
index 6103d43e4..9bb80711c 100644
--- a/node_modules/archiver/lib/core.js
+++ b/node_modules/archiver/lib/core.js
@@ -9,6 +9,8 @@ var fs = require('fs');
var glob = require('glob');
var async = require('async');
var _ = require('lodash');
+var path = require('path');
+var walkdir = require('walkdir');
var util = require('archiver-utils');
var inherits = require('util').inherits;
@@ -16,6 +18,10 @@ var Transform = require('readable-stream').Transform;
var win32 = process.platform === 'win32';
+if (process._loggedBulkDeprecation === undefined) {
+ process._loggedBulkDeprecation = false;
+}
+
/**
* @constructor
* @param {String} format The archive format to use.
@@ -58,8 +64,6 @@ var Archiver = function(format, options) {
};
this._streams = [];
-
- this._loggedBulkDeprecation = false;
};
inherits(Archiver, Transform);
@@ -557,8 +561,8 @@ Archiver.prototype.append = function(source, data) {
* @return {this}
*/
Archiver.prototype.bulk = function(mappings) {
- if (!this._loggedBulkDeprecation) {
- this._loggedBulkDeprecation = true;
+ if (process._loggedBulkDeprecation === false) {
+ process._loggedBulkDeprecation = true;
var warning = 'Archiver.bulk() deprecated since 0.21.0';
if (typeof process !== 'undefined' && typeof process.emitWarning !== 'undefined') {
process.emitWarning(warning, 'DeprecationWarning');
@@ -655,38 +659,43 @@ Archiver.prototype.directory = function(dirpath, destpath, data) {
data = {};
}
- var self = this;
+ function onWalkPath(filepath, stats){
+ var entryData = _.extend({}, data);
+ entryData.name = path.relative(dirpath, filepath).replace(/\\/g, '/');
+ entryData.prefix = destpath;
+ entryData.stats = stats;
- util.walkdir(dirpath, function(err, results) {
- if (err) {
- self.emit('error', err);
- } else {
- results.forEach(function(file) {
- var entryData = _.extend({}, data);
- entryData.name = file.relative;
- entryData.prefix = destpath;
- entryData.stats = file.stats;
-
- try {
- if (dataFunction) {
- entryData = dataFunction(entryData);
-
- if (typeof entryData !== 'object') {
- throw new Error('directory: invalid data returned from custom function');
- }
- }
- } catch(e) {
- self.emit('error', e);
- return;
- }
+ try {
+ if (dataFunction) {
+ entryData = dataFunction(entryData);
- self._append(file.path, entryData);
- });
+ if (typeof entryData !== 'object') {
+ throw new Error('directory: invalid data returned from custom function');
+ }
+ }
+ } catch(e) {
+ this.emit('error', e);
+ return;
}
- self._pending--;
- self._maybeFinalize();
- });
+ this._append(filepath, entryData);
+ }
+
+ function onWalkEnd() {
+ this._pending--;
+ this._maybeFinalize();
+ }
+
+ function onWalkError(err) {
+ this.emit('error', 'directory: ' + err);
+ }
+
+ var walker = walkdir(dirpath);
+
+ walker.on('error', onWalkError.bind(this));
+ walker.on('directory', onWalkPath.bind(this));
+ walker.on('file', onWalkPath.bind(this));
+ walker.on('end', onWalkEnd.bind(this));
return this;
};
@@ -736,26 +745,30 @@ Archiver.prototype.glob = function(pattern, options, data) {
stat: false
});
- var globber = glob(pattern, options, function(err, files) {
- if (err) {
- this.emit('error', err);
- return this;
- }
+ function onGlobEnd() {
+ this._pending--;
+ this._maybeFinalize();
+ }
- files.forEach(function(file) {
- entryData = _.extend({}, data);
+ function onGlobError(err) {
+ this.emit('error', 'glob: ' + err);
+ }
- if (options.cwd) {
- entryData.name = file;
- file = globber._makeAbs(file);
- }
+ function onGlobMatch(match){
+ entryData = _.extend({}, data);
- this._append(file, entryData);
- }, this);
+ if (options.cwd) {
+ entryData.name = match;
+ match = globber._makeAbs(match);
+ }
- this._pending--;
- this._maybeFinalize();
- }.bind(this));
+ this._append(match, entryData);
+ }
+
+ var globber = glob(pattern, options);
+ globber.on('error', onGlobError.bind(this));
+ globber.on('match', onGlobMatch.bind(this));
+ globber.on('end', onGlobEnd.bind(this));
return this;
};
@@ -890,4 +903,4 @@ module.exports = Archiver;
* when working with methods like `directory` or `glob`.
* @property {fs.Stats} [stats] Sets the fs stat data for this entry allowing
* for reduction of fs stat calls when stat data is already known.
- */ \ No newline at end of file
+ */
diff --git a/node_modules/archiver/package.json b/node_modules/archiver/package.json
index c0f9c1a0a..44b3ed7de 100644
--- a/node_modules/archiver/package.json
+++ b/node_modules/archiver/package.json
@@ -1,6 +1,6 @@
{
"name": "archiver",
- "version": "1.2.0",
+ "version": "1.3.0",
"description": "a streaming interface for archive generation",
"homepage": "https://github.com/archiverjs/node-archiver",
"author": {
@@ -36,13 +36,14 @@
"lodash": "^4.8.0",
"readable-stream": "^2.0.0",
"tar-stream": "^1.5.0",
- "zip-stream": "^1.1.0"
+ "zip-stream": "^1.1.0",
+ "walkdir": "^0.0.11"
},
"devDependencies": {
"archiver-jsdoc-theme": "^1.0.0",
"jsdoc": "~3.4.0",
"chai": "^3.4.0",
- "mocha": "^2.3.3",
+ "mocha": "^3.1.1",
"rimraf": "^2.4.2",
"mkdirp": "^0.5.0",
"stream-bench": "^0.1.2",