less-cluster
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -248,12 +248,15 @@ /** | ||
This overrides the filesToProcess array derived from the | ||
data passed to the _finishCollect method. | ||
This augments the filesToProcess array derived from the | ||
data passed to the _finishCollect method if additional consumers | ||
are detected. | ||
@method _filterAdHocFiles | ||
@param {String[]} adHocFiles | ||
@return {String[]} sorted array of file paths | ||
@param {String[]} filesToProcess | ||
@return {String[]} sorted array of file paths to read into cache | ||
@private | ||
**/ | ||
LessCluster.prototype._filterAdHocFiles = function (adHocFiles) { | ||
var memo = {}, | ||
LessCluster.prototype._filterAdHocFiles = function (filesToProcess) { | ||
"use strict"; | ||
var read = {}, | ||
mix = utils.mix, | ||
@@ -263,14 +266,21 @@ parents = this._parents, | ||
visit = function (nodes, visitor, memo) { | ||
if (nodes) { | ||
Object.keys(nodes).forEach(visitor, memo); | ||
} | ||
}, | ||
visitParents = function (node) { | ||
if (node in parents) { | ||
mix(memo, parents[node]); | ||
Object.keys(parents[node]).forEach(visitParents); | ||
mix(this, parents[node]); | ||
visit(parents[node], visitParents, this); | ||
} | ||
}, | ||
// copy array to allow modification in loop | ||
adHocFiles = filesToProcess.slice(), | ||
i = 0, | ||
len = adHocFiles.length, | ||
file; | ||
for (; i < len; i += 1) { | ||
for (; i < adHocFiles.length; i += 1) { | ||
file = adHocFiles[i]; | ||
@@ -280,17 +290,22 @@ | ||
// file is imported elsewhere | ||
mix(memo, children[file]); | ||
mix(read, children[file]); | ||
Object.keys(children[file]).forEach(visitParents); | ||
} else if (file in parents) { | ||
// files that import this file need to be compiled as well | ||
filesToProcess.push.apply(filesToProcess, Object.keys(children[file])); | ||
visit(children[file], visitParents, read); | ||
} | ||
if (file in parents) { | ||
// file imports other files | ||
mix(memo, parents[file]); | ||
mix(read, parents[file]); | ||
Object.keys(parents[file]).forEach(visitParents); | ||
visit(parents[file], visitParents, read); | ||
} | ||
// always read adHocFiles | ||
memo[file] = true; | ||
read[file] = true; | ||
} | ||
return Object.keys(memo).sort(); | ||
return Object.keys(read).sort(); | ||
}; | ||
@@ -297,0 +312,0 @@ |
{ | ||
"name": "less-cluster", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"description": "Parallel, directory-based execution of lessc.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -225,3 +225,3 @@ /*global describe, it, before, beforeEach, after, afterEach, chai, should, sinon */ | ||
"toFilter" : ["modules/parent.less"], | ||
"toProcess": ["modules/parent.less"], | ||
"toProcess": ["modules/parent.less", "base.less"], | ||
"toRead" : [ | ||
@@ -240,6 +240,6 @@ "_variables.less", | ||
"toProcess": [ | ||
"_variables.less" | ||
// "modules/child.less", | ||
// "modules/parent.less", | ||
// "themes/fancy.less" | ||
"_variables.less", | ||
"modules/child.less", | ||
"modules/parent.less", | ||
"themes/fancy.less" | ||
], | ||
@@ -259,3 +259,3 @@ "toRead" : [ | ||
"toFilter" : ["themes/simple.less"], | ||
"toProcess": ["themes/simple.less"], | ||
"toProcess": ["themes/simple.less", "modules/child.less"], | ||
"toRead" : [ | ||
@@ -262,0 +262,0 @@ "_variables.less", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
119383
3048
0