mirror of
https://github.com/flynx/features.js.git
synced 2025-10-28 18:00:11 +00:00
added loop detection + found a bug (can't yet reproduce)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
48bb6b2746
commit
9670d2bf0b
20
features.js
20
features.js
@ -601,9 +601,25 @@ var FeatureSetProto = {
|
||||
// chain completed -> check and store...
|
||||
if(chain.indexOf(k) >= 0){
|
||||
var c = JSON.stringify(chain)
|
||||
// repeating chain -> loop detected...
|
||||
// repeating chain -> loop or order conflict detected...
|
||||
if(chains.indexOf(c) >= 0){
|
||||
console.error('Feature cyclic dependency:', chain)
|
||||
// format the graph...
|
||||
// XXX this catches strange things and not only loops...
|
||||
// ...at this point I can't repeat this error, see
|
||||
// ImageGrid.Viewer in nwjs load console output...
|
||||
var graph = []
|
||||
chain.forEach(function(k){
|
||||
graph = graph
|
||||
.concat((that[k].depends || [])
|
||||
.filter(function(e){
|
||||
return chain.indexOf(e) >= 0 })
|
||||
.map(function(e){
|
||||
return `${k} \t-> ${e}` })) })
|
||||
console.error('Feature cyclic dependency or order conflict:\n\t'
|
||||
+ graph.join('\n\t'))
|
||||
|
||||
// XXX should we give up completely (break) here
|
||||
// or move on and find new loops???
|
||||
break
|
||||
}
|
||||
chains.push(c)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-features",
|
||||
"version": "2.2.5",
|
||||
"version": "2.2.6",
|
||||
"description": "",
|
||||
"main": "features.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user