<commit_before>'use strict';

var gulp = require('gulp');
var _ = require('lodash');
var browserify = require('browserify');
var reactify = require('reactify');
var File = require('vinyl');
var source = require('vinyl-source-stream');

var dest = gulp.dest('./build/');

var files = {
  'test1': './test1.jsx',
  'test2': './test2.jsx'
};

gulp.task('index', function () {
  var indexContent = _.map(files, function (file) {
    return 'require(\'' + file + '\');';
  }).join('\n');

  var indexFile = new File({
    contents: new Buffer(indexContent)
  });

  indexFile.pipe(source('index.js'))
    .pipe(dest);
});

gulp.task('default', function () {
  var bd = browserify({
    debug: true
  });

  bd.require('react');
  bd.require('./test1.jsx', {expose: 'test1'});

  bd.transform(reactify)
    .bundle()
    .pipe(source('bundle.js'))
    .pipe(dest);
});
<commit_msg>Stream the default task and index tasks.<commit_after>'use strict';

var gulp = require('gulp');
var _ = require('lodash');
var browserify = require('browserify');
var reactify = require('reactify');
var File = require('vinyl');
var source = require('vinyl-source-stream');
var path = require('path');

var buildPath = './build/';
var indexFileName = '__index.js';

var files = {
  'test1': './test1.jsx',
  'test2': './test2.jsx'
};

gulp.task('index', function () {
  var indexContent = _.map(files, function (file) {
    return 'require(\'' + path.resolve(file) + '\');';
  }).join('\n');

  var indexFile = new File({
    contents: new Buffer(indexContent)
  });

  return indexFile
    .pipe(source(indexFileName))
    .pipe(gulp.dest(buildPath));
});

gulp.task('default', ['index'], function () {
  var indexFilePath = path.resolve(buildPath, indexFileName);
  var opts = {
    debug: true
  };

  browserify(indexFilePath, opts)
    .transform(reactify)
    .bundle()
    .pipe(source('bundle.js'))
    .pipe(gulp.dest(buildPath));
});

{'fraction_non_alphanumeric': 0.20531526836894215, 'fraction_numerical': 0.005211047420531527, 'mean_word_length': 3.93573264781491, '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': '5577145', 'n_tokens_mistral': 660, 'n_tokens_neox': 647, 'n_words': 142}