@travetto/email-compiler 5.0.0-rc.11 → 5.0.0-rc.12
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/package.json +2 -2
- package/src/util.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email-compiler",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.12",
|
|
4
4
|
"description": "Email compiling module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@travetto/config": "^5.0.0-rc.11",
|
|
30
30
|
"@travetto/di": "^5.0.0-rc.10",
|
|
31
31
|
"@travetto/email": "^5.0.0-rc.11",
|
|
32
|
-
"@travetto/image": "^5.0.0-rc.
|
|
32
|
+
"@travetto/image": "^5.0.0-rc.11",
|
|
33
33
|
"@travetto/runtime": "^5.0.0-rc.10",
|
|
34
34
|
"@travetto/worker": "^5.0.0-rc.10",
|
|
35
35
|
"@types/inline-css": "^3.0.3",
|
package/src/util.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { buffer as toBuffer } from 'node:stream/consumers';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
5
|
import { EmailCompiled, EmailTemplateModule, EmailTemplateResource } from '@travetto/email';
|
|
6
|
-
import {
|
|
6
|
+
import { ImageUtil } from '@travetto/image';
|
|
7
7
|
|
|
8
8
|
type Tokenized = {
|
|
9
9
|
text: string;
|
|
@@ -137,8 +137,9 @@ export class EmailCompileUtil {
|
|
|
137
137
|
for (const [token, src] of tokens) {
|
|
138
138
|
const ext = path.extname(src);
|
|
139
139
|
if (/^[.](jpe?g|png)$/.test(ext)) {
|
|
140
|
-
const output = await
|
|
141
|
-
|
|
140
|
+
const output = await ImageUtil.optimize(
|
|
141
|
+
await opts.loader.readStream(src),
|
|
142
|
+
{ format: ext === '.png' ? 'png' : 'jpeg' }
|
|
142
143
|
);
|
|
143
144
|
const buffer = await toBuffer(output);
|
|
144
145
|
pendingImages.push([token, ext, buffer]);
|