Comparing version 5.3.1 to 6.0.0
12
index.js
@@ -47,3 +47,3 @@ 'use strict'; | ||
if (!Array.isArray(input)) { | ||
return Promise.reject(new TypeError('Expected an array')); | ||
return Promise.reject(new TypeError(`Expected an \`Array\`, got \`${typeof input}\``)); | ||
} | ||
@@ -59,3 +59,3 @@ | ||
return globby(input, {nodir: true}).then(paths => Promise.all(paths.map(x => handleFile(x, output, opts)))); | ||
return globby(input, {onlyFiles: true}).then(paths => Promise.all(paths.map(x => handleFile(x, output, opts)))); | ||
}; | ||
@@ -65,3 +65,3 @@ | ||
if (!Buffer.isBuffer(input)) { | ||
return Promise.reject(new TypeError('Expected a buffer')); | ||
return Promise.reject(new TypeError(`Expected a \`Buffer\`, got \`${typeof input}\``)); | ||
} | ||
@@ -72,5 +72,7 @@ | ||
const pipe = opts.plugins.length > 0 ? pPipe(opts.plugins)(input) : Promise.resolve(input); | ||
if (opts.plugins.length === 0) { | ||
return Promise.resolve(input); | ||
} | ||
return pipe.then(buf => buf.length < input.length ? buf : input); | ||
return pPipe(opts.plugins)(input).then(buf => (buf.length < input.length ? buf : input)); | ||
}; |
100
package.json
{ | ||
"name": "imagemin", | ||
"version": "5.3.1", | ||
"description": "Minify images", | ||
"license": "MIT", | ||
"repository": "imagemin/imagemin", | ||
"author": { | ||
"name": "Kevin Mårtensson", | ||
"email": "kevinmartensson@gmail.com", | ||
"url": "github.com/kevva" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
{ | ||
"name": "Shinnosuke Watanabe", | ||
"url": "github.com/shinnn" | ||
} | ||
], | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"minify", | ||
"compress", | ||
"image", | ||
"images", | ||
"jpeg", | ||
"jpg", | ||
"png", | ||
"gif", | ||
"svg" | ||
], | ||
"dependencies": { | ||
"file-type": "^4.1.0", | ||
"globby": "^6.1.0", | ||
"make-dir": "^1.0.0", | ||
"p-pipe": "^1.1.0", | ||
"pify": "^2.3.0", | ||
"replace-ext": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"del": "^2.2.0", | ||
"imagemin-jpegtran": "^5.0.0", | ||
"imagemin-webp": "^4.0.0", | ||
"is-jpg": "^1.0.0", | ||
"tempy": "^0.1.0", | ||
"xo": "*" | ||
} | ||
"name": "imagemin", | ||
"version": "6.0.0", | ||
"description": "Minify images", | ||
"license": "MIT", | ||
"repository": "imagemin/imagemin", | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"minify", | ||
"compress", | ||
"image", | ||
"images", | ||
"jpeg", | ||
"jpg", | ||
"png", | ||
"gif", | ||
"svg" | ||
], | ||
"dependencies": { | ||
"file-type": "^8.1.0", | ||
"globby": "^8.0.1", | ||
"make-dir": "^1.0.0", | ||
"p-pipe": "^1.1.0", | ||
"pify": "^3.0.0", | ||
"replace-ext": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"del": "^3.0.0", | ||
"imagemin-jpegtran": "^5.0.0", | ||
"imagemin-webp": "^4.0.0", | ||
"is-jpg": "^2.0.0", | ||
"tempy": "^0.2.1", | ||
"xo": "*" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# 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) | ||
# imagemin [![Build Status](https://travis-ci.org/imagemin/imagemin.svg?branch=master)](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) | ||
@@ -9,3 +9,3 @@ > Minify images seamlessly | ||
``` | ||
$ npm install --save imagemin | ||
$ npm install imagemin | ||
``` | ||
@@ -21,11 +21,13 @@ | ||
imagemin(['images/*.{jpg,png}'], 'build/images', { | ||
plugins: [ | ||
imageminJpegtran(), | ||
imageminPngquant({quality: '65-80'}) | ||
] | ||
}).then(files => { | ||
(async () => { | ||
const files = await imagemin(['images/*.{jpg,png}'], 'build/images', { | ||
plugins: [ | ||
imageminJpegtran(), | ||
imageminPngquant({quality: '65-80'}) | ||
] | ||
}); | ||
console.log(files); | ||
//=> [{data: <Buffer 89 50 4e …>, path: 'build/images/foo.jpg'}, …] | ||
}); | ||
})(); | ||
``` | ||
@@ -36,3 +38,3 @@ | ||
### imagemin(input, output, [options]) | ||
### imagemin(input, [output], [options]) | ||
@@ -43,3 +45,3 @@ Returns `Promise<Object[]>` in the format `{data: Buffer, path: String}`. | ||
Type: `Array` | ||
Type: `string[]` | ||
@@ -46,0 +48,0 @@ Files to be optimized. See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58
94
5789
2
+ Added@mrmlnc/readdir-enhanced@2.2.1(transitive)
+ Added@nodelib/fs.stat@1.1.3(transitive)
+ Addedarr-diff@4.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedarray-unique@0.3.2(transitive)
+ Addedarrify@1.0.1(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedatob@2.1.2(transitive)
+ Addedbase@0.11.2(transitive)
+ Addedbraces@2.3.2(transitive)
+ Addedcache-base@1.0.1(transitive)
+ Addedcall-me-maybe@1.0.2(transitive)
+ Addedclass-utils@0.3.6(transitive)
+ Addedcollection-visit@1.0.0(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddefine-property@0.2.51.0.02.0.2(transitive)
+ Addeddir-glob@2.0.0(transitive)
+ Addedexpand-brackets@2.1.4(transitive)
+ Addedextend-shallow@2.0.13.0.2(transitive)
+ Addedextglob@2.0.4(transitive)
+ Addedfast-glob@2.2.7(transitive)
+ Addedfile-type@8.1.0(transitive)
+ Addedfill-range@4.0.0(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfragment-cache@0.2.1(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-value@2.0.6(transitive)
+ Addedglob-parent@3.1.0(transitive)
+ Addedglob-to-regexp@0.3.0(transitive)
+ Addedglobby@8.0.2(transitive)
+ Addedhas-value@0.3.11.0.0(transitive)
+ Addedhas-values@0.1.41.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedignore@3.3.10(transitive)
+ Addedis-accessor-descriptor@1.0.1(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-data-descriptor@1.0.1(transitive)
+ Addedis-descriptor@0.1.71.0.3(transitive)
+ Addedis-extendable@0.1.11.0.1(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@3.1.04.0.3(transitive)
+ Addedis-number@3.0.0(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.03.0.1(transitive)
+ Addedkind-of@3.2.24.0.06.0.3(transitive)
+ Addedmap-cache@0.2.2(transitive)
+ Addedmap-visit@1.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@3.1.10(transitive)
+ Addedmixin-deep@1.3.2(transitive)
+ Addedms@2.0.0(transitive)
+ Addednanomatch@1.2.13(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedobject-visit@1.0.1(transitive)
+ Addedobject.pick@1.3.0(transitive)
+ Addedpascalcase@0.1.1(transitive)
+ Addedpath-dirname@1.0.2(transitive)
+ Addedpath-type@3.0.0(transitive)
+ Addedposix-character-classes@0.1.1(transitive)
+ Addedregex-not@1.0.2(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedresolve-url@0.2.1(transitive)
+ Addedret@0.1.15(transitive)
+ Addedsafe-regex@1.1.0(transitive)
+ Addedset-value@2.0.1(transitive)
+ Addedslash@1.0.0(transitive)
+ Addedsnapdragon@0.8.2(transitive)
+ Addedsnapdragon-node@2.1.1(transitive)
+ Addedsnapdragon-util@3.0.1(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsource-map-resolve@0.5.3(transitive)
+ Addedsource-map-url@0.4.1(transitive)
+ Addedsplit-string@3.1.0(transitive)
+ Addedstatic-extend@0.1.2(transitive)
+ Addedto-object-path@0.3.0(transitive)
+ Addedto-regex@3.0.2(transitive)
+ Addedto-regex-range@2.1.1(transitive)
+ Addedunion-value@1.0.1(transitive)
+ Addedunset-value@1.0.0(transitive)
+ Addedurix@0.1.0(transitive)
+ Addeduse@3.1.1(transitive)
- Removedfile-type@4.4.0(transitive)
- Removedglobby@6.1.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
Updatedfile-type@^8.1.0
Updatedglobby@^8.0.1
Updatedpify@^3.0.0