<commit_before>let fs = require('fs');

module.exports = WatchTimestampsPlugin;

function WatchTimestampsPlugin(patterns) {
	this.patterns = patterns;
}

WatchTimestampsPlugin.prototype.apply = function (compiler) {
	compiler.plugin('watch-run', (watch, callback) => {
		let patterns = this.patterns;
		let timestamps = watch.fileTimestamps || watch.compiler.fileTimestamps;

		Object.keys(timestamps).forEach( filepath => {
			if (patterns.some( pat => pat instanceof RegExp ? pat.test(filepath) : filepath.indexOf(pat)===0 )) {
				let time = fs.statSync(filepath).mtime;
				if (timestamps instanceof Map) timestamps.set(filepath, time);
				else timestamps[filepath] = time;
			}
		});
		callback();
	});
};<commit_msg>Use classes for webpack plugins.<commit_after>const fs = require('fs');

module.exports = class WatchTimestampsPlugin {
	constructor(patterns) {
		this.patterns = patterns;
	}

	apply(compiler) {
		compiler.plugin('watch-run', (watch, callback) => {
			let patterns = this.patterns;
			let timestamps = watch.fileTimestamps || watch.compiler.fileTimestamps;

			Object.keys(timestamps).forEach(filepath => {
				if (patterns.some(pat => pat instanceof RegExp ? pat.test(filepath) : filepath.indexOf(pat) === 0)) {
					let time = fs.statSync(filepath).mtime;
					if (timestamps instanceof Map) timestamps.set(filepath, time);
					else timestamps[filepath] = time;
				}
			});
			callback();
		});
	}
};
{'fraction_non_alphanumeric': 0.14355742296918766, 'fraction_numerical': 0.0014005602240896359, 'mean_word_length': 4.4541984732824424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1535934', 'n_tokens_mistral': 517, 'n_tokens_neox': 463, 'n_words': 91}