var fs = require('fs'), path = require('path'), vm = require('vm'), vow = require('vow');
var Bundle = function(name, folder){
this.name = name+'.bundles';
this.folder = folder;
this.path = path.join(this.name,this.folder,this.folder);
this.BEMTREE = this.bemtree();
this.BEMHTML = require('../../../' + this.path + '.bemhtml.js');
};
Bundle.prototype.bemtree = function(){
var bemtreePath = './' + this.path + '.bemtree.js',
bemtreeFile = fs.readFileSync(bemtreePath, 'utf-8'),
context = vm.createContext({
console: console,
Vow: vow,
require: require,
setImmediate: setImmediate
});
vm.runInContext(bemtreeFile, context);
return context.BEMTREE;
};
module.exports = Bundle;
var Bundle = require('../server/libs/bem');
var index = new Bundle('desktop', 'index');
index.BEMTREE.apply({ block: 'header' }).then(function(bemjson){
console.log(bemjson);
});
evalmachine.
Error: Wrong .match() argument
at assert (evalmachine.
в каком-то из шаблонов в .match не функция?
Не обязательно в
match()
, может быть в любой из «сахарных» функций (tag()
,attrs()
и т.д.).Могу помочь найти точное места, если опубликуешь собранный бандл и входные данные.
index.bemjson.js:
bundle.js:
test.js:
throw new Error(msg || 'Assertion failed'); ^
Error: Wrong .match() argument at assert (/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:1823:11) at Tree.match (/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:1613:5) at Object. (/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:1967:1)
at Tree.build (/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:1517:13)
at BEMHTML.compile (/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:372:18)
at buildBemXjst (/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:1844:5)
at /home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:2044:26
at Object. (/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js:2057:3)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
я про
/home/rustam/my-bem-project/desktop.bundles/index/index.bemtree.js
говорил