diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-05-04 20:08:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 20:08:28 +0300 |
commit | db80eb96fac9611dce440d225abc96823e758fbe (patch) | |
tree | aa44c8d4ac4cb01d857c10c9b784627f8e9210f6 | |
parent | 56190d04dd3f52b27547537e8d80dd632ad495dc (diff) |
Move babel whitelist helpers to a common file (#30723)
-rw-r--r-- | build/babel-helpers.js | 14 | ||||
-rw-r--r-- | build/build-plugins.js | 11 | ||||
-rw-r--r-- | build/rollup.config.js | 11 | ||||
-rw-r--r-- | js/tests/karma.conf.js | 10 |
4 files changed, 20 insertions, 26 deletions
diff --git a/build/babel-helpers.js b/build/babel-helpers.js new file mode 100644 index 0000000000..30a5156771 --- /dev/null +++ b/build/babel-helpers.js @@ -0,0 +1,14 @@ +'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 47527ed7b6..30c2c80179 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -11,21 +11,14 @@ const path = require('path') const rollup = require('rollup') 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: [ - 'createClass', - 'createSuper', - 'defineProperties', - 'defineProperty', - 'getPrototypeOf', - 'inheritsLoose', - 'objectSpread2' - ] + externalHelpersWhitelist: babelHelpers }) ] const bsPlugins = { diff --git a/build/rollup.config.js b/build/rollup.config.js index a7c3a6f5a4..d32346e101 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -4,6 +4,7 @@ const path = require('path') 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,15 +16,7 @@ const plugins = [ // Only transpile our source code exclude: 'node_modules/**', // Include only required helpers - externalHelpersWhitelist: [ - 'createClass', - 'createSuper', - 'defineProperties', - 'defineProperty', - 'getPrototypeOf', - 'inheritsLoose', - 'objectSpread2' - ] + externalHelpersWhitelist: babelHelpers }) ] const globals = { diff --git a/js/tests/karma.conf.js b/js/tests/karma.conf.js index c9826c05ea..af90a958ff 100644 --- a/js/tests/karma.conf.js +++ b/js/tests/karma.conf.js @@ -9,6 +9,7 @@ const { browsers, browsersKeys } = require('./browsers') +const babelHelpers = require('../../build/babel-helpers.js') const { env } = process const browserStack = env.BROWSER === 'true' @@ -72,14 +73,7 @@ const conf = { // Only transpile our source code exclude: 'node_modules/**', // Include only required helpers - externalHelpersWhitelist: [ - 'defineProperties', - 'createClass', - 'createSuper', - 'inheritsLoose', - 'defineProperty', - 'objectSpread2' - ], + externalHelpersWhitelist: babelHelpers, plugins: [ '@babel/plugin-proposal-object-rest-spread' ] |