<commit_before>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
var RawSource = require("webpack-sources").RawSource;
var ModuleFilenameHelpers = require("./ModuleFilenameHelpers");

function EvalDevToolModuleTemplatePlugin(sourceUrlComment, moduleFilenameTemplate) {
	this.sourceUrlComment = sourceUrlComment || "\n//# sourceURL=[url]";
	this.moduleFilenameTemplate = moduleFilenameTemplate || "webpack:///[resourcePath]?[loaders]";
}
module.exports = EvalDevToolModuleTemplatePlugin;

EvalDevToolModuleTemplatePlugin.prototype.apply = function(moduleTemplate) {
	var self = this;
	moduleTemplate.plugin("module", function(source, module) {
		var content = source.source();
		var str = ModuleFilenameHelpers.createFilename(module, self.moduleFilenameTemplate, this.requestShortener);
		var footer = ["\n",
			ModuleFilenameHelpers.createFooter(module, this.requestShortener),
			self.sourceUrlComment.replace(/\[url\]/g, encodeURI(str).replace(/%2F/g, "/").replace(/%20/g, "_").replace(/%5E/g, "^").replace(/%5C/g, "\\").replace(/^\//, ""))
		].join("\n");
		return new RawSource("eval(" + JSON.stringify(content + footer) + ");");
	});
	moduleTemplate.plugin("hash", function(hash) {
		hash.update("EvalDevToolModuleTemplatePlugin");
		hash.update("2");
	});
};
<commit_msg>refactor(EvalDevToolModuleTemplatePlugin): upgrade to ES6<commit_after>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
"use strict";

const RawSource = require("webpack-sources").RawSource;
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");

class EvalDevToolModuleTemplatePlugin {
	constructor(sourceUrlComment, moduleFilenameTemplate) {
		this.sourceUrlComment = sourceUrlComment || "\n//# sourceURL=[url]";
		this.moduleFilenameTemplate = moduleFilenameTemplate || "webpack:///[resourcePath]?[loaders]";
	}

	apply(moduleTemplate) {
		const self = this;
		moduleTemplate.plugin("module", function(source, module) {
			const content = source.source();
			const str = ModuleFilenameHelpers.createFilename(module, self.moduleFilenameTemplate, this.requestShortener);
			const footer = ["\n",
				ModuleFilenameHelpers.createFooter(module, this.requestShortener),
				self.sourceUrlComment.replace(/\[url\]/g, encodeURI(str).replace(/%2F/g, "/").replace(/%20/g, "_").replace(/%5E/g, "^").replace(/%5C/g, "\\").replace(/^\//, ""))
			].join("\n");
			return new RawSource(`eval(${JSON.stringify(content + footer)});`);
		});
		moduleTemplate.plugin("hash", hash => {
			hash.update("EvalDevToolModuleTemplatePlugin");
			hash.update("2");
		});
	}
}

module.exports = EvalDevToolModuleTemplatePlugin;

{'fraction_non_alphanumeric': 0.17444901008591707, 'fraction_numerical': 0.004856182293612252, 'mean_word_length': 5.831632653061225, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2634150', 'n_tokens_mistral': 850, 'n_tokens_neox': 805, 'n_words': 128}