From fc2ab72f2fdb95f83d9153e005b5f7d7c2cf4dd8 Mon Sep 17 00:00:00 2001 From: Sergey Berezhnoy Date: Wed, 18 Sep 2013 14:52:23 +0400 Subject: [PATCH 1/6] close #459: deps: possibility to declare dependence without explicit including item Conflicts: lib/techs/deps.js.js --- lib/techs/deps.js.js | 20 ++++++--- test/deps.js | 100 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 103 insertions(+), 17 deletions(-) diff --git a/lib/techs/deps.js.js b/lib/techs/deps.js.js index c9f5add1..2f5fc1a2 100644 --- a/lib/techs/deps.js.js +++ b/lib/techs/deps.js.js @@ -94,10 +94,14 @@ var Deps = exports.Deps = INHERIT({ var items = this.items, targetKey = target.buildKey(), itemKey = item.buildKey(), + itemByKey = items[itemKey], deps; - if (!items[itemKey]) { + if(!itemByKey) { items[itemKey] = item; + item.include && this.itemsByOrder.push(itemKey); + } else if(!itemByKey.include && item.include) { + itemByKey.include = true; this.itemsByOrder.push(itemKey); } @@ -376,11 +380,13 @@ var Deps = exports.Deps = INHERIT({ var key = i.buildKey(), ctxTech = ctx && ctx.item.tech || ''; if(!uniq.hasOwnProperty(key) || !uniq[key].hasOwnProperty(ctxTech)) { - (uniq[key] || (uniq[key] = {}))[ctxTech] = true; - var newCtx = ctx || i; - _this.forEach(fn, uniq, i.mustDeps, i); - fn.call(_this, i, newCtx); - _this.forEach(fn, uniq, i.shouldDeps, i); + if(i.include) { + (uniq[key] || (uniq[key] = {}))[ctxTech] = true; + var newCtx = ctx || i; + _this.forEach(fn, uniq, i.mustDeps, i); + fn.call(_this, i, newCtx); + _this.forEach(fn, uniq, i.shouldDeps, i); + } } } }); @@ -497,7 +503,7 @@ var DepsItem = exports.DepsItem = INHERIT({ this.item = {}; this.extendByCtx({ item: item }); this.extendByCtx(ctx); - + this.include = item.include !== false; }, extendByCtx: function(ctx) { diff --git a/test/deps.js b/test/deps.js index f090dc58..542aabfb 100644 --- a/test/deps.js +++ b/test/deps.js @@ -57,12 +57,14 @@ describe('Deps', function() { shouldDeps: ['b1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: [], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' } })); @@ -77,18 +79,21 @@ describe('Deps', function() { shouldDeps: [ 'b1', 'b1__e1' ], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: [], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' }, 'b1__e1': { shouldDeps: [], mustDeps: [], item: { block: 'b1', elem: 'e1' }, + include: true, key: 'b1__e1' } } @@ -111,18 +116,21 @@ describe('Deps', function() { ], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: [], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' }, 'b1__e1': { shouldDeps: [], mustDeps: [], item: { block: 'b1', elem: 'e1' }, + include: true, key: 'b1__e1' }, 'b1__e1_m1': { @@ -133,6 +141,7 @@ describe('Deps', function() { elem: 'e1', mod: 'm1' }, + include: true, key: 'b1__e1_m1' }, 'b1__e1_m1_v1': { @@ -144,6 +153,7 @@ describe('Deps', function() { mod: 'm1', val: 'v1' }, + include: true, key: 'b1__e1_m1_v1' }, 'b1__e1_m1_v2': { @@ -155,6 +165,7 @@ describe('Deps', function() { 'mod': 'm1', 'val': 'v2' }, + include: true, key: 'b1__e1_m1_v2' } } @@ -179,24 +190,28 @@ describe('Deps', function() { ], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: [], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' }, 'b1__e1': { shouldDeps: [], mustDeps: [], item: { block: 'b1', elem: 'e1' }, + include: true, key: 'b1__e1' }, 'b1__e2': { shouldDeps: [], mustDeps: [], item: { block: 'b1', elem: 'e2' }, + include: true, key: 'b1__e2' }, 'b1_m1_v1': { @@ -207,6 +222,7 @@ describe('Deps', function() { mod: 'm1', val: 'v1' }, + include: true, key: 'b1_m1_v1' }, 'b1_m2_v2': { @@ -217,6 +233,7 @@ describe('Deps', function() { mod: 'm2', val: 'v2' }, + include: true, key: 'b1_m2_v2' } } @@ -233,12 +250,14 @@ describe('Deps', function() { shouldDeps: ['b1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: [], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' } } @@ -251,6 +270,7 @@ describe('Deps', function() { shouldDeps: ['b1__e1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1__e1': { @@ -260,6 +280,7 @@ describe('Deps', function() { block: 'b1', elem: 'e1' }, + include: true, key: 'b1__e1' } } @@ -278,24 +299,28 @@ describe('Deps', function() { shouldDeps: ['b1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: ['b2', 'b3'], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' }, 'b2': { shouldDeps: [], mustDeps: ['b3'], item: { block: 'b2' }, + include: true, key: 'b2' }, 'b3': { shouldDeps: [], mustDeps: [], item: { block: 'b3' }, + include: true, key: 'b3' } } @@ -308,18 +333,21 @@ describe('Deps', function() { shouldDeps: ['b1', 'b2'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: [], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' }, 'b2': { shouldDeps: [], mustDeps: [], item: { block: 'b2' }, + include: true, key: 'b2' } } @@ -353,12 +381,14 @@ describe('Deps', function() { shouldDeps: ['b1.t1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1.t1': { shouldDeps: [], mustDeps: [], item: { block: 'b1', tech: 't1' }, + include: true, key: 'b1.t1' } } @@ -371,12 +401,14 @@ describe('Deps', function() { shouldDeps: ['b1__e1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1__e1': { shouldDeps: [], mustDeps: [], item: { block: 'b1', elem: 'e1' }, + include: true, key: 'b1__e1' } } @@ -394,36 +426,42 @@ describe('Deps', function() { shouldDeps: ['b1.t1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1.t1': { shouldDeps: ['b2', 'b3'], mustDeps: ['b0', 'b4'], item: { block: 'b1', tech: 't1' }, + include: true, key: 'b1.t1' }, 'b0': { shouldDeps: [], mustDeps: [], item: { block: 'b0' }, + include: true, key: 'b0' }, 'b4': { shouldDeps: [], mustDeps: [], item: { block: 'b4' }, + include: true, key: 'b4' }, 'b2': { shouldDeps: [], mustDeps: [], item: { block: 'b2' }, + include: true, key: 'b2' }, 'b3': { shouldDeps: [], mustDeps: [], item: { block: 'b3' }, + include: true, key: 'b3' } } @@ -440,18 +478,21 @@ describe('Deps', function() { shouldDeps: ['b1.t1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1.t1': { shouldDeps: ['b2.t2'], mustDeps: [], item: { block: 'b1', tech: 't1' }, + include: true, key: 'b1.t1' }, 'b2.t2': { shouldDeps: [], mustDeps: [], item: { block: 'b2', tech: 't2' }, + include: true, key: 'b2.t2' } } @@ -471,24 +512,28 @@ describe('Deps', function() { shouldDeps: ['b1'], mustDeps: [], item: {}, + include: true, key: '' }, 'b1': { shouldDeps: ['b2.t2'], mustDeps: [], item: { block: 'b1' }, + include: true, key: 'b1' }, 'b2.t2': { shouldDeps: ['b3'], mustDeps: [], item: { block: 'b2', tech: 't2' }, + include: true, key: 'b2.t2' }, 'b3': { shouldDeps: [], mustDeps: [], item: { block: 'b3'}, + include: true, key: 'b3' } } @@ -527,6 +572,29 @@ describe('Deps', function() { }); + describe('include: false', function() { + + it('block', assertDepsParse( + [ + { + block: 'b1', + shouldDeps: [ + { block: 'b2', include: false }, + { block: 'b3', include: false } + ], + mustDeps: [ + { block: 'b4', include: false }, + { block: 'b5', include: false } + ] + }, + { block: 'b3' }, + { block: 'b4' } + ], + { '': { '': [ { block: 'b4' }, { block: 'b1' }, { block: 'b3' } ] } } + )); + + }); + }); describe('serialize:', function() { @@ -551,9 +619,13 @@ describe('Deps', function() { describe('clone', function() { - var deps1 = new Deps().parse([{ block: 'b1', bla: 1 }, 'b2']), - deps2 = deps1.clone(), + var deps1, deps2, deps; + + beforeEach(function(){ + deps1 = new Deps().parse([{ block: 'b1', bla: 1 }, 'b2']); + deps2 = deps1.clone(); deps = [deps1, deps2]; + }); it('.items', function() { assert.deepEqual(deps[1].items, deps[0].items); @@ -567,24 +639,28 @@ describe('Deps', function() { describe('subtract', function() { - var deps1 = new DEPS.Deps().parse([ + var deps1, deps2, deps3; + + beforeEach(function() { + deps1 = new DEPS.Deps().parse([ { block: 'b1' }, { block: 'b2' }, { block: 'b3' }, { block: 'b5' } - ]), + ]); deps2 = new DEPS.Deps().parse([ { block: 'b1' }, { block: 'b3' }, { block: 'b4' } - ]), + ]); deps3 = new DEPS.Deps().parse([ { block: 'b5' } ]); - deps1.subtract(deps2).subtract(deps3); + deps1.subtract(deps2).subtract(deps3); + }); it('works correctly', function() { assert.deepEqual(deps1.serialize(), { @@ -598,18 +674,21 @@ describe('Deps', function() { describe('intersect', function() { - var deps1 = new DEPS.Deps().parse([ + var deps1, deps2, deps3; + + beforeEach(function() { + deps1 = new DEPS.Deps().parse([ { block: 'b1' }, { block: 'b2' }, { block: 'b3' }, { block: 'b5' } - ]), + ]); deps2 = new DEPS.Deps().parse([ { block: 'b3' }, { block: 'b1' }, { block: 'b4' } - ]), + ]); deps3 = new DEPS.Deps().parse([ { block: 'b3' }, @@ -617,7 +696,8 @@ describe('Deps', function() { { block: 'b1' } ]); - deps1.intersect(deps2).intersect(deps3); + deps1.intersect(deps2).intersect(deps3); + }); it('works correctly', function() { assert.deepEqual(deps1.serialize(), { From ea210a54a9ebd38aa3e312b6fd2a28afd1a5d737 Mon Sep 17 00:00:00 2001 From: Sergey Berezhnoy Date: Wed, 18 Sep 2013 16:05:28 +0400 Subject: [PATCH 2/6] tests for serializing of `include: false` items --- test/deps.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/deps.js b/test/deps.js index 542aabfb..a71152cf 100644 --- a/test/deps.js +++ b/test/deps.js @@ -593,6 +593,41 @@ describe('Deps', function() { { '': { '': [ { block: 'b4' }, { block: 'b1' }, { block: 'b3' } ] } } )); + it('serialize', assertDepsFull( + [ + { + block: 'b1', + include: false + }, + { + block: 'b2' + } + ], + { + '': { + shouldDeps: [ 'b1', 'b2' ], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + b1: { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: false, + key: 'b1' + }, + b2: { + shouldDeps: [], + mustDeps: [], + item: { block: 'b2' }, + include: true, + key: 'b2' + } + } + )); + }); }); From 6e908b6ea37e97444db49eb3f4004f3863d1a705 Mon Sep 17 00:00:00 2001 From: Dmitry Filatov Date: Wed, 18 Sep 2013 16:46:59 +0400 Subject: [PATCH 3/6] port to v2 Conflicts: lib/techs/v2/deps.js.js --- lib/techs/v2/deps.js.js | 21 +- .../pages-with-merged/merged/merged.deps.js | 37 +- .../pages-with-merged/page1/page1.deps.js | 33 + .../pages-with-merged/page2/page2.deps.js | 25 + .../pages/by-techs/by-techs.deps.js | 24 + .../client/__profile/client__profile.deps.js | 22 + .../pages/client/client.deps.js | 33 + .../pages/example/example.deps.js | 33 + test/v2-deps.js | 789 ++++++++++++++++++ 9 files changed, 1009 insertions(+), 8 deletions(-) create mode 100644 test/v2-deps.js diff --git a/lib/techs/v2/deps.js.js b/lib/techs/v2/deps.js.js index 7bf13c5f..c2a41a88 100644 --- a/lib/techs/v2/deps.js.js +++ b/lib/techs/v2/deps.js.js @@ -198,10 +198,14 @@ var Deps = exports.Deps = INHERIT(/** @lends Deps.prototype */{ var items = this.items, targetKey = target.buildKey(), itemKey = item.buildKey(), + itemByKey = items[itemKey], deps; - if (!items[itemKey]) { + if(!itemByKey) { items[itemKey] = item; + item.include && this.itemsByOrder.push(itemKey); + } else if(!itemByKey.include && item.include) { + itemByKey.include = true; this.itemsByOrder.push(itemKey); } @@ -557,11 +561,13 @@ var Deps = exports.Deps = INHERIT(/** @lends Deps.prototype */{ var key = i.buildKey(), ctxTech = ctx && ctx.item.tech || ''; if(!uniq.hasOwnProperty(key) || !uniq[key].hasOwnProperty(ctxTech)) { - (uniq[key] || (uniq[key] = {}))[ctxTech] = true; - var newCtx = ctx || i; - _this.forEach(fn, uniq, i.mustDeps, i); - fn.call(_this, i, newCtx); - _this.forEach(fn, uniq, i.shouldDeps, i); + if(i.include) { + (uniq[key] || (uniq[key] = {}))[ctxTech] = true; + var newCtx = ctx || i; + _this.forEach(fn, uniq, i.mustDeps, i); + fn.call(_this, i, newCtx); + _this.forEach(fn, uniq, i.shouldDeps, i); + } } } }); @@ -604,7 +610,7 @@ var Deps = exports.Deps = INHERIT(/** @lends Deps.prototype */{ var _this = this, uniq = {}, res = []; _filter(); return res; - + function _filter(itemsByOrder,ctx){ (itemsByOrder||_this.items[''].shouldDeps).forEach(function(item){ if(item = _this.items[item]){ @@ -700,6 +706,7 @@ var DepsItem = exports.DepsItem = INHERIT({ this.item = {}; this.extendByCtx({ item: item }); this.extendByCtx(ctx); + this.include = item.include !== false; }, extendByCtx: function(ctx) { diff --git a/test/data/make/reference-result/pages-with-merged/merged/merged.deps.js b/test/data/make/reference-result/pages-with-merged/merged/merged.deps.js index d29b7e96..ae068064 100644 --- a/test/data/make/reference-result/pages-with-merged/merged/merged.deps.js +++ b/test/data/make/reference-result/pages-with-merged/merged/merged.deps.js @@ -156,7 +156,8 @@ exports.depsFull = { "b-logo" ], "mustDeps": [], - "item": {} + "item": {}, + "include": true }, "b-page": { "shouldDeps": [ @@ -177,6 +178,7 @@ exports.depsFull = { "item": { "block": "b-page" }, + "include": true, "key": "b-page" }, "b-link": { @@ -185,6 +187,7 @@ exports.depsFull = { "item": { "block": "b-link" }, + "include": true, "key": "b-link" }, "b-link_pseudo": { @@ -201,6 +204,7 @@ exports.depsFull = { "block": "b-link", "mod": "pseudo" }, + "include": true, "key": "b-link_pseudo" }, "b-link_pseudo_yes": { @@ -214,6 +218,7 @@ exports.depsFull = { "mod": "pseudo", "val": "yes" }, + "include": true, "key": "b-link_pseudo_yes" }, "b-link_togcolor": { @@ -223,6 +228,7 @@ exports.depsFull = { "block": "b-link", "mod": "togcolor" }, + "include": true, "key": "b-link_togcolor" }, "b-link_togcolor_yes": { @@ -238,6 +244,7 @@ exports.depsFull = { "mod": "togcolor", "val": "yes" }, + "include": true, "key": "b-link_togcolor_yes" }, "b-link_color": { @@ -247,6 +254,7 @@ exports.depsFull = { "block": "b-link", "mod": "color" }, + "include": true, "key": "b-link_color" }, "b-link_color_green": { @@ -257,6 +265,7 @@ exports.depsFull = { "mod": "color", "val": "green" }, + "include": true, "key": "b-link_color_green" }, "i-bem": { @@ -277,6 +286,7 @@ exports.depsFull = { "item": { "block": "i-bem" }, + "include": true, "key": "i-bem" }, "i-bem__html": { @@ -289,6 +299,7 @@ exports.depsFull = { "block": "i-bem", "elem": "html" }, + "include": true, "key": "i-bem__html" }, "i-bem__dom": { @@ -303,6 +314,7 @@ exports.depsFull = { "block": "i-bem", "elem": "dom" }, + "include": true, "key": "i-bem__dom" }, "i-bem__dom_init": { @@ -313,6 +325,7 @@ exports.depsFull = { "elem": "dom", "mod": "init" }, + "include": true, "key": "i-bem__dom_init" }, "i-bem__dom_init_auto": { @@ -324,6 +337,7 @@ exports.depsFull = { "mod": "init", "val": "auto" }, + "include": true, "key": "i-bem__dom_init_auto" }, "i-ua": { @@ -335,6 +349,7 @@ exports.depsFull = { "item": { "block": "i-ua" }, + "include": true, "key": "i-ua" }, "i-jquery": { @@ -343,6 +358,7 @@ exports.depsFull = { "item": { "block": "i-jquery" }, + "include": true, "key": "i-jquery" }, "i-jquery__core": { @@ -352,6 +368,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "core" }, + "include": true, "key": "i-jquery__core" }, "b-page__css": { @@ -361,6 +378,7 @@ exports.depsFull = { "block": "b-page", "elem": "css" }, + "include": true, "key": "b-page__css" }, "b-page__js": { @@ -370,6 +388,7 @@ exports.depsFull = { "block": "b-page", "elem": "js" }, + "include": true, "key": "b-page__js" }, "i-jquery__leftclick": { @@ -379,6 +398,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "leftclick" }, + "include": true, "key": "i-jquery__leftclick" }, "b-link_pseudo_no": { @@ -389,6 +409,7 @@ exports.depsFull = { "mod": "pseudo", "val": "no" }, + "include": true, "key": "b-link_pseudo_no" }, "b-link__inner": { @@ -398,6 +419,7 @@ exports.depsFull = { "block": "b-link", "elem": "inner" }, + "include": true, "key": "b-link__inner" }, "b-link_color_red": { @@ -408,6 +430,7 @@ exports.depsFull = { "mod": "color", "val": "red" }, + "include": true, "key": "b-link_color_red" }, "i-jquery__inherit": { @@ -417,6 +440,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "inherit" }, + "include": true, "key": "i-jquery__inherit" }, "i-jquery__identify": { @@ -426,6 +450,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "identify" }, + "include": true, "key": "i-jquery__identify" }, "i-jquery__is-empty-object": { @@ -435,6 +460,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "is-empty-object" }, + "include": true, "key": "i-jquery__is-empty-object" }, "i-jquery__debounce": { @@ -444,6 +470,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "debounce" }, + "include": true, "key": "i-jquery__debounce" }, "i-jquery__observable": { @@ -457,6 +484,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "observable" }, + "include": true, "key": "i-jquery__observable" }, "i-ecma__object": { @@ -466,6 +494,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "object" }, + "include": true, "key": "i-ecma__object" }, "i-ecma__array": { @@ -475,6 +504,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "array" }, + "include": true, "key": "i-ecma__array" }, "i-ecma__function": { @@ -484,6 +514,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "function" }, + "include": true, "key": "i-ecma__function" }, "i-bem__internal": { @@ -493,6 +524,7 @@ exports.depsFull = { "block": "i-bem", "elem": "internal" }, + "include": true, "key": "i-bem__internal" }, "i-ecma__string": { @@ -502,6 +534,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "string" }, + "include": true, "key": "i-ecma__string" }, "b-logo": { @@ -513,6 +546,7 @@ exports.depsFull = { "item": { "block": "b-logo" }, + "include": true, "key": "b-logo" }, "b-icon": { @@ -521,6 +555,7 @@ exports.depsFull = { "item": { "block": "b-icon" }, + "include": true, "key": "b-icon" } }; diff --git a/test/data/make/reference-result/pages-with-merged/page1/page1.deps.js b/test/data/make/reference-result/pages-with-merged/page1/page1.deps.js index e1d0a9a2..f9c08bf6 100644 --- a/test/data/make/reference-result/pages-with-merged/page1/page1.deps.js +++ b/test/data/make/reference-result/pages-with-merged/page1/page1.deps.js @@ -150,6 +150,7 @@ exports.depsFull = { ], "mustDeps": [], "item": {}, + "include": true, "key": "" }, "b-page": { @@ -171,6 +172,7 @@ exports.depsFull = { "item": { "block": "b-page" }, + "include": true, "key": "b-page" }, "b-link": { @@ -179,6 +181,7 @@ exports.depsFull = { "item": { "block": "b-link" }, + "include": true, "key": "b-link" }, "b-link_pseudo": { @@ -195,6 +198,7 @@ exports.depsFull = { "block": "b-link", "mod": "pseudo" }, + "include": true, "key": "b-link_pseudo" }, "b-link_pseudo_yes": { @@ -208,6 +212,7 @@ exports.depsFull = { "mod": "pseudo", "val": "yes" }, + "include": true, "key": "b-link_pseudo_yes" }, "b-link_togcolor": { @@ -217,6 +222,7 @@ exports.depsFull = { "block": "b-link", "mod": "togcolor" }, + "include": true, "key": "b-link_togcolor" }, "b-link_togcolor_yes": { @@ -232,6 +238,7 @@ exports.depsFull = { "mod": "togcolor", "val": "yes" }, + "include": true, "key": "b-link_togcolor_yes" }, "b-link_color": { @@ -241,6 +248,7 @@ exports.depsFull = { "block": "b-link", "mod": "color" }, + "include": true, "key": "b-link_color" }, "b-link_color_green": { @@ -251,6 +259,7 @@ exports.depsFull = { "mod": "color", "val": "green" }, + "include": true, "key": "b-link_color_green" }, "i-bem": { @@ -271,6 +280,7 @@ exports.depsFull = { "item": { "block": "i-bem" }, + "include": true, "key": "i-bem" }, "i-bem__html": { @@ -283,6 +293,7 @@ exports.depsFull = { "block": "i-bem", "elem": "html" }, + "include": true, "key": "i-bem__html" }, "i-bem__dom": { @@ -297,6 +308,7 @@ exports.depsFull = { "block": "i-bem", "elem": "dom" }, + "include": true, "key": "i-bem__dom" }, "i-bem__dom_init": { @@ -307,6 +319,7 @@ exports.depsFull = { "elem": "dom", "mod": "init" }, + "include": true, "key": "i-bem__dom_init" }, "i-bem__dom_init_auto": { @@ -318,6 +331,7 @@ exports.depsFull = { "mod": "init", "val": "auto" }, + "include": true, "key": "i-bem__dom_init_auto" }, "i-ua": { @@ -329,6 +343,7 @@ exports.depsFull = { "item": { "block": "i-ua" }, + "include": true, "key": "i-ua" }, "i-jquery": { @@ -337,6 +352,7 @@ exports.depsFull = { "item": { "block": "i-jquery" }, + "include": true, "key": "i-jquery" }, "i-jquery__core": { @@ -346,6 +362,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "core" }, + "include": true, "key": "i-jquery__core" }, "b-page__css": { @@ -355,6 +372,7 @@ exports.depsFull = { "block": "b-page", "elem": "css" }, + "include": true, "key": "b-page__css" }, "b-page__js": { @@ -364,6 +382,7 @@ exports.depsFull = { "block": "b-page", "elem": "js" }, + "include": true, "key": "b-page__js" }, "i-jquery__leftclick": { @@ -373,6 +392,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "leftclick" }, + "include": true, "key": "i-jquery__leftclick" }, "b-link_pseudo_no": { @@ -383,6 +403,7 @@ exports.depsFull = { "mod": "pseudo", "val": "no" }, + "include": true, "key": "b-link_pseudo_no" }, "b-link__inner": { @@ -392,6 +413,7 @@ exports.depsFull = { "block": "b-link", "elem": "inner" }, + "include": true, "key": "b-link__inner" }, "b-link_color_red": { @@ -402,6 +424,7 @@ exports.depsFull = { "mod": "color", "val": "red" }, + "include": true, "key": "b-link_color_red" }, "i-jquery__inherit": { @@ -411,6 +434,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "inherit" }, + "include": true, "key": "i-jquery__inherit" }, "i-jquery__identify": { @@ -420,6 +444,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "identify" }, + "include": true, "key": "i-jquery__identify" }, "i-jquery__is-empty-object": { @@ -429,6 +454,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "is-empty-object" }, + "include": true, "key": "i-jquery__is-empty-object" }, "i-jquery__debounce": { @@ -438,6 +464,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "debounce" }, + "include": true, "key": "i-jquery__debounce" }, "i-jquery__observable": { @@ -451,6 +478,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "observable" }, + "include": true, "key": "i-jquery__observable" }, "i-ecma__object": { @@ -460,6 +488,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "object" }, + "include": true, "key": "i-ecma__object" }, "i-ecma__array": { @@ -469,6 +498,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "array" }, + "include": true, "key": "i-ecma__array" }, "i-ecma__function": { @@ -478,6 +508,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "function" }, + "include": true, "key": "i-ecma__function" }, "i-bem__internal": { @@ -487,6 +518,7 @@ exports.depsFull = { "block": "i-bem", "elem": "internal" }, + "include": true, "key": "i-bem__internal" }, "i-ecma__string": { @@ -496,6 +528,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "string" }, + "include": true, "key": "i-ecma__string" } }; diff --git a/test/data/make/reference-result/pages-with-merged/page2/page2.deps.js b/test/data/make/reference-result/pages-with-merged/page2/page2.deps.js index 727911a4..e45a8478 100644 --- a/test/data/make/reference-result/pages-with-merged/page2/page2.deps.js +++ b/test/data/make/reference-result/pages-with-merged/page2/page2.deps.js @@ -105,6 +105,7 @@ exports.depsFull = { ], "mustDeps": [], "item": {}, + "include": true, "key": "" }, "b-page": { @@ -126,6 +127,7 @@ exports.depsFull = { "item": { "block": "b-page" }, + "include": true, "key": "b-page" }, "b-logo": { @@ -137,6 +139,7 @@ exports.depsFull = { "item": { "block": "b-logo" }, + "include": true, "key": "b-logo" }, "i-bem": { @@ -157,6 +160,7 @@ exports.depsFull = { "item": { "block": "i-bem" }, + "include": true, "key": "i-bem" }, "i-bem__html": { @@ -169,6 +173,7 @@ exports.depsFull = { "block": "i-bem", "elem": "html" }, + "include": true, "key": "i-bem__html" }, "i-bem__dom": { @@ -183,6 +188,7 @@ exports.depsFull = { "block": "i-bem", "elem": "dom" }, + "include": true, "key": "i-bem__dom" }, "i-bem__dom_init": { @@ -193,6 +199,7 @@ exports.depsFull = { "elem": "dom", "mod": "init" }, + "include": true, "key": "i-bem__dom_init" }, "i-bem__dom_init_auto": { @@ -204,6 +211,7 @@ exports.depsFull = { "mod": "init", "val": "auto" }, + "include": true, "key": "i-bem__dom_init_auto" }, "i-ua": { @@ -215,6 +223,7 @@ exports.depsFull = { "item": { "block": "i-ua" }, + "include": true, "key": "i-ua" }, "i-jquery": { @@ -223,6 +232,7 @@ exports.depsFull = { "item": { "block": "i-jquery" }, + "include": true, "key": "i-jquery" }, "i-jquery__core": { @@ -232,6 +242,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "core" }, + "include": true, "key": "i-jquery__core" }, "b-page__css": { @@ -241,6 +252,7 @@ exports.depsFull = { "block": "b-page", "elem": "css" }, + "include": true, "key": "b-page__css" }, "b-page__js": { @@ -250,6 +262,7 @@ exports.depsFull = { "block": "b-page", "elem": "js" }, + "include": true, "key": "b-page__js" }, "b-link": { @@ -258,6 +271,7 @@ exports.depsFull = { "item": { "block": "b-link" }, + "include": true, "key": "b-link" }, "b-icon": { @@ -266,6 +280,7 @@ exports.depsFull = { "item": { "block": "b-icon" }, + "include": true, "key": "b-icon" }, "i-jquery__inherit": { @@ -275,6 +290,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "inherit" }, + "include": true, "key": "i-jquery__inherit" }, "i-jquery__identify": { @@ -284,6 +300,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "identify" }, + "include": true, "key": "i-jquery__identify" }, "i-jquery__is-empty-object": { @@ -293,6 +310,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "is-empty-object" }, + "include": true, "key": "i-jquery__is-empty-object" }, "i-jquery__debounce": { @@ -302,6 +320,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "debounce" }, + "include": true, "key": "i-jquery__debounce" }, "i-jquery__observable": { @@ -315,6 +334,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "observable" }, + "include": true, "key": "i-jquery__observable" }, "i-ecma__object": { @@ -324,6 +344,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "object" }, + "include": true, "key": "i-ecma__object" }, "i-ecma__array": { @@ -333,6 +354,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "array" }, + "include": true, "key": "i-ecma__array" }, "i-ecma__function": { @@ -342,6 +364,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "function" }, + "include": true, "key": "i-ecma__function" }, "i-bem__internal": { @@ -351,6 +374,7 @@ exports.depsFull = { "block": "i-bem", "elem": "internal" }, + "include": true, "key": "i-bem__internal" }, "i-ecma__string": { @@ -360,6 +384,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "string" }, + "include": true, "key": "i-ecma__string" } }; diff --git a/test/data/make/reference-result/pages/by-techs/by-techs.deps.js b/test/data/make/reference-result/pages/by-techs/by-techs.deps.js index ba011387..3c4e00fa 100644 --- a/test/data/make/reference-result/pages/by-techs/by-techs.deps.js +++ b/test/data/make/reference-result/pages/by-techs/by-techs.deps.js @@ -99,6 +99,7 @@ exports.depsFull = { ], "mustDeps": [], "item": {}, + "include": true, "key": "" }, "b-page": { @@ -120,6 +121,7 @@ exports.depsFull = { "item": { "block": "b-page" }, + "include": true, "key": "b-page" }, "b-with-js": { @@ -130,6 +132,7 @@ exports.depsFull = { "item": { "block": "b-with-js" }, + "include": true, "key": "b-with-js" }, "i-bem": { @@ -150,6 +153,7 @@ exports.depsFull = { "item": { "block": "i-bem" }, + "include": true, "key": "i-bem" }, "i-bem__html": { @@ -162,6 +166,7 @@ exports.depsFull = { "block": "i-bem", "elem": "html" }, + "include": true, "key": "i-bem__html" }, "i-bem__dom": { @@ -176,6 +181,7 @@ exports.depsFull = { "block": "i-bem", "elem": "dom" }, + "include": true, "key": "i-bem__dom" }, "i-bem__dom_init": { @@ -186,6 +192,7 @@ exports.depsFull = { "elem": "dom", "mod": "init" }, + "include": true, "key": "i-bem__dom_init" }, "i-bem__dom_init_auto": { @@ -197,6 +204,7 @@ exports.depsFull = { "mod": "init", "val": "auto" }, + "include": true, "key": "i-bem__dom_init_auto" }, "i-ua": { @@ -208,6 +216,7 @@ exports.depsFull = { "item": { "block": "i-ua" }, + "include": true, "key": "i-ua" }, "i-jquery": { @@ -216,6 +225,7 @@ exports.depsFull = { "item": { "block": "i-jquery" }, + "include": true, "key": "i-jquery" }, "i-jquery__core": { @@ -225,6 +235,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "core" }, + "include": true, "key": "i-jquery__core" }, "b-page__css": { @@ -234,6 +245,7 @@ exports.depsFull = { "block": "b-page", "elem": "css" }, + "include": true, "key": "b-page__css" }, "b-page__js": { @@ -243,6 +255,7 @@ exports.depsFull = { "block": "b-page", "elem": "js" }, + "include": true, "key": "b-page__js" }, "b-with-css.css": { @@ -252,6 +265,7 @@ exports.depsFull = { "block": "b-with-css", "tech": "css" }, + "include": true, "key": "b-with-css.css" }, "i-jquery__inherit": { @@ -261,6 +275,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "inherit" }, + "include": true, "key": "i-jquery__inherit" }, "i-jquery__identify": { @@ -270,6 +285,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "identify" }, + "include": true, "key": "i-jquery__identify" }, "i-jquery__is-empty-object": { @@ -279,6 +295,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "is-empty-object" }, + "include": true, "key": "i-jquery__is-empty-object" }, "i-jquery__debounce": { @@ -288,6 +305,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "debounce" }, + "include": true, "key": "i-jquery__debounce" }, "i-jquery__observable": { @@ -301,6 +319,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "observable" }, + "include": true, "key": "i-jquery__observable" }, "i-ecma__object": { @@ -310,6 +329,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "object" }, + "include": true, "key": "i-ecma__object" }, "i-ecma__array": { @@ -319,6 +339,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "array" }, + "include": true, "key": "i-ecma__array" }, "i-ecma__function": { @@ -328,6 +349,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "function" }, + "include": true, "key": "i-ecma__function" }, "i-bem__internal": { @@ -337,6 +359,7 @@ exports.depsFull = { "block": "i-bem", "elem": "internal" }, + "include": true, "key": "i-bem__internal" }, "i-ecma__string": { @@ -346,6 +369,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "string" }, + "include": true, "key": "i-ecma__string" } }; diff --git a/test/data/make/reference-result/pages/client/__profile/client__profile.deps.js b/test/data/make/reference-result/pages/client/__profile/client__profile.deps.js index 553edd37..60611e4b 100644 --- a/test/data/make/reference-result/pages/client/__profile/client__profile.deps.js +++ b/test/data/make/reference-result/pages/client/__profile/client__profile.deps.js @@ -95,6 +95,7 @@ exports.depsFull = { ], "mustDeps": [], "item": {}, + "include": true, "key": "" }, "b-page": { @@ -116,6 +117,7 @@ exports.depsFull = { "item": { "block": "b-page" }, + "include": true, "key": "b-page" }, "i-bem": { @@ -136,6 +138,7 @@ exports.depsFull = { "item": { "block": "i-bem" }, + "include": true, "key": "i-bem" }, "i-bem__html": { @@ -148,6 +151,7 @@ exports.depsFull = { "block": "i-bem", "elem": "html" }, + "include": true, "key": "i-bem__html" }, "i-bem__dom": { @@ -162,6 +166,7 @@ exports.depsFull = { "block": "i-bem", "elem": "dom" }, + "include": true, "key": "i-bem__dom" }, "i-bem__dom_init": { @@ -172,6 +177,7 @@ exports.depsFull = { "elem": "dom", "mod": "init" }, + "include": true, "key": "i-bem__dom_init" }, "i-bem__dom_init_auto": { @@ -183,6 +189,7 @@ exports.depsFull = { "mod": "init", "val": "auto" }, + "include": true, "key": "i-bem__dom_init_auto" }, "i-ua": { @@ -194,6 +201,7 @@ exports.depsFull = { "item": { "block": "i-ua" }, + "include": true, "key": "i-ua" }, "i-jquery": { @@ -202,6 +210,7 @@ exports.depsFull = { "item": { "block": "i-jquery" }, + "include": true, "key": "i-jquery" }, "i-jquery__core": { @@ -211,6 +220,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "core" }, + "include": true, "key": "i-jquery__core" }, "b-page__css": { @@ -220,6 +230,7 @@ exports.depsFull = { "block": "b-page", "elem": "css" }, + "include": true, "key": "b-page__css" }, "b-page__js": { @@ -229,6 +240,7 @@ exports.depsFull = { "block": "b-page", "elem": "js" }, + "include": true, "key": "b-page__js" }, "i-jquery__inherit": { @@ -238,6 +250,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "inherit" }, + "include": true, "key": "i-jquery__inherit" }, "i-jquery__identify": { @@ -247,6 +260,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "identify" }, + "include": true, "key": "i-jquery__identify" }, "i-jquery__is-empty-object": { @@ -256,6 +270,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "is-empty-object" }, + "include": true, "key": "i-jquery__is-empty-object" }, "i-jquery__debounce": { @@ -265,6 +280,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "debounce" }, + "include": true, "key": "i-jquery__debounce" }, "i-jquery__observable": { @@ -278,6 +294,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "observable" }, + "include": true, "key": "i-jquery__observable" }, "i-ecma__object": { @@ -287,6 +304,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "object" }, + "include": true, "key": "i-ecma__object" }, "i-ecma__array": { @@ -296,6 +314,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "array" }, + "include": true, "key": "i-ecma__array" }, "i-ecma__function": { @@ -305,6 +324,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "function" }, + "include": true, "key": "i-ecma__function" }, "i-bem__internal": { @@ -314,6 +334,7 @@ exports.depsFull = { "block": "i-bem", "elem": "internal" }, + "include": true, "key": "i-bem__internal" }, "i-ecma__string": { @@ -323,6 +344,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "string" }, + "include": true, "key": "i-ecma__string" } }; diff --git a/test/data/make/reference-result/pages/client/client.deps.js b/test/data/make/reference-result/pages/client/client.deps.js index 6caf6106..4fea591a 100644 --- a/test/data/make/reference-result/pages/client/client.deps.js +++ b/test/data/make/reference-result/pages/client/client.deps.js @@ -146,6 +146,7 @@ exports.depsFull = { ], "mustDeps": [], "item": {}, + "include": true, "key": "" }, "b-page": { @@ -174,6 +175,7 @@ exports.depsFull = { "item": { "block": "b-page" }, + "include": true, "key": "b-page" }, "i-bem": { @@ -194,6 +196,7 @@ exports.depsFull = { "item": { "block": "i-bem" }, + "include": true, "key": "i-bem" }, "i-bem__html": { @@ -206,6 +209,7 @@ exports.depsFull = { "block": "i-bem", "elem": "html" }, + "include": true, "key": "i-bem__html" }, "i-bem__dom": { @@ -220,6 +224,7 @@ exports.depsFull = { "block": "i-bem", "elem": "dom" }, + "include": true, "key": "i-bem__dom" }, "i-bem__dom_init": { @@ -230,6 +235,7 @@ exports.depsFull = { "elem": "dom", "mod": "init" }, + "include": true, "key": "i-bem__dom_init" }, "i-bem__dom_init_auto": { @@ -241,6 +247,7 @@ exports.depsFull = { "mod": "init", "val": "auto" }, + "include": true, "key": "i-bem__dom_init_auto" }, "i-ua": { @@ -252,6 +259,7 @@ exports.depsFull = { "item": { "block": "i-ua" }, + "include": true, "key": "i-ua" }, "i-jquery": { @@ -260,6 +268,7 @@ exports.depsFull = { "item": { "block": "i-jquery" }, + "include": true, "key": "i-jquery" }, "i-jquery__core": { @@ -269,6 +278,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "core" }, + "include": true, "key": "i-jquery__core" }, "b-page__css": { @@ -278,6 +288,7 @@ exports.depsFull = { "block": "b-page", "elem": "css" }, + "include": true, "key": "b-page__css" }, "b-page__js": { @@ -287,6 +298,7 @@ exports.depsFull = { "block": "b-page", "elem": "js" }, + "include": true, "key": "b-page__js" }, "b-link": { @@ -295,6 +307,7 @@ exports.depsFull = { "item": { "block": "b-link" }, + "include": true, "key": "b-link" }, "b-link_pseudo": { @@ -311,6 +324,7 @@ exports.depsFull = { "block": "b-link", "mod": "pseudo" }, + "include": true, "key": "b-link_pseudo" }, "b-link_pseudo_yes": { @@ -324,6 +338,7 @@ exports.depsFull = { "mod": "pseudo", "val": "yes" }, + "include": true, "key": "b-link_pseudo_yes" }, "b-link_togcolor": { @@ -333,6 +348,7 @@ exports.depsFull = { "block": "b-link", "mod": "togcolor" }, + "include": true, "key": "b-link_togcolor" }, "b-link_togcolor_yes": { @@ -348,6 +364,7 @@ exports.depsFull = { "mod": "togcolor", "val": "yes" }, + "include": true, "key": "b-link_togcolor_yes" }, "b-link_color": { @@ -357,6 +374,7 @@ exports.depsFull = { "block": "b-link", "mod": "color" }, + "include": true, "key": "b-link_color" }, "b-link_color_green": { @@ -367,6 +385,7 @@ exports.depsFull = { "mod": "color", "val": "green" }, + "include": true, "key": "b-link_color_green" }, "i-jquery__inherit": { @@ -376,6 +395,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "inherit" }, + "include": true, "key": "i-jquery__inherit" }, "i-jquery__identify": { @@ -385,6 +405,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "identify" }, + "include": true, "key": "i-jquery__identify" }, "i-jquery__is-empty-object": { @@ -394,6 +415,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "is-empty-object" }, + "include": true, "key": "i-jquery__is-empty-object" }, "i-jquery__debounce": { @@ -403,6 +425,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "debounce" }, + "include": true, "key": "i-jquery__debounce" }, "i-jquery__observable": { @@ -416,6 +439,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "observable" }, + "include": true, "key": "i-jquery__observable" }, "i-ecma__object": { @@ -425,6 +449,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "object" }, + "include": true, "key": "i-ecma__object" }, "i-ecma__array": { @@ -434,6 +459,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "array" }, + "include": true, "key": "i-ecma__array" }, "i-ecma__function": { @@ -443,6 +469,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "function" }, + "include": true, "key": "i-ecma__function" }, "i-bem__internal": { @@ -452,6 +479,7 @@ exports.depsFull = { "block": "i-bem", "elem": "internal" }, + "include": true, "key": "i-bem__internal" }, "i-ecma__string": { @@ -461,6 +489,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "string" }, + "include": true, "key": "i-ecma__string" }, "i-jquery__leftclick": { @@ -470,6 +499,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "leftclick" }, + "include": true, "key": "i-jquery__leftclick" }, "b-link_pseudo_no": { @@ -480,6 +510,7 @@ exports.depsFull = { "mod": "pseudo", "val": "no" }, + "include": true, "key": "b-link_pseudo_no" }, "b-link__inner": { @@ -489,6 +520,7 @@ exports.depsFull = { "block": "b-link", "elem": "inner" }, + "include": true, "key": "b-link__inner" }, "b-link_color_red": { @@ -499,6 +531,7 @@ exports.depsFull = { "mod": "color", "val": "red" }, + "include": true, "key": "b-link_color_red" } }; diff --git a/test/data/make/reference-result/pages/example/example.deps.js b/test/data/make/reference-result/pages/example/example.deps.js index e1d0a9a2..f9c08bf6 100644 --- a/test/data/make/reference-result/pages/example/example.deps.js +++ b/test/data/make/reference-result/pages/example/example.deps.js @@ -150,6 +150,7 @@ exports.depsFull = { ], "mustDeps": [], "item": {}, + "include": true, "key": "" }, "b-page": { @@ -171,6 +172,7 @@ exports.depsFull = { "item": { "block": "b-page" }, + "include": true, "key": "b-page" }, "b-link": { @@ -179,6 +181,7 @@ exports.depsFull = { "item": { "block": "b-link" }, + "include": true, "key": "b-link" }, "b-link_pseudo": { @@ -195,6 +198,7 @@ exports.depsFull = { "block": "b-link", "mod": "pseudo" }, + "include": true, "key": "b-link_pseudo" }, "b-link_pseudo_yes": { @@ -208,6 +212,7 @@ exports.depsFull = { "mod": "pseudo", "val": "yes" }, + "include": true, "key": "b-link_pseudo_yes" }, "b-link_togcolor": { @@ -217,6 +222,7 @@ exports.depsFull = { "block": "b-link", "mod": "togcolor" }, + "include": true, "key": "b-link_togcolor" }, "b-link_togcolor_yes": { @@ -232,6 +238,7 @@ exports.depsFull = { "mod": "togcolor", "val": "yes" }, + "include": true, "key": "b-link_togcolor_yes" }, "b-link_color": { @@ -241,6 +248,7 @@ exports.depsFull = { "block": "b-link", "mod": "color" }, + "include": true, "key": "b-link_color" }, "b-link_color_green": { @@ -251,6 +259,7 @@ exports.depsFull = { "mod": "color", "val": "green" }, + "include": true, "key": "b-link_color_green" }, "i-bem": { @@ -271,6 +280,7 @@ exports.depsFull = { "item": { "block": "i-bem" }, + "include": true, "key": "i-bem" }, "i-bem__html": { @@ -283,6 +293,7 @@ exports.depsFull = { "block": "i-bem", "elem": "html" }, + "include": true, "key": "i-bem__html" }, "i-bem__dom": { @@ -297,6 +308,7 @@ exports.depsFull = { "block": "i-bem", "elem": "dom" }, + "include": true, "key": "i-bem__dom" }, "i-bem__dom_init": { @@ -307,6 +319,7 @@ exports.depsFull = { "elem": "dom", "mod": "init" }, + "include": true, "key": "i-bem__dom_init" }, "i-bem__dom_init_auto": { @@ -318,6 +331,7 @@ exports.depsFull = { "mod": "init", "val": "auto" }, + "include": true, "key": "i-bem__dom_init_auto" }, "i-ua": { @@ -329,6 +343,7 @@ exports.depsFull = { "item": { "block": "i-ua" }, + "include": true, "key": "i-ua" }, "i-jquery": { @@ -337,6 +352,7 @@ exports.depsFull = { "item": { "block": "i-jquery" }, + "include": true, "key": "i-jquery" }, "i-jquery__core": { @@ -346,6 +362,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "core" }, + "include": true, "key": "i-jquery__core" }, "b-page__css": { @@ -355,6 +372,7 @@ exports.depsFull = { "block": "b-page", "elem": "css" }, + "include": true, "key": "b-page__css" }, "b-page__js": { @@ -364,6 +382,7 @@ exports.depsFull = { "block": "b-page", "elem": "js" }, + "include": true, "key": "b-page__js" }, "i-jquery__leftclick": { @@ -373,6 +392,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "leftclick" }, + "include": true, "key": "i-jquery__leftclick" }, "b-link_pseudo_no": { @@ -383,6 +403,7 @@ exports.depsFull = { "mod": "pseudo", "val": "no" }, + "include": true, "key": "b-link_pseudo_no" }, "b-link__inner": { @@ -392,6 +413,7 @@ exports.depsFull = { "block": "b-link", "elem": "inner" }, + "include": true, "key": "b-link__inner" }, "b-link_color_red": { @@ -402,6 +424,7 @@ exports.depsFull = { "mod": "color", "val": "red" }, + "include": true, "key": "b-link_color_red" }, "i-jquery__inherit": { @@ -411,6 +434,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "inherit" }, + "include": true, "key": "i-jquery__inherit" }, "i-jquery__identify": { @@ -420,6 +444,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "identify" }, + "include": true, "key": "i-jquery__identify" }, "i-jquery__is-empty-object": { @@ -429,6 +454,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "is-empty-object" }, + "include": true, "key": "i-jquery__is-empty-object" }, "i-jquery__debounce": { @@ -438,6 +464,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "debounce" }, + "include": true, "key": "i-jquery__debounce" }, "i-jquery__observable": { @@ -451,6 +478,7 @@ exports.depsFull = { "block": "i-jquery", "elem": "observable" }, + "include": true, "key": "i-jquery__observable" }, "i-ecma__object": { @@ -460,6 +488,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "object" }, + "include": true, "key": "i-ecma__object" }, "i-ecma__array": { @@ -469,6 +498,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "array" }, + "include": true, "key": "i-ecma__array" }, "i-ecma__function": { @@ -478,6 +508,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "function" }, + "include": true, "key": "i-ecma__function" }, "i-bem__internal": { @@ -487,6 +518,7 @@ exports.depsFull = { "block": "i-bem", "elem": "internal" }, + "include": true, "key": "i-bem__internal" }, "i-ecma__string": { @@ -496,6 +528,7 @@ exports.depsFull = { "block": "i-ecma", "elem": "string" }, + "include": true, "key": "i-ecma__string" } }; diff --git a/test/v2-deps.js b/test/v2-deps.js new file mode 100644 index 00000000..e522f13c --- /dev/null +++ b/test/v2-deps.js @@ -0,0 +1,789 @@ +'use strict'; + +var assert = require('chai').assert, + DEPS = require('..').require('./techs/v2/deps.js.js'), + Deps = DEPS.Deps, + DepsItem = DEPS.DepsItem; + +/** + * Mocha BDD interface. + */ +/** @name describe @function */ +/** @name it @function */ +/** @name before @function */ +/** @name after @function */ +/** @name beforeEach @function */ +/** @name afterEach @function */ + +function assertDepsParse(deps, expected) { + return function () { + var serialized = new Deps().parse(deps).serialize(); + assert.deepEqual(serialized, expected, JSON.stringify(serialized, null, 2) + '\n\n' + JSON.stringify(expected, null, 2)); + }; +} + +function assertDepsFull(deps, expected) { + return function() { + var serialized = new Deps().parse(deps).serializeFull(); + assert.deepEqual(serialized, expected, JSON.stringify(serialized, null, 4) + '\n\n' + JSON.stringify(expected, null, 4)); + }; +} + +function assertDepsMap(deps, expected) { + return function() { + var serialized = new Deps() + .parse(deps) + .map(function(i) { + return i.item; + }); + assert.deepEqual(serialized, expected, JSON.stringify(serialized, null, 4) + '\n\n' + JSON.stringify(expected, null, 4)); + }; +} + +function assertBuildKey(item, expected) { + return function () { + assert.equal(new DepsItem(item).buildKey(), expected); + }; +} + +describe('Deps v2', function() { + + describe('parsing:', function() { + + describe('old format with names', function() { + + it('block', assertDepsFull([ { name: 'b1' } ], { + '': { + shouldDeps: ['b1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + } + })); + + it('block with elem', assertDepsFull( + [ { + name: 'b1', + elems: [ { name: 'e1' } ] + } ], + { + '': { + shouldDeps: [ 'b1', 'b1__e1' ], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + }, + 'b1__e1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1', elem: 'e1' }, + include: true, + key: 'b1__e1' + } + } + )); + + it('block with elem with mods with vals', assertDepsFull( + [ + { name: 'b1', elems: [ + { name: 'e1', mods: [ + { name: 'm1', vals: [ 'v1', 'v2' ] } ] } ] } + ], + { + '': { + shouldDeps: [ + 'b1', + 'b1__e1', + 'b1__e1_m1', + 'b1__e1_m1_v1', + 'b1__e1_m1_v2' + ], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + }, + 'b1__e1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1', elem: 'e1' }, + include: true, + key: 'b1__e1' + }, + 'b1__e1_m1': { + shouldDeps: [], + mustDeps: [], + item: { + block: 'b1', + elem: 'e1', + mod: 'm1' + }, + include: true, + key: 'b1__e1_m1' + }, + 'b1__e1_m1_v1': { + shouldDeps: [], + mustDeps: [], + item: { + block: 'b1', + elem: 'e1', + mod: 'm1', + val: 'v1' + }, + include: true, + key: 'b1__e1_m1_v1' + }, + 'b1__e1_m1_v2': { + shouldDeps: [], + mustDeps: [], + item: { + 'block': 'b1', + 'elem': 'e1', + 'mod': 'm1', + 'val': 'v2' + }, + include: true, + key: 'b1__e1_m1_v2' + } + } + )); + + it('block with mods with vals and with elems', assertDepsFull( + [ { name: 'b1', + elems: [ 'e1', 'e2' ], + mods: [ + { name: 'm1', val: 'v1' }, + { name: 'm2', val: 'v2' } + ] + } ], + { + '': { + shouldDeps: [ + 'b1', + 'b1__e1', + 'b1__e2', + 'b1_m1_v1', + 'b1_m2_v2' + ], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + }, + 'b1__e1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1', elem: 'e1' }, + include: true, + key: 'b1__e1' + }, + 'b1__e2': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1', elem: 'e2' }, + include: true, + key: 'b1__e2' + }, + 'b1_m1_v1': { + shouldDeps: [], + mustDeps: [], + item: { + block: 'b1', + mod: 'm1', + val: 'v1' + }, + include: true, + key: 'b1_m1_v1' + }, + 'b1_m2_v2': { + shouldDeps: [], + mustDeps: [], + item: { + block: 'b1', + mod: 'm2', + val: 'v2' + }, + include: true, + key: 'b1_m2_v2' + } + } + )); + + }); + + describe('new format', function() { + + it('block', assertDepsFull( + [ { block: 'b1' } ], + { + '': { + shouldDeps: ['b1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + } + } + )); + + it('elem', assertDepsFull( + [ { block: 'b1', elem: 'e1' } ], + { + '': { + shouldDeps: ['b1__e1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1__e1': { + shouldDeps: [], + mustDeps: [], + item: { + block: 'b1', + elem: 'e1' + }, + include: true, + key: 'b1__e1' + } + } + )); + + it('block with shouldDeps and mustDeps', assertDepsFull( + [ { + block: 'b1', + shouldDeps: [ + { block: 'b2', mustDeps: 'b3' }, + 'b3' + ] + } ], + { + '': { + shouldDeps: ['b1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: ['b2', 'b3'], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + }, + 'b2': { + shouldDeps: [], + mustDeps: ['b3'], + item: { block: 'b2' }, + include: true, + key: 'b2' + }, + 'b3': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b3' }, + include: true, + key: 'b3' + } + } + )); + + it('simple blocks', assertDepsFull( + [ 'b1', 'b2' ], + { + '': { + shouldDeps: ['b1', 'b2'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + }, + 'b2': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b2' }, + include: true, + key: 'b2' + } + } + )); + + }); + + describe('new format with techs', function() { + + it('block', assertDepsFull( + [ { tech: 't1', block: 'b1' } ], + { + '': { + shouldDeps: ['b1.t1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1.t1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1', tech: 't1' }, + include: true, + key: 'b1.t1' + } + } + )); + + it('elem', assertDepsFull( + [ { block: 'b1', elem: 'e1' } ], + { + '': { + shouldDeps: ['b1__e1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1__e1': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1', elem: 'e1' }, + include: true, + key: 'b1__e1' + } + } + )); + + it('block with tech', assertDepsFull( + { + block: 'b1', + tech: 't1', + shouldDeps: ['b2', 'b3'], + mustDeps: ['b0', 'b4'] + }, + { + '': { + shouldDeps: ['b1.t1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1.t1': { + shouldDeps: ['b2', 'b3'], + mustDeps: ['b0', 'b4'], + item: { block: 'b1', tech: 't1' }, + include: true, + key: 'b1.t1' + }, + 'b0': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b0' }, + include: true, + key: 'b0' + }, + 'b4': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b4' }, + include: true, + key: 'b4' + }, + 'b2': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b2' }, + include: true, + key: 'b2' + }, + 'b3': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b3' }, + include: true, + key: 'b3' + } + } + )); + + it('block with techs', assertDepsFull( + { + block: 'b1', + tech: 't1', + shouldDeps: { block: 'b2', tech: 't2' } + }, + { + '': { + shouldDeps: ['b1.t1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1.t1': { + shouldDeps: ['b2.t2'], + mustDeps: [], + item: { block: 'b1', tech: 't1' }, + include: true, + key: 'b1.t1' + }, + 'b2.t2': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b2', tech: 't2' }, + include: true, + key: 'b2.t2' + } + } + )); + + it('block with and without tech', assertDepsFull( + { + block: 'b1', + shouldDeps: { + block: 'b2', + tech: 't2', + shouldDeps: { block: 'b3' } + } + }, + { + '': { + shouldDeps: ['b1'], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + 'b1': { + shouldDeps: ['b2.t2'], + mustDeps: [], + item: { block: 'b1' }, + include: true, + key: 'b1' + }, + 'b2.t2': { + shouldDeps: ['b3'], + mustDeps: [], + item: { block: 'b2', tech: 't2' }, + include: true, + key: 'b2.t2' + }, + 'b3': { + shouldDeps: [], + mustDeps: [], + item: { block: 'b3'}, + include: true, + key: 'b3' + } + } + )); + + }); + + describe('noDeps', function() { + + it('block', assertDepsMap( + [ + { + block: 'b1', + shouldDeps: ['b2', 'b3'], + mustDeps: ['b0', 'b4'] + }, + { + block: 'b1', + noDeps: ['b2', 'b4'] + } + ], + [ + { block: 'b0' }, + { block: 'b1' }, + { block: 'b3' } + ] + )); + + }); + + describe('include: false', function() { + + it('block', assertDepsParse( + [ + { + block: 'b1', + shouldDeps: [ + { block: 'b2', include: false }, + { block: 'b3', include: false } + ], + mustDeps: [ + { block: 'b4', include: false }, + { block: 'b5', include: false } + ] + }, + { block: 'b3' }, + { block: 'b4' } + ], + { '': { '': [ { block: 'b4' }, { block: 'b1' }, { block: 'b3' } ] } } + )); + + it('serialize', assertDepsFull( + [ + { + block: 'b1', + include: false + }, + { + block: 'b2' + } + ], + { + '': { + shouldDeps: [ 'b1', 'b2' ], + mustDeps: [], + item: {}, + include: true, + key: '' + }, + b1: { + shouldDeps: [], + mustDeps: [], + item: { block: 'b1' }, + include: false, + key: 'b1' + }, + b2: { + shouldDeps: [], + mustDeps: [], + item: { block: 'b2' }, + include: true, + key: 'b2' + } + } + )); + + }); + + }); + + describe('serialize:', function() { + + describe('empty deps serialize to {}', function() { + + var empty = {}; + + it('empty deps object: new Deps()', function() { + assert.deepEqual(new Deps().serialize(), empty); + }); + + it('empty object: {}', assertDepsParse({}, empty)); + + it('empty array: []', assertDepsParse([], empty)); + + it('undefined', assertDepsParse(undefined, empty)); + + }); + + }); + + describe('clone', function() { + + var deps1, deps2, deps; + + beforeEach(function(){ + deps1 = new Deps().parse([{ block: 'b1', bla: 1 }, 'b2']); + deps2 = deps1.clone(); + deps = [deps1, deps2]; + }); + + it('.items', function() { + assert.deepEqual(deps[1].items, deps[0].items); + }); + + it('.itemsByOrder', function() { + assert.deepEqual(deps[1].itemsByOrder, deps[0].itemsByOrder); + }); + + }); + + describe('subtract', function() { + + var deps1, deps2, deps3; + + beforeEach(function() { + deps1 = new DEPS.Deps().parse([ + { block: 'b1' }, + { block: 'b2' }, + { block: 'b3' }, + { block: 'b5' } + ]); + + deps2 = new DEPS.Deps().parse([ + { block: 'b1' }, + { block: 'b3' }, + { block: 'b4' } + ]); + + deps3 = new DEPS.Deps().parse([ + { block: 'b5' } + ]); + + deps1.subtract(deps2).subtract(deps3); + }); + + it('works correctly', function() { + assert.deepEqual(deps1.serialize(), { + '': { + '': [ { block: 'b2' } ] + } + }); + }); + + }); + + describe('intersect', function() { + + var deps1, deps2, deps3; + + beforeEach(function() { + deps1 = new DEPS.Deps().parse([ + { block: 'b1' }, + { block: 'b2' }, + { block: 'b3' }, + { block: 'b5' } + ]); + + deps2 = new DEPS.Deps().parse([ + { block: 'b3' }, + { block: 'b1' }, + { block: 'b4' } + ]); + + deps3 = new DEPS.Deps().parse([ + { block: 'b3' }, + { block: 'b6' }, + { block: 'b1' } + ]); + + deps1.intersect(deps2).intersect(deps3); + }); + + it('works correctly', function() { + assert.deepEqual(deps1.serialize(), { + '': { + '': [ + { block: 'b1' }, + { block: 'b3' } + ] + } + }); + }); + + }); + + describe('DepsItem', function() { + + describe('buildKey', function() { + + it('block without tech', assertBuildKey( + { block: 'b1' }, + 'b1')); + + it('block modifier without tech', assertBuildKey( + { block: 'b1', mod: 'm1' }, + 'b1_m1')); + + it('block modifier value without tech', assertBuildKey( + { block: 'b1', mod: 'm1', val: 'v1' }, + 'b1_m1_v1')); + + it('block element without tech', assertBuildKey( + { block: 'b1', elem: 'e1' }, + 'b1__e1')); + + it('element modifier without tech', assertBuildKey( + { block: 'b1', elem: 'e1', mod: 'm1' }, + 'b1__e1_m1')); + + it('element modifier value without tech', assertBuildKey( + { block: 'b1', elem: 'e1', mod: 'm1', val: 'v1' }, + 'b1__e1_m1_v1')); + + it('block with tech', assertBuildKey( + { tech: 't1', block: 'b1' }, + 'b1.t1')); + + it('block modifier with tech', assertBuildKey( + { tech: 't1', block: 'b1', mod: 'm1' }, + 'b1_m1.t1')); + + it('block modifier value with tech', assertBuildKey( + { tech: 't1', block: 'b1', mod: 'm1', val: 'v1' }, + 'b1_m1_v1.t1')); + + it('block element with tech', assertBuildKey( + { tech: 't1', block: 'b1', elem: 'e1' }, + 'b1__e1.t1')); + + it('element modifier with tech', assertBuildKey( + { tech: 't1', block: 'b1', elem: 'e1', mod: 'm1' }, + 'b1__e1_m1.t1')); + + it('element modifier value with tech', assertBuildKey( + { tech: 't1', block: 'b1', elem: 'e1', mod: 'm1', val: 'v1' }, + 'b1__e1_m1_v1.t1')); + + it('just tech', assertBuildKey( + { tech: 't1' }, + '.t1')); + + it('empty', assertBuildKey( + {}, + '')); + + }); + + }); + +}); From 23e6442063088f9ab56b1b15e6af782da298da28 Mon Sep 17 00:00:00 2001 From: Dmitry Filatov Date: Wed, 25 Sep 2013 17:16:11 +0400 Subject: [PATCH 4/6] add comments, xit -> it.skip Conflicts: test/v2-deps.js --- lib/techs/v2/deps.js.js | 3 ++- test/v2-deps.js | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/techs/v2/deps.js.js b/lib/techs/v2/deps.js.js index c2a41a88..c17cd5f4 100644 --- a/lib/techs/v2/deps.js.js +++ b/lib/techs/v2/deps.js.js @@ -205,6 +205,7 @@ var Deps = exports.Deps = INHERIT(/** @lends Deps.prototype */{ items[itemKey] = item; item.include && this.itemsByOrder.push(itemKey); } else if(!itemByKey.include && item.include) { + // update `include` for existing item in case of adding of new item without `include: false` itemByKey.include = true; this.itemsByOrder.push(itemKey); } @@ -561,7 +562,7 @@ var Deps = exports.Deps = INHERIT(/** @lends Deps.prototype */{ var key = i.buildKey(), ctxTech = ctx && ctx.item.tech || ''; if(!uniq.hasOwnProperty(key) || !uniq[key].hasOwnProperty(ctxTech)) { - if(i.include) { + if(i.include) { // include only items without `include: false` (uniq[key] || (uniq[key] = {}))[ctxTech] = true; var newCtx = ctx || i; _this.forEach(fn, uniq, i.mustDeps, i); diff --git a/test/v2-deps.js b/test/v2-deps.js index e522f13c..3d90af3c 100644 --- a/test/v2-deps.js +++ b/test/v2-deps.js @@ -353,6 +353,15 @@ describe('Deps v2', function() { } )); + // TODO: https://github.com/bem/bem-tools/issues/401 + it.skip('block with elem array', assertDepsParse( + [ { block: 'b1', elem: ['e1', 'e2'] } ], + { '': {'': [ + {block: 'b1', elem: 'e1'}, + {block: 'b1', elem: 'e2'} + ] } } + )); + }); describe('new format with techs', function() { @@ -522,6 +531,16 @@ describe('Deps v2', function() { } )); + // TODO: https://github.com/bem/bem-tools/issues/413 + it.skip('block with tech shortcut', assertDepsParse( + {block: 'b1', tech: 't1', shouldDeps: {tech: 't2'}}, + { 't1': { + 't1': [ { block: 'b1', tech: 't1'} ], + 't2': [ { block: 'b1', tech: 't2'} ] + } + } + )); + }); describe('noDeps', function() { From 3e37dd3fa35e0358a9104feb3e83a7884d0a32d9 Mon Sep 17 00:00:00 2001 From: Sergey Berezhnoy Date: Thu, 26 Sep 2013 16:18:50 +0400 Subject: [PATCH 5/6] comments --- lib/techs/deps.js.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/techs/deps.js.js b/lib/techs/deps.js.js index 2f5fc1a2..d84131db 100644 --- a/lib/techs/deps.js.js +++ b/lib/techs/deps.js.js @@ -101,6 +101,7 @@ var Deps = exports.Deps = INHERIT({ items[itemKey] = item; item.include && this.itemsByOrder.push(itemKey); } else if(!itemByKey.include && item.include) { + // update `include` for existing item in case of adding of new item without `include: false` itemByKey.include = true; this.itemsByOrder.push(itemKey); } @@ -380,7 +381,7 @@ var Deps = exports.Deps = INHERIT({ var key = i.buildKey(), ctxTech = ctx && ctx.item.tech || ''; if(!uniq.hasOwnProperty(key) || !uniq[key].hasOwnProperty(ctxTech)) { - if(i.include) { + if(i.include) { // include only items without `include: false` (uniq[key] || (uniq[key] = {}))[ctxTech] = true; var newCtx = ctx || i; _this.forEach(fn, uniq, i.mustDeps, i); From b23dbdb1032b965fee9bc7c8659217c342f17a80 Mon Sep 17 00:00:00 2001 From: Sergey Belov Date: Wed, 16 Oct 2013 16:23:57 +0300 Subject: [PATCH 6/6] Fix broken tests --- lib/techs/v2/deps.js.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/techs/v2/deps.js.js b/lib/techs/v2/deps.js.js index c17cd5f4..2ef2cb72 100644 --- a/lib/techs/v2/deps.js.js +++ b/lib/techs/v2/deps.js.js @@ -684,7 +684,11 @@ var Deps = exports.Deps = INHERIT(/** @lends Deps.prototype */{ * @returns {Object} */ serializeFull: function() { - return this.items; + var result = {}; + for(var item in this.items){ + result[item] = this.items[item].serializeFull(); + } + return result; }, /** @@ -783,6 +787,16 @@ var DepsItem = exports.DepsItem = INHERIT({ while(k = ks.shift()) this.item[k] && (res[k] = this.item[k]); if(res.block) return res; + }, + + serializeFull: function() { + var res = {}; + for (var key in this) { + if (this.hasOwnProperty(key)) { + res[key] = this[key]; + } + } + return res; } });