<commit_before>/**
 * Copyright 2018 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import builtins from 'rollup-plugin-node-builtins';
import json from 'rollup-plugin-json';
import ignore from 'rollup-plugin-ignore';
import compiler from '@ampproject/rollup-plugin-closure-compiler';
import serve from 'rollup-plugin-serve';
import filesize from 'rollup-plugin-filesize';
import semver from 'semver';
import pkg from './package.json';

const nodePlugins = [
  resolve({
    preferBuiltins: true,
  }),
  json(),
  commonjs(),
  builtins(),
];

const browserPlugins = [
  ignore(['crypto']),
  ...nodePlugins,
];


if (semver.gt(process.version, '7.99.99')) {
  browserPlugins.push(
      compiler()
  );
}

// Start our server if we are watching
if (process.env.ROLLUP_WATCH) {
  const servePlugin = serve({
    contentBase: ['dist', 'examples'],
    host: 'localhost',
    port: 8000,
  });

  nodePlugins.push(servePlugin);
  browserPlugins.push(servePlugin);
}

nodePlugins.push(filesize());
browserPlugins.push(filesize());

export default [
  {
    input: 'index.js',
    output: {
      name: 'amp-toolbox-cache-url',
      file: pkg.browser,
      format: 'umd',
      exports: 'named',
      name: 'AmpToolboxCacheUrl',
    },
    context: 'window',
    plugins: browserPlugins,
  },
  {
    input: 'index.js',
    output: {
      file: pkg.module,
      format: 'es',
      exports: 'named',
    },
    context: 'window',
    plugins: browserPlugins,
  },
  {
    input: 'index.js',
    output: {
      file: pkg.main,
      format: 'cjs',
      exports: 'named',
    },
    context: 'global',
    plugins: nodePlugins,
  },
];
<commit_msg>Fixed builds for node 6<commit_after>/**
 * Copyright 2018 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import builtins from 'rollup-plugin-node-builtins';
import json from 'rollup-plugin-json';
import ignore from 'rollup-plugin-ignore';
import serve from 'rollup-plugin-serve';
import semver from 'semver';
import pkg from './package.json';

const nodePlugins = [
  resolve({
    preferBuiltins: true,
  }),
  json(),
  commonjs(),
  builtins(),
];

const browserPlugins = [
  ignore(['crypto']),
  ...nodePlugins,
];

// Start our server if we are watching
if (process.env.ROLLUP_WATCH) {
  const servePlugin = serve({
    contentBase: ['dist', 'examples'],
    host: 'localhost',
    port: 8000,
  });

  nodePlugins.push(servePlugin);
  browserPlugins.push(servePlugin);
}

if (semver.gt(process.version, '7.99.99')) {
  const compiler = require('@ampproject/rollup-plugin-closure-compiler');
  const filesize = require('rollup-plugin-filesize');
  browserPlugins.push(
      compiler()
  );
  nodePlugins.push(filesize());
  browserPlugins.push(filesize());
}

export default [
  {
    input: 'index.js',
    output: {
      name: 'amp-toolbox-cache-url',
      file: pkg.browser,
      format: 'umd',
      exports: 'named',
      name: 'AmpToolboxCacheUrl',
    },
    context: 'window',
    plugins: browserPlugins,
  },
  {
    input: 'index.js',
    output: {
      file: pkg.module,
      format: 'es',
      exports: 'named',
    },
    context: 'window',
    plugins: browserPlugins,
  },
  {
    input: 'index.js',
    output: {
      file: pkg.main,
      format: 'cjs',
      exports: 'named',
    },
    context: 'global',
    plugins: nodePlugins,
  },
];

{'fraction_non_alphanumeric': 0.1331896551724138, 'fraction_numerical': 0.007543103448275862, 'mean_word_length': 3.3012048192771086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4594731', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1432, 'n_words': 426}