@divriots/jampack 0.11.5 → 0.11.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/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
@@ -18,7 +18,6 @@ export async function compressCSS(originalCode, type) {
18
18
  catch (e) {
19
19
  // Error while processing with lightningcss
20
20
  // Take original code
21
- // TODO catch SyntaxError and report a Warning
22
21
  }
23
22
  let resultBuffer = undefined;
24
23
  if (lightCSSData && lightCSSData.length < originalCode.length) {
@@ -5,6 +5,11 @@ const default_options = {
5
5
  image: {
6
6
  embed_size: 1500,
7
7
  srcset_min_width: 640,
8
+ external: {
9
+ process: 'download',
10
+ src_include: /.*/,
11
+ src_exclude: null,
12
+ },
8
13
  compress: true,
9
14
  jpeg: {
10
15
  options: {
@@ -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' | 'add-dimensions-only' | 'off';
15
+ src_include: RegExp | undefined;
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
@@ -184,9 +184,21 @@ 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
- // Image not local, don't touch it
189
- return;
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 'add-dimensions-only':
199
+ // Only add dimensions of image
200
+ return;
201
+ }
190
202
  }
191
203
  /*
192
204
  * Loading image
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.11.5",
3
+ "version": "0.11.6",
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
+ }