@travetto/email-compiler 5.0.0-rc.8 → 5.0.0

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.8",
3
+ "version": "5.0.0",
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/runtime": "^5.0.0-rc.8",
30
- "@travetto/config": "^5.0.0-rc.8",
31
- "@travetto/di": "^5.0.0-rc.8",
32
- "@travetto/email": "^5.0.0-rc.8",
33
- "@travetto/image": "^5.0.0-rc.8",
34
- "@travetto/worker": "^5.0.0-rc.8",
29
+ "@travetto/config": "^5.0.0",
30
+ "@travetto/di": "^5.0.0",
31
+ "@travetto/email": "^5.0.0",
32
+ "@travetto/image": "^5.0.0",
33
+ "@travetto/runtime": "^5.0.0",
34
+ "@travetto/worker": "^5.0.0",
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.6"
39
+ "sass": "^1.77.8"
40
40
  },
41
41
  "peerDependencies": {
42
- "@travetto/cli": "^5.0.0-rc.8"
42
+ "@travetto/cli": "^5.0.0"
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, Runtime } from '@travetto/runtime';
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 Util.bufferedFileWrite(outs[k], content);
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 { ImageConverter } from '@travetto/image';
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 ImageConverter.optimize(
141
- ext === '.png' ? 'png' : 'jpeg', await opts.loader.readStream(src)
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]);
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
2
 
3
- import { Util, Runtime } from '@travetto/runtime';
3
+ import { Runtime, BinaryUtil } from '@travetto/runtime';
4
4
  import { parse, stringify } from 'yaml';
5
5
 
6
6
  import { EditorConfigType } from './types';
@@ -40,8 +40,7 @@ export class EditorConfig {
40
40
  const data: EditorConfigType = parse(content) ?? {};
41
41
  return key ? data[key] : data;
42
42
  } catch {
43
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
44
- return {} as EditorConfigType;
43
+ return { to: undefined!, from: undefined! };
45
44
  }
46
45
  }
47
46
 
@@ -52,7 +51,7 @@ export class EditorConfig {
52
51
  static async ensureConfig(): Promise<string> {
53
52
  const resolved = Runtime.workspaceRelative(CONFIG_FILE);
54
53
  if (!(await fs.stat(resolved).catch(() => { }))) {
55
- await Util.bufferedFileWrite(resolved, this.getDefaultConfig());
54
+ await BinaryUtil.bufferedFileWrite(resolved, this.getDefaultConfig());
56
55
  }
57
56
  return resolved;
58
57
  }
@@ -29,7 +29,7 @@ export class EditorSendService {
29
29
  DependencyRegistry.install(cls, { curr: cls, type: 'added' });
30
30
 
31
31
  this.ethereal = !!senderConfig.host?.includes('ethereal.email');
32
- } catch (err) {
32
+ } catch {
33
33
  console.error('A mail transport is currently needed to support sending emails. Please install @travetto/email-nodemailer or any other compatible transport');
34
34
  throw new Error('A mail transport is currently needed to support sending emails. Please install @travetto/email-nodemailer or any other compatible transport');
35
35
  }
@@ -47,8 +47,8 @@ export class EditorSendService {
47
47
  const svc = await this.service();
48
48
  if (this.ethereal) {
49
49
  const { getTestMessageUrl } = await import('nodemailer');
50
- const { default: smtp } = await import('nodemailer/lib/smtp-transport/index');
51
- type SendMessage = Parameters<Parameters<(typeof smtp)['prototype']['send']>[1]>[1];
50
+ const { default: _smtp } = await import('nodemailer/lib/smtp-transport/index');
51
+ type SendMessage = Parameters<Parameters<(typeof _smtp)['prototype']['send']>[1]>[1];
52
52
  const info = await svc.send<SendMessage>(message);
53
53
  const url = getTestMessageUrl(info);
54
54
  console.log('Sent email', { to, url });