<commit_before>var transformTools = require('browserify-transform-tools');
var glob = require('glob');
var path = require('path');

module.exports = transformTools.makeRequireTransform('require-globify', {
    jsFilesOnly: true,
    evaluateArguments: true
  },
  function (args, opts, done) {
    var optsObj = args[1];
    if (typeof  optsObj !== 'undefined' && (optsObj.hash || optsObj.glob)) {
      var cwd = path.dirname(opts.file),
        globPattern = args[0],
        files = glob.sync(globPattern, {
          cwd: cwd
        });
      if (files.length !== 0 && files.length > 0) {
        var modules = [];
        var replacement;
        for (var fi = 0, fl = files.length; fi < fl; fi++) {
          if (path.resolve(cwd, files[fi]) !== opts.file) {
            modules.push(files[fi]);
          }
        }
        if ((typeof optsObj.hash !== "undefined" && optsObj.hash !== null && optsObj.hash !== false)) {
          for (var mi = 0, mil = modules.length; mi < mil; mi++) {
            var module = modules[mi];
            var hashProp = optsObj.ext ? path.basename(module) : path.basename(module, path.extname(module));
            modules[mi] = '"' + hashProp + '": require(\'' + module + '\')';
          }
          replacement = '{' + modules.join(', ') + '}';
        } else {
          replacement = 'require(\'' + modules.join('\');\nrequire(\'') + '\')';
        }
        done(null, replacement);
      } else {
        done('Glob expression "' + globPattern + '" couldn\'t find any files');
      }
    } else {
      done();
    }
  }
);<commit_msg>Fixed bug where extensions were applied inside the require call when they shouldn't be<commit_after>var transformTools = require('browserify-transform-tools');
var glob = require('glob');
var path = require('path');

module.exports = transformTools.makeRequireTransform('require-globify', {
    jsFilesOnly: true,
    evaluateArguments: true
  },
  function (args, opts, done) {
    var optsObj = args[1];
    if (typeof  optsObj !== 'undefined' && (optsObj.hash || optsObj.glob)) {
      var cwd = path.dirname(opts.file),
        globPattern = args[0],
        files = glob.sync(globPattern, {
          cwd: cwd
        });
      if (files.length !== 0 && files.length > 0) {
        var modules = [];
        var replacement;
        for (var fi = 0, fl = files.length; fi < fl; fi++) {
          if (path.resolve(cwd, files[fi]) !== opts.file) {
            modules.push(files[fi]);
          }
        }
        if ((typeof optsObj.hash !== "undefined" && optsObj.hash !== null && optsObj.hash !== false)) {
          for (var mi = 0, mil = modules.length; mi < mil; mi++) {
            var mod = modules[mi];
            var hashKey = optsObj.ext ? path.basename(mod) : path.basename(mod, path.extname(mod));
            var modulePath = path.dirname(mod) + '/' + hashKey;
            modules[mi] = '"' + hashKey + '": require("' + modulePath + '")';
          }
          replacement = '{' + modules.join(', ') + '}';
        } else {
          replacement = 'require("' + modules.join('");\nrequire("') + '")';
        }
        done(null, replacement);
      } else {
        done('Glob expression "' + globPattern + '" couldn\'t find any files');
      }
    } else {
      done();
    }
  }
);
{'fraction_non_alphanumeric': 0.17360899969595622, 'fraction_numerical': 0.0036485253876558225, 'mean_word_length': 2.219178082191781, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 5, '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': '2152964', 'n_tokens_mistral': 989, 'n_tokens_neox': 983, 'n_words': 233}