<commit_before>var sequence = require('run-sequence');
var color = require('cli-color');

var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');

var babelify = require('babelify');
var watchify = require('watchify');
var row_flow = require('browserify-row-flow');

var util = require('gulp-util');

module.exports = function(gulp, opts){
    var config = opts.config;

    function build(watch, watchCallback){
        var b = browserify({
            debug: config.debug || false,
            cache: {},
            packageCache: {},
            paths: [config.js.srcDir],
            extensions: ['js', '.react.js', 'jsx']
        });
        b.transform("babelify", {
            sourceMapsAbsolute: !!config.debug,
            sourceMaps: !!config.debug,
            retainLines: !!config.debug,
            compact: !config.debug,
            minified: !config.debug,
            comments: !!config.debug,
            ast: !!config.debug
        });
        b = watch ? watchify(b) : b;
        b.add(config.js.target);

        function rebundle(){
            return b.bundle()
            .pipe(source(config.js.distFilename || 'bundle.js'))
            .pipe(gulp.dest(config.js.distDir));
        }

        b.on('update', function(path){
            util.log(color.yellowBright('rebundling...'));
            return rebundle();
        });
        b.on('time', function(time){
            util.log("Finished "+color.yellowBright("rebundle()")+" after "+color.magenta(time+" ms"));
            watchCallback();
        });

        return rebundle();
    }

    gulp.task('browserify', function(){
        return build(false);
    });

    gulp.task('watch-browserify', ['browserify'], function() {
        return build(true, function(){
            hightlight('Finished bundling for \'watch-js\'');
        });
    });<commit_msg>use uglify-js-harmony<commit_after>var sequence = require('run-sequence');
var color = require('cli-color');

var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');

var babelify = require('babelify');
var watchify = require('watchify');
var row_flow = require('browserify-row-flow');

var util = require('gulp-util');
var uglifyjs = require('uglify-js-harmony');
var minifier = require('gulp-uglify/minifier');
var pump = require('pump');

module.exports = function(gulp, opts){
    var config = opts.config;

    function build(watch, watchCallback){
        var b = browserify({
            debug: config.debug || false,
            cache: {},
            packageCache: {},
            paths: [config.js.srcDir],
            extensions: ['js', '.react.js', 'jsx']
        });
        b.transform("babelify", {
            sourceMapsAbsolute: !!config.debug,
            sourceMaps: !!config.debug,
            retainLines: !!config.debug,
            compact: !config.debug,
            minified: !config.debug,
            comments: !!config.debug,
            ast: !!config.debug
        });
        b = watch ? watchify(b) : b;
        b.add(config.js.target);

        function rebundle(){
            return b.bundle()
            .pipe(source(config.js.distFilename || 'bundle.js'))
            .pipe(gulp.dest(config.js.distDir));
        }

        b.on('update', function(path){
            util.log(color.yellowBright('rebundling...'));
            return rebundle();
        });
        b.on('time', function(time){
            util.log("Finished "+color.yellowBright("rebundle()")+" after "+color.magenta(time+" ms"));
            watchCallback();
        });

        return rebundle();
    }

    gulp.task('browserify-build', function(){
        return build(false);
    });

    gulp.task('browserify', ['browserify-build'], function(cb){
        pump([
            gulp.src(config.js.distDir + '/' + config.js.distFilename),
            minifier({}, uglifyjs),
            gulp.dest(config.js.distDir)
        ], cb);
    });

    gulp.task('watch-browserify', ['browserify'], function() {
        return build(true, function(){
            hightlight('Finished bundling for \'watch-js\'');
        });
    });
{'fraction_non_alphanumeric': 0.16634980988593157, 'fraction_numerical': 0.0, 'mean_word_length': 2.2577399380804954, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7052099', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1204, 'n_words': 232}