@divriots/jampack 0.24.3 → 0.24.4

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
@@ -17,6 +17,8 @@ const default_options = {
17
17
  srcset_min_width: 390 * 2, // HiDPI phone
18
18
  srcset_max_width: 1920 * 2, // 4K
19
19
  max_width: 99999,
20
+ src_include: /^.*$/,
21
+ src_exclude: /^\/vercel\/image\?/, // Ignore /vervel/image? URLs because not local and most likely already optimized,
20
22
  external: {
21
23
  process: 'off',
22
24
  src_include: /^.*$/,
@@ -24,6 +24,8 @@ export type Options = {
24
24
  srcset_min_width: number;
25
25
  srcset_max_width: number;
26
26
  max_width: number;
27
+ src_include: RegExp;
28
+ src_exclude: RegExp | null;
27
29
  external: {
28
30
  process: 'off' | 'download';
29
31
  src_include: RegExp;
package/dist/index.js CHANGED
@@ -65,7 +65,7 @@ program
65
65
  mkdirSync(join(dir, '_jampack'));
66
66
  }
67
67
  catch (e) {
68
- console.error('Failed to create `_jampack` folder.');
68
+ console.error('Folder `_jampack` is present in target folder. This means that jampack has already processed this folder. You should always run jampack on clean build of the static website.');
69
69
  exit(1);
70
70
  }
71
71
  // Inject config into modules
package/dist/optimize.js CHANGED
@@ -220,6 +220,10 @@ async function processImage(htmlfile, img, isAboveTheFold) {
220
220
  });
221
221
  return;
222
222
  }
223
+ if (!isIncluded(attrib_src, config.image.src_include, config.image.src_exclude)) {
224
+ // Setup to ignore
225
+ return;
226
+ }
223
227
  /*
224
228
  * Attribute 'alt'
225
229
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.24.3",
3
+ "version": "0.24.4",
4
4
  "cache-version": {
5
5
  "img": "v1",
6
6
  "img-ext": "v1"
@@ -58,17 +58,18 @@
58
58
  "tslib": "^2.6.2",
59
59
  "typescript": "^5.4.5"
60
60
  },
61
- "engines": {
62
- "node": ">=14.0.0"
63
- },
64
- "bugs": "https://github.com/divriots/jampack/issues",
65
- "keywords": [],
66
- "types": "dist/index.d.ts",
67
61
  "scripts": {
68
62
  "watch": "pnpm build --watch",
69
63
  "try": "shx rm -fr demo && cp -R demo_drc demo && node ./dist/index.js ./demo --nocache",
70
64
  "build": "shx rm -rf dist && tsc -b",
71
65
  "lint": "eslint . --ext .ts --config .eslintrc",
66
+ "prepublishOnly": "pnpm build",
72
67
  "cleanAllDotJampack": "find -s . | grep '.jampack$' | xargs rm -fr"
73
- }
68
+ },
69
+ "engines": {
70
+ "node": ">=14.0.0"
71
+ },
72
+ "bugs": "https://github.com/divriots/jampack/issues",
73
+ "keywords": [],
74
+ "types": "dist/index.d.ts"
74
75
  }