diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/gulp-zip | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) | |
download | wallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz |
node_modules
Diffstat (limited to 'node_modules/gulp-zip')
-rw-r--r-- | node_modules/gulp-zip/index.js | 54 | ||||
-rw-r--r-- | node_modules/gulp-zip/package.json | 22 | ||||
-rw-r--r-- | node_modules/gulp-zip/readme.md | 14 |
3 files changed, 46 insertions, 44 deletions
diff --git a/node_modules/gulp-zip/index.js b/node_modules/gulp-zip/index.js index 82733be43..9f3e080a6 100644 --- a/node_modules/gulp-zip/index.js +++ b/node_modules/gulp-zip/index.js @@ -1,29 +1,29 @@ 'use strict'; -var path = require('path'); -var gutil = require('gulp-util'); -var through = require('through2'); -var chalk = require('chalk'); -var Yazl = require('yazl'); -var concatStream = require('concat-stream'); +const path = require('path'); +const gutil = require('gulp-util'); +const through = require('through2'); +const Yazl = require('yazl'); +const getStream = require('get-stream'); -module.exports = function (filename, opts) { +module.exports = (filename, opts) => { if (!filename) { - throw new gutil.PluginError('gulp-zip', chalk.blue('filename') + ' required'); + throw new gutil.PluginError('gulp-zip', '`filename` required'); } - opts = opts || {}; - opts.compress = typeof opts.compress === 'boolean' ? opts.compress : true; + opts = Object.assign({ + compress: true + }, opts); - var firstFile; - var zip = new Yazl.ZipFile(); + let firstFile; + const zip = new Yazl.ZipFile(); - return through.obj(function (file, enc, cb) { + return through.obj((file, enc, cb) => { if (!firstFile) { firstFile = file; } - // because Windows... - var pathname = file.relative.replace(/\\/g, '/'); + // Because Windows... + const pathname = file.relative.replace(/\\/g, '/'); if (!pathname) { cb(); @@ -36,7 +36,7 @@ module.exports = function (filename, opts) { mode: file.stat.mode }); } else { - var stat = { + const stat = { compress: opts.compress, mtime: file.stat ? file.stat.mtime : new Date(), mode: file.stat ? file.stat.mode : null @@ -58,17 +58,17 @@ module.exports = function (filename, opts) { return; } - zip.end(function () { - zip.outputStream.pipe(concatStream(function (data) { - this.push(new gutil.File({ - cwd: firstFile.cwd, - base: firstFile.base, - path: path.join(firstFile.base, filename), - contents: data - })); + getStream.buffer(zip.outputStream).then(data => { + this.push(new gutil.File({ + cwd: firstFile.cwd, + base: firstFile.base, + path: path.join(firstFile.base, filename), + contents: data + })); - cb(); - }.bind(this))); - }.bind(this)); + cb(); // eslint-disable-line promise/no-callback-in-promise + }); + + zip.end(); }); }; diff --git a/node_modules/gulp-zip/package.json b/node_modules/gulp-zip/package.json index 73d272075..6efa163dc 100644 --- a/node_modules/gulp-zip/package.json +++ b/node_modules/gulp-zip/package.json @@ -1,19 +1,19 @@ { "name": "gulp-zip", - "version": "3.2.0", + "version": "4.0.0", "description": "ZIP compress files", "license": "MIT", "repository": "sindresorhus/gulp-zip", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" + "url": "sindresorhus.com" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "scripts": { - "test": "mocha" + "test": "xo && ava" }, "files": [ "index.js" @@ -28,17 +28,17 @@ "file" ], "dependencies": { - "chalk": "^1.0.0", - "concat-stream": "^1.4.7", + "get-stream": "^3.0.0", "gulp-util": "^3.0.0", "through2": "^2.0.1", "yazl": "^2.1.0" }, "devDependencies": { - "decompress-unzip": "*", - "gulp": "*", - "mocha": "*", - "vinyl-assign": "*", - "vinyl-file": "^2.0.0" + "ava": "*", + "decompress-unzip": "^3.0.0", + "gulp": "^3.9.1", + "vinyl-assign": "^1.2.1", + "vinyl-file": "^3.0.0", + "xo": "*" } } diff --git a/node_modules/gulp-zip/readme.md b/node_modules/gulp-zip/readme.md index ad01564f9..9873f7088 100644 --- a/node_modules/gulp-zip/readme.md +++ b/node_modules/gulp-zip/readme.md @@ -16,11 +16,11 @@ $ npm install --save-dev gulp-zip const gulp = require('gulp'); const zip = require('gulp-zip'); -gulp.task('default', () => { - return gulp.src('src/*') +gulp.task('default', () => + gulp.src('src/*') .pipe(zip('archive.zip')) - .pipe(gulp.dest('dist')); -}); + .pipe(gulp.dest('dist')) +); ``` @@ -28,7 +28,7 @@ gulp.task('default', () => { Supports [streaming mode](https://github.com/gulpjs/gulp/blob/master/docs/API.md#optionsbuffer). -### zip(filename, options) +### zip(filename, [options]) #### filename @@ -36,6 +36,8 @@ Type: `string` #### options +Type: `Object` + ##### compress Type: `boolean`<br> @@ -44,4 +46,4 @@ Default: `true` ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](https://sindresorhus.com) |