Skip to content

Commit

Permalink
Update gifsicle dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 21, 2020
1 parent 7d29c8f commit 68b9a4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ const execa = require('execa');
const gifsicle = require('gifsicle');
const isGif = require('is-gif');

module.exports = (options = {}) => input => {
module.exports = (options = {}) => async input => {
if (!Buffer.isBuffer(input)) {
return Promise.reject(new TypeError(`Expected \`input\` to be of type \`Buffer\` but received type \`${typeof input}\``));
throw new TypeError(`Expected \`input\` to be of type \`Buffer\` but received type \`${typeof input}\``);
}

if (!isGif(input)) {
return Promise.resolve(input);
return input;
}

const args = ['--no-warnings', '--no-app-extensions'];
Expand All @@ -26,9 +26,10 @@ module.exports = (options = {}) => input => {
args.push(`--colors=${options.colors}`);
}

return execa(gifsicle, args, {
const {stdout} = await execa(gifsicle, args, {
encoding: null,
input
})
.then(({stdout}) => stdout);
});

return stdout;
};
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Imagemin plugin for Gifsicle",
"license": "MIT",
"repository": "imagemin/imagemin-gifsicle",
"funding": "https://github.com/imagemin/imagemin-gifsicle?sponsor=1",
"engines": {
"node": ">=6"
},
Expand All @@ -26,12 +27,12 @@
],
"dependencies": {
"execa": "^1.0.0",
"gifsicle": "^4.0.0",
"gifsicle": "^5.0.0",
"is-gif": "^3.0.0"
},
"devDependencies": {
"ava": "^0.25.0",
"pify": "^4.0.0",
"xo": "^0.23.0"
"xo": "^0.25.3"
}
}

0 comments on commit 68b9a4d

Please sign in to comment.