@divriots/jampack 0.1.4 → 0.1.6
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/dist/compress.d.ts +0 -1
- package/dist/compress.js +2 -2
- package/dist/optimize.js +3 -4
- package/package.json +1 -1
package/dist/compress.d.ts
CHANGED
package/dist/compress.js
CHANGED
|
@@ -41,7 +41,7 @@ const processFile = async (file, stats) => {
|
|
|
41
41
|
case '.jpg':
|
|
42
42
|
case '.jpeg':
|
|
43
43
|
case '.webp':
|
|
44
|
-
|
|
44
|
+
//case '.gif':
|
|
45
45
|
const newImageData = await compressImageFile(file);
|
|
46
46
|
if (newImageData && newImageData.length < result.originalSize) {
|
|
47
47
|
writeData = newImageData;
|
|
@@ -99,7 +99,7 @@ export const compressImage = async (data, resize) => {
|
|
|
99
99
|
case 'jpg':
|
|
100
100
|
case 'jpeg':
|
|
101
101
|
case 'webp':
|
|
102
|
-
|
|
102
|
+
//case 'gif':
|
|
103
103
|
return await sharpFile.resize({ ...resize, fit: 'fill', withoutEnlargement: true }).toBuffer();
|
|
104
104
|
}
|
|
105
105
|
return undefined;
|
package/dist/optimize.js
CHANGED
|
@@ -8,7 +8,6 @@ import options from './options.js';
|
|
|
8
8
|
import { compressImage } from './compress.js';
|
|
9
9
|
import svgToMiniDataURI from 'mini-svg-data-uri';
|
|
10
10
|
import globalState from './state.js';
|
|
11
|
-
import { exit } from 'process';
|
|
12
11
|
async function analyse(file) {
|
|
13
12
|
console.log('Processing ' + file);
|
|
14
13
|
const html = (await fs.readFile(path.join(globalState.dir, file))).toString();
|
|
@@ -109,7 +108,7 @@ async function processImage(file, $, imgElement) {
|
|
|
109
108
|
case 'jpeg':
|
|
110
109
|
case 'png':
|
|
111
110
|
case 'webp':
|
|
112
|
-
|
|
111
|
+
//case 'gif':
|
|
113
112
|
// TODO
|
|
114
113
|
break;
|
|
115
114
|
}
|
|
@@ -191,8 +190,8 @@ async function processImage(file, $, imgElement) {
|
|
|
191
190
|
catch (e) {
|
|
192
191
|
console.error('Error while processing image');
|
|
193
192
|
console.error(e);
|
|
194
|
-
// exit here
|
|
195
|
-
exit(1);
|
|
193
|
+
// exit here
|
|
194
|
+
// exit(1);
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
function setImageSize(img, meta) {
|