Comparing version 0.7.0-beta4 to 0.7.0-beta5
@@ -186,3 +186,4 @@ /* | ||
if(err) return callback(err); | ||
resolveLoadersFunc(context, postLoaders, options.resolve, onPostLoadersResolved); | ||
if(postLoaders) resolveLoadersFunc(context, postLoaders, options.resolve, onPostLoadersResolved); | ||
else onPostLoadersResolved(null, []); | ||
function onPostLoadersResolved(err, postLoaders) { | ||
@@ -208,11 +209,7 @@ if(err) return callback(err); | ||
profile && (profile.loadersCheckEnd = buildModuleStart); | ||
(seperate ? seperateBuildModule : buildModule)({ | ||
context: context, | ||
filenameWithLoaders: filenameWithLoaders, | ||
preLoaders: preLoaders, | ||
loaders: loaders, | ||
postLoaders: postLoaders, | ||
filename: filename, | ||
options: options | ||
}, function(err, source, deps, dependencyInfo, profileBuild) { | ||
(seperate ? seperateBuildModule : buildModule)( | ||
context, filenameWithLoaders, | ||
preLoaders, loaders, postLoaders, | ||
filename, | ||
options, function(err, source, deps, dependencyInfo, profileBuild) { | ||
if(err) return callback(err); | ||
@@ -250,11 +247,15 @@ | ||
function seperateBuildModule(parameters, callback) { | ||
function seperateBuildModule(context, filenameWithLoaders, | ||
preLoaders, loaders, postLoaders, | ||
filename, options, callback) { | ||
var opt = {}; | ||
Object.keys(parameters.options).forEach(function(name) { | ||
Object.keys(options).forEach(function(name) { | ||
if(name == "internal") return; | ||
if(name == "events") return; | ||
opt[name] = parameters.options[name]; | ||
if(name == "workers") return; | ||
opt[name] = options[name]; | ||
}); | ||
parameters.options = opt; | ||
options.workers.run("buildModule", parameters, function(err, source, deps, cacheInfo, profileBuild) { | ||
options.workers.run("buildModule", context, filenameWithLoaders, | ||
preLoaders, loaders, postLoaders, | ||
filename, opt, function(err, source, deps, cacheInfo, profileBuild) { | ||
if(err) err = { | ||
@@ -261,0 +262,0 @@ message: err.message, |
@@ -5,12 +5,7 @@ var fs = require("fs"); | ||
function buildModule(parameters, callback) { | ||
function buildModule(context, filenameWithLoaders, | ||
preLoaders, loaders, postLoaders, | ||
filename, | ||
options, callback) { | ||
var context = parameters.context; | ||
var filenameWithLoaders = parameters.filenameWithLoaders; | ||
var preLoaders = parameters.preLoaders; | ||
var loaders = parameters.loaders; | ||
var postLoaders = parameters.postLoaders; | ||
var filename = parameters.filename; | ||
var options = parameters.options; | ||
if(options.profile) var profile = { | ||
@@ -24,10 +19,2 @@ start: new Date().getTime() | ||
} | ||
var cacheEntry = parameters.cacheEntry || { | ||
add: function(file) { | ||
dependencyInfo.files.push(file); | ||
}, | ||
clear: function() { | ||
dependencyInfo.files = []; | ||
} | ||
}; | ||
@@ -34,0 +21,0 @@ fs.readFile(filename, function(err, content) { |
var buildModule = require("./buildModule"); | ||
var resolve = require("enhanced-resolve"); | ||
var registers = {}; | ||
function applyRegister(arr) { | ||
var regMapping = arr.splice(2, 1)[0]; | ||
var regName = arr[1]; | ||
if(regMapping) { | ||
var reg = registers[regName]; | ||
for(var i = 0; i < regMapping.length; i++) { | ||
if(regMapping[i]) | ||
arr[i+2] = reg[i]; | ||
} | ||
} | ||
registers[regName] = arr.slice(2); | ||
for(var i = 2; i < arr.length; i++) | ||
arr[i] = JSON.parse(arr[i]); | ||
} | ||
@@ -10,6 +25,16 @@ process.on("message", function(msg) { | ||
try { | ||
applyRegister(msg); | ||
switch(msg[1]) { | ||
case "buildModule": | ||
var parameters = msg[2]; | ||
buildModule(parameters, function(err, source, deps, cacheInfo, profile) { | ||
var context = msg[2], | ||
filenameWithLoaders = msg[3], | ||
preLoaders = msg[4], | ||
loaders = msg[5], | ||
postLoaders = msg[6], | ||
filename = msg[7], | ||
options = msg[8]; | ||
buildModule(context, filenameWithLoaders, | ||
preLoaders, loaders, postLoaders, | ||
filename, | ||
options, function(err, source, deps, cacheInfo, profile) { | ||
if(err) err = { message: err.message, stack: err.stack, _toString: err.toString() }; | ||
@@ -16,0 +41,0 @@ process.send([id, err, source, deps, cacheInfo, profile]); |
@@ -6,2 +6,3 @@ var child_process = require("child_process"); | ||
this.workers = []; | ||
this.workersRegister = []; | ||
this.forkedWorkers = []; | ||
@@ -28,4 +29,3 @@ this.workersJobs = []; | ||
if(worker < 0) throw new Error("Not ready! Check workers.ready()."); | ||
this.workersJobs[worker]++; | ||
args.unshift(this.workers[worker]); | ||
args.unshift(worker); | ||
this.pushJob.apply(this, args); | ||
@@ -41,2 +41,3 @@ } | ||
this.workersJobs.push(0); | ||
this.workersRegister.push({}); | ||
worker.on("message", function(result) { | ||
@@ -66,3 +67,19 @@ this.workersJobs[idx]--; | ||
args[0] = id; | ||
worker.send(args); | ||
this.workersJobs[worker]++; | ||
for(var i = 2; i < args.length; i++) | ||
args[i] = JSON.stringify(args[i]); | ||
var reg = this.workersRegister[worker][args[1]]; | ||
var regMapping = null; | ||
var newValues = args.slice(2); | ||
this.workersRegister[worker][args[1]] = newValues; | ||
if(reg && newValues.length == reg.length) { | ||
regMapping = []; | ||
for(var i = 0; i < reg.length; i++) { | ||
var match = reg[i] == newValues[i]; | ||
regMapping.push(match); | ||
if(match) args[i+2] = null; | ||
} | ||
} | ||
args.splice(2, 0, regMapping); | ||
this.workers[worker].send(args); | ||
} | ||
@@ -75,2 +92,4 @@ | ||
this.workers.length = 0; | ||
this.workersJobs.length = 0; | ||
this.workersRegister.length = 0; | ||
} | ||
@@ -77,0 +96,0 @@ |
{ | ||
"name": "webpack", | ||
"version": "0.7.0-beta4", | ||
"version": "0.7.0-beta5", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "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.", |
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
369750
9062