Joffrey JAFFEUX
|
bbddce4d3a
|
DEV: updates js transpiler to use babel 7 (#10627)
Updates our js transpiler code to use Babel 7.11.6
List of changes in this commit:
- Updates plugins, babel plugins all have a new version which doesn't contain -es2015- anymore
- Drops [transform-es2015-classes](https://babeljs.io/docs/en/babel-plugin-transform-classes) this plugin shouldn't be needed now that we don't support IE
- Drops check-es2015-constants, checking constants is now part of babel and the check-constants plugin is deprecated. As a result the behavior slightly changed, and is now wrapping every const call in a readOnlyError function which would throw if assigned a new value. This explains the modified spec.
- Adds [proposal-optional-chaining](https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining)
```javascript
const obj = {
foo: {
bar: {
baz: 42,
},
},
};
const baz = obj?.foo?.bar?.baz; // 42
```
- Adds [proposal-json-strings](https://babeljs.io/docs/en/babel-plugin-proposal-json-strings)
```javascript
// IN
const ex = "before
after";
// ^ There's a U+2028 char between 'before' and 'after'
// OUT
const ex = "before\u2028after";
// ^ There's a U+2028 char between 'before' and 'after'
```
- Adds [proposal-nullish-coalescing-operator](https://babeljs.io/docs/en/babel-plugin-proposal-nullish-coalescing-operator)
```javascript
var object = {};
var foo = object.foo ?? "default"; // default
```
- Adds [proposal-logical-assignment-operators](https://babeljs.io/docs/en/babel-plugin-proposal-logical-assignment-operators)
```javascript
let a;
let b = 2;
a ||= b; // 2
```
- Adds [proposal-numeric-separator](https://babeljs.io/docs/en/babel-plugin-proposal-numeric-separator)
```javascript
let budget = 1_000_000_000_000;
console.log(budget === 10 ** 12); // true
```
- Adds proposal-object-rest-spread https://babeljs.io/docs/en/babel-plugin-proposal-object-rest-spread
```javascript
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
console.log(x); // 1
console.log(y); // 2
console.log(z); // { a: 3, b: 4 }
```
- Adds proposal-optional-catch-binding https://babeljs.io/docs/en/babel-plugin-proposal-optional-catch-binding
```javascript
try {
} catch {
} finally {
// ensures finally is available in every browsers
}
```
- Adds improved regex support for firefox through (transform-dotall-regex](https://babeljs.io/docs/en/next/babel-plugin-transform-dotall-regex.html) and (proposal-unicode-property-regex](https://babeljs.io/docs/en/babel-plugin-proposal-unicode-property-regex)
- Drops async/generator stuff, the browser we target should allow to use this (excepts iterable async)
|
2020-09-15 09:26:33 +02:00 |
|
Joffrey JAFFEUX
|
9a4f6619d9
|
DEV: upgrades babel to 6.26.3 (#7651)
This is the last version of the 6.x babel branch.
To achieve this I used https://github.com/babel/babel-standalone witht he following patch:
diff --git a/gulpfile.js b/gulpfile.js
index 2121b5f..c40bfa3 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -74,24 +74,23 @@ const minifyAndRename = lazypipe()
.pipe(uglify)
.pipe(rename, { extname: '.min.js' });
-gulp.task('default', ['build']);
-gulp.task('build', ['build-babel', 'build-babili']);
-
-gulp.task('build-babel', cb => {
- pump([
- gulp.src('src/index.js'),
- webpackBuild('babel.js', 'Babel', require('./package.json').version),
- gulp.dest('.'),
- minifyAndRename(),
- gulp.dest('.'),
- ], cb);
-});
-gulp.task('build-babili', cb => {
- pump([
- gulp.src('src/babili.js'),
- webpackBuild('babili.js', 'Babili', require('./packages/babili-standalone/package.json').version),
- gulp.dest('packages/babili-standalone/'),
- minifyAndRename(),
- gulp.dest('packages/babili-standalone/'),
- ], cb);
-});
+ gulp.task('build-babel', gulp.series(cb => {
+ pump([
+ gulp.src('src/index.js'),
+ webpackBuild('babel.js', 'Babel', require('./package.json').version),
+ gulp.dest('.'),
+ minifyAndRename(),
+ gulp.dest('.'),
+ ], cb);
+ }));
+ gulp.task('build-babili', gulp.series(cb => {
+ pump([
+ gulp.src('src/babili.js'),
+ webpackBuild('babili.js', 'Babili', require('./packages/babili-standalone/package.json').version),
+ gulp.dest('packages/babili-standalone/'),
+ minifyAndRename(),
+ gulp.dest('packages/babili-standalone/'),
+ ], cb);
+ }));
+gulp.task('build', gulp.series('build-babel', 'build-babili'));
+gulp.task('default', gulp.series('build'));
diff --git a/package.json b/package.json
index f2414d2..854cfad 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"url": "git+https://github.com/Daniel15/babel-standalone.git"
},
"devDependencies": {
- "babel-core": "6.26.0",
+ "babel-core": "6.26.3",
"babel-helper-builder-react-jsx": "6.23.0",
"babel-loader": "6.4.1",
"babel-plugin-check-es2015-constants": "6.22.0",
@@ -123,7 +123,7 @@
"babel-preset-stage-1": "6.24.1",
"babel-preset-stage-2": "6.24.1",
"babel-preset-stage-3": "6.24.1",
- "gulp": "^3.9.1",
+ "gulp": "^4",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^2.0.1",
"jest": "^18.1.0",
and then ran:
yarn
yarn run build
|
2019-05-30 17:08:37 +02:00 |
|