all files / gulp-browser/ index.js

93.75% Statements 15/16
75% Branches 3/4
100% Functions 5/5
93.75% Lines 15/16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                                             
#!/usr/bin/env node
 
/// <reference path="./index.ts" />
var GulpBrowserBrowserify;
(function (GulpBrowserBrowserify) {
    function init() {
        return function () {
            return plugins.through.obj(function (file, enc, cb) {
                var bundleCallback = function (err, bufferedContent) {
                    Eif (Buffer.isBuffer(bufferedContent)) {
                        file.contents = bufferedContent;
                    }
                    else {
                        plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
                    }
                    cb(null, file);
                };
                plugins.browserify(file, { basedir: file.base })
                    .bundle(bundleCallback);
            });
        };
    }
    GulpBrowserBrowserify.init = init;
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
/// <reference path="./typings/main.d.ts" />
/// <reference path="./modulebrowserify.ts" />
var plugins = {
    beautylog: require("beautylog"),
    through: require("through2"),
    gutil: require("gulp-util"),
    path: require("path"),
    browserify: require("browserify")
};
//create the return object
var gulpBrowser = {};
gulpBrowser.browserify = GulpBrowserBrowserify.init();
module.exports = gulpBrowser;