@nestjs-modules/mailer 1.9.1 → 1.10.3

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/.nvmrc CHANGED
@@ -1 +1 @@
1
- 18.17.0
1
+ v20.10.0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.10.3](https://github.com/nest-modules/mailer/compare/v1.10.2...v1.10.3) (2023-12-20)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add tslib ([36f3aca](https://github.com/nest-modules/mailer/commit/36f3aca0ffac5943fa1dcd927cce7200dbcdb8df))
11
+
12
+ ### [1.10.2](https://github.com/nest-modules/mailer/compare/v1.10.0...v1.10.2) (2023-12-20)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * allows you to handle peer dependencies greater than or equal to ([9885780](https://github.com/nest-modules/mailer/commit/988578099fe9975ca96c3e245bfc1b709d9be28a))
18
+
19
+ ### [1.10.1](https://github.com/nest-modules/mailer/compare/v1.10.0...v1.10.1) (2023-12-20)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * allows you to handle peer dependencies greater than or equal to ([9885780](https://github.com/nest-modules/mailer/commit/988578099fe9975ca96c3e245bfc1b709d9be28a))
25
+
26
+ ## [1.10.0](https://github.com/nest-modules/mailer/compare/v1.9.1...v1.10.0) (2023-12-20)
27
+
5
28
  ### [1.9.1](https://github.com/nest-modules/mailer/compare/v1.9.0...v1.9.1) (2023-07-20)
6
29
 
7
30
 
@@ -5,12 +5,12 @@ const ejs_1 = require("ejs");
5
5
  const lodash_1 = require("lodash");
6
6
  const fs = require("fs");
7
7
  const path = require("path");
8
- const inlineCss = require("inline-css");
8
+ const css_inline_1 = require("css-inline");
9
9
  class EjsAdapter {
10
10
  constructor(config) {
11
11
  this.precompiledTemplates = {};
12
12
  this.config = {
13
- inlineCssOptions: { url: ' ' },
13
+ inlineCssOptions: {},
14
14
  inlineCssEnabled: true,
15
15
  };
16
16
  Object.assign(this.config, config);
@@ -24,7 +24,9 @@ class EjsAdapter {
24
24
  ? path.dirname(template)
25
25
  : path.join(templateBaseDir, path.dirname(template));
26
26
  const templatePath = path.join(templateDir, templateName + templateExt);
27
- templateName = path.relative(templateBaseDir, templatePath).replace(templateExt, '');
27
+ templateName = path
28
+ .relative(templateBaseDir, templatePath)
29
+ .replace(templateExt, '');
28
30
  if (!this.precompiledTemplates[templateName]) {
29
31
  try {
30
32
  const template = fs.readFileSync(templatePath, 'utf-8');
@@ -37,17 +39,15 @@ class EjsAdapter {
37
39
  const rendered = this.precompiledTemplates[templateName](context);
38
40
  const render = (html) => {
39
41
  if (this.config.inlineCssEnabled) {
40
- inlineCss(html, this.config.inlineCssOptions)
41
- .then((html) => {
42
- mail.data.html = html;
43
- return callback();
44
- })
45
- .catch(callback);
42
+ try {
43
+ mail.data.html = (0, css_inline_1.inline)(html, this.config.inlineCssOptions);
44
+ }
45
+ catch (e) { }
46
46
  }
47
47
  else {
48
48
  mail.data.html = html;
49
- return callback();
50
49
  }
50
+ return callback();
51
51
  };
52
52
  if (typeof rendered === 'string') {
53
53
  render(rendered);
@@ -4,14 +4,14 @@ exports.HandlebarsAdapter = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
6
  const handlebars = require("handlebars");
7
- const inlineCss = require("inline-css");
7
+ const css_inline_1 = require("css-inline");
8
8
  const glob = require("glob");
9
9
  const lodash_1 = require("lodash");
10
10
  class HandlebarsAdapter {
11
11
  constructor(helpers, config) {
12
12
  this.precompiledTemplates = {};
13
13
  this.config = {
14
- inlineCssOptions: { url: ' ' },
14
+ inlineCssOptions: {},
15
15
  inlineCssEnabled: true,
16
16
  };
17
17
  handlebars.registerHelper('concat', (...args) => {
@@ -30,7 +30,9 @@ class HandlebarsAdapter {
30
30
  ? path.dirname(template)
31
31
  : path.join(templateBaseDir, path.dirname(template));
32
32
  const templatePath = path.join(templateDir, templateName + templateExt);
33
- templateName = path.relative(templateBaseDir, templatePath).replace(templateExt, '');
33
+ templateName = path
34
+ .relative(templateBaseDir, templatePath)
35
+ .replace(templateExt, '');
34
36
  if (!this.precompiledTemplates[templateName]) {
35
37
  try {
36
38
  const template = fs.readFileSync(templatePath, 'utf-8');
@@ -53,7 +55,9 @@ class HandlebarsAdapter {
53
55
  data: {},
54
56
  });
55
57
  if (runtimeOptions.partials) {
56
- const partialPath = path.join(runtimeOptions.partials.dir, '**', '*.hbs').replace(/\\/g, '/');
58
+ const partialPath = path
59
+ .join(runtimeOptions.partials.dir, '**', '*.hbs')
60
+ .replace(/\\/g, '/');
57
61
  const files = glob.sync(partialPath);
58
62
  files.forEach((file) => {
59
63
  const { templateName, templatePath } = precompile(file, () => { }, runtimeOptions.partials);
@@ -63,17 +67,15 @@ class HandlebarsAdapter {
63
67
  }
64
68
  const rendered = this.precompiledTemplates[templateName](mail.data.context, Object.assign(Object.assign({}, runtimeOptions), { partials: this.precompiledTemplates }));
65
69
  if (this.config.inlineCssEnabled) {
66
- inlineCss(rendered, this.config.inlineCssOptions)
67
- .then((html) => {
68
- mail.data.html = html;
69
- return callback();
70
- })
71
- .catch(callback);
70
+ try {
71
+ mail.data.html = (0, css_inline_1.inline)(rendered, this.config.inlineCssOptions);
72
+ }
73
+ catch (e) { }
72
74
  }
73
75
  else {
74
76
  mail.data.html = rendered;
75
- return callback();
76
77
  }
78
+ return callback();
77
79
  }
78
80
  }
79
81
  exports.HandlebarsAdapter = HandlebarsAdapter;
@@ -4,11 +4,11 @@ exports.PugAdapter = void 0;
4
4
  const path = require("path");
5
5
  const lodash_1 = require("lodash");
6
6
  const pug_1 = require("pug");
7
- const inlineCss = require("inline-css");
7
+ const css_inline_1 = require("css-inline");
8
8
  class PugAdapter {
9
9
  constructor(config) {
10
10
  this.config = {
11
- inlineCssOptions: { url: ' ' },
11
+ inlineCssOptions: {},
12
12
  inlineCssEnabled: true,
13
13
  };
14
14
  Object.assign(this.config, config);
@@ -27,17 +27,15 @@ class PugAdapter {
27
27
  return callback(err);
28
28
  }
29
29
  if (this.config.inlineCssEnabled) {
30
- inlineCss(body, this.config.inlineCssOptions)
31
- .then((html) => {
32
- mail.data.html = html;
33
- return callback();
34
- })
35
- .catch(callback);
30
+ try {
31
+ mail.data.html = (0, css_inline_1.inline)(body, this.config.inlineCssOptions);
32
+ }
33
+ catch (e) { }
36
34
  }
37
35
  else {
38
36
  mail.data.html = body;
39
- return callback();
40
37
  }
38
+ return callback();
41
39
  });
42
40
  }
43
41
  }
@@ -1,5 +1,5 @@
1
- import InlineCss = require('inline-css');
1
+ import { InlineOptions } from 'css-inline';
2
2
  export interface TemplateAdapterConfig {
3
- inlineCssOptions?: InlineCss.Options;
3
+ inlineCssOptions?: InlineOptions;
4
4
  inlineCssEnabled?: boolean;
5
5
  }
@@ -6,7 +6,7 @@ const tslib_1 = require("tslib");
6
6
  const common_1 = require("@nestjs/common");
7
7
  const mailer_constant_1 = require("./constants/mailer.constant");
8
8
  const mailer_service_1 = require("./mailer.service");
9
- let MailerCoreModule = exports.MailerCoreModule = MailerCoreModule_1 = class MailerCoreModule {
9
+ let MailerCoreModule = MailerCoreModule_1 = class MailerCoreModule {
10
10
  static forRoot(options) {
11
11
  const MailerOptionsProvider = {
12
12
  provide: mailer_constant_1.MAILER_OPTIONS,
@@ -67,6 +67,7 @@ let MailerCoreModule = exports.MailerCoreModule = MailerCoreModule_1 = class Mai
67
67
  };
68
68
  }
69
69
  };
70
+ exports.MailerCoreModule = MailerCoreModule;
70
71
  exports.MailerCoreModule = MailerCoreModule = MailerCoreModule_1 = tslib_1.__decorate([
71
72
  (0, common_1.Global)(),
72
73
  (0, common_1.Module)({})
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const nodemailer_1 = require("nodemailer");
6
6
  const common_1 = require("@nestjs/common");
7
7
  const mailer_constant_1 = require("./constants/mailer.constant");
8
- let MailerTransportFactory = exports.MailerTransportFactory = class MailerTransportFactory {
8
+ let MailerTransportFactory = class MailerTransportFactory {
9
9
  constructor(options) {
10
10
  this.options = options;
11
11
  }
@@ -13,6 +13,7 @@ let MailerTransportFactory = exports.MailerTransportFactory = class MailerTransp
13
13
  return (0, nodemailer_1.createTransport)(opts || this.options.transport, this.options.defaults);
14
14
  }
15
15
  };
16
+ exports.MailerTransportFactory = MailerTransportFactory;
16
17
  exports.MailerTransportFactory = MailerTransportFactory = tslib_1.__decorate([
17
18
  tslib_1.__param(0, (0, common_1.Inject)(mailer_constant_1.MAILER_OPTIONS)),
18
19
  tslib_1.__metadata("design:paramtypes", [Object])
@@ -5,7 +5,7 @@ exports.MailerModule = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const common_1 = require("@nestjs/common");
7
7
  const mailer_core_module_1 = require("./mailer-core.module");
8
- let MailerModule = exports.MailerModule = MailerModule_1 = class MailerModule {
8
+ let MailerModule = MailerModule_1 = class MailerModule {
9
9
  static forRoot(options) {
10
10
  return {
11
11
  module: MailerModule_1,
@@ -23,6 +23,7 @@ let MailerModule = exports.MailerModule = MailerModule_1 = class MailerModule {
23
23
  };
24
24
  }
25
25
  };
26
+ exports.MailerModule = MailerModule;
26
27
  exports.MailerModule = MailerModule = MailerModule_1 = tslib_1.__decorate([
27
28
  (0, common_1.Module)({})
28
29
  ], MailerModule);
@@ -7,7 +7,7 @@ const common_1 = require("@nestjs/common");
7
7
  const previewEmail = require("preview-email");
8
8
  const mailer_constant_1 = require("./constants/mailer.constant");
9
9
  const mailer_transport_factory_1 = require("./mailer-transport.factory");
10
- let MailerService = exports.MailerService = class MailerService {
10
+ let MailerService = class MailerService {
11
11
  initTemplateAdapter(templateAdapter, transporter) {
12
12
  if (templateAdapter) {
13
13
  transporter.use('compile', (mail, callback) => {
@@ -85,6 +85,7 @@ let MailerService = exports.MailerService = class MailerService {
85
85
  return transporterName;
86
86
  }
87
87
  };
88
+ exports.MailerService = MailerService;
88
89
  exports.MailerService = MailerService = tslib_1.__decorate([
89
90
  (0, common_1.Injectable)(),
90
91
  tslib_1.__param(0, (0, common_1.Inject)(mailer_constant_1.MAILER_OPTIONS)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs-modules/mailer",
3
- "version": "1.9.1",
3
+ "version": "1.10.3",
4
4
  "private": false,
5
5
  "description": "NestJS - a mailer module (@mailer)",
6
6
  "keywords": [
@@ -52,58 +52,55 @@
52
52
  ]
53
53
  },
54
54
  "dependencies": {
55
- "glob": "10.3.3",
56
- "inline-css": "4.0.2",
57
- "mjml": "^4.14.1",
55
+ "css-inline": "0.11.2",
56
+ "glob": "10.3.10",
57
+ "mjml": "4.14.1",
58
58
  "preview-email": "3.0.19"
59
59
  },
60
60
  "optionalDependencies": {
61
- "@types/ejs": "^3.1.2",
62
- "@types/pug": "2.0.6",
61
+ "@types/ejs": "^3.1.5",
62
+ "@types/pug": "^2.0.10",
63
63
  "ejs": "^3.1.9",
64
- "handlebars": "^4.7.7",
64
+ "handlebars": "^4.7.8",
65
65
  "pug": "^3.0.2"
66
66
  },
67
67
  "devDependencies": {
68
- "@commitlint/cli": "^17.6.7",
69
- "@commitlint/config-angular": "^17.6.7",
70
- "@nestjs/common": "^10.1.0",
71
- "@nestjs/core": "^10.1.0",
72
- "@nestjs/testing": "^10.1.0",
73
- "@types/glob": "^8.1.0",
74
- "@types/inline-css": "3.0.1",
75
- "@types/jest": "^29.5.3",
76
- "@types/lodash": "^4.14.195",
77
- "@types/nodemailer": "^6.4.8",
78
- "@types/pug": "2.0.6",
79
- "@typescript-eslint/eslint-plugin": "^6.1.0",
80
- "@typescript-eslint/parser": "^6.1.0",
81
- "husky": "^8.0.3",
82
- "jest": "^29.6.1",
83
- "lint-staged": "^13.2.3",
84
- "nodemailer": "^6.9.4",
85
- "nodemailer-mock": "2.0.1",
86
- "prettier": "^3.0.0",
87
- "reflect-metadata": "0.1.13",
88
- "rimraf": "5.0.1",
89
- "rxjs": "^7.8.1",
68
+ "@commitlint/cli": "18.4.3",
69
+ "@commitlint/config-angular": "18.4.3",
70
+ "@nestjs/common": "10.3.0",
71
+ "@nestjs/core": "10.3.0",
72
+ "@nestjs/testing": "10.3.0",
73
+ "@types/glob": "8.1.0",
74
+ "@types/jest": "29.5.11",
75
+ "@types/lodash": "4.14.202",
76
+ "@types/nodemailer": "6.4.14",
77
+ "@types/pug": "2.0.10",
78
+ "@typescript-eslint/eslint-plugin": "6.15.0",
79
+ "@typescript-eslint/parser": "6.15.0",
80
+ "husky": "8.0.3",
81
+ "jest": "29.7.0",
82
+ "lint-staged": "15.2.0",
83
+ "nodemailer": "6.9.7",
84
+ "nodemailer-mock": "2.0.3",
85
+ "prettier": "3.1.1",
86
+ "reflect-metadata": "0.2.1",
87
+ "rimraf": "5.0.5",
88
+ "rxjs": "7.8.1",
90
89
  "standard-version": "9.5.0",
91
- "ts-jest": "^29.1.1",
92
- "ts-node": "10.9.1",
93
- "typescript": "^5.1.6",
94
- "yarn-audit-fix": "^9.3.12"
90
+ "ts-jest": "29.1.1",
91
+ "ts-node": "10.9.2",
92
+ "tslib": "2.6.2",
93
+ "typescript": "5.3.3",
94
+ "yarn-audit-fix": "10.0.7"
95
95
  },
96
96
  "peerDependencies": {
97
- "@nestjs/common": "^7.0.9 || ^8.0.0 || ^9.0.0 || ^10.0.0",
98
- "@nestjs/core": "^7.0.9 || ^8.0.0 || ^9.0.0 || ^10.0.0",
99
- "@types/ejs": "^3.0.3",
100
- "@types/pug": "2.0.6",
101
- "ejs": "^3.1.2",
102
- "handlebars": "^4.7.6",
103
- "nodemailer": "^6.4.6",
104
- "pug": "^3.0.1"
105
- },
106
- "resolutions": {
107
- "vm2": "isolated-vm"
97
+ "@nestjs/common": ">=7.0.9",
98
+ "@nestjs/core": ">=7.0.9",
99
+ "@types/ejs": ">=3.0.3",
100
+ "@types/pug": ">=2.0.6",
101
+ "ejs": ">=3.1.2",
102
+ "handlebars": ">=4.7.6",
103
+ "nodemailer": ">=6.4.6",
104
+ "pug": ">=3.0.1"
108
105
  }
109
106
  }