broccoli-eyeglass
Advanced tools
Comparing version 2.4.2 to 2.4.3
@@ -17,3 +17,2 @@ var path = require("path"); | ||
var walkSync = require("walk-sync"); | ||
var os = require("os"); | ||
@@ -278,26 +277,8 @@ require("string.prototype.startswith"); | ||
var self = this; | ||
// flatten array of promises | ||
var promises = []; | ||
files.forEach(function(sassFile) { | ||
promises = promises.concat(RSVP.all(self.compileSassFile(srcPath, sassFile, destDir))); | ||
}); | ||
// throttle number of calls to compileSassFile | ||
var concurrentTasksPerCPU = 4; | ||
var numConcurrentCalls = os.cpus().length * concurrentTasksPerCPU; | ||
var promiseChunks = []; | ||
for (var index = 0; index < promises.length; index += numConcurrentCalls) { | ||
var chunk = promises.slice(index, index + numConcurrentCalls); | ||
promiseChunks.push(chunk); | ||
} | ||
return promiseChunks.reduce(function(promise, chunk) { | ||
return promise.then(function() { | ||
return RSVP.allSettled(chunk).then(function(settled) { | ||
settled.forEach(function(item) { | ||
if (item.state === "rejected") { | ||
throw item.reason; | ||
} | ||
}); | ||
}); | ||
}); | ||
}, RSVP.Promise.resolve()); | ||
return files.reduce(function(promise, sassFile) { | ||
return promise.then(function() { | ||
return RSVP.all(self.compileSassFile(srcPath, sassFile, destDir)); | ||
}); | ||
}, RSVP.Promise.resolve()); | ||
}; | ||
@@ -304,0 +285,0 @@ |
{ | ||
"name": "broccoli-eyeglass", | ||
"description": "Sass compiler for Broccoli with Eyeglass Integration", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"author": "Chris Eppstein <chris@eppsteins.net>", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
102324
2208