nuxt-mail 5.0.0 → 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 CHANGED
@@ -60,10 +60,10 @@ Does not work for static sites (via `nuxt generate`) because the module creates
60
60
 
61
61
  ```bash
62
62
  # npm
63
- $ npm install nuxt-mail
63
+ $ npx nuxi module add nuxt-mail
64
64
 
65
65
  # Yarn
66
- $ yarn add nuxt-mail
66
+ $ yarn nuxi module add nuxt-mail
67
67
  ```
68
68
  <!-- /INSTALL -->
69
69
 
@@ -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'),
@@ -1,4 +1,4 @@
1
- export default ((context, inject) => inject('mail', {
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 (async (body, options, transport) => {
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.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",
@@ -52,20 +52,22 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@dword-design/base": "^11.0.4",
55
+ "@dword-design/base-config-nuxt-module": "^1.0.0",
55
56
  "@dword-design/puppeteer": "^7.0.0",
56
57
  "@nuxtjs/axios": "^5.13.1",
57
58
  "axios": "^0",
58
59
  "depcheck-package-name": "^3.0.0",
59
60
  "execa": "^8.0.1",
61
+ "get-port": "^7.1.0",
60
62
  "nuxt": "^3.3.3",
61
63
  "nuxt-dev-ready": "^3.0.0",
62
- "ora": "^8.0.1",
63
64
  "output-files": "^2.0.19",
64
65
  "port-ready": "^0.1.0",
65
66
  "smtp-tester": "^2.0.1",
66
67
  "tree-kill-promise": "^3.0.9",
67
68
  "with-local-tmp-dir": "^5.0.0"
68
69
  },
70
+ "packageManager": "pnpm@9.11.0+sha256.1c0e33f70e5df9eede84a357bdfa0b1f9dba6e58194628d48a1055756f553754",
69
71
  "engines": {
70
72
  "node": ">=18"
71
73
  },