Skip to content

Commit 8c0ab9c

Browse files
committed
fire bundle-invalid, documentation, added noWrite option
1 parent f436d7b commit 8c0ab9c

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,22 @@ You can also save this options object in a JSON file and use it with the shell c
399399

400400
events: new EventEmitter(), // default: new EventEmitter()
401401
// EventEmitter on which events for the compile process are fired
402-
// events: "bundle", "module", "context", "task", "task-end"
402+
// events:
403+
// -- bundling process --
404+
// "bundle" (stats) the bundle is finished
405+
// "bundle-invalid" () fired when the bundle gets invalid
406+
// [bundle-invalid is only fired in watch mode]
407+
// "start-writing" (hash) fired when webpack starts writing
408+
// -- events for dependencies --
409+
// "module" (module, filename) before a module is loaded
410+
// "context" (module, dirname) before a context is loaded
411+
// "dependency" (filename) before a dependency is loaded
412+
// -- events for progress --
413+
// "task" (name?) start of a task
414+
// "task-end" (name?) end of a task
415+
416+
noWrite: true, // default: undefined
417+
// if true webpack do not write out any file
403418

404419
parse: {
405420
// options for parsing

‎lib/webpack.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ module.exports = function(context, moduleName, options, callback) {
150150

151151
// Start the timeout again
152152
function startAgain() {
153+
if(!isWaiting)
154+
options.events.emit("bundle-invalid");
153155
isWaiting = true;
154156
if(timeout)
155157
clearTimeout(timeout);
@@ -161,6 +163,7 @@ module.exports = function(context, moduleName, options, callback) {
161163

162164
runAgain = false;
163165
isRunning = true;
166+
isWaiting = false;
164167

165168
// compile
166169
webpack(context, moduleName, options, callback);
@@ -226,7 +229,7 @@ function webpack(context, moduleName, options, callback) {
226229
options.internal.subStats = subStats;
227230

228231
// Some status info
229-
options.events.emit("task", "create ouput directory");
232+
if(!options.noWrite) options.events.emit("task", "create ouput directory");
230233
options.events.emit("task", "prepare chunks");
231234
options.events.emit("task", "statistics");
232235

@@ -346,6 +349,9 @@ function webpack(context, moduleName, options, callback) {
346349
options.emitFile(filename, buffer, true);
347350
});
348351
options.events.emit("task-end", "prepare chunks");
352+
353+
if(options.noWrite) return writingFinished();
354+
349355
options.events.emit("start-writing", hash);
350356

351357
// recursive create dir

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack",
3-
"version": "0.5.7",
3+
"version": "0.5.8",
44
"author": "Tobias Koppers @sokra",
55
"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.",
66
"dependencies": {

0 commit comments

Comments
 (0)