Socket
Socket
Sign inDemoInstall

webpack

Package Overview
Dependencies
53
Maintainers
1
Versions
832
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.9 to 0.3.10

75

bin/webpack.js

@@ -144,3 +144,45 @@ #!/usr/bin/env node

if(!options.outputPostfix) options.outputPostfix = "." + path.basename(output);
var events = webpack(input, options, function(err, stats) {
if(argv.progress) {
if(!options.events) options.events = new (require("events").EventEmitter)();
var events = options.events;
var sum = 0;
var finished = 0;
var chars = 0;
function print() {
var msg = "";
if(sum > 0) {
msg += "compiling... (" + c("\033[1m\033[33m");
msg += sprintf("%4s", finished+"") + "/" + sprintf("%4s", sum+"");
msg += " " + sprintf("%4s", Math.floor(finished*100/sum)+"%");
msg += c("\033[39m\033[22m") + ")";
}
for(var i = 0; i < chars; i++)
process.stderr.write("\b");
process.stderr.write(msg);
chars = msg.length;
}
events.on("task", function(name) {
sum++;
print();
});
events.on("task-end", function(name) {
finished++;
if(name) {
for(var i = 0; i < chars; i++)
process.stderr.write("\b \b");
process.stderr.write(name + " " + c("\033[1m\033[32m") + "done" + c("\033[39m\033[22m") + "\n");
chars = 0;
}
print();
});
events.on("bundle", function(name) {
sum = 0;
finished = 0;
for(var i = 0; i < chars; i++)
process.stderr.write("\b \b");
chars = 0;
});
}
webpack(input, options, function(err, stats) {
if(err) {

@@ -236,33 +278,2 @@ console.error(err);

});
if(argv.progress) {
var sum = 0;
var finished = 0;
var chars = 0;
function print() {
var msg = "";
if(sum > 0) {
msg += "compiling... (" + c("\033[1m\033[33m");
msg += sprintf("%4s", finished+"") + "/" + sprintf("%4s", sum+"");
msg += " " + sprintf("%4s", Math.floor(finished*100/sum)+"%");
msg += c("\033[39m\033[22m") + ")";
}
for(var i = 0; i < chars; i++)
process.stdout.write("\b");
process.stdout.write(msg);
chars = msg.length;
}
events.on("task", function() {
sum++;
print();
});
events.on("task-end", function() {
finished++;
print();
});
events.on("bundle", function() {
sum = 0;
finished = 0;
print();
});
}
}

@@ -9,2 +9,3 @@ /*

var path = require("path");
var assert = require("assert");

@@ -35,7 +36,7 @@ /**

}
options.events.emit("task", "build modules");
options.events.emit("task", "build chunks");
options.events.emit("task", "optimize");
options.events.emit("task", "cleanup");
var mainModuleId;
options.events.emit("task");
options.events.emit("task");
options.events.emit("task");
options.events.emit("task");
addModule(depTree, context, mainModule, options, {type: "main"}, function(err, id) {

@@ -50,7 +51,7 @@ if(err) {

function buildTree() {
options.events.emit("task-end");
options.events.emit("task-end", "build modules");
addChunk(depTree, depTree.modulesById[mainModuleId], options);
createRealIds(depTree, options);
options.events.emit("task-end");
options.events.emit("task-end", "build chunks");

@@ -62,3 +63,3 @@ for(var chunkId in depTree.chunks) {

}
options.events.emit("task-end");
options.events.emit("task-end", "optimize");

@@ -73,3 +74,3 @@ // cleanup

// return
options.events.emit("task-end");
options.events.emit("task-end", "cleanup");
callback(null, depTree);

@@ -101,4 +102,5 @@ }

if(loaderFunctions.length > 0) {
var async = false;
var done = false;
try {
var async = false;
var context = {

@@ -123,2 +125,4 @@ request: request,

async = true;
assert(!done);
done = true;
nextLoader.apply(null, arguments);

@@ -133,6 +137,14 @@ },

var retVal = loaderFunctions.pop().apply(context, args);
if(!async)
if(!async) {
done = true;
nextLoader(retVal === undefined ? new Error("loader did not return a value") : null, retVal);
}
} catch(e) {
callback("Loader throwed exeception: " + e);
if(!done) {
done = true;
callback("Loader throwed exeception: " + e);
} else {
if(e.stack) console.error(e.stack);
else console.error(e);
}
return;

@@ -281,2 +293,3 @@ }

count--;
assert(count >= 0);
if(count === 0) {

@@ -340,2 +353,3 @@ if(errors.length) {

count--;
assert(count >= 0);
if(count == 0) {

@@ -342,0 +356,0 @@ if(errors.length > 0)

@@ -74,3 +74,2 @@ /*

if(options.watch) {
console.log("start watching...");
var fs = require("fs");

@@ -140,8 +139,11 @@ var watchers = [];

options.resolve.loaders.push({test: /\.less$/, loader: "style!less"});
options.events.emit("task");
function callback(err, result) {
options.events.emit("task-end");
finalCallback(err, result);
}
options.events.emit("task", "create ouput directory");
options.events.emit("task", "prepare chunks");
options.events.emit("task", "statistics");
buildDeps(context, moduleName, options, function(err, depTree) {
function callback(err, result) {
options.events.emit("task-end", "statistics");
finalCallback(err, result);
}
if(err) {

@@ -254,2 +256,3 @@ callback(err);

});
options.events.emit("task-end", "prepare chunks");
options.events.emit("start-writing", hash);

@@ -284,2 +287,3 @@ // write files

createDir(outDir, function(err) {
options.events.emit("task-end", "create ouput directory");
if(err) return callback(err);

@@ -290,3 +294,5 @@ writeFiles();

fileWrites.forEach(function(writeAction) {
options.events.emit("task", "write " + writeAction[0]);
fs.writeFile(writeAction[0].replace(HASH_REGEXP, hash), writeAction[1], "utf-8", function(err) {
options.events.emit("task-end", "write " + writeAction[0]);
if(err) throw err;

@@ -293,0 +299,0 @@ remFiles--;

@@ -178,4 +178,4 @@ /*

"eval(",
JSON.stringify(result.join("")),
"\n\n// WEBPACK FOOTER //\n",
JSON.stringify(result),
");\n\n// WEBPACK FOOTER //\n",
"// module.id = ", module.id, "\n",

@@ -182,0 +182,0 @@ "// module.realId = ", module.realId, "\n",

{
"name": "webpack",
"version": "0.3.9",
"version": "0.3.10",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "Packs CommonJs 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.",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc