broccoli-eyeglass
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -11,2 +11,3 @@ "use strict"; | ||
const RSVP = require("rsvp"); | ||
const Promise = RSVP.Promise; | ||
const mkdirp = require("mkdirp"); | ||
@@ -23,4 +24,2 @@ mkdirp.promise = mkdirp.promise || RSVP.denodeify(mkdirp); | ||
require("string.prototype.startswith"); | ||
const READ_AS_UTF_8 = {encoding: "utf8"}; | ||
@@ -240,3 +239,2 @@ const readFile = RSVP.denodeify(fs.readFile); | ||
} | ||
moveOption(this.options, this, "cssDir", "sassDir", | ||
@@ -248,2 +246,3 @@ "optionsGenerator", "fullException", | ||
if (!this.cssDir) { | ||
@@ -307,9 +306,15 @@ throw new Error("Expected cssDir option."); | ||
compileTree(srcPath, files, destDir) { | ||
let numConcurrentCalls = Number(process.env.JOBS) || os.cpus().length; | ||
switch (files.length) { | ||
case 0: return Promise.resolve(); | ||
case 1: return RSVP.all(this.compileSassFile(srcPath, files[0], destDir)); | ||
default: { | ||
let numConcurrentCalls = Number(process.env.JOBS) || os.cpus().length; | ||
let worker = queue.async.asyncify(file => { | ||
return RSVP.all(this.compileSassFile(srcPath, file, destDir)); | ||
}); | ||
let worker = queue.async.asyncify(file => { | ||
return RSVP.all(this.compileSassFile(srcPath, file, destDir)); | ||
}); | ||
return RSVP.resolve(queue(worker, files, numConcurrentCalls)); | ||
return RSVP.resolve(queue(worker, files, numConcurrentCalls)); | ||
} | ||
} | ||
} | ||
@@ -394,3 +399,2 @@ | ||
cachedOutput(srcDir, relativeFilename, options) { | ||
debugger; | ||
return this.keyForSourceFile(srcDir, relativeFilename, options).then(key => { | ||
@@ -493,3 +497,3 @@ | ||
} | ||
let results = []; | ||
inputFiles.forEach(dep => { | ||
@@ -499,6 +503,9 @@ // populate the dependencies cache for rebuilds | ||
}); | ||
let files = Object.keys(outputFiles); | ||
persistentCacheDebug("cached output files for %s are: %s", | ||
details.sassFilename, files.join(", ")); | ||
files.forEach(f => { | ||
return RSVP.Promise.all(files.map(f => { | ||
let data = outputFiles[f]; | ||
@@ -508,7 +515,6 @@ let outputFile = path.join(details.destDir, f); | ||
this.addOutput(details.fullSassFilename, outputFile); | ||
let writePromise = mkdirp.promise(path.dirname(outputFile)). | ||
return mkdirp.promise(path.dirname(outputFile)). | ||
then(() => writeFile(outputFile, new Buffer(data, "base64"))); | ||
results.push(writePromise); | ||
}); | ||
return RSVP.all(results); | ||
})); | ||
} | ||
@@ -926,3 +932,2 @@ | ||
persistentCacheDebug("clearing cache because forceInvalidateCache was set."); | ||
debugger; | ||
return this.persistentCache.clear().then(this._build.bind(this)); | ||
@@ -929,0 +934,0 @@ } else { |
@@ -147,42 +147,37 @@ "use strict"; | ||
dependenciesHash(srcDir, relativeFilename, options) { | ||
return new RSVP.Promise(resolve => { | ||
if (!this._dependenciesHash) { | ||
let hashForDep = require("hash-for-dep"); | ||
let eyeglass = new this.Eyeglass(options); | ||
let hash = crypto.createHash("sha1"); | ||
let cachableOptions = stringify(this.cachableOptions(options)); | ||
if (!this._dependenciesHash) { | ||
let hashForDep = require("hash-for-dep"); | ||
let eyeglass = new this.Eyeglass(options); | ||
let hash = crypto.createHash("sha1"); | ||
let cachableOptions = stringify(this.cachableOptions(options)); | ||
persistentCacheDebug("cachableOptions are %s", cachableOptions); | ||
hash.update(cachableOptions); | ||
hash.update("broccoli-eyeglass@" + EyeglassCompiler.currentVersion()); | ||
persistentCacheDebug("cachableOptions are %s", cachableOptions); | ||
hash.update(cachableOptions); | ||
hash.update("broccoli-eyeglass@" + EyeglassCompiler.currentVersion()); | ||
let egModules = sortby(eyeglass.modules.list, m => m.name); | ||
let egModules = sortby(eyeglass.modules.list, m => m.name); | ||
egModules.forEach(mod => { | ||
if (mod.inDevelopment || mod.eyeglass.inDevelopment) { | ||
hash.update(mod.name+"@"+hashForDep(mod.path)); | ||
} else { | ||
hash.update(mod.name+"@"+mod.version); | ||
} | ||
}); | ||
egModules.forEach(mod => { | ||
if (mod.inDevelopment || mod.eyeglass.inDevelopment) { | ||
hash.update(mod.name + "@" + hashForDep(mod.path)); | ||
} else { | ||
hash.update(mod.name + "@" + mod.version); | ||
} | ||
}); | ||
this._dependenciesHash = hash.digest("hex"); | ||
} | ||
this._dependenciesHash = hash.digest("hex"); | ||
} | ||
resolve(this._dependenciesHash); | ||
}); | ||
return this._dependenciesHash; | ||
} | ||
keyForSourceFile(srcDir, relativeFilename, options) { | ||
let keyPromise = super.keyForSourceFile(srcDir, relativeFilename, options); | ||
let dependenciesPromise = this.dependenciesHash(srcDir, relativeFilename, options); | ||
let key = super.keyForSourceFile(srcDir, relativeFilename, options); | ||
let dependencies = this.dependenciesHash(srcDir, relativeFilename, options); | ||
return RSVP.all([ | ||
keyPromise, | ||
dependenciesPromise | ||
]).then(results => { | ||
let mungedKey = results[0] + "+" + results[1]; | ||
return mungedKey; | ||
}); | ||
return RSVP.hash({ | ||
key, | ||
dependencies | ||
}).then(results => results.key + "+" + results.dependencies); | ||
} | ||
}; |
{ | ||
"name": "broccoli-eyeglass", | ||
"description": "Sass compiler for Broccoli with Eyeglass Integration", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"author": "Chris Eppstein <chris@eppsteins.net>", | ||
@@ -41,3 +41,2 @@ "main": "lib/index.js", | ||
"rsvp": "^4.0.1", | ||
"string.prototype.startswith": "^0.2.0", | ||
"walk-sync": "^0.3.1" | ||
@@ -44,0 +43,0 @@ }, |
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
18
219386
2170
- Removedstring.prototype.startswith@^0.2.0
- Removedstring.prototype.startswith@0.2.0(transitive)