let fs = Promise.promisifyAll(require('fs'))
let path = require('path')
let babel = require('babel-core')
let uglifyJS = require('uglify-js')

const uglifyJSOptions = {
	fromString: true,
	compress: {
		screw_ie8: true
	},
	mangle: {
		screw_ie8: true
	}
}

const babelOptions = {
	plugins: [
		require('babel-plugin-transform-es2015-template-literals'),
		require('babel-plugin-transform-es2015-literals'),
		require('babel-plugin-transform-es2015-function-name'),
		require('babel-plugin-transform-es2015-arrow-functions'),
		require('babel-plugin-transform-es2015-block-scoped-functions'),
		require('babel-plugin-transform-es2015-classes'),
		require('babel-plugin-transform-es2015-object-super'),
		require('babel-plugin-transform-es2015-shorthand-properties'),
		require('babel-plugin-transform-es2015-computed-properties'),
		require('babel-plugin-transform-es2015-for-of'),
		require('babel-plugin-transform-es2015-sticky-regex'),
		require('babel-plugin-transform-es2015-unicode-regex'),
		require('babel-plugin-check-es2015-constants'),
		require('babel-plugin-transform-es2015-spread'),
		require('babel-plugin-transform-es2015-parameters'),
		require('babel-plugin-transform-es2015-destructuring'),
		require('babel-plugin-transform-es2015-block-scoping')
	]
}

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: {
			filename: file
		}
	}, uglifyJSOptions)).code

	return source
}

module.exports = function*(file) {
	file = path.resolve(file)

	try {
		let cached = this.cache.scripts[file]
		
		if(cached && (yield fs.statAsync(file)).mtime <= new Date(cached.mtime))
			return cached.code

		let source = yield fs.readFileAsync(file, 'utf8')

		if(!path.basename(file).endsWith('.min.js'))
			source = minify(source, file)

		// Cache it
		this.cache.scripts[file] = {
			code: source,
			mtime: (new Date()).toISOString()
		}

		return source
	} catch(e) {
		if(e.code !== 'ENOENT' || e.path !== file)
			this.log(e)

		return null
	}
}
@@ -288,24 +288,16 @@
 ns: %5B%0A%09%09
-require(
 'babel-p
@@ -333,37 +333,28 @@
 te-literals'
-)
 ,%0A%09%09
-require(
 'babel-plugi
@@ -381,29 +381,20 @@
 iterals'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -430,29 +430,20 @@
 on-name'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -477,37 +477,28 @@
 w-functions'
-)
 ,%0A%09%09
-require(
 'babel-plugi
@@ -539,29 +539,20 @@
 nctions'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -582,29 +582,20 @@
 classes'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -630,29 +630,20 @@
 t-super'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -682,37 +682,28 @@
 -properties'
-)
 ,%0A%09%09
-require(
 'babel-plugi
@@ -741,29 +741,20 @@
 perties'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -783,29 +783,20 @@
 -for-of'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -827,37 +827,28 @@
 ticky-regex'
-)
 ,%0A%09%09
-require(
 'babel-plugi
@@ -880,29 +880,20 @@
 e-regex'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -921,29 +921,20 @@
 nstants'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -963,29 +963,20 @@
 -spread'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -1009,29 +1009,20 @@
 ameters'
-)
 ,%0A%09%09
-require(
 'babel-p
@@ -1062,21 +1062,12 @@
 ing'
-)
 ,%0A%09%09
-require(
 'bab
@@ -1107,17 +1107,16 @@
 scoping'
-)
 %0A%09%5D%0A%7D%0A%0Al
@@ -1543,11 +1543,9 @@
 le%5D%0A
-%09%09
 %0A
+
 %09%09if
@@ -1980,13 +1980,14 @@
 urn null%0A%09%7D%0A
-
 %7D
+%0A

Change babel plugin array to correct format