mirror of
https://github.com/flynx/features.js.git
synced 2025-10-29 10:20:09 +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...
|
// chain completed -> check and store...
|
||||||
if(chain.indexOf(k) >= 0){
|
if(chain.indexOf(k) >= 0){
|
||||||
var c = JSON.stringify(chain)
|
var c = JSON.stringify(chain)
|
||||||
// repeating chain -> loop detected...
|
// repeating chain -> loop or order conflict detected...
|
||||||
if(chains.indexOf(c) >= 0){
|
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
|
break
|
||||||
}
|
}
|
||||||
chains.push(c)
|
chains.push(c)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-features",
|
"name": "ig-features",
|
||||||
"version": "2.2.5",
|
"version": "2.2.6",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "features.js",
|
"main": "features.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user