From 2a7278eb7eb4c1895c5beebda2a0ea1e80bc4037 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Thu, 18 Jul 2019 18:17:20 -0300 Subject: [PATCH] Remove Babel transformations for older browser versions (#6812) The Babel config had previously supported all browsers with greater than 0.25% global usage (according to `browserlist`). This resulted in `babel-preset-env` including plugins sufficient to support the following minimum browser versions: ``` { "chrome": "49", "android": "4.4", "edge": "16", "firefox": "52", "ios": "9.3", "safari": "11" } ``` Instead, the babel config now explicitly supports chrome >= 58 and firefox >= 53. Chrome and Firefox are the only browsers we currently publish to, and these were the minimum versions with no additional Babel transformations. The minimum browser versions we support should be re-evaluated later, when we have added tests and documentation. The plugin 'transform-async-to-generator' has also been removed. It was used to translate async/await, but our browser targets all support async/await. Removing some of these transformations exposed bugs in `uglify-es` that only presented themselves in the production build. `gulp-uglify-es` has been updated to a version that uses `terser` instead of `uglify-es`, which has resolved these issues. Relates to #6805 --- .babelrc | 6 ++---- package-lock.json | 37 ++++++++++++++++++++++++------------- package.json | 3 +-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.babelrc b/.babelrc index a5317cdc5..067335f61 100644 --- a/.babelrc +++ b/.babelrc @@ -5,9 +5,8 @@ { "targets": { "browsers": [ - ">0.25%", - "not ie 11", - "not op_mini all" + "chrome >= 58", + "firefox >= 53" ] } } @@ -16,7 +15,6 @@ ], "plugins": [ "transform-runtime", - "transform-async-to-generator", "transform-class-properties", "transform-object-rest-spread" ] diff --git a/package-lock.json b/package-lock.json index 5baf8b901..d36ba88a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35501,14 +35501,14 @@ } }, "gulp-uglify-es": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gulp-uglify-es/-/gulp-uglify-es-1.0.1.tgz", - "integrity": "sha512-lwVTOhSPNJvoPZ8wC1mrDiqSszS8INK2R4kaslBKf9wyMVXLWckKs+LRh5bgcymeB5zsczGKT9bGCTNKeEoCvQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/gulp-uglify-es/-/gulp-uglify-es-1.0.4.tgz", + "integrity": "sha512-UMRufZsBmQizCYpftutaiVoLswpbzFEfY90EJLU4YlTgculeHnanb794s88TMd5tpCZVC638sAX6JrLVYTP/Wg==", "dev": true, "requires": { "o-stream": "^0.2.2", "plugin-error": "^1.0.1", - "uglify-es": "^3.3.9", + "terser": "^3.7.5", "vinyl": "^2.1.0", "vinyl-sourcemaps-apply": "^0.2.1" }, @@ -35520,9 +35520,9 @@ "dev": true }, "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true }, "extend-shallow": { @@ -35562,14 +35562,25 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, - "uglify-es": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", - "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "source-map-support": { + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", + "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", "dev": true, "requires": { - "commander": "~2.13.0", - "source-map": "~0.6.1" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "terser": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-3.17.0.tgz", + "integrity": "sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ==", + "dev": true, + "requires": { + "commander": "^2.19.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.10" } } } diff --git a/package.json b/package.json index 359f0001b..0cbd873e1 100644 --- a/package.json +++ b/package.json @@ -175,7 +175,6 @@ "addons-linter": "^1.10.0", "babel-core": "^6.26.3", "babel-eslint": "^8.0.0", - "babel-plugin-transform-async-to-generator": "^6.24.1", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-object-rest-spread": "^6.22.0", "babel-plugin-transform-runtime": "^6.23.0", @@ -223,7 +222,7 @@ "gulp-sourcemaps": "^2.6.0", "gulp-stylefmt": "^1.1.0", "gulp-stylelint": "^7.0.0", - "gulp-uglify-es": "^1.0.1", + "gulp-uglify-es": "^1.0.4", "gulp-util": "^3.0.7", "gulp-watch": "^5.0.1", "gulp-zip": "^4.0.0",