@travetto/email-compiler 5.0.0-rc.6 → 5.0.0-rc.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/email-compiler",
3
- "version": "5.0.0-rc.6",
3
+ "version": "5.0.0-rc.7",
4
4
  "description": "Email compiling module",
5
5
  "keywords": [
6
6
  "email",
@@ -26,12 +26,12 @@
26
26
  "directory": "module/email-compiler"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/runtime": "^5.0.0-rc.6",
30
- "@travetto/config": "^5.0.0-rc.6",
31
- "@travetto/di": "^5.0.0-rc.6",
32
- "@travetto/email": "^5.0.0-rc.6",
33
- "@travetto/image": "^5.0.0-rc.6",
34
- "@travetto/worker": "^5.0.0-rc.6",
29
+ "@travetto/runtime": "^5.0.0-rc.7",
30
+ "@travetto/config": "^5.0.0-rc.7",
31
+ "@travetto/di": "^5.0.0-rc.7",
32
+ "@travetto/email": "^5.0.0-rc.7",
33
+ "@travetto/image": "^5.0.0-rc.7",
34
+ "@travetto/worker": "^5.0.0-rc.7",
35
35
  "@types/inline-css": "^3.0.3",
36
36
  "html-entities": "^2.5.2",
37
37
  "inline-css": "^4.0.2",
@@ -39,7 +39,7 @@
39
39
  "sass": "^1.77.6"
40
40
  },
41
41
  "peerDependencies": {
42
- "@travetto/cli": "^5.0.0-rc.6"
42
+ "@travetto/cli": "^5.0.0-rc.7"
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, Util, RuntimeIndex, watchCompiler } from '@travetto/runtime';
4
+ import { TypedObject, Util, RuntimeIndex, watchCompiler, Runtime } from '@travetto/runtime';
5
5
  import { EmailCompiled, MailUtil, EmailTemplateImport, EmailTemplateModule } from '@travetto/email';
6
6
 
7
7
  import { EmailCompileUtil } from './util';
@@ -15,13 +15,9 @@ export class EmailCompiler {
15
15
  * Load Template
16
16
  */
17
17
  static async loadTemplate(file: string): Promise<EmailTemplateModule> {
18
- const entry = RuntimeIndex.getEntry(file);
19
- const mod = entry ? RuntimeIndex.getModule(entry.module) : undefined;
20
- if (!entry || !mod) {
21
- throw new Error(`Unable to find template for ${file}`);
22
- }
23
- const root: EmailTemplateImport = (await import(entry.outputFile)).default;
24
- return await root.prepare({ file, module: mod.name });
18
+ const root = (await Runtime.importFrom<{ default: EmailTemplateImport }>(file)).default;
19
+ const entry = RuntimeIndex.getEntry(file)!;
20
+ return await root.prepare({ file, module: entry.module });
25
21
  }
26
22
 
27
23
  /**
package/src/util.ts CHANGED
@@ -140,7 +140,7 @@ export class EmailCompileUtil {
140
140
  const output = await ImageConverter.optimize(
141
141
  ext === '.png' ? 'png' : 'jpeg', await opts.loader.readStream(src)
142
142
  );
143
- const buffer = toBuffer(output);
143
+ const buffer = await toBuffer(output);
144
144
  pendingImages.push([token, ext, buffer]);
145
145
  } else {
146
146
  pendingImages.push([token, ext, opts.loader.read(src, true)]);