imagemin
Advanced tools
Comparing version 5.2.2 to 5.3.0
10
index.js
@@ -6,5 +6,5 @@ 'use strict'; | ||
const globby = require('globby'); | ||
const mkdirp = require('mkdirp'); | ||
const makeDir = require('make-dir'); | ||
const pify = require('pify'); | ||
const promisePipe = require('promise.pipe'); | ||
const pPipe = require('p-pipe'); | ||
const replaceExt = require('replace-ext'); | ||
@@ -16,3 +16,3 @@ | ||
const dest = output ? path.join(output, path.basename(input)) : null; | ||
const pipe = opts.plugins.length > 0 ? promisePipe(opts.plugins)(data) : Promise.resolve(data); | ||
const pipe = opts.plugins.length > 0 ? pPipe(opts.plugins)(data) : Promise.resolve(data); | ||
@@ -32,3 +32,3 @@ return pipe | ||
return pify(mkdirp)(path.dirname(ret.path)) | ||
return makeDir(path.dirname(ret.path)) | ||
.then(() => fsP.writeFile(ret.path, ret.data)) | ||
@@ -67,5 +67,5 @@ .then(() => ret); | ||
const pipe = opts.plugins.length > 0 ? promisePipe(opts.plugins)(input) : Promise.resolve(input); | ||
const pipe = opts.plugins.length > 0 ? pPipe(opts.plugins)(input) : Promise.resolve(input); | ||
return pipe.then(buf => buf.length < input.length ? buf : input); | ||
}; |
{ | ||
"name": "imagemin", | ||
"version": "5.2.2", | ||
"version": "5.3.0", | ||
"description": "Minify images", | ||
@@ -44,8 +44,8 @@ "license": "MIT", | ||
"dependencies": { | ||
"file-type": "^3.8.0", | ||
"globby": "^5.0.0", | ||
"mkdirp": "^0.5.1", | ||
"file-type": "^4.1.0", | ||
"globby": "^6.1.0", | ||
"make-dir": "^1.0.0", | ||
"p-pipe": "^1.0.0", | ||
"pify": "^2.3.0", | ||
"promise.pipe": "^3.0.0", | ||
"replace-ext": "0.0.1" | ||
"replace-ext": "^1.0.0" | ||
}, | ||
@@ -58,6 +58,5 @@ "devDependencies": { | ||
"is-jpg": "^1.0.0", | ||
"mkdirp": "^0.5.1", | ||
"tempfile": "^1.1.1", | ||
"tempy": "^0.1.0", | ||
"xo": "*" | ||
} | ||
} |
@@ -17,3 +17,3 @@ # imagemin [![Build Status](https://img.shields.io/travis/imagemin/imagemin.svg)](https://travis-ci.org/imagemin/imagemin) [![Build status](https://ci.appveyor.com/api/projects/status/wlnem7wef63k4n1t?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/imagemin) | ||
const imagemin = require('imagemin'); | ||
const imageminMozjpeg = require('imagemin-mozjpeg'); | ||
const imageminJpegtran = require('imagemin-jpegtran'); | ||
const imageminPngquant = require('imagemin-pngquant'); | ||
@@ -23,3 +23,3 @@ | ||
plugins: [ | ||
imageminMozjpeg({targa: true}), | ||
imageminJpegtran(), | ||
imageminPngquant({quality: '65-80'}) | ||
@@ -38,7 +38,7 @@ ] | ||
Returns a promise for an array of objects in the format `{data: Buffer, path: String}`. | ||
Returns `Promise<Object[]>` in the format `{data: Buffer, path: String}`. | ||
#### input | ||
Type: `array` | ||
Type: `Array` | ||
@@ -55,25 +55,29 @@ Files to be optimized. See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). | ||
Type: `Object` | ||
##### plugins | ||
Type: `array` | ||
Type: `Array` | ||
Array of [plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. | ||
[Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. | ||
### imagemin.buffer(buffer, [options]) | ||
Returns a promise for a buffer. | ||
Returns `Promise<Buffer>`. | ||
#### buffer | ||
Type: `buffer` | ||
Type: `Buffer` | ||
The buffer to optimize. | ||
Buffer to optimize. | ||
#### options | ||
Type: `Object` | ||
##### plugins | ||
Type: `array` | ||
Type: `Array` | ||
Array of [plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. | ||
[Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. | ||
@@ -80,0 +84,0 @@ |
7
92
5971
+ Addedmake-dir@^1.0.0
+ Addedp-pipe@^1.0.0
+ Addedfile-type@4.4.0(transitive)
+ Addedglobby@6.1.0(transitive)
+ Addedmake-dir@1.3.0(transitive)
+ Addedp-pipe@1.2.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedreplace-ext@1.0.1(transitive)
- Removedmkdirp@^0.5.1
- Removedpromise.pipe@^3.0.0
- Removedarrify@1.0.1(transitive)
- Removedfile-type@3.9.0(transitive)
- Removedglobby@5.0.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedpromise.pipe@3.0.0(transitive)
- Removedreplace-ext@0.0.1(transitive)
Updatedfile-type@^4.1.0
Updatedglobby@^6.1.0
Updatedreplace-ext@^1.0.0