Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Commit

Permalink
Removed babel dependency (browser ES 6 support required)
Browse files Browse the repository at this point in the history
  • Loading branch information
akyoto committed Sep 24, 2016
1 parent b975e40 commit f00f4b8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 45 deletions.
39 changes: 1 addition & 38 deletions lib/App/loadScript.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
let fs = Promise.promisifyAll(require('fs'))
let path = require('path')
let babel = require('babel-core')
let uglifyJS = require('uglify-js')
let uglifyJS = require('uglify-js-harmony')

const uglifyJSOptions = {
fromString: true,
Expand All @@ -13,43 +12,7 @@ const uglifyJSOptions = {
}
}

const babelOptions = {
plugins: [
'babel-plugin-transform-es2015-template-literals',
'babel-plugin-transform-es2015-literals',
'babel-plugin-transform-es2015-function-name',
'babel-plugin-transform-es2015-arrow-functions',
'babel-plugin-transform-es2015-block-scoped-functions',
'babel-plugin-transform-es2015-classes',
'babel-plugin-transform-es2015-object-super',
'babel-plugin-transform-es2015-shorthand-properties',
'babel-plugin-transform-es2015-computed-properties',
'babel-plugin-transform-es2015-for-of',
'babel-plugin-transform-es2015-sticky-regex',
'babel-plugin-transform-es2015-unicode-regex',
'babel-plugin-check-es2015-constants',
'babel-plugin-transform-es2015-spread',
'babel-plugin-transform-es2015-parameters',
'babel-plugin-transform-es2015-destructuring',
'babel-plugin-transform-es2015-block-scoping'
].map(pluginName => {
// For backwards compatibility:
// On older babel versions these need to be included directly,
// on newer ones a string array is expected.
try {
return require(pluginName)
} catch(e) {
return pluginName
}
})
}

let minify = function(source, file) {
// Translate ES 2015 to standard JavaScript
source = babel.transform(source, Object.assign({
filename: file
}, babelOptions)).code

// Minify
source = uglifyJS.minify(source, Object.assign({
parse: {
Expand Down
4 changes: 2 additions & 2 deletions lib/LiveReload/client.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function _watch() {
var ws = new WebSocket('${protocol}://localhost:${port}/');
let ws = new WebSocket('${protocol}://localhost:${port}/');

ws.onmessage = function(e) {
var message = JSON.parse(e.data);
let message = JSON.parse(e.data);

if(message.title === 'reload') {
return location.reload();
Expand Down
2 changes: 1 addition & 1 deletion lib/LiveReload/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let WebSocket = require('ws')
let UglifyJS = require('uglify-js')
let UglifyJS = require('uglify-js-harmony')
let chalk = require('chalk')

class LiveReload {
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "aero",
"version": "1.7.3",
"version": "1.7.4",
"description": "The fastest web framework on the node platform.",
"repository": "aerojs/aero",
"homepage": "https://github.com/aerojs/aero",
"license": "GPL-3.0",
"main": "lib/index.js",
"dependencies": {
"autoprefixer-stylus": "0.x",
"babel-core": "6.x",
"babel-preset-es2015": "*",
"bluebird": "3.x",
"chalk": "1.x",
"etag": "1.x",
Expand All @@ -25,7 +23,7 @@
"spdy": "3.x",
"strict-mode": "*",
"stylus": ">=0.54.0",
"uglify-js": ">=2.6",
"uglify-js-harmony": ">=2.6",
"ws": ">=1.1.1"
},
"devDependencies": {
Expand Down

0 comments on commit f00f4b8

Please sign in to comment.