@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.
- package/dist/config-types.d.ts +2 -0
- package/dist/optimize.js +7 -4
- package/package.json +1 -1
package/dist/config-types.d.ts
CHANGED
|
@@ -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
|
-
|
|
279
|
-
if (!
|
|
280
|
-
|
|
281
|
-
|
|
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))
|