@travetto/email 5.0.0-rc.0 → 5.0.0-rc.2
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 +4 -4
- package/src/resource.ts +3 -4
- package/src/service.ts +2 -2
- package/src/template.ts +1 -1
- package/src/types.ts +1 -1
- package/src/util.ts +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"description": "Email transmission module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"directory": "module/email"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@travetto/
|
|
27
|
-
"@travetto/config": "^5.0.0-rc.
|
|
28
|
-
"@travetto/di": "^5.0.0-rc.
|
|
26
|
+
"@travetto/runtime": "^5.0.0-rc.2",
|
|
27
|
+
"@travetto/config": "^5.0.0-rc.2",
|
|
28
|
+
"@travetto/di": "^5.0.0-rc.2",
|
|
29
29
|
"@types/mustache": "^4.2.5",
|
|
30
30
|
"mustache": "^4.2.0"
|
|
31
31
|
},
|
package/src/resource.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AppError, Env, FileLoader } from '@travetto/
|
|
2
|
-
import { RuntimeIndex } from '@travetto/manifest';
|
|
1
|
+
import { AppError, Env, FileLoader, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
3
2
|
|
|
4
3
|
/** Build a resource loader that looks into a module and it's dependencies */
|
|
5
4
|
export class EmailResourceLoader extends FileLoader {
|
|
@@ -8,12 +7,12 @@ export class EmailResourceLoader extends FileLoader {
|
|
|
8
7
|
if (!mod) {
|
|
9
8
|
throw new AppError(`Unknown module - ${module}`, 'notfound', { module });
|
|
10
9
|
}
|
|
11
|
-
super([
|
|
10
|
+
super(Runtime.modulePaths([
|
|
12
11
|
...Env.TRV_RESOURCES.list ?? [],
|
|
13
12
|
`${module}#resources`,
|
|
14
13
|
...RuntimeIndex.getDependentModules(mod, 'children').map(x => `${x.name}#resources`),
|
|
15
14
|
'@@#resources',
|
|
16
15
|
...globalResources ?? []
|
|
17
|
-
]);
|
|
16
|
+
]));
|
|
18
17
|
}
|
|
19
18
|
}
|
package/src/service.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Runtime, RuntimeResources } from '@travetto/runtime';
|
|
2
2
|
import { Injectable } from '@travetto/di';
|
|
3
3
|
|
|
4
4
|
import { EmailCompiled, EmailOptions, SentEmail } from './types';
|
|
@@ -30,7 +30,7 @@ export class MailService {
|
|
|
30
30
|
* Get compiled content by key
|
|
31
31
|
*/
|
|
32
32
|
async getCompiled(key: string): Promise<EmailCompiled> {
|
|
33
|
-
if (
|
|
33
|
+
if (Runtime.dynamic || !this.#compiled.has(key)) {
|
|
34
34
|
const [html, text, subject] = await Promise.all([
|
|
35
35
|
RuntimeResources.read(`${key}.compiled.html`),
|
|
36
36
|
RuntimeResources.read(`${key}.compiled.text`),
|
package/src/template.ts
CHANGED
package/src/types.ts
CHANGED
package/src/util.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Util, Runtime } from '@travetto/runtime';
|
|
2
2
|
|
|
3
3
|
import { EmailAttachment, EmailIdentity, EmailIdentityList, EmailOptions } from './types';
|
|
4
|
-
import { Util } from '@travetto/base';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Utilities for email
|
|
@@ -16,7 +15,7 @@ export class MailUtil {
|
|
|
16
15
|
static buildBrand(file: string, content: string, compile?: string): string {
|
|
17
16
|
const out = [
|
|
18
17
|
'WARNING: Do not modify.',
|
|
19
|
-
`File is generated from "${file.replace(
|
|
18
|
+
`File is generated from "${file.replace(Runtime.workspace.path, '.')}"`,
|
|
20
19
|
compile ? `Run \`${compile.replaceAll('\n', ' ')}\` to regenerate` : ''
|
|
21
20
|
];
|
|
22
21
|
return `<!-- ${out.join(' ').trim()} -->\n${content}`;
|