lib/engines.js
function (name, options, cb) {
                var engine = enginesByExtension[this.ext],
                    that = this,
                    // queue
                    stack = [],
                    ctx = {
                        name    : name,
                        options : options,
                        cb      : cb
                    };

                this.engines = engines;
                this.thru = function (name, _name, _options, _cb) {
                    var engine = engines[name];
                    if (!engine) {
                        return cb(Error('Unknown engine ' + name));
                    }
                    this.ext = engine.extension;
                    engine.call(this, _name || ctx.name, _options || ctx.options, _cb || ctx.cb);
                };

                options.forceLoad = options.hasOwnProperty('forceLoad') ? options.forceLoad : !expressBem.envLoadCache;
                options.forceExec = options.hasOwnProperty('forceExec') ? options.forceExec : !expressBem.envExecCache;

                if (!middlewares.length) {
                    return engine.call(this, ctx.name, ctx.options, ctx.cb);
                }

                // async fn queue
                middlewares.forEach(function (mw) {
                    if (!mw.engine /* || shouldUseMiddlewareFor(mw.engine)*/) {
                        stack.push(mw.fn);
                    }
                });

                // put engine as last call
                stack.push(function (ctx) {
                    engine.call(this, ctx.name, ctx.options, ctx.cb);
                });

                function next () {
                    var fn = stack.shift();
                    fn.call(that, ctx, next);
                }

                process.nextTick(next);

                return this;
            }
function (name, options, cb) {
                var engine = enginesByExtension[this.ext],
                    that = this,
                    // queue
                    stack = [],
                    ctx = {
                        name    : name,
                        options : options,
                        cb      : cb
                    };

                this.engines = engines;
                this.thru = function (name, _name, _options, _cb) {
                    var engine = engines[name];
                    if (!engine) {
                        return cb(Error('Unknown engine ' + name));
                    }
                    this.ext = engine.extension;
                    engine.call(this, _name || ctx.name, _options || ctx.options, _cb || ctx.cb);
                };

                options.forceLoad = options.hasOwnProperty('forceLoad') ? options.forceLoad : !expressBem.envLoadCache;
                options.forceExec = options.hasOwnProperty('forceExec') ? options.forceExec : !expressBem.envExecCache;

                if (!middlewares.length) {
                    return engine.call(this, ctx.name, ctx.options, ctx.cb);
                }

                // async fn queue
                middlewares.forEach(function (mw) {
                    if (!mw.engine /* || shouldUseMiddlewareFor(mw.engine)*/) {
                        stack.push(mw.fn);
                    }
                });

                // put engine as last call
                stack.push(function (ctx) {
                    engine.call(this, ctx.name, ctx.options, ctx.cb);
                });

                function next () {
                    var fn = stack.shift();
                    fn.call(that, ctx, next);
                }

                process.nextTick(next);

                return this;
            }
function ( name , options , cb ) { var engine = enginesByExtension [ this . ext ] , that = this , // queue stack = [ ] , ctx = { name : name , options : options , cb : cb } ; this . engines = engines ; this . thru = function ( name , _name , _options , _cb ) { var engine = engines [ name ] ; if ( ! engine ) { return cb ( Error ( 'Unknown engine ' + name ) ) ; } this . ext = engine . extension ; engine . call ( this , _name || ctx . name , _options || ctx . options , _cb || ctx . cb ) ; } ; options . forceLoad = options . hasOwnProperty ( 'forceLoad' ) ? options . forceLoad : ! expressBem . envLoadCache ; options . forceExec = options . hasOwnProperty ( 'forceExec' ) ? options . forceExec : ! expressBem . envExecCache ; if ( ! middlewares . length ) { return engine . call ( this , ctx . name , ctx . options , ctx . cb ) ; } // async fn queue middlewares . forEach ( function ( mw ) { if ( ! mw . engine /* || shouldUseMiddlewareFor(mw.engine)*/ ) { stack . push ( mw . fn ) ; } } ) ; // put engine as last call stack . push ( function ( ctx ) { engine . call ( this , ctx . name , ctx . options , ctx . cb ) ; } ) ; function next ( ) { var fn = stack . shift ( ) ; fn . call ( that , ctx , next ) ; } process . nextTick ( next ) ; return this ; }
all engines will pass through it
all engines will pass through it