From 3b22d207746bf543c66ea0933315b8f165c2189c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernat=20Jufr=C3=A9?= Date: Fri, 28 May 2021 06:29:56 +0200 Subject: [PATCH] feat: add support for ESM module when transpiling code --- babel.config.js | 3 ++ package.json | 5 ++- packages/mjml-accordion/package.json | 6 ++- packages/mjml-body/package.json | 6 ++- packages/mjml-button/package.json | 6 ++- packages/mjml-carousel/package.json | 6 ++- packages/mjml-column/package.json | 6 ++- packages/mjml-core/package.json | 6 ++- packages/mjml-divider/package.json | 6 ++- packages/mjml-group/package.json | 6 ++- packages/mjml-head-attributes/package.json | 6 ++- packages/mjml-head-breakpoint/package.json | 6 ++- packages/mjml-head-font/package.json | 6 ++- .../mjml-head-html-attributes/package.json | 6 ++- packages/mjml-head-preview/package.json | 6 ++- packages/mjml-head-style/package.json | 6 ++- packages/mjml-head-title/package.json | 6 ++- packages/mjml-head/package.json | 6 ++- packages/mjml-hero/package.json | 6 ++- packages/mjml-image/package.json | 6 ++- packages/mjml-navbar/package.json | 6 ++- packages/mjml-parser-xml/package.json | 6 ++- packages/mjml-preset-core/package.json | 6 ++- packages/mjml-raw/package.json | 6 ++- packages/mjml-section/package.json | 6 ++- packages/mjml-social/package.json | 6 ++- packages/mjml-spacer/package.json | 6 ++- packages/mjml-table/package.json | 6 ++- packages/mjml-text/package.json | 6 ++- packages/mjml-validator/package.json | 6 ++- packages/mjml-wrapper/package.json | 6 ++- packages/mjml/package.json | 6 ++- yarn.lock | 40 +++++++++++++++++++ 33 files changed, 167 insertions(+), 61 deletions(-) diff --git a/babel.config.js b/babel.config.js index 04c3ed896..f722f463b 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,7 +1,10 @@ +const ESM = process.env.ESM === 'true' + module.exports = { presets: [['@babel/env', { targets: { node: '10' }, include: ['transform-classes'], + ...(ESM ? { modules: false } : {}), }]], plugins: [ '@babel/proposal-class-properties', diff --git a/package.json b/package.json index 95f507375..8a5ae249a 100755 --- a/package.json +++ b/package.json @@ -3,7 +3,9 @@ "private": true, "scripts": { "build:watch": "lerna run build --parallel -- -- -w", - "build": "lerna run build --parallel --ignore mjml-browser", + "build": "yarn run build:cjs && yarn run build:esm", + "build:cjs": "lerna run build --parallel --ignore mjml-browser", + "build:esm": "cross-env ESM=true lerna run build:esm --parallel --ignore mjml-browser --ignore mjml-cli --ignore mjml-migrate", "build-browser": "cd packages/mjml-browser && yarn build", "lint": "eslint .", "lint:fix": "eslint . --fix", @@ -22,6 +24,7 @@ "babel-eslint": "^10.1.0", "babel-plugin-add-module-exports": "^1.0.2", "babel-plugin-lodash": "^3.3.4", + "cross-env": "^7.0.3", "eslint": "^6.8.0", "eslint-config-airbnb-base": "^14.1.0", "eslint-config-prettier": "^6.11.0", diff --git a/packages/mjml-accordion/package.json b/packages/mjml-accordion/package.json index cfe02e3dd..e1fa6efad 100644 --- a/packages/mjml-accordion/package.json +++ b/packages/mjml-accordion/package.json @@ -2,7 +2,8 @@ "name": "mjml-accordion", "description": "mjml-accordion", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-body/package.json b/packages/mjml-body/package.json index 2cc0a9864..5337801b3 100644 --- a/packages/mjml-body/package.json +++ b/packages/mjml-body/package.json @@ -2,7 +2,8 @@ "name": "mjml-body", "description": "mjml-body", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-button/package.json b/packages/mjml-button/package.json index ab3174501..c100b8b1a 100644 --- a/packages/mjml-button/package.json +++ b/packages/mjml-button/package.json @@ -2,7 +2,8 @@ "name": "mjml-button", "description": "mjml-button", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-carousel/package.json b/packages/mjml-carousel/package.json index 802d39180..496a109dd 100644 --- a/packages/mjml-carousel/package.json +++ b/packages/mjml-carousel/package.json @@ -2,7 +2,8 @@ "name": "mjml-carousel", "description": "mjml-carousel", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-column/package.json b/packages/mjml-column/package.json index e472bde40..212e2385a 100644 --- a/packages/mjml-column/package.json +++ b/packages/mjml-column/package.json @@ -2,7 +2,8 @@ "name": "mjml-column", "description": "mjml-column", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-core/package.json b/packages/mjml-core/package.json index f95722378..a046c581b 100644 --- a/packages/mjml-core/package.json +++ b/packages/mjml-core/package.json @@ -2,7 +2,8 @@ "name": "mjml-core", "description": "mjml-core", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward", + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward", "test": "node ./tests/index.js" }, "dependencies": { diff --git a/packages/mjml-divider/package.json b/packages/mjml-divider/package.json index 65a0c3c41..2de571642 100644 --- a/packages/mjml-divider/package.json +++ b/packages/mjml-divider/package.json @@ -2,7 +2,8 @@ "name": "mjml-divider", "description": "mjml-divider", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-group/package.json b/packages/mjml-group/package.json index 93b148ae5..caee363a8 100644 --- a/packages/mjml-group/package.json +++ b/packages/mjml-group/package.json @@ -2,7 +2,8 @@ "name": "mjml-group", "description": "mjml-group", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head-attributes/package.json b/packages/mjml-head-attributes/package.json index 50d7c3b14..a828f2b13 100644 --- a/packages/mjml-head-attributes/package.json +++ b/packages/mjml-head-attributes/package.json @@ -2,7 +2,8 @@ "name": "mjml-head-attributes", "description": "mjml-head-attributes", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head-breakpoint/package.json b/packages/mjml-head-breakpoint/package.json index fdb9c385e..9c7a53d8b 100644 --- a/packages/mjml-head-breakpoint/package.json +++ b/packages/mjml-head-breakpoint/package.json @@ -2,7 +2,8 @@ "name": "mjml-head-breakpoint", "description": "mjml-head-breakpoint", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head-font/package.json b/packages/mjml-head-font/package.json index 10cebb37b..184c7f1de 100644 --- a/packages/mjml-head-font/package.json +++ b/packages/mjml-head-font/package.json @@ -2,7 +2,8 @@ "name": "mjml-head-font", "description": "mjml-head-font", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head-html-attributes/package.json b/packages/mjml-head-html-attributes/package.json index 07e6dbfd8..ed1121e90 100644 --- a/packages/mjml-head-html-attributes/package.json +++ b/packages/mjml-head-html-attributes/package.json @@ -2,7 +2,8 @@ "name": "mjml-head-html-attributes", "description": "mjml-head-html-attributes", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head-preview/package.json b/packages/mjml-head-preview/package.json index c99a3120b..b54e80d51 100644 --- a/packages/mjml-head-preview/package.json +++ b/packages/mjml-head-preview/package.json @@ -2,7 +2,8 @@ "name": "mjml-head-preview", "description": "mjml-head-preview", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head-style/package.json b/packages/mjml-head-style/package.json index 2121570f5..0a9e598e3 100644 --- a/packages/mjml-head-style/package.json +++ b/packages/mjml-head-style/package.json @@ -2,7 +2,8 @@ "name": "mjml-head-style", "description": "mjml-head-style", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head-title/package.json b/packages/mjml-head-title/package.json index be243dc39..2237c6af5 100644 --- a/packages/mjml-head-title/package.json +++ b/packages/mjml-head-title/package.json @@ -2,7 +2,8 @@ "name": "mjml-head-title", "description": "mjml-head-title", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-head/package.json b/packages/mjml-head/package.json index 18db4363e..56c848e4e 100644 --- a/packages/mjml-head/package.json +++ b/packages/mjml-head/package.json @@ -2,7 +2,8 @@ "name": "mjml-head", "description": "mjml-head", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-hero/package.json b/packages/mjml-hero/package.json index 8f2d43930..193f9ac9a 100644 --- a/packages/mjml-hero/package.json +++ b/packages/mjml-hero/package.json @@ -2,7 +2,8 @@ "name": "mjml-hero", "description": "mjml-hero", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-image/package.json b/packages/mjml-image/package.json index 5b811a3ed..39215e9e1 100644 --- a/packages/mjml-image/package.json +++ b/packages/mjml-image/package.json @@ -2,7 +2,8 @@ "name": "mjml-image", "description": "mjml-image", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-navbar/package.json b/packages/mjml-navbar/package.json index 434529398..f9bb8b344 100644 --- a/packages/mjml-navbar/package.json +++ b/packages/mjml-navbar/package.json @@ -2,7 +2,8 @@ "name": "mjml-navbar", "description": "mjml-navbar", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-parser-xml/package.json b/packages/mjml-parser-xml/package.json index 279402a6d..e3ac024d3 100644 --- a/packages/mjml-parser-xml/package.json +++ b/packages/mjml-parser-xml/package.json @@ -2,7 +2,8 @@ "name": "mjml-parser-xml", "description": "mjml-parser-xml", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward", + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward", "test": "node ./test/test.js" }, "dependencies": { diff --git a/packages/mjml-preset-core/package.json b/packages/mjml-preset-core/package.json index c041380b0..f68bca0d2 100644 --- a/packages/mjml-preset-core/package.json +++ b/packages/mjml-preset-core/package.json @@ -2,7 +2,8 @@ "name": "mjml-preset-core", "description": "mjml-preset-core", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-raw/package.json b/packages/mjml-raw/package.json index 95aa23347..9619c751f 100644 --- a/packages/mjml-raw/package.json +++ b/packages/mjml-raw/package.json @@ -2,7 +2,8 @@ "name": "mjml-raw", "description": "mjml-raw", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-section/package.json b/packages/mjml-section/package.json index d2bb252de..3cf220be8 100644 --- a/packages/mjml-section/package.json +++ b/packages/mjml-section/package.json @@ -2,7 +2,8 @@ "name": "mjml-section", "description": "mjml-section", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-social/package.json b/packages/mjml-social/package.json index ba3861373..5c29a5f62 100644 --- a/packages/mjml-social/package.json +++ b/packages/mjml-social/package.json @@ -2,7 +2,8 @@ "name": "mjml-social", "description": "mjml-social", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-spacer/package.json b/packages/mjml-spacer/package.json index 89ef22aaa..dae0383c2 100644 --- a/packages/mjml-spacer/package.json +++ b/packages/mjml-spacer/package.json @@ -2,7 +2,8 @@ "name": "mjml-spacer", "description": "mjml-spacer", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-table/package.json b/packages/mjml-table/package.json index 9ef38fd60..34ee6a1d4 100644 --- a/packages/mjml-table/package.json +++ b/packages/mjml-table/package.json @@ -2,7 +2,8 @@ "name": "mjml-table", "description": "mjml-atable", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-text/package.json b/packages/mjml-text/package.json index 041142c88..092c80349 100644 --- a/packages/mjml-text/package.json +++ b/packages/mjml-text/package.json @@ -2,7 +2,8 @@ "name": "mjml-text", "description": "mjml-text", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml-validator/package.json b/packages/mjml-validator/package.json index cca4b9c6c..84943e8bd 100644 --- a/packages/mjml-validator/package.json +++ b/packages/mjml-validator/package.json @@ -2,7 +2,8 @@ "name": "mjml-validator", "description": "mjml-validator", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/cjs/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7" diff --git a/packages/mjml-wrapper/package.json b/packages/mjml-wrapper/package.json index 88dfe9c10..9cfcb4320 100644 --- a/packages/mjml-wrapper/package.json +++ b/packages/mjml-wrapper/package.json @@ -2,7 +2,8 @@ "name": "mjml-wrapper", "description": "mjml-wrapper", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "files": [ "lib" ], @@ -18,7 +19,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward" + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward" }, "dependencies": { "@babel/runtime": "^7.8.7", diff --git a/packages/mjml/package.json b/packages/mjml/package.json index 1fb575320..658003699 100644 --- a/packages/mjml/package.json +++ b/packages/mjml/package.json @@ -2,7 +2,8 @@ "name": "mjml", "description": "MJML: the only framework that makes responsive-email easy", "version": "4.9.3", - "main": "lib/index.js", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", "bin": { "mjml": "bin/mjml" }, @@ -22,7 +23,8 @@ "homepage": "https://mjml.io", "scripts": { "clean": "rimraf lib", - "build": "babel src --out-dir lib --root-mode upward", + "build": "babel src --out-dir lib/cjs --root-mode upward", + "build:esm": "babel src --out-dir lib/esm --root-mode upward", "test": "node ./test/test-html-attributes.js" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index 40f2f3831..b96b9b44c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3985,6 +3985,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +cross-env@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== + dependencies: + cross-spawn "^7.0.1" + cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -3996,6 +4003,15 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -7279,6 +7295,11 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -8125,11 +8146,23 @@ shebang-command@^1.2.0: dependencies: shebang-regex "^1.0.0" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + sigmund@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" @@ -9173,6 +9206,13 @@ which@^1.2.14, which@^1.2.9, which@^1.3.1: dependencies: isexe "^2.0.0" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + wide-align@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457"