imagemin-jpegoptim
Advanced tools
Comparing version 7.0.0 to 8.0.0
20
index.js
@@ -1,7 +0,7 @@ | ||
'use strict'; | ||
const execa = require('execa'); | ||
const isJpg = require('is-jpg'); | ||
const jpegoptim = require('jpegoptim-bin'); | ||
import {Buffer} from 'node:buffer'; | ||
import {execa} from 'execa'; | ||
import isJpg from 'is-jpg'; | ||
import jpegoptim from 'jpegoptim-bin'; | ||
module.exports = options => async buffer => { | ||
const imageminJpegoptim = options => async buffer => { | ||
options = { | ||
@@ -14,3 +14,3 @@ stripAll: true, | ||
stripXmp: true, | ||
...options | ||
...options, | ||
}; | ||
@@ -28,3 +28,3 @@ | ||
'--stdin', | ||
'--stdout' | ||
'--stdout', | ||
]; | ||
@@ -64,3 +64,3 @@ | ||
if (options.size) { | ||
if (options.size > 0) { | ||
args.push(`--size=${options.size}`); | ||
@@ -72,3 +72,3 @@ } | ||
input: buffer, | ||
maxBuffer: Infinity | ||
maxBuffer: Number.POSITIVE_INFINITY, | ||
}); | ||
@@ -78,1 +78,3 @@ | ||
}; | ||
export default imageminJpegoptim; |
{ | ||
"name": "imagemin-jpegoptim", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"description": "Imagemin plugin for jpegoptim", | ||
"license": "MIT", | ||
"repository": "imagemin/imagemin-jpegoptim", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"author": { | ||
@@ -24,3 +26,3 @@ "name": "Kevin Mårtensson", | ||
"engines": { | ||
"node": ">=10" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -43,11 +45,11 @@ "scripts": { | ||
"dependencies": { | ||
"execa": "^4.0.0", | ||
"is-jpg": "^2.0.0", | ||
"jpegoptim-bin": "^6.0.0" | ||
"execa": "^6.0.0", | ||
"is-jpg": "^3.0.0", | ||
"jpegoptim-bin": "^7.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.8.0", | ||
"ava": "^3.15.0", | ||
"is-progressive": "^3.0.0", | ||
"xo": "^0.30.0" | ||
"xo": "^0.47.0" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# imagemin-jpegoptim [![Build Status](https://travis-ci.org/imagemin/imagemin-jpegoptim.svg?branch=master)](https://travis-ci.org/imagemin/imagemin-jpegoptim) | ||
# imagemin-jpegoptim | ||
> [Imagemin](https://github.com/imagemin/imagemin) plugin for [jpegoptim](https://github.com/tjko/jpegoptim) | ||
## Install | ||
@@ -14,12 +13,12 @@ | ||
## Usage | ||
```js | ||
const imagemin = require('imagemin'); | ||
const imageminJpegoptim = require('imagemin-jpegoptim'); | ||
import imagemin from 'imagemin'; | ||
import imageminJpegoptim from 'imagemin-jpegoptim'; | ||
(async () => { | ||
await imagemin(['images/*.jpg'], 'build/images', { | ||
use: [ | ||
await imagemin(['images/*.jpg'], { | ||
destination: 'build/images', | ||
plugins: [ | ||
imageminJpegoptim() | ||
@@ -33,6 +32,5 @@ ] | ||
## API | ||
### imageminJpegoptim([options])(buffer) | ||
### imageminJpegoptim(options?)(buffer) | ||
@@ -43,7 +41,7 @@ Returns a `Promise<Buffer>`. | ||
Type: `Object` | ||
Type: `object` | ||
##### progressive | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `false` | ||
@@ -61,3 +59,3 @@ | ||
Type: `number` `string` | ||
Type: `number | string` | ||
@@ -68,3 +66,3 @@ Try to optimize file to given size. Target size is specified either in kilo bytes (`1`-`n`) or as percentage (`1%`-`99%`). | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -78,3 +76,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -86,3 +84,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -94,3 +92,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -102,3 +100,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -110,3 +108,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -116,3 +114,2 @@ | ||
#### buffer | ||
@@ -123,6 +120,1 @@ | ||
Buffer to optimize. | ||
## License | ||
MIT © [Imagemin](https://github.com/imagemin) |
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
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
59
Yes
5108
109
+ Addedexeca@6.1.0(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedhuman-signals@3.0.1(transitive)
+ Addedis-jpg@3.0.0(transitive)
+ Addedis-stream@3.0.0(transitive)
+ Addedjpegoptim-bin@7.1.0(transitive)
+ Addedmimic-fn@4.0.0(transitive)
+ Addednpm-run-path@5.3.0(transitive)
+ Addedonetime@6.0.0(transitive)
+ Addedpath-key@4.0.0(transitive)
+ Addedstrip-final-newline@3.0.0(transitive)
- Removedexeca@4.1.0(transitive)
- Removedget-stream@5.2.0(transitive)
- Removedhuman-signals@1.1.1(transitive)
- Removedis-jpg@2.0.0(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedjpegoptim-bin@6.0.1(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removednpm-run-path@4.0.1(transitive)
- Removedonetime@5.1.2(transitive)
- Removedstrip-final-newline@2.0.0(transitive)
Updatedexeca@^6.0.0
Updatedis-jpg@^3.0.0
Updatedjpegoptim-bin@^7.1.0