From 9670d2bf0b8a79b82df4df9b415e716340b35907 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 20 May 2017 17:08:47 +0300 Subject: [PATCH] added loop detection + found a bug (can't yet reproduce)... Signed-off-by: Alex A. Naanou --- features.js | 20 ++++++++++++++++++-- package.json | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/features.js b/features.js index 694b4cd..db6b9a8 100755 --- a/features.js +++ b/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) diff --git a/package.json b/package.json index 9179540..85f2003 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-features", - "version": "2.2.5", + "version": "2.2.6", "description": "", "main": "features.js", "scripts": {