imagemin-webp
Advanced tools
Comparing version 3.0.0 to 3.0.1
19
index.js
'use strict'; | ||
var ExecBuffer = require('exec-buffer'); | ||
var imageType = require('image-type'); | ||
var isCwebpReadable = require('is-cwebp-readable'); | ||
var replaceExt = require('replace-ext'); | ||
@@ -9,13 +9,6 @@ var through = require('through2'); | ||
/** | ||
* webp imagemin plugin | ||
* | ||
* @param {Object} opts | ||
* @api public | ||
*/ | ||
module.exports = function (opts) { | ||
opts = opts || {}; | ||
return through.ctor({ objectMode: true }, function (file, enc, cb) { | ||
return through.ctor({objectMode: true}, function (file, enc, cb) { | ||
if (file.isNull()) { | ||
@@ -31,3 +24,3 @@ cb(null, file); | ||
if (['jpg', 'png', 'tif'].indexOf(imageType(file.contents)) === -1) { | ||
if (!isCwebpReadable(file.contents)) { | ||
cb(null, file); | ||
@@ -37,3 +30,3 @@ return; | ||
var exec = new ExecBuffer(); | ||
var execBuffer = new ExecBuffer(); | ||
var args = ['-quiet', '-mt']; | ||
@@ -81,4 +74,4 @@ | ||
exec | ||
.use(webp, args.concat([exec.src(), '-o', exec.dest()])) | ||
execBuffer | ||
.use(webp, args.concat([execBuffer.src(), '-o', execBuffer.dest()])) | ||
.run(file.contents, function (err, buf) { | ||
@@ -85,0 +78,0 @@ if (err) { |
{ | ||
"name": "imagemin-webp", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "webp imagemin plugin", | ||
@@ -37,4 +37,4 @@ "license": "MIT", | ||
"cwebp-bin": "^2.0.0", | ||
"exec-buffer": "^1.0.0", | ||
"image-type": "^1.0.0", | ||
"exec-buffer": "^2.0.0", | ||
"is-cwebp-readable": "^1.0.0", | ||
"replace-ext": "0.0.1", | ||
@@ -41,0 +41,0 @@ "through2": "^0.6.1" |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
5701
4
66
1
+ Addedis-cwebp-readable@^1.0.0
+ Addedexec-buffer@2.0.1(transitive)
+ Addedis-cwebp-readable@1.0.3(transitive)
- Removedimage-type@^1.0.0
- Removedexec-buffer@1.1.2(transitive)
- Removedimage-type@1.1.0(transitive)
- Removedis-bmp@1.0.1(transitive)
- Removedis-gif@1.0.0(transitive)
- Removedis-jpg@1.0.1(transitive)
- Removedis-jxr@1.0.1(transitive)
- Removedis-png@1.1.0(transitive)
- Removedis-psd@1.0.1(transitive)
- Removedis-tif@1.0.1(transitive)
- Removedis-webp@1.0.1(transitive)
Updatedexec-buffer@^2.0.0