@divriots/jampack 0.23.2 → 0.23.3

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.
@@ -1,3 +1,4 @@
1
+ import type { UrlTransformer } from 'unpic';
1
2
  export type WebpOptions = {
2
3
  effort: number;
3
4
  mode: 'lossless' | 'lossly';
@@ -32,6 +33,7 @@ export type Options = {
32
33
  process: 'off' | 'optimize';
33
34
  src_include: RegExp;
34
35
  src_exclude: RegExp | null;
36
+ transformer?: UrlTransformer;
35
37
  };
36
38
  compress: boolean;
37
39
  jpeg: {
package/dist/optimize.js CHANGED
@@ -275,10 +275,13 @@ async function processImage(htmlfile, img, isAboveTheFold) {
275
275
  case 'off':
276
276
  break;
277
277
  case 'optimize':
278
- const canonical = getCanonicalCdnForUrl(attrib_src);
279
- if (!canonical)
280
- break;
281
- const cdnTransformer = getTransformer(canonical.cdn);
278
+ let cdnTransformer = config.image.cdn.transformer;
279
+ if (!cdnTransformer) {
280
+ const canonical = getCanonicalCdnForUrl(attrib_src);
281
+ if (!canonical)
282
+ break;
283
+ cdnTransformer = getTransformer(canonical.cdn);
284
+ }
282
285
  if (!cdnTransformer)
283
286
  break;
284
287
  if (!isIncluded(attrib_src, config.image.cdn.src_include, config.image.cdn.src_exclude))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divriots/jampack",
3
- "version": "0.23.2",
3
+ "version": "0.23.3",
4
4
  "cache-version": {
5
5
  "img": "v1",
6
6
  "img-ext": "v1"