@depup/imagemin-mozjpeg 10.0.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @depup/imagemin-mozjpeg
2
+
3
+ > Dependency-bumped version of [imagemin-mozjpeg](https://www.npmjs.com/package/imagemin-mozjpeg)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/imagemin-mozjpeg
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [imagemin-mozjpeg](https://www.npmjs.com/package/imagemin-mozjpeg) @ 10.0.0 |
17
+ | Processed | 2026-03-19 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 1 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | execa | ^6.0.0 | ^9.6.1 |
26
+
27
+ ---
28
+
29
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/imagemin-mozjpeg
30
+
31
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "bumped": {
3
+ "execa": {
4
+ "from": "^6.0.0",
5
+ "to": "^9.6.1"
6
+ }
7
+ },
8
+ "timestamp": "2026-03-19T03:28:27.934Z",
9
+ "totalUpdated": 1
10
+ }
package/index.js ADDED
@@ -0,0 +1,118 @@
1
+ import {Buffer} from 'node:buffer';
2
+ import {execa} from 'execa';
3
+ import isJpg from 'is-jpg';
4
+ import mozjpeg from 'mozjpeg';
5
+
6
+ const imageminMozjpeg = options => async buffer => {
7
+ options = {
8
+ trellis: true,
9
+ trellisDC: true,
10
+ overshoot: true,
11
+ ...options,
12
+ };
13
+
14
+ if (!Buffer.isBuffer(buffer)) {
15
+ return Promise.reject(new TypeError('Expected a buffer'));
16
+ }
17
+
18
+ if (!isJpg(buffer)) {
19
+ return Promise.resolve(buffer);
20
+ }
21
+
22
+ // TODO: Remove these sometime far in the future
23
+ if (options.fastcrush) {
24
+ return Promise.reject(new Error('Option `fastcrush` was renamed to `fastCrush`'));
25
+ }
26
+
27
+ if (options.maxmemory) {
28
+ return Promise.reject(new Error('Option `maxmemory` was renamed to `maxMemory`'));
29
+ }
30
+
31
+ if (options.notrellis) {
32
+ return Promise.reject(new Error('Option `notrellis` was renamed to `trellis` and inverted'));
33
+ }
34
+
35
+ if (options.noovershoot) {
36
+ return Promise.reject(new Error('Option `noovershoot` was renamed to `overshoot` and inverted'));
37
+ }
38
+
39
+ const args = [];
40
+
41
+ if (typeof options.quality !== 'undefined') {
42
+ args.push('-quality', options.quality);
43
+ }
44
+
45
+ if (options.progressive === false) {
46
+ args.push('-baseline');
47
+ }
48
+
49
+ if (options.targa) {
50
+ args.push('-targa');
51
+ }
52
+
53
+ if (options.revert) {
54
+ args.push('-revert');
55
+ }
56
+
57
+ if (options.fastCrush) {
58
+ args.push('-fastcrush');
59
+ }
60
+
61
+ if (typeof options.dcScanOpt !== 'undefined') {
62
+ args.push('-dc-scan-opt', options.dcScanOpt);
63
+ }
64
+
65
+ if (!options.trellis) {
66
+ args.push('-notrellis');
67
+ }
68
+
69
+ if (!options.trellisDC) {
70
+ args.push('-notrellis-dc');
71
+ }
72
+
73
+ if (options.tune) {
74
+ args.push(`-tune-${options.tune}`);
75
+ }
76
+
77
+ if (!options.overshoot) {
78
+ args.push('-noovershoot');
79
+ }
80
+
81
+ if (options.arithmetic) {
82
+ args.push('-arithmetic');
83
+ }
84
+
85
+ if (options.dct) {
86
+ args.push('-dct', options.dct);
87
+ }
88
+
89
+ if (options.quantBaseline) {
90
+ args.push('-quant-baseline', options.quantBaseline);
91
+ }
92
+
93
+ if (typeof options.quantTable !== 'undefined') {
94
+ args.push('-quant-table', options.quantTable);
95
+ }
96
+
97
+ if (options.smooth) {
98
+ args.push('-smooth', options.smooth);
99
+ }
100
+
101
+ if (options.maxMemory) {
102
+ args.push('-maxmemory', options.maxMemory);
103
+ }
104
+
105
+ if (options.sample) {
106
+ args.push('-sample', options.sample.join(','));
107
+ }
108
+
109
+ const {stdout} = await execa(mozjpeg, args, {
110
+ encoding: null,
111
+ input: buffer,
112
+ maxBuffer: Number.POSITIVE_INFINITY,
113
+ });
114
+
115
+ return stdout;
116
+ };
117
+
118
+ export default imageminMozjpeg;
package/license ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Imagemin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@depup/imagemin-mozjpeg",
3
+ "version": "10.0.0-depup.0",
4
+ "description": "Imagemin plugin for mozjpeg (with updated dependencies)",
5
+ "license": "MIT",
6
+ "repository": "imagemin/imagemin-mozjpeg",
7
+ "type": "module",
8
+ "exports": "./index.js",
9
+ "author": {
10
+ "name": "Kevin Mårtensson",
11
+ "email": "kevinmartensson@gmail.com",
12
+ "url": "github.com/kevva"
13
+ },
14
+ "maintainers": [
15
+ {
16
+ "name": "Sindre Sorhus",
17
+ "email": "sindresorhus@gmail.com",
18
+ "url": "sindresorhus.com"
19
+ },
20
+ {
21
+ "name": "Shinnosuke Watanabe",
22
+ "url": "github.com/shinnn"
23
+ }
24
+ ],
25
+ "engines": {
26
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
27
+ },
28
+ "scripts": {
29
+ "test": "xo && ava"
30
+ },
31
+ "files": [
32
+ "index.js",
33
+ "changes.json",
34
+ "README.md"
35
+ ],
36
+ "keywords": [
37
+ "imagemin-mozjpeg",
38
+ "depup",
39
+ "updated-dependencies",
40
+ "security",
41
+ "latest",
42
+ "patched",
43
+ "compress",
44
+ "image",
45
+ "imageminplugin",
46
+ "img",
47
+ "jpeg",
48
+ "jpg",
49
+ "minify",
50
+ "mozjpeg",
51
+ "optimize"
52
+ ],
53
+ "dependencies": {
54
+ "execa": "^9.6.1",
55
+ "is-jpg": "^3.0.0",
56
+ "mozjpeg": "^8.0.0"
57
+ },
58
+ "devDependencies": {
59
+ "ava": "^3.15.0",
60
+ "is-progressive": "^3.0.0",
61
+ "xo": "^0.47.0"
62
+ },
63
+ "depup": {
64
+ "changes": {
65
+ "execa": {
66
+ "from": "^6.0.0",
67
+ "to": "^9.6.1"
68
+ }
69
+ },
70
+ "depsUpdated": 1,
71
+ "originalPackage": "imagemin-mozjpeg",
72
+ "originalVersion": "10.0.0",
73
+ "processedAt": "2026-03-19T03:28:39.792Z",
74
+ "smokeTest": "passed"
75
+ }
76
+ }
package/readme.md ADDED
@@ -0,0 +1,172 @@
1
+ # imagemin-mozjpeg
2
+
3
+ > [Imagemin](https://github.com/imagemin/imagemin) plugin for [mozjpeg](https://github.com/mozilla/mozjpeg)
4
+
5
+ ## Install
6
+
7
+ ```
8
+ $ npm install imagemin-mozjpeg
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import imagemin from 'imagemin';
15
+ import imageminMozjpeg from 'imagemin-mozjpeg';
16
+
17
+ (async () => {
18
+ await imagemin(['images/*.jpg'], {
19
+ destination: 'build/images',
20
+ plugins: [
21
+ imageminMozjpeg()
22
+ ]
23
+ });
24
+
25
+ console.log('Images optimized');
26
+ })();
27
+ ```
28
+
29
+ ## API
30
+
31
+ ### imageminMozjpeg(options?)(buffer)
32
+
33
+ Returns a `Promise<Buffer>`.
34
+
35
+ #### options
36
+
37
+ Type: `object`
38
+
39
+ ##### quality
40
+
41
+ Type: `number`
42
+
43
+ Compression quality, in range `0` (worst) to `100` (perfect).
44
+
45
+ ##### progressive
46
+
47
+ Type: `boolean`\
48
+ Default: `true`
49
+
50
+ `false` creates baseline JPEG file.
51
+
52
+ ##### targa
53
+
54
+ Type: `boolean`\
55
+ Default: `false`
56
+
57
+ Input file is Targa format (usually not needed).
58
+
59
+ ##### revert
60
+
61
+ Type: `boolean`\
62
+ Default: `false`
63
+
64
+ Revert to standard defaults instead of mozjpeg defaults.
65
+
66
+ ##### fastCrush
67
+
68
+ Type: `boolean`\
69
+ Default: `false`
70
+
71
+ Disable progressive scan optimization.
72
+
73
+ ##### dcScanOpt
74
+
75
+ Type: `number`\
76
+ Default: `1`
77
+
78
+ Set DC scan optimization mode.
79
+
80
+ - `0` One scan for all components
81
+ - `1` One scan per component
82
+ - `2` Optimize between one scan for all components and one scan for 1st component plus one scan for remaining components
83
+
84
+ ##### trellis
85
+
86
+ Type: `boolean`\
87
+ Default: `true`
88
+
89
+ [Trellis optimization](https://en.wikipedia.org/wiki/Trellis_quantization).
90
+
91
+ ##### trellisDC
92
+
93
+ Type: `boolean`\
94
+ Default: `true`
95
+
96
+ Trellis optimization of DC coefficients.
97
+
98
+ ##### tune
99
+
100
+ Type: `string`\
101
+ Default: `hvs-psnr`
102
+
103
+ Set Trellis optimization method. Available methods: `psnr`, `hvs-psnr`, `ssim`, `ms-ssim`
104
+
105
+ ##### overshoot
106
+
107
+ Type: `boolean`\
108
+ Default: `true`
109
+
110
+ Black-on-white deringing via overshoot.
111
+
112
+ ##### arithmetic
113
+
114
+ Type: `boolean`\
115
+ Default: `false`
116
+
117
+ Use [arithmetic coding](https://en.wikipedia.org/wiki/Arithmetic_coding).
118
+
119
+ ##### dct
120
+
121
+ Type: `string`\
122
+ Default: `int`
123
+
124
+ Set [DCT](https://en.wikipedia.org/wiki/Discrete_cosine_transform) method:
125
+
126
+ - `int` Use integer DCT
127
+ - `fast` Use fast integer DCT (less accurate)
128
+ - `float` Use floating-point DCT
129
+
130
+ ##### quantBaseline
131
+
132
+ Type: `boolean`\
133
+ Default: `false`
134
+
135
+ Use 8-bit quantization table entries for baseline JPEG compatibility.
136
+
137
+ ##### quantTable
138
+
139
+ Type: `number`
140
+
141
+ Use predefined quantization table.
142
+
143
+ - `0` JPEG Annex K
144
+ - `1` Flat
145
+ - `2` Custom, tuned for MS-SSIM
146
+ - `3` ImageMagick table by N. Robidoux
147
+ - `4` Custom, tuned for PSNR-HVS
148
+ - `5` Table from paper by Klein, Silverstein and Carney
149
+
150
+ ##### smooth
151
+
152
+ Type: `number`
153
+
154
+ Set the strength of smooth dithered input. (1...100)
155
+
156
+ ##### maxMemory
157
+
158
+ Type: `number`
159
+
160
+ Set the maximum memory to use in kilobytes.
161
+
162
+ ##### sample
163
+
164
+ Type: `string[]`
165
+
166
+ Set component sampling factors. Each item should be in the format `HxV`, for example `2x1`.
167
+
168
+ #### buffer
169
+
170
+ Type: `buffer`
171
+
172
+ Buffer to optimize.