<commit_before>import gulp from 'gulp';
import { buildExternalHelpers } from 'babel-core';
import babelify from 'babelify';
import browserify from 'browserify';
import uglifyify from 'uglifyify';
import yamlify from 'yamlify';
import buffer from 'gulp-buffer';
import collapse from 'bundle-collapser/plugin';
import envify from 'loose-envify/custom';
import { transform as insert } from 'gulp-insert';
import source from 'vinyl-source-stream';
import sourcemaps from 'gulp-sourcemaps';
import uglify from 'gulp-uglify';
import when from 'gulp-if';

import exposePluginDependencies, {
  EXPORT_MAIN,
  EXPORT_SUBMODULES
} from './utils/exposePluginDependencies';

export const exposeModules = {
  classnames: EXPORT_MAIN,
  react: EXPORT_MAIN,
  'react-dom': EXPORT_MAIN,
  redux: EXPORT_MAIN,
  'react-redux': EXPORT_MAIN,
  'react-dnd': EXPORT_MAIN,
  // Not exposing SVG icons because their use is a bit all over the place.
  // Really we should pick a few components to expose here and leave plugins
  // to include the rest.
  'material-ui': /^(styles\/)?([^\/]+)(\/index)?\.js$/,
  recompose: EXPORT_SUBMODULES,
  'u-wave-web': /^lib\/constants(\/([^\/]+)\.js)?$/
};

// The browserify task compiles all the necessary modules into a single file,
// called a "bundle". It includes both üWave's own modules, like the React
// components and Redux reducers, and dependency files like React itself.

export default function browserifyTask({ minify = false }) {
  process.env.NODE_ENV = minify ? 'production' : 'development';

  // Browserify works by passing a single entry point file, which contains the
  // code that starts the application. It'll combine all of them into a single
  // file that can be included simply by using a <script> tag.
  const b = browserify({
    debug: true,
    // The main üWave application file.
    entries: './src/app.js'
  });

  // Replace Bluebird with es6-promise.
  // Bluebird is only used by dependencies for its most basic Promises
  // functionality, so we can just use the es6-promise olyfill module that we
  // already use elsewhere. This shaves some 20kb off the final minified+gzipped
  // bundle (that's > 15%).
  b.require('./src/utils/Promise', { expose: 'bluebird' });

  b.transform(yamlify);

  // Babelify transforms the üWave source code, which is written in JavaScript
  // of the future and JSX, to JavaScript of today.<commit_msg>build: remove smallish modules from exposed paths<commit_after>import gulp from 'gulp';
import { buildExternalHelpers } from 'babel-core';
import babelify from 'babelify';
import browserify from 'browserify';
import uglifyify from 'uglifyify';
import yamlify from 'yamlify';
import buffer from 'gulp-buffer';
import collapse from 'bundle-collapser/plugin';
import envify from 'loose-envify/custom';
import { transform as insert } from 'gulp-insert';
import source from 'vinyl-source-stream';
import sourcemaps from 'gulp-sourcemaps';
import uglify from 'gulp-uglify';
import when from 'gulp-if';

import exposePluginDependencies, { EXPORT_MAIN } from './utils/exposePluginDependencies';

export const exposeModules = {
  react: EXPORT_MAIN,
  'react-dom': EXPORT_MAIN,
  'react-redux': EXPORT_MAIN,
  'react-dnd': EXPORT_MAIN,
  // Not exposing SVG icons because their use is a bit all over the place.
  // Really we should pick a few components to expose here and leave plugins
  // to include the rest.
  'material-ui': /^(styles\/)?([^\/]+)(\/index)?\.js$/,
  'u-wave-web': /^lib\/constants(\/([^\/]+)\.js)?$/
};

// The browserify task compiles all the necessary modules into a single file,
// called a "bundle". It includes both üWave's own modules, like the React
// components and Redux reducers, and dependency files like React itself.

export default function browserifyTask({ minify = false }) {
  process.env.NODE_ENV = minify ? 'production' : 'development';

  // Browserify works by passing a single entry point file, which contains the
  // code that starts the application. It'll combine all of them into a single
  // file that can be included simply by using a <script> tag.
  const b = browserify({
    debug: true,
    // The main üWave application file.
    entries: './src/app.js'
  });

  // Replace Bluebird with es6-promise.
  // Bluebird is only used by dependencies for its most basic Promises
  // functionality, so we can just use the es6-promise olyfill module that we
  // already use elsewhere. This shaves some 20kb off the final minified+gzipped
  // bundle (that's > 15%).
  b.require('./src/utils/Promise', { expose: 'bluebird' });

  b.transform(yamlify);

  // Babelify transforms the üWave source code, which is written in JavaScript
  // of the future and JSX, to JavaScript of today.
{'fraction_non_alphanumeric': 0.11327959270258804, 'fraction_numerical': 0.002545608824777259, 'mean_word_length': 3.891078838174274, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3784894', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1384, 'n_words': 544}