<commit_before>const requireFromString = (source, filename) => {
  var m = new module.constructor();
  m._compile(source, filename);
  return m.exports;
};
  // Credits: http://stackoverflow.com/a/17585470/2816199

const loaderContext = {
  cacheable() {},
  dependencies() {},
  async() {throw new Error(
    'isomorphic-ensure: Async modules are not supported.'
  );},
  resolve() {throw new Error(
    'isomorphic-ensure: Loaders which use `this.resolve` are not supported.'
  );},
};

const startsWithDot = /^\./;
const moduleIdParts = /^((?:[a-z\-]+!)*)(.*)$/;
  //  ^           From the beginning of the string match:
  //  ((?:        1.
  //    [a-z\-]+  A loader name, consisting of lowercase letters and hyphens
  //    !         followed by a bang
  //  )*)         as many times as possible.
  //  (.*)        2. Any sequence of characters
  //  $           until the end of the string.

export default (settings = {}) => {
  const {loaders} = settings;
  const {readFileSync} = require('fs');

  return (dependencies, callback) => {
    process.nextTick(() => callback(
      function customRequire(moduleId) {
        const {dirname} = customRequire;
        const [, loadersPart, rawPath] = moduleId.match(moduleIdParts);
        const loadersList = loadersPart.split('!').slice(0, -1);
        const modulePath = (startsWithDot.test(rawPath) ?
          `${dirname}/${rawPath}` :
          require.resolve(rawPath)
        );

        return (loadersList.length ?
          requireFromString(
            loadersList.reduce(
              (moduleString, loaderName) => loaders[loaderName]
                .bind(loaderContext)(moduleString)
              ,
              readFileSync(modulePath, {encoding: 'utf8'})
            ),
            modulePath.split('/').pop()
          ) :<commit_msg>Update the module<commit_after>const requireFromString = (source, filename) => {
  var m = new module.constructor();
  m._compile(source, filename);
  return m.exports;
};
  // Credits: http://stackoverflow.com/a/17585470/2816199

const loaderContext = {
  cacheable() {},
  dependencies() {},
  async() {throw new Error(
    'isomorphic-ensure: Async modules are not supported.'
  );},
  resolve() {throw new Error(
    'isomorphic-ensure: Loaders which use `this.resolve` are not supported.'
  );},
};

const startsWithDot = /^\./;
const moduleIdParts = /^((?:[a-z\-]+!)*)(.*)$/;
  //  ^           From the beginning of the string match:
  //  ((?:        1.
  //    [a-z\-]+  A loader name, consisting of lowercase letters and hyphens
  //    !         followed by a bang
  //  )*)         as many times as possible.
  //  (.*)        2. Any sequence of characters
  //  $           until the end of the string.

export default (settings = {}) => {
  const {loaders, dirname} = settings;
  const {readFileSync} = require('fs');

  return (dependencies, callback) => {
    process.nextTick(() => callback(
      function customRequire(moduleId) {
        const [, loadersPart, rawPath] = moduleId.match(moduleIdParts);
        const loadersList = loadersPart.split('!').slice(0, -1);
        const modulePath = (startsWithDot.test(rawPath) ?
          `${dirname}/${rawPath}` :
          require.resolve(rawPath)
        );

        return (loadersList.length ?
          requireFromString(
            loadersList.reduce(
              (moduleString, loaderName) => loaders[loaderName]
                .bind(loaderContext)(moduleString)
              ,
              readFileSync(modulePath, {encoding: 'utf8'})
            ),
            modulePath.split('/').pop()
          ) :
{'fraction_non_alphanumeric': 0.14997217584863662, 'fraction_numerical': 0.011129660545353366, 'mean_word_length': 2.3042279411764706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2172931', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1051, 'n_words': 254}