From 35135af462439117f886fb4698321ab37b41e8bb Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 11 Dec 2016 03:34:30 +0300 Subject: [PATCH] updated features... Signed-off-by: Alex A. Naanou --- lib/features.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/features.js b/lib/features.js index 62f111a..a4e8147 100755 --- a/lib/features.js +++ b/lib/features.js @@ -98,7 +98,9 @@ module.FeatureProto = { // mixin actions... if(this.actions != null){ - actions.mixin(this.actions) + this.tag ? + actions.mixin(this.actions, {source_tag: this.tag}) + : actions.mixin(this.actions) } // install handlers... @@ -346,6 +348,8 @@ var FeatureSetProto = { var missing = {} var conflicts = {} + var exclusive = {} + // reverse dependency cache... var dependants = {} @@ -392,6 +396,7 @@ var FeatureSetProto = { var deps = that[k].depends || [] var refs = that[k].suggested || [] + var excl = that[k].exclusive || [] deps.forEach(function(n){ // expand lst with dependencies.... @@ -406,8 +411,16 @@ var FeatureSetProto = { refs.forEach(function(n){ lst.indexOf(n) < 0 && lst.push(n) }) + + // build exclusive table... + excl.forEach(function(n){ + var l = exclusive[n] = exclusive[n] || [] + l.indexOf(k) < 0 && l.push(k) + }) } + console.log('EXCL:', exclusive) + // sort features by priority or position... lst = lst // remove undefined and non-features... @@ -433,7 +446,7 @@ var FeatureSetProto = { .filter(function(e){ return disabled.indexOf(e) < 0 }) // build the sort table: [ , , ] .map(function(e, i){ return [ that[e].getPriority(), i, e ] }) - // do the sort... + // sort by priority then index... // NOTE: JS compares lists as strings so we have to compare // the list manually... .sort(function(a, b){ return a[0] - b[0] || a[1] - b[1] })