Войти с помощью github
Форум /

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.:1823 throw new Error(msg || 'Assertion failed'); ^

Error: Wrong .match() argument at assert (evalmachine.:1823:11) at Tree.match (evalmachine.:1613:5) at Object. (evalmachine.:1967:1) at Tree.build (evalmachine.:1517:13) at BEMHTML.compile (evalmachine.:372:18) at buildBemXjst (evalmachine.:1844:5) at evalmachine.:2080:15 at evalmachine.:2083:3 at Object.exports.runInContext (vm.js:44:17) at Bundle.bemtree (/home/rustam/www/rhblog/server/libs/bem/index.js:24:5)