<commit_before>/* jshint node: true */
'use strict';

require('jsonminify');

var fs = require('fs');
var lodash = require('lodash');
var RSVP = require('rsvp');
var buildOpenlayers = require('openlayers/tasks/build');
var defaultConfig = require('openlayers/config/ol.json');

var APP_CONFIG_PATH = ".ol-build";
var OUTPUT_FILENAME = "ol.js";

module.exports = {

  OUTPUT_FILENAME: OUTPUT_FILENAME,

  normalizeConfig: function(config) {

    if (config.compile) {
      // remove source map
      delete config.compile.create_source_map;
      delete config.compile.source_map_format;

      // remove compile optimizations
      // config.compile.compilation_level = "WHITESPACE_ONLY";

      // prettify output
      // config.compile.formatting = "PRETTY_PRINT";
    }

    return config;
  },

  loadConfig: function(path) {

    var config = {};

    try {
      var configContent = fs.readFileSync(path, { encoding: 'utf8'} );
      config = JSON.parse( JSON.minify(configContent) );
    } catch(e) {}

    return config;
  },

  getConfig: function() {
    var config = {};

    var appConfig = this.loadConfig(APP_CONFIG_PATH);

    if (appConfig.extend) {
      delete appConfig.extend;
      config = lodash.merge(defaultConfig, appConfig);
    } else if (!lodash.isEmpty(appConfig)) {
      config = appConfig;
    } else {
      config = defaultConfig;
    }

    return this.normalizeConfig(config);
  },

  build: function(outputPath) {
    var config = this.getConfig();
    return new RSVP.Promise(function(resolve, reject) {
      buildOpenlayers(config, function(error, compiledLib) {
        if (error) {
          reject(error);
        } else {
          compiledLib = compiledLib.replace('module.exports = factory()', 'exports.default = factory.apply(window)');
          fs.writeFileSync(outputPath, compiledLib, { encoding: 'utf8' });
          resolve();
        }
      });
    });
  }

};
<commit_msg>Disabled source optomizations<commit_after>/* jshint node: true */
'use strict';

require('jsonminify');

var fs = require('fs');
var lodash = require('lodash');
var RSVP = require('rsvp');
var buildOpenlayers = require('openlayers/tasks/build');
var defaultConfig = require('openlayers/config/ol.json');

var APP_CONFIG_PATH = ".ol-build";
var OUTPUT_FILENAME = "ol.js";

module.exports = {

  OUTPUT_FILENAME: OUTPUT_FILENAME,

  normalizeConfig: function(config) {

    if (config.compile) {
      // remove source map
      delete config.compile.create_source_map;
      delete config.compile.source_map_format;

      // remove compile optimizations
      config.compile.compilation_level = "WHITESPACE_ONLY";

      // prettify output
      config.compile.formatting = "PRETTY_PRINT";
    }

    return config;
  },

  loadConfig: function(path) {

    var config = {};

    try {
      var configContent = fs.readFileSync(path, { encoding: 'utf8'} );
      config = JSON.parse( JSON.minify(configContent) );
    } catch(e) {}

    return config;
  },

  getConfig: function() {
    var config = {};

    var appConfig = this.loadConfig(APP_CONFIG_PATH);

    if (appConfig.extend) {
      delete appConfig.extend;
      config = lodash.merge(defaultConfig, appConfig);
    } else if (!lodash.isEmpty(appConfig)) {
      config = appConfig;
    } else {
      config = defaultConfig;
    }

    return this.normalizeConfig(config);
  },

  build: function(outputPath) {
    var config = this.getConfig();
    return new RSVP.Promise(function(resolve, reject) {
      buildOpenlayers(config, function(error, compiledLib) {
        if (error) {
          reject(error);
        } else {
          compiledLib = compiledLib.replace('module.exports = factory()', 'exports.default = factory.apply(window)');
          fs.writeFileSync(outputPath, compiledLib, { encoding: 'utf8' });
          resolve();
        }
      });
    });
  }

};

{'fraction_non_alphanumeric': 0.1337809917355372, 'fraction_numerical': 0.0010330578512396695, 'mean_word_length': 2.9723076923076923, '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': '7525433', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1164, 'n_words': 240}