<commit_before>/* jshint node: true */
'use strict';

var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var path = require('path');
var rename = require('broccoli-stew').rename;
var esTranspiler = require('broccoli-babel-transpiler');
const concat = require('broccoli-concat');
var packageDependencies = require("./package.json")['dependencies'];
var Filter = require('broccoli-filter');

function UMDToAMDRewriteFilter(inputNode, packageName, options) {
  options = options || {};
  Filter.call(this, inputNode, {
    annotation: options.annotation || "Rewriting package: " + packageName,
  });
  this.packageName = packageName;
}

UMDToAMDRewriteFilter.prototype = Object.create(Filter.prototype);
UMDToAMDRewriteFilter.prototype.constructor = UMDToAMDRewriteFilter;

function createAMDHeader() {
  return "  // ember-cli-d3-primitive: Insert a fake AMD definition so that Ember's loader.js loads this UMD build.\n" +
         "  define.amd = true;";
}

UMDToAMDRewriteFilter.prototype.processString = function(content) {
  var lines = content.split(/\n/);
  var header = createAMDHeader();
  lines.splice(1, 0, header);
  lines.splice(5, 0, "  delete define.amd;");
  return lines.join("\n");
};

module.exports = {
  isDevelopingAddon: function(){<commit_msg>Document why we do this<commit_after>/* jshint node: true */
'use strict';

var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var path = require('path');
var rename = require('broccoli-stew').rename;
var esTranspiler = require('broccoli-babel-transpiler');
const concat = require('broccoli-concat');
var packageDependencies = require("./package.json")['dependencies'];
var Filter = require('broccoli-filter');

/**
 * A few things to note here:
 * 1. This is pretty much the worst.
 * 2. We should consider some more over engineered approaches, but this *works*.
 *
 * Why:
 * This filter exists simply to define a variable and then remove it to trick
 * loader.js in to loading this package.
 *
 * Ideally:
 * What we should be doing is just producing a correct package header so this isn't required.
 * However, to do that we would need to figure out what imports each package has,
 * then write the header. There might be another approach by providing a custom
 * module factory, but I haven't looked in to this.
 */

function UMDToAMDRewriteFilter(inputNode, packageName, options) {
  options = options || {};
  Filter.call(this, inputNode, {
    annotation: options.annotation || "Rewriting package: " + packageName,
  });
  this.packageName = packageName;
}

UMDToAMDRewriteFilter.prototype = Object.create(Filter.prototype);
UMDToAMDRewriteFilter.prototype.constructor = UMDToAMDRewriteFilter;

function createAMDHeader() {
  return "  // ember-cli-d3-primitive: Insert a fake AMD definition so that Ember's loader.js loads this UMD build.\n" +
         "  define.amd = true;";
}

UMDToAMDRewriteFilter.prototype.processString = function(content) {
  var lines = content.split(/\n/);
  var header = createAMDHeader();
  lines.splice(1, 0, header);
  lines.splice(5, 0, "  delete define.amd;");
  return lines.join("\n");
};

module.exports = {
  isDevelopingAddon: function(){
{'fraction_non_alphanumeric': 0.13011152416356878, 'fraction_numerical': 0.0037174721189591076, 'mean_word_length': 4.684859154929577, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '386456', 'n_tokens_mistral': 1018, 'n_tokens_neox': 975, 'n_words': 279}