fly-webpack
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -9,9 +9,13 @@ <div align="center"> | ||
### v1.0.8 | ||
* add more tests | ||
### v1.0.6 | ||
* added support for node@0.11 | ||
* add support for node@0.11 | ||
### v1.0.5 | ||
* added tests. | ||
* add tests. | ||
@@ -18,0 +22,0 @@ ### v1.0.3 |
@@ -91,71 +91,95 @@ 'use strict'; | ||
try { | ||
(function () { | ||
var _webpack = wp || _webpack3['default']; | ||
var _webpack = wp || _webpack3['default']; | ||
if (!opts.entry) { | ||
(function () { | ||
if (!opts.entry) { | ||
(function () { | ||
if (!files.length) { | ||
cb(new Error('source file not found')); | ||
} | ||
if (!files.length) { | ||
cb(new Error('source file not found')); | ||
} | ||
var entries = {}; | ||
var entries = {}; | ||
files.forEach(function (file) { | ||
var name = _path2['default'].basename(file, _path2['default'].extname(file)); | ||
entries[name] = []; | ||
entries[name].push(_path2['default'].join(process.cwd(), file)); | ||
}); | ||
files.forEach(function (file) { | ||
var name = _path2['default'].basename(file, _path2['default'].extname(file)); | ||
entries[name] = []; | ||
entries[name].push(_path2['default'].join(process.cwd(), file)); | ||
}); | ||
opts.entry = entries; | ||
})(); | ||
} | ||
opts.entry = entries; | ||
})(); | ||
} | ||
var _opts = _lodash2['default'].cloneDeep(opts); | ||
if (opts.debug) { | ||
_this.emit('fly_wp_entry_setup', opts.entry); | ||
} | ||
if (opts.debug) { | ||
_opts.watch = false; | ||
} | ||
var _opts = _lodash2['default'].cloneDeep(opts); | ||
var compiler = _webpack(_opts, function (err, stats) { | ||
if (!opts.watch) { | ||
if (err || stats.compilation.errors.length) { | ||
cb(err || stats.compilation.errors[0]); | ||
} else { | ||
done(stats); | ||
cb(null, _chalk2['default'].bold.green('webpack is done')); | ||
if (opts.debug) { | ||
_opts.watch = false; | ||
} | ||
var compiler = _webpack(_opts, function (err, stats) { | ||
if (!opts.watch) { | ||
if (err || stats.compilation.errors.length) { | ||
cb(err || stats.compilation.errors[0]); | ||
} else { | ||
done(stats); | ||
cb(null, _chalk2['default'].bold.green('webpack is done')); | ||
} | ||
} | ||
customCb(err, stats); | ||
}); | ||
if (opts.debug) { | ||
(function () { | ||
// hide output in dev mode | ||
var fs = compiler.outputFileSystem = new _memoryFs2['default'](); | ||
compiler.plugin('after-emit', function (compilation, callback) { | ||
var output = {}; | ||
_Object$keys(compilation.assets).forEach(function (outname) { | ||
if (compilation.assets[outname].emitted) { | ||
var file_path = fs.join(compiler.outputPath, outname); | ||
if (file_path.indexOf('?') !== -1) { | ||
file_path = file_path.split('?')[0]; | ||
} | ||
output[outname] = file_path; | ||
} | ||
}); | ||
_this.emit('fly_wp_output', output); | ||
callback(); | ||
}); | ||
})(); | ||
} | ||
customCb(err, stats); | ||
}); | ||
if (opts.debug) { | ||
// hide output in dev mode | ||
compiler.outputFileSystem = new _memoryFs2['default'](); | ||
} | ||
if (opts.watch) { | ||
if (!opts.debug) { | ||
compiler = compiler.compiler; | ||
} | ||
_this.log(_chalk2['default'].underline.cyan('webpack is watching for changes')); | ||
} | ||
if (opts.watch) { | ||
compiler = compiler.compiler; | ||
_this.log(_chalk2['default'].underline.cyan('webpack is watching for changes')); | ||
} | ||
if (!opts.debug) { | ||
if (!opts.debug) { | ||
if (opts.progress && !opts.debug) { | ||
compiler.apply(new _webpackLibProgressPlugin2['default'](function (percentage, msg) { | ||
percentage = Math.floor(percentage * 100); | ||
msg = percentage + '% ' + msg; | ||
if (percentage < 10) { | ||
msg = ' ' + msg; | ||
} | ||
_this.log(_chalk2['default'].bold.yellow('webpack ' + msg)); | ||
})); | ||
} | ||
if (opts.progress && !opts.debug) { | ||
compiler.apply(new _webpackLibProgressPlugin2['default'](function (percentage, msg) { | ||
percentage = Math.floor(percentage * 100); | ||
msg = percentage + '% ' + msg; | ||
if (percentage < 10) { | ||
msg = ' ' + msg; | ||
compiler.plugin('done', function (stats) { | ||
if (opts.watch) { | ||
done(stats); | ||
} | ||
_this.log(_chalk2['default'].bold.yellow('webpack ' + msg)); | ||
})); | ||
}); | ||
} | ||
compiler.plugin('done', function (stats) { | ||
if (opts.watch) { | ||
done(stats); | ||
} | ||
}); | ||
} | ||
})(); | ||
} catch (err) { | ||
@@ -162,0 +186,0 @@ cb(err); |
{ | ||
"name": "fly-webpack", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Webpack plugin for Fly.", | ||
@@ -26,3 +26,3 @@ "license": "MIT", | ||
"scripts": { | ||
"lint": "eslint src/*.js", | ||
"lint": "eslint src/*.js test/*.js", | ||
"setup": "npm i && npm test", | ||
@@ -29,0 +29,0 @@ "build": "babel --optional runtime src -d dist", |
@@ -36,7 +36,7 @@ <div align="center"> | ||
} | ||
}; | ||
} | ||
yield this | ||
.source("src/main.js") | ||
.webpack(webpackConfig); | ||
.webpack(webpackConfig) | ||
} | ||
@@ -51,3 +51,3 @@ ``` | ||
.source("src/main.js") | ||
.webpack( require('./webpack.config.js') ); | ||
.webpack( require('./webpack.config.js') ) | ||
} | ||
@@ -59,3 +59,3 @@ ``` | ||
import webpack from 'webpack'; | ||
import webpack from 'webpack' | ||
@@ -65,3 +65,3 @@ export default function* () { | ||
.source("src/main.js") | ||
.webpack( require('./webpack.config.js'), webpack); | ||
.webpack( require('./webpack.config.js'), webpack) | ||
} | ||
@@ -80,3 +80,3 @@ ``` | ||
/* Use stats to do more things if needed */ | ||
}); | ||
}) | ||
} | ||
@@ -101,3 +101,3 @@ ``` | ||
} | ||
}); | ||
}) | ||
} | ||
@@ -116,3 +116,3 @@ ``` | ||
} | ||
}); | ||
}) | ||
} | ||
@@ -122,4 +122,5 @@ ``` | ||
## Release History | ||
* 1.0.6 - Added support for node@0.11 | ||
* 1.0.5 - Added tests | ||
* 1.0.8 - Add more tests | ||
* 1.0.6 - Add support for node@0.11 | ||
* 1.0.5 - Add tests | ||
* 1.0.3 - Initial release | ||
@@ -126,0 +127,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12313
146
136