@travetto/email-compiler 4.1.2 → 5.0.0-rc.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 ArcSine Technologies
3
+ Copyright (c) 2023 ArcSine Technologies
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/email-compiler",
3
- "version": "4.1.2",
3
+ "version": "5.0.0-rc.0",
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/base": "^4.1.2",
30
- "@travetto/config": "^4.1.2",
31
- "@travetto/di": "^4.1.1",
32
- "@travetto/email": "^4.1.1",
33
- "@travetto/image": "^4.1.1",
34
- "@travetto/worker": "^4.1.1",
29
+ "@travetto/base": "^5.0.0-rc.0",
30
+ "@travetto/config": "^5.0.0-rc.0",
31
+ "@travetto/di": "^5.0.0-rc.0",
32
+ "@travetto/email": "^5.0.0-rc.0",
33
+ "@travetto/image": "^5.0.0-rc.0",
34
+ "@travetto/worker": "^5.0.0-rc.0",
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": "^4.1.2"
42
+ "@travetto/cli": "^5.0.0-rc.0"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
45
  "@travetto/cli": {
package/src/compiler.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import fs from 'node:fs/promises';
2
+ import path from 'node:path';
2
3
 
3
4
  import { TypedObject, Util, watchCompiler } from '@travetto/base';
4
5
  import { EmailCompiled, MailUtil, EmailTemplateImport, EmailTemplateModule } from '@travetto/email';
5
- import { RuntimeIndex, path } from '@travetto/manifest';
6
+ import { RuntimeIndex } from '@travetto/manifest';
6
7
 
7
8
  import { EmailCompileUtil } from './util';
8
9
 
package/src/util.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import util from 'node:util';
2
- import { pipeline } from 'node:stream/promises';
2
+ import { buffer as toBuffer } from 'node:stream/consumers';
3
+ import path from 'node:path';
3
4
 
4
- import { MemoryWritable } from '@travetto/base';
5
5
  import { EmailCompiled, EmailTemplateModule, EmailTemplateResource } from '@travetto/email';
6
6
  import { ImageConverter } from '@travetto/image';
7
- import { path } from '@travetto/manifest';
8
7
 
9
8
  type Tokenized = {
10
9
  text: string;
@@ -141,9 +140,8 @@ export class EmailCompileUtil {
141
140
  const output = await ImageConverter.optimize(
142
141
  ext === '.png' ? 'png' : 'jpeg', await opts.loader.readStream(src)
143
142
  );
144
- const buffer = new MemoryWritable();
145
- await pipeline(output, buffer);
146
- pendingImages.push([token, ext, buffer.toBuffer()]);
143
+ const buffer = toBuffer(output);
144
+ pendingImages.push([token, ext, buffer]);
147
145
  } else {
148
146
  pendingImages.push([token, ext, opts.loader.read(src, true)]);
149
147
  }
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
 
3
3
  import { RuntimeContext } from '@travetto/manifest';
4
- import { YamlUtil } from '@travetto/yaml';
4
+ import { parse, stringify } from 'yaml';
5
5
  import { Util } from '@travetto/base';
6
6
 
7
7
  import { EditorConfigType } from './types';
@@ -38,7 +38,7 @@ export class EditorConfig {
38
38
  try {
39
39
  const resolved = RuntimeContext.workspaceRelative(CONFIG_FILE);
40
40
  const content = await fs.readFile(resolved, 'utf8');
41
- const data = YamlUtil.parse<EditorConfigType>(content);
41
+ const data: EditorConfigType = parse(content) ?? {};
42
42
  return key ? data[key] : data;
43
43
  } catch {
44
44
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
@@ -47,7 +47,7 @@ export class EditorConfig {
47
47
  }
48
48
 
49
49
  static getDefaultConfig(): string {
50
- return YamlUtil.serialize(this.DEFAULT_CONFIG);
50
+ return stringify(this.DEFAULT_CONFIG);
51
51
  }
52
52
 
53
53
  static async ensureConfig(): Promise<string> {
@@ -1,4 +1,5 @@
1
- import { path } from '@travetto/manifest';
1
+ import path from 'node:path';
2
+
2
3
  import { RootRegistry } from '@travetto/registry';
3
4
  import { CliCommandShape, CliCommand } from '@travetto/cli';
4
5
  import { DependencyRegistry } from '@travetto/di';