<commit_before>var url = require('url'),
  grunt = require('grunt');

module.exports = {
  manifestUrl: function(manifest) {
    return function(path) {
      if(process.env.GLAZIER_ENV !== "prod") { return path; }
      var parsed = url.parse(path, true);

      if (!manifest[parsed.pathname]) {
        throw "No file found in manifest for path " + parsed.pathname;
      } else {
        console.log("Found entry for path " + parsed.pathname);
      }

      var assetHost = grunt.config.process('<%= pkg.assetHost %>');
      var parts = {
        pathname: assetHost + manifest[parsed.pathname],
        hash: parsed.hash,
        query: grunt.util._.extend({}, parsed.query, {"cors-fix": "1"})
      };

      console.log(path + " -> " + url.format(parts));

      return url.format(parts);
    };
  }
};
<commit_msg>Use .min files when available.<commit_after>var url = require('url'),
  grunt = require('grunt');

module.exports = {
  manifestUrl: function(manifest) {
    return function(path) {
      if(process.env.GLAZIER_ENV !== "prod") { return path; }
      var parsed = url.parse(path, true);

      var pathname = parsed.pathname;
      var minifiedPathname = pathname.replace(/\.(js|css)$/, '.min.$1');

      var path = manifest[minifiedPathname] || manifest[pathname];

      if (!path) {
        throw "No file found in manifest for path " + pathname;
      } else {
        console.log("Found entry for path " + pathname);
      }

      var assetHost = grunt.config.process('<%= pkg.assetHost %>');
      var parts = {
        pathname: assetHost + path,
        hash: parsed.hash,
        query: grunt.util._.extend({}, parsed.query, {"cors-fix": "1"})
      };

      console.log(path + " -> " + url.format(parts));

      return url.format(parts);
    };
  }
};

{'fraction_non_alphanumeric': 0.16321967579653437, 'fraction_numerical': 0.0016769144773616546, 'mean_word_length': 2.5657370517928286, 'pattern_counts': {'":': 2, '<': 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': '6510344', 'n_tokens_mistral': 579, 'n_tokens_neox': 557, 'n_words': 125}