mailgun.js 3.5.9 → 3.6.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/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "mailgun.js",
3
- "version": "3.5.9",
4
- "main": "dist/mailgun.js",
3
+ "version": "3.6.0",
4
+ "main": "dist/mailgun.node.js",
5
+ "browser": "dist/mailgun.web.js",
5
6
  "types": "dist/index.d.ts",
6
7
  "author": "Mailgun",
7
8
  "license": "MIT",
@@ -18,9 +19,9 @@
18
19
  },
19
20
  "homepage": "https://github.com/mailgun/mailgun-js#readme",
20
21
  "scripts": {
21
- "build": "webpack --config ./webpack.config.js --progress --color",
22
- "build:release": "webpack --config ./webpack.release.config.js --progress --color",
23
- "start": "webpack --watch --config ./webpack.config.js --progress --color",
22
+ "build": "webpack --config ./webpack/webpack.dev.config.js --progress --color",
23
+ "build:release": "webpack --config ./webpack/webpack.release.config.js --progress --color",
24
+ "start": "webpack --watch --config ./webpack/webpack.dev.config.js --progress --color",
24
25
  "release": "standard-version -a",
25
26
  "test": "multi='dot=- xunit=./results.xml' mocha -t 10000 -R mocha-multi -r ts-node/register test/*.test.ts",
26
27
  "test-watch": "mocha -r ts-node/register -w -R dot test/*.test.ts",
@@ -105,7 +106,7 @@
105
106
  "commitUrlFormat": "https://github.com/mailgun/mailgun-js/commits/{{hash}}",
106
107
  "compareUrlFormat": "https://github.com/mailgun/mailgun-js/compare/{{previousTag}}...{{currentTag}}",
107
108
  "scripts": {
108
- "prerelease": "npm test && webpack --config ./webpack.release.config.js --progress --color && git add -A dist",
109
+ "prerelease": "npm test && webpack --config ./webpack/webpack.release.config.js --progress --color && git add -A dist",
109
110
  "posttag": "git push && git push --tags && rm -rf build"
110
111
  }
111
112
  }
@@ -7,4 +7,4 @@
7
7
  "**/*.test.ts",
8
8
  "node_modules"
9
9
  ]
10
- }
10
+ }
@@ -0,0 +1,48 @@
1
+ const webpack = require('webpack');
2
+ const path = require('path');
3
+ const pkg = require('../package.json');
4
+
5
+
6
+ const SRC_DIR = path.join(__dirname, '../');
7
+
8
+ const outputDir = 'dist';
9
+ const commonConfig = {
10
+ mode: 'development',
11
+ context: SRC_DIR,
12
+ entry: {
13
+ mailgun: path.join(SRC_DIR, 'index.ts'),
14
+ 'mailgun.min': path.join(SRC_DIR, 'index.ts')
15
+ },
16
+ output: {
17
+ path: path.join(SRC_DIR, outputDir),
18
+ filename: 'mailgun.js',
19
+ library: 'mailgun',
20
+ libraryTarget: 'umd',
21
+ globalObject: 'this',
22
+ },
23
+ module: {
24
+ rules: [
25
+ {
26
+ test: /\.(ts|js)?/,
27
+ use: [
28
+ {
29
+ loader: 'babel-loader',
30
+ },
31
+ {
32
+ loader: 'ts-loader?configFile='+path.join(SRC_DIR,'tsconfig.webpack.json')
33
+ }
34
+ ],
35
+ exclude: /(node_modules|test)/
36
+ }
37
+ ]
38
+ },
39
+ plugins: [
40
+ new webpack.BannerPlugin(`${pkg.name} v${pkg.version}`)
41
+ ],
42
+ resolve: {
43
+ extensions: ['.ts', '.js', '.json']
44
+ },
45
+ devtool: 'inline-source-map'
46
+ };
47
+
48
+ module.exports = commonConfig;
@@ -0,0 +1,19 @@
1
+ const commonConfig = require('./webpack.common.config');
2
+
3
+ const { merge } = require('webpack-merge');
4
+
5
+ const nodeConf = merge(commonConfig, {
6
+ target: 'node',
7
+ output: {
8
+ filename: 'mailgun.node.js'
9
+ }
10
+ });
11
+
12
+ const webConf = merge(commonConfig, {
13
+ target: 'web',
14
+ output: {
15
+ filename: 'mailgun.web.js'
16
+ }
17
+ });
18
+
19
+ module.exports = [nodeConf, webConf];
@@ -0,0 +1,38 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+
4
+ const TerserPlugin = require('terser-webpack-plugin');
5
+ const baseConfig = require('./webpack.common.config');
6
+
7
+ const { merge } = require('webpack-merge');
8
+
9
+ const productionConfig = merge(baseConfig, {
10
+ mode: 'production',
11
+ devtool: undefined,
12
+ optimization: {
13
+ minimize: true,
14
+ minimizer: [
15
+ new TerserPlugin({
16
+ parallel: true,
17
+ terserOptions: {
18
+ keep_classnames: true,
19
+ }
20
+ }),
21
+ ],
22
+ },
23
+ });
24
+
25
+ const nodeConf = merge(productionConfig, {
26
+ target: 'node',
27
+ output: {
28
+ filename: 'mailgun.node.js'
29
+ }
30
+ });
31
+
32
+ const webConf = merge(productionConfig, {
33
+ target: 'web',
34
+ output: {
35
+ filename: 'mailgun.web.js'
36
+ }
37
+ });
38
+ module.exports = [nodeConf, webConf];