Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update babel-preset-lux to version 2.0.1 #570

Merged
merged 8 commits into from Dec 17, 2016
Merged
4 changes: 3 additions & 1 deletion .babelrc
@@ -1,3 +1,5 @@
{
"presets": ["lux"]
"presets": ["lux"],
"minified": true,
"comments": false
}
3 changes: 3 additions & 0 deletions .eslintrc.json
Expand Up @@ -27,10 +27,12 @@
}
},
"rules": {
"strict": 0,
"max-len": ["error", 80],
"arrow-parens": 0,
"comma-dangle": [2, "only-multiline"],
"prefer-reflect": 2,
"global-require": 0,
"class-methods-use-this": 0,
"no-restricted-syntax": [
"error",
Expand All @@ -49,6 +51,7 @@
],
"newlines-between": "always"
}],
"import/no-dynamic-require": 0,
"import/prefer-default-export": 0,
"flowtype/semi": 2,
"flowtype/no-dupe-keys": 2,
Expand Down
37 changes: 24 additions & 13 deletions lib/babel-hook.js
@@ -1,18 +1,29 @@
'use strict'; // eslint-disable-line strict, lines-around-directive
'use strict';

// Require this module to use code in the /src dir prior to transpilation.
const IS_NODE_SEVEN = process.version.charAt(1) === '7';
const HAS_HARMONY_FLAG = process.execArgv.includes('--harmony');

const plugins = (...items) => items.concat([
'transform-async-to-generator',
'transform-class-properties',
'transform-es2015-destructuring',
'transform-es2015-parameters',
'transform-es2015-spread',
'transform-exponentiation-operator',
'transform-flow-strip-types',
'transform-object-rest-spread',
'transform-es2015-modules-commonjs'
]);
const plugins = (...items) => {
const defaultPlugins = [
'transform-class-properties',
'transform-flow-strip-types',
'transform-es2015-modules-commonjs',
['transform-object-rest-spread', {
useBuiltIns: true
}]
];

if (!IS_NODE_SEVEN) {
defaultPlugins.push(
'babel-plugin-transform-exponentiation-operator',
'babel-plugin-transform-async-to-generator'
);
} else if (!HAS_HARMONY_FLAG) {
defaultPlugins.push('babel-plugin-transform-async-to-generator');
}

return items.concat(defaultPlugins);
};

// eslint-disable-next-line import/no-extraneous-dependencies
require('babel-core/register')({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -59,7 +59,7 @@
"babel-core": "6.21.0",
"babel-plugin-istanbul": "2.0.3",
"babel-plugin-transform-es2015-modules-commonjs": "6.18.0",
"babel-preset-lux": "1.3.0",
"babel-preset-lux": "2.0.1",
"chai": "3.5.0",
"eslint-config-airbnb-base": "11.0.0",
"eslint-plugin-flowtype": "2.29.1",
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/cli.js
@@ -1,5 +1,7 @@
'use strict'; // eslint-disable-line strict, lines-around-directive

process.env.NODE_ENV = 'production';

require('../../lib/babel-hook');

const { EOL } = require('os');
Expand Down