<commit_before>// FIX reconsider name, but compiler.compile.compiler.compile() method calls would rock.
compiler.compile.compiler = def(
  [
    compiler.meta.metalator,
    compiler.tools.io,
    compiler.tools.error,
    ephox.bolt.kernel.module.analyser,
    ephox.bolt.kernel.fp.functions,
    ephox.bolt.kernel.fp.object
  ],

  function (metalator, io, error, analyser, fn, obj) {
    var modules = {};  // id -> [id]
    var rendered = {}; // id -> rendered
    var printed = {};

    var unexpected = fn.curry(error.die, "unexpected call to require, define or demand by compile modulator.");

    var load = function (regulator, id) {
      if (!regulator.can(id, unexpected))
        error.die("No modulator can load module: " + id);
      var spec = regulator.regulate(id, unexpected, unexpected, unexpected);
      rendered[id] = spec.render();
      spec.load(function (id, dependencies) {
        modules[id] = dependencies;
      });
    };

    var analyse = function (ids) {
      var results = analyser.analyse(ids, modules);
      if (results.cycle)
        error.die('cycle detected whilst compiling modules: ' + results.cycle.join(' ~> '));
      return results;
    };

    var render = function (ids) {
      var renderer = function (id) {
        if (printed[id])
          return "";
        var dependencies = modules[id];
        var deps = dependencies.map(renderer);
        printed[id] = true;
        return deps.join('\n') + '\n' + rendered[id];
      };
      return ids.map(renderer).join('\n');
    };

    var compile = function (regulator, ids) {
      var loader = fn.curry(load, regulator);
      var results = analyse(ids);
      while (results.load.length > 0) {
        results.load.forEach(loader);
        results = analyse(ids);
      }
      return render(ids);
    };

    var write = function (regulator, ids, target) {
      var header = metalator.render(ids);<commit_msg>Handle undefined rendered version.<commit_after>// FIX reconsider name, but compiler.compile.compiler.compile() method calls would rock.
compiler.compile.compiler = def(
  [
    compiler.meta.metalator,
    compiler.tools.io,
    compiler.tools.error,
    ephox.bolt.kernel.module.analyser,
    ephox.bolt.kernel.fp.functions,
    ephox.bolt.kernel.fp.object
  ],

  function (metalator, io, error, analyser, fn, obj) {
    var modules = {};  // id -> [id]
    var rendered = {}; // id -> rendered
    var printed = {};

    var unexpected = fn.curry(error.die, "unexpected call to require, define or demand by compile modulator.");

    var load = function (regulator, id) {
      if (!regulator.can(id, unexpected))
        error.die("No modulator can load module: " + id);
      var spec = regulator.regulate(id, unexpected, unexpected, unexpected);
      rendered[id] = spec.render();
      spec.load(function (id, dependencies) {
        modules[id] = dependencies;
      });
    };

    var analyse = function (ids) {
      var results = analyser.analyse(ids, modules);
      if (results.cycle)
        error.die('cycle detected whilst compiling modules: ' + results.cycle.join(' ~> '));
      return results;
    };

    var render = function (ids) {
      var renderer = function (id) {
        if (printed[id])
          return "";
        var dependencies = modules[id];
        var deps = dependencies.map(renderer);
        printed[id] = true;
        return deps.join('\n') + '\n' + (rendered[id] || "");
      };
      return ids.map(renderer).join('\n');
    };

    var compile = function (regulator, ids) {
      var loader = fn.curry(load, regulator);
      var results = analyse(ids);
      while (results.load.length > 0) {
        results.load.forEach(loader);
        results = analyse(ids);
      }
      return render(ids);
    };

    var write = function (regulator, ids, target) {
      var header = metalator.render(ids);
{'fraction_non_alphanumeric': 0.14034634272421814, 'fraction_numerical': 0.0005169294391315585, 'mean_word_length': 2.5407136322049406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2451744', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1129, 'n_words': 296}