From 36087e076bf9690344aaf81af4b19982f4e9b9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Wed, 15 Jun 2016 18:33:34 +0200 Subject: [PATCH] Update babel 5 to babel-core 6 with new config and plugins --- .babelrc | 3 +++ README.md | 2 +- fixtures/compiled/babel/basic.js | 18 ++++++++++-------- package.json | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..c13c5f6 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/README.md b/README.md index 6fcbdd7..8347ab5 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ npm install -g fusile **General usage:** `fusile ` -Fusile is a compiling file system proxy. In order to get it to compile your assets you need to install one or more of these precompilers: `LiveScript`, `babel`, `coco`, `coffee-script`, `dogescript`, `less`, `marked`, `myth`, `node-sass`, `stylus`, `swig` +Fusile is a compiling file system proxy. In order to get it to compile your assets you need to install one or more of these precompilers: `LiveScript`, `babel-core`, `coco`, `coffee-script`, `dogescript`, `less`, `marked`, `myth`, `node-sass`, `stylus`, `swig` When any of the above precompilers are available in the context of fusile (in your project root or globally installed), fusile will automatically load it and start compiling files with the corresponding file extension when you read the files from the mountpoint. diff --git a/fixtures/compiled/babel/basic.js b/fixtures/compiled/babel/basic.js index d74a473..abc65ad 100644 --- a/fixtures/compiled/babel/basic.js +++ b/fixtures/compiled/babel/basic.js @@ -1,21 +1,23 @@ 'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } -var Test = (function (_TestClass) { +var Test = function (_TestClass) { _inherits(Test, _TestClass); function Test(greeting) { _classCallCheck(this, Test); - _get(Object.getPrototypeOf(Test.prototype), 'constructor', this).call(this); - this.greeting = greeting; + var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Test).call(this)); + + _this.greeting = greeting; + return _this; } _createClass(Test, null, [{ @@ -26,4 +28,4 @@ var Test = (function (_TestClass) { }]); return Test; -})(TestClass); \ No newline at end of file +}(TestClass); \ No newline at end of file diff --git a/package.json b/package.json index ee491de..e97b933 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ }, "devDependencies": { "LiveScript": "1.3.1", - "babel": "5.8.23", + "babel-core": "6.9.1", + "babel-preset-es2015": "6.9.0", "coco": "0.9.1", "coffee-script": "1.10.0", "coveralls": "2.11.9",