diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-05-26 06:14:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 06:14:12 +0300 |
commit | 340236cbe4a5bfb3fb3583f177ba7a493bb4f21c (patch) | |
tree | 6fc829896c5ee381a7457244d3d100012b5eef01 | |
parent | c9cd3e4a083a69bcd2eefb1d1b62e6106e2ce469 (diff) |
Update to `@rollup/plugin-babel` (#30742)
-rw-r--r-- | build/babel-helpers.js | 14 | ||||
-rw-r--r-- | build/build-plugins.js | 7 | ||||
-rw-r--r-- | build/rollup.config.js | 7 | ||||
-rw-r--r-- | js/tests/integration/rollup.bundle.js | 5 | ||||
-rw-r--r-- | js/tests/karma.conf.js | 10 | ||||
-rw-r--r-- | package-lock.json | 20 | ||||
-rw-r--r-- | package.json | 2 |
7 files changed, 23 insertions, 42 deletions
diff --git a/build/babel-helpers.js b/build/babel-helpers.js deleted file mode 100644 index 30a5156771..0000000000 --- a/build/babel-helpers.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -// These are the babel helpers we whitelist -const helpers = [ - 'createClass', - 'createSuper', - 'defineProperties', - 'defineProperty', - 'getPrototypeOf', - 'inheritsLoose', - 'objectSpread2' -] - -module.exports = helpers diff --git a/build/build-plugins.js b/build/build-plugins.js index 44d155c4f9..c57c53ce4e 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -11,16 +11,15 @@ const path = require('path') const rollup = require('rollup') -const babel = require('rollup-plugin-babel') +const { babel } = require('@rollup/plugin-babel') const banner = require('./banner.js') -const babelHelpers = require('./babel-helpers.js') const plugins = [ babel({ // Only transpile our source code exclude: 'node_modules/**', - // Include only required helpers - externalHelpersWhitelist: babelHelpers + // Inline the required helpers in each file + babelHelpers: 'inline' }) ] const bsPlugins = { diff --git a/build/rollup.config.js b/build/rollup.config.js index d32346e101..a792502172 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -1,10 +1,9 @@ 'use strict' const path = require('path') -const babel = require('rollup-plugin-babel') +const { babel } = require('@rollup/plugin-babel') const resolve = require('@rollup/plugin-node-resolve') const banner = require('./banner.js') -const babelHelpers = require('./babel-helpers.js') const BUNDLE = process.env.BUNDLE === 'true' const ESM = process.env.ESM === 'true' @@ -15,8 +14,8 @@ const plugins = [ babel({ // Only transpile our source code exclude: 'node_modules/**', - // Include only required helpers - externalHelpersWhitelist: babelHelpers + // Include the helpers in the bundle, at most one copy of each + babelHelpers: 'bundled' }) ] const globals = { diff --git a/js/tests/integration/rollup.bundle.js b/js/tests/integration/rollup.bundle.js index d09a9dbbe2..0ac6e406ae 100644 --- a/js/tests/integration/rollup.bundle.js +++ b/js/tests/integration/rollup.bundle.js @@ -1,7 +1,7 @@ /* eslint-env node */ const resolve = require('@rollup/plugin-node-resolve') -const babel = require('rollup-plugin-babel') +const { babel } = require('@rollup/plugin-babel') module.exports = { input: 'js/tests/integration/bundle.js', @@ -12,7 +12,8 @@ module.exports = { plugins: [ resolve(), babel({ - exclude: 'node_modules/**' + exclude: 'node_modules/**', + babelHelpers: 'bundled' }) ] } diff --git a/js/tests/karma.conf.js b/js/tests/karma.conf.js index 6e1effc3a3..8281593e25 100644 --- a/js/tests/karma.conf.js +++ b/js/tests/karma.conf.js @@ -1,7 +1,7 @@ /* eslint-env node */ const path = require('path') const ip = require('ip') -const babel = require('rollup-plugin-babel') +const { babel } = require('@rollup/plugin-babel') const istanbul = require('rollup-plugin-istanbul') const resolve = require('@rollup/plugin-node-resolve') @@ -9,7 +9,6 @@ const { browsers, browsersKeys } = require('./browsers') -const babelHelpers = require('../../build/babel-helpers.js') const { env } = process const browserStack = env.BROWSER === 'true' @@ -77,11 +76,8 @@ const conf = { babel({ // Only transpile our source code exclude: 'node_modules/**', - // Include only required helpers - externalHelpersWhitelist: babelHelpers, - plugins: [ - '@babel/plugin-proposal-object-rest-spread' - ] + // Inline the required helpers in each file + babelHelpers: 'inline' }), resolve() ], diff --git a/package-lock.json b/package-lock.json index e55d8a305d..3e760b49fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -985,6 +985,16 @@ "fastq": "^1.6.0" } }, + "@rollup/plugin-babel": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.0.2.tgz", + "integrity": "sha512-GiL7jL+FGppzQ1Sn4y2ER4UYXlgXFFEt+sHm4WJEzQwI76Yf9oy2QDqIvcon6xApZWlik3L8fezRGC6Mj2vRXg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.7.4", + "@rollup/pluginutils": "^3.0.8" + } + }, "@rollup/plugin-commonjs": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz", @@ -9878,16 +9888,6 @@ } } }, - "rollup-plugin-babel": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz", - "integrity": "sha512-Lek/TYp1+7g7I+uMfJnnSJ7YWoD58ajo6Oarhlex7lvUce+RCKRuGRSgztDO3/MF/PuGKmUL5iTHKf208UNszw==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.0.0", - "rollup-pluginutils": "^2.8.1" - } - }, "rollup-plugin-istanbul": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/rollup-plugin-istanbul/-/rollup-plugin-istanbul-2.0.1.tgz", diff --git a/package.json b/package.json index 2b51aa9566..692233c11f 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "@babel/core": "^7.9.6", "@babel/plugin-proposal-object-rest-spread": "^7.9.6", "@babel/preset-env": "^7.9.6", + "@rollup/plugin-babel": "^5.0.2", "@rollup/plugin-commonjs": "^11.1.0", "@rollup/plugin-node-resolve": "^7.1.3", "autoprefixer": "^9.8.0", @@ -129,7 +130,6 @@ "popper.js": "^1.16.0", "postcss-cli": "^7.1.1", "rollup": "^2.10.4", - "rollup-plugin-babel": "^4.4.0", "rollup-plugin-istanbul": "^2.0.1", "serve": "^11.3.0", "shelljs": "^0.8.4", |