<commit_before>'use strict';

module.exports = {
  name: 'ember-cli-uglify',

  included(app) {
    this._super.included.apply(this, arguments);

    const defaults = require('lodash.defaultsdeep');

    let defaultOptions = {
      enabled: app.env === 'production',

      uglify: {
        compress: {
          // this is adversely affects heuristics for IIFE eval
          'negate_iife': false,
          // limit sequences because of memory issues during parsing
          sequences: 30,
        },
        output: {
          // no difference in size and much easier to debug
          semicolons: false,
        },
      }
    };

    if (app.options.sourcemaps && !this._sourceMapsEnabled(app.options.sourcemaps)) {
      defaultOptions.uglify.sourceMap = false;
    }

    this._options = defaults(app.options['ember-cli-uglify'] || {}, defaultOptions);
  },

  _sourceMapsEnabled(options) {
    if (options.enabled === false) {
      return false;
    }

    let extensions = options.extensions || [];
    if (extensions.indexOf('js') === -1) {
      return false;
    }

    return true;
  },

  postprocessTree(type, tree) {
    if (this._options.enabled === true && type === 'all') {
      return require('broccoli-uglify-sourcemap')(tree, this._options);
    } else {
      return tree;
    }
  }
};
<commit_msg>Add a fix for Safari to the default config<commit_after>'use strict';

module.exports = {
  name: 'ember-cli-uglify',

  included(app) {
    this._super.included.apply(this, arguments);

    const defaults = require('lodash.defaultsdeep');

    let defaultOptions = {
      enabled: app.env === 'production',

      uglify: {
        compress: {
          // this is adversely affects heuristics for IIFE eval
          'negate_iife': false,
          // limit sequences because of memory issues during parsing
          sequences: 30,
        },
        mangle: {
          safari10: true
        },
        output: {
          // no difference in size and much easier to debug
          semicolons: false,
        },
      }
    };

    if (app.options.sourcemaps && !this._sourceMapsEnabled(app.options.sourcemaps)) {
      defaultOptions.uglify.sourceMap = false;
    }

    this._options = defaults(app.options['ember-cli-uglify'] || {}, defaultOptions);
  },

  _sourceMapsEnabled(options) {
    if (options.enabled === false) {
      return false;
    }

    let extensions = options.extensions || [];
    if (extensions.indexOf('js') === -1) {
      return false;
    }

    return true;
  },

  postprocessTree(type, tree) {
    if (this._options.enabled === true && type === 'all') {
      return require('broccoli-uglify-sourcemap')(tree, this._options);
    } else {
      return tree;
    }
  }
};

{'fraction_non_alphanumeric': 0.13253012048192772, 'fraction_numerical': 0.0029207740051113546, 'mean_word_length': 2.293269230769231, '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': '4831396', 'n_tokens_mistral': 835, 'n_tokens_neox': 799, 'n_words': 185}