nuxt-mail 5.0.1 → 5.1.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/README.md +12 -0
- package/dist/index.js +8 -6
- package/dist/plugin-nuxt2.js +2 -2
- package/dist/send.js +2 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -95,6 +95,18 @@ export default {
|
|
|
95
95
|
port: 587,
|
|
96
96
|
},
|
|
97
97
|
},
|
|
98
|
+
// or use runtimeConfig
|
|
99
|
+
runtimeConfig: {
|
|
100
|
+
mail: {
|
|
101
|
+
message: {
|
|
102
|
+
to: 'foo@bar.de',
|
|
103
|
+
},
|
|
104
|
+
smtp: {
|
|
105
|
+
host: "smtp.example.com",
|
|
106
|
+
port: 587,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
98
110
|
}
|
|
99
111
|
```
|
|
100
112
|
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,15 @@ const packageConfig = fs.readJsonSync(resolver.resolve('../package.json'));
|
|
|
13
13
|
const moduleName = parsePackagejsonName(packageConfig.name).fullName;
|
|
14
14
|
export default function (moduleOptions, nuxt) {
|
|
15
15
|
nuxt = nuxt || this;
|
|
16
|
+
let isNuxt3 = true;
|
|
17
|
+
try {
|
|
18
|
+
isNuxt3 = isNuxt3Try();
|
|
19
|
+
} catch {
|
|
20
|
+
isNuxt3 = false;
|
|
21
|
+
}
|
|
22
|
+
const runtimeConfig = nuxt.options[isNuxt3 ? 'runtimeConfig' : 'privateRuntimeConfig'];
|
|
16
23
|
const options = {
|
|
24
|
+
...runtimeConfig.mail,
|
|
17
25
|
...nuxt.options.mail,
|
|
18
26
|
...moduleOptions
|
|
19
27
|
};
|
|
@@ -29,12 +37,6 @@ export default function (moduleOptions, nuxt) {
|
|
|
29
37
|
if (some(c => !c.to && !c.cc && !c.bcc)(options.message)) {
|
|
30
38
|
throw new Error('You have to provide to/cc/bcc in all configs.');
|
|
31
39
|
}
|
|
32
|
-
let isNuxt3 = true;
|
|
33
|
-
try {
|
|
34
|
-
isNuxt3 = isNuxt3Try();
|
|
35
|
-
} catch {
|
|
36
|
-
isNuxt3 = false;
|
|
37
|
-
}
|
|
38
40
|
if (isNuxt3) {
|
|
39
41
|
addTemplate({
|
|
40
42
|
filename: P.join(moduleName, 'options.mjs'),
|
package/dist/plugin-nuxt2.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default (
|
|
1
|
+
export default (context, inject) => inject('mail', {
|
|
2
2
|
send: async config => {
|
|
3
3
|
try {
|
|
4
4
|
await context.app.$axios.$post('/mail/send', config);
|
|
@@ -6,4 +6,4 @@ export default ((context, inject) => inject('mail', {
|
|
|
6
6
|
throw new Error(error.response.data);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
})
|
|
9
|
+
});
|
package/dist/send.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findIndex, omit } from '@dword-design/functions';
|
|
2
|
-
export default
|
|
2
|
+
export default async (body, options, transport) => {
|
|
3
3
|
body = {
|
|
4
4
|
config: 0,
|
|
5
5
|
...body
|
|
@@ -17,4 +17,4 @@ export default (async (body, options, transport) => {
|
|
|
17
17
|
...omit(['config', 'to', 'cc', 'bcc'])(body),
|
|
18
18
|
...omit(['name'])(options.message[body.config])
|
|
19
19
|
});
|
|
20
|
-
}
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-mail",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -58,15 +58,16 @@
|
|
|
58
58
|
"axios": "^0",
|
|
59
59
|
"depcheck-package-name": "^3.0.0",
|
|
60
60
|
"execa": "^8.0.1",
|
|
61
|
+
"get-port": "^7.1.0",
|
|
61
62
|
"nuxt": "^3.3.3",
|
|
62
63
|
"nuxt-dev-ready": "^3.0.0",
|
|
63
|
-
"ora": "^8.0.1",
|
|
64
64
|
"output-files": "^2.0.19",
|
|
65
65
|
"port-ready": "^0.1.0",
|
|
66
66
|
"smtp-tester": "^2.0.1",
|
|
67
67
|
"tree-kill-promise": "^3.0.9",
|
|
68
68
|
"with-local-tmp-dir": "^5.0.0"
|
|
69
69
|
},
|
|
70
|
+
"packageManager": "pnpm@9.11.0+sha256.1c0e33f70e5df9eede84a357bdfa0b1f9dba6e58194628d48a1055756f553754",
|
|
70
71
|
"engines": {
|
|
71
72
|
"node": ">=18"
|
|
72
73
|
},
|