more browserify refactoring. #158.

This commit is contained in:
Christopher Jeffrey 2015-07-26 17:48:22 -07:00
parent 956836a9ed
commit 18f3dfcc99
1 changed files with 8 additions and 9 deletions

View File

@ -17,22 +17,21 @@ var requires = widgets.reduce(function(out, name) {
}, ''); }, '');
function transform(target) { function transform(target) {
var tr = new Transform; var stream = new Transform;
tr._transform = function(chunk, encoding, callback) { stream._transform = function(chunk, encoding, callback) {
return callback(null, chunk); return callback(null, chunk);
}; };
tr._flush = function(callback) { stream._flush = function(callback) {
if (target) { if (target) {
tr.push(requires); stream.push(requires);
} }
return callback(); return callback();
}; };
return tr; return stream;
} }
module.exports = function(file) { module.exports = function(file) {
if (path.basename(file) === 'widget.js') { return path.basename(file) === 'widget.js'
return transform(true); ? transform(true)
} : transform();
return transform();
}; };