<commit_before>/* eslint-disable no-console */
// Build for filestack.js published to npm

import jetpack from 'fs-jetpack';
import minimist from 'minimist';
import babel from 'rollup-plugin-babel';
import babelrc from 'babelrc-rollup';
import inject from 'rollup-plugin-inject';
import replace from 'rollup-plugin-replace';
import nodeResolve from 'rollup-plugin-node-resolve';
import commonJs from 'rollup-plugin-commonjs';

const argv = minimist(process.argv);
const envName = argv.env || 'production';
const manifest = jetpack.read('package.json', 'json');

const sourcemapType = () => {
  if (envName === 'production' || envName === 'staging') {
    // For production and staging sourcemaps are in separate file.
    return true;
  }
  // For debugging it's better to have sourcemaps in same file.
  return 'inline';
};

export default {
  entry: 'lib/filestack.js',
  acorn: {
    allowReserved: true,
  },
  onwarn(warning) {
    // Suppress this error message
    // https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
    if (warning.code === 'THIS_IS_UNDEFINED') {
      return;
    }
    console.error(warning.message);
  },
  plugins: [
    inject({
      exclude: 'node_modules/**',
      modules: {
        ENV: jetpack.path(`config/env_${envName}.js`),
      },
    }),
    replace({
      delimiters: ['@{', '}'],
      values: {
        VERSION: manifest.version,
      },
    }),
    nodeResolve(),
    commonJs(),
    babel(babelrc()),
  ],<commit_msg>Add module and jsnext fields to rollup-plugin-node-resolve config<commit_after>/* eslint-disable no-console */
// Build for filestack.js published to npm

import jetpack from 'fs-jetpack';
import minimist from 'minimist';
import babel from 'rollup-plugin-babel';
import babelrc from 'babelrc-rollup';
import inject from 'rollup-plugin-inject';
import replace from 'rollup-plugin-replace';
import nodeResolve from 'rollup-plugin-node-resolve';
import commonJs from 'rollup-plugin-commonjs';

const argv = minimist(process.argv);
const envName = argv.env || 'production';
const manifest = jetpack.read('package.json', 'json');

const sourcemapType = () => {
  if (envName === 'production' || envName === 'staging') {
    // For production and staging sourcemaps are in separate file.
    return true;
  }
  // For debugging it's better to have sourcemaps in same file.
  return 'inline';
};

export default {
  entry: 'lib/filestack.js',
  acorn: {
    allowReserved: true,
  },
  onwarn(warning) {
    // Suppress this error message
    // https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
    if (warning.code === 'THIS_IS_UNDEFINED') {
      return;
    }
    console.error(warning.message);
  },
  plugins: [
    inject({
      exclude: 'node_modules/**',
      modules: {
        ENV: jetpack.path(`config/env_${envName}.js`),
      },
    }),
    replace({
      delimiters: ['@{', '}'],
      values: {
        VERSION: manifest.version,
      },
    }),
    nodeResolve({
      module: true,
      jsnext: true,
      main: true,
    }),
    commonJs(),
    babel(babelrc()),
  ],
{'fraction_non_alphanumeric': 0.14746692481445628, 'fraction_numerical': 0.0, 'mean_word_length': 3.200542005420054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '5784478', 'n_tokens_mistral': 998, 'n_tokens_neox': 975, 'n_words': 243}