fire bundle-invalid, documentation, added noWrite option

This commit is contained in:
Tobias Koppers 2012-08-08 20:27:55 +02:00
parent f436d7b2e1
commit 8c0ab9c229
3 changed files with 24 additions and 3 deletions

View File

@ -399,7 +399,22 @@ You can also save this options object in a JSON file and use it with the shell c
events: new EventEmitter(), // default: new EventEmitter()
// EventEmitter on which events for the compile process are fired
// events: "bundle", "module", "context", "task", "task-end"
// events:
// -- bundling process --
// "bundle" (stats) the bundle is finished
// "bundle-invalid" () fired when the bundle gets invalid
// [bundle-invalid is only fired in watch mode]
// "start-writing" (hash) fired when webpack starts writing
// -- events for dependencies --
// "module" (module, filename) before a module is loaded
// "context" (module, dirname) before a context is loaded
// "dependency" (filename) before a dependency is loaded
// -- events for progress --
// "task" (name?) start of a task
// "task-end" (name?) end of a task
noWrite: true, // default: undefined
// if true webpack do not write out any file
parse: {
// options for parsing

View File

@ -150,6 +150,8 @@ module.exports = function(context, moduleName, options, callback) {
// Start the timeout again
function startAgain() {
if(!isWaiting)
options.events.emit("bundle-invalid");
isWaiting = true;
if(timeout)
clearTimeout(timeout);
@ -161,6 +163,7 @@ module.exports = function(context, moduleName, options, callback) {
runAgain = false;
isRunning = true;
isWaiting = false;
// compile
webpack(context, moduleName, options, callback);
@ -226,7 +229,7 @@ function webpack(context, moduleName, options, callback) {
options.internal.subStats = subStats;
// Some status info
options.events.emit("task", "create ouput directory");
if(!options.noWrite) options.events.emit("task", "create ouput directory");
options.events.emit("task", "prepare chunks");
options.events.emit("task", "statistics");
@ -346,6 +349,9 @@ function webpack(context, moduleName, options, callback) {
options.emitFile(filename, buffer, true);
});
options.events.emit("task-end", "prepare chunks");
if(options.noWrite) return writingFinished();
options.events.emit("start-writing", hash);
// recursive create dir

View File

@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "0.5.7",
"version": "0.5.8",
"author": "Tobias Koppers @sokra",
"description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.",
"dependencies": {