<commit_before>import * as node from  "../../api/node";
import * as messages from "../../messages";
import * as util from  "../../util";

export default class PluginManager {
  static memoisedPlugins = [];

  static memoisePluginContainer(fn) {
    for (var i = 0; i < PluginManager.memoisedPlugins.length; i++) {
      var plugin = PluginManager.memoisedPlugins[i];
      if (plugin.container === fn) return plugin.transformer;
    }

    var transformer = fn(node);
    PluginManager.memoisedPlugins.push({
      container: fn,
      transformer: transformer
    });
    return transformer;
  }

  static positions = ["before", "after"];

  constructor({ file, transformers, before, after } = { transformers: {}, before: [], after: [] }) {
    this.transformers = transformers;
    this.file         = file;
    this.before       = before;
    this.after        = after;
  }

  subnormaliseString(name, position) {
    // this is a plugin in the form of "foobar" or "foobar:after"
    // where the optional colon is the delimiter for plugin position in the transformer stack

    var match = name.match(/^(.*?):(after|before)$/);
    if (match) [, name, position] = match;

    var loc = util.resolveRelative(name) || util.resolveRelative(`babel-plugin-${name}`);
    if (loc) {
      return {<commit_msg>Resolve 'babel-plugin-' name before the plain name<commit_after>import * as node from  "../../api/node";
import * as messages from "../../messages";
import * as util from  "../../util";

export default class PluginManager {
  static memoisedPlugins = [];

  static memoisePluginContainer(fn) {
    for (var i = 0; i < PluginManager.memoisedPlugins.length; i++) {
      var plugin = PluginManager.memoisedPlugins[i];
      if (plugin.container === fn) return plugin.transformer;
    }

    var transformer = fn(node);
    PluginManager.memoisedPlugins.push({
      container: fn,
      transformer: transformer
    });
    return transformer;
  }

  static positions = ["before", "after"];

  constructor({ file, transformers, before, after } = { transformers: {}, before: [], after: [] }) {
    this.transformers = transformers;
    this.file         = file;
    this.before       = before;
    this.after        = after;
  }

  subnormaliseString(name, position) {
    // this is a plugin in the form of "foobar" or "foobar:after"
    // where the optional colon is the delimiter for plugin position in the transformer stack

    var match = name.match(/^(.*?):(after|before)$/);
    if (match) [, name, position] = match;

    var loc = util.resolveRelative(`babel-plugin-${name}`) || util.resolveRelative(name);
    if (loc) {
      return {
{'fraction_non_alphanumeric': 0.14258770275367785, 'fraction_numerical': 0.0007544322897019992, 'mean_word_length': 2.9641255605381165, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5823551', 'n_tokens_mistral': 799, 'n_tokens_neox': 764, 'n_words': 226}