@divriots/jampack 0.11.5 → 0.11.7
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/config-default.js +5 -0
- package/dist/config-types.d.ts +5 -0
- package/dist/index.js +0 -0
- package/dist/optimize.js +18 -3
- package/package.json +9 -9
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/config-default.js
CHANGED
package/dist/config-types.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export type Options = {
|
|
|
10
10
|
image: {
|
|
11
11
|
embed_size: number;
|
|
12
12
|
srcset_min_width: number;
|
|
13
|
+
external: {
|
|
14
|
+
process: 'download' | 'cdn-srcset-when-possible' | 'add-dimensions-only' | 'off';
|
|
15
|
+
src_include: RegExp;
|
|
16
|
+
src_exclude: RegExp | null;
|
|
17
|
+
};
|
|
13
18
|
compress: boolean;
|
|
14
19
|
jpeg: {
|
|
15
20
|
options: {
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/optimize.js
CHANGED
|
@@ -80,7 +80,7 @@ async function analyse(file) {
|
|
|
80
80
|
}
|
|
81
81
|
// Add CSS to head
|
|
82
82
|
if (config.html.add_css_reset_as === 'inline') {
|
|
83
|
-
const CSS = `<style>:where(img){height:auto;
|
|
83
|
+
const CSS = `<style>:where(img){height:auto;}</style>`;
|
|
84
84
|
const heads = $('head');
|
|
85
85
|
if (heads.length > 0) {
|
|
86
86
|
heads.prepend(CSS);
|
|
@@ -184,9 +184,24 @@ async function processImage(htmlfile, $, imgElement, isAboveTheFold) {
|
|
|
184
184
|
* Attribute 'decoding'
|
|
185
185
|
*/
|
|
186
186
|
img.attr('decoding', 'async');
|
|
187
|
+
/*
|
|
188
|
+
* Check for external images
|
|
189
|
+
*/
|
|
187
190
|
if (!isLocal(attrib_src)) {
|
|
188
|
-
|
|
189
|
-
|
|
191
|
+
switch (config.image.external.process) {
|
|
192
|
+
case 'off':
|
|
193
|
+
// Don't process external images
|
|
194
|
+
return;
|
|
195
|
+
case 'download':
|
|
196
|
+
// Download external image for local processing
|
|
197
|
+
break;
|
|
198
|
+
case 'cdn-srcset-when-possible':
|
|
199
|
+
// Use unpic to use CDN capabilities
|
|
200
|
+
throw new Error('External images with `cdn-srcset-when-possible` is not implemented yet.');
|
|
201
|
+
case 'add-dimensions-only':
|
|
202
|
+
// Only add dimensions of image
|
|
203
|
+
throw new Error('External images with `add-dimensions-only` is not implemented yet.');
|
|
204
|
+
}
|
|
190
205
|
}
|
|
191
206
|
/*
|
|
192
207
|
* Loading image
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@divriots/jampack",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.7",
|
|
4
4
|
"description": "Packer for static websites",
|
|
5
5
|
"author": "Georges Gomes @georges-gomes",
|
|
6
6
|
"bin": {
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"tslib": "^2.5.0",
|
|
42
42
|
"typescript": "^5.0.4"
|
|
43
43
|
},
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=14.0.0"
|
|
46
|
-
},
|
|
47
|
-
"bugs": "https://github.com/divriots/jampack/issues",
|
|
48
|
-
"keywords": [],
|
|
49
|
-
"types": "dist/index.d.ts",
|
|
50
44
|
"scripts": {
|
|
51
45
|
"watch": "pnpm build --watch",
|
|
52
46
|
"try": "shx rm -fr demo && cp -R demo_rf demo && node ./dist/index.js ./demo --nocache --onlyoptim",
|
|
53
47
|
"build": "shx rm -rf dist && tsc -b",
|
|
54
48
|
"lint": "eslint . --ext .ts --config .eslintrc"
|
|
55
|
-
}
|
|
56
|
-
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=14.0.0"
|
|
52
|
+
},
|
|
53
|
+
"bugs": "https://github.com/divriots/jampack/issues",
|
|
54
|
+
"keywords": [],
|
|
55
|
+
"types": "dist/index.d.ts"
|
|
56
|
+
}
|