@travetto/email-compiler 5.0.0-rc.9 → 5.0.1
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 +9 -9
- package/src/compiler.ts +2 -2
- package/src/util.ts +4 -3
- package/support/bin/config.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email-compiler",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Email compiling module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
"directory": "module/email-compiler"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/
|
|
30
|
-
"@travetto/
|
|
31
|
-
"@travetto/
|
|
32
|
-
"@travetto/
|
|
33
|
-
"@travetto/
|
|
34
|
-
"@travetto/worker": "^5.0.
|
|
29
|
+
"@travetto/config": "^5.0.1",
|
|
30
|
+
"@travetto/di": "^5.0.1",
|
|
31
|
+
"@travetto/email": "^5.0.1",
|
|
32
|
+
"@travetto/image": "^5.0.1",
|
|
33
|
+
"@travetto/runtime": "^5.0.1",
|
|
34
|
+
"@travetto/worker": "^5.0.1",
|
|
35
35
|
"@types/inline-css": "^3.0.3",
|
|
36
36
|
"html-entities": "^2.5.2",
|
|
37
37
|
"inline-css": "^4.0.2",
|
|
38
38
|
"purgecss": "^6.0.0",
|
|
39
|
-
"sass": "^1.77.
|
|
39
|
+
"sass": "^1.77.8"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@travetto/cli": "^5.0.
|
|
42
|
+
"@travetto/cli": "^5.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@travetto/cli": {
|
package/src/compiler.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import { TypedObject,
|
|
4
|
+
import { TypedObject, RuntimeIndex, watchCompiler, Runtime, BinaryUtil } from '@travetto/runtime';
|
|
5
5
|
import { EmailCompiled, MailUtil, EmailTemplateImport, EmailTemplateModule } from '@travetto/email';
|
|
6
6
|
|
|
7
7
|
import { EmailCompileUtil } from './util';
|
|
@@ -57,7 +57,7 @@ export class EmailCompiler {
|
|
|
57
57
|
await Promise.all(TypedObject.keys(outs).map(async k => {
|
|
58
58
|
if (msg[k]) {
|
|
59
59
|
const content = MailUtil.buildBrand(file, msg[k], 'trv email:compile');
|
|
60
|
-
await
|
|
60
|
+
await BinaryUtil.bufferedFileWrite(outs[k], content);
|
|
61
61
|
} else {
|
|
62
62
|
await fs.rm(outs[k], { force: true }); // Remove file if data not provided
|
|
63
63
|
}
|
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]);
|
package/support/bin/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Runtime, BinaryUtil } from '@travetto/runtime';
|
|
4
4
|
import { parse, stringify } from 'yaml';
|
|
5
5
|
|
|
6
6
|
import { EditorConfigType } from './types';
|
|
@@ -51,7 +51,7 @@ export class EditorConfig {
|
|
|
51
51
|
static async ensureConfig(): Promise<string> {
|
|
52
52
|
const resolved = Runtime.workspaceRelative(CONFIG_FILE);
|
|
53
53
|
if (!(await fs.stat(resolved).catch(() => { }))) {
|
|
54
|
-
await
|
|
54
|
+
await BinaryUtil.bufferedFileWrite(resolved, this.getDefaultConfig());
|
|
55
55
|
}
|
|
56
56
|
return resolved;
|
|
57
57
|
}
|