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

var Compilation = require("./Compilation");
var Parser = require("./Parser");
var Resolver = require("enhanced-resolve/lib/Resolver");

var NormalModuleFactory = require("./NormalModuleFactory");
var ContextModuleFactory = require("./ContextModuleFactory");

function Watching(compiler, watchOptions, handler) {
	this.startTime = null;
	this.invalid = false;
	this.error = null;
	this.stats = null;
	this.handler = handler;
	if(typeof watchOptions === "number") {
		this.watchOptions = {
			aggregateTimeout: watchOptions
		};
	} else if(watchOptions && typeof watchOptions === "object") {
		this.watchOptions = Object.create(watchOptions);
	} else {
		this.watchOptions = {};
	}
	this.watchOptions.aggregateTimeout = this.watchOptions.aggregateTimeout || 200;
	this.compiler = compiler;
	this.running = true;
	this.compiler.readRecords(function(err) {
		if(err) return this._done(err);

		this._go();
	}.bind(this));
}

Watching.prototype._go = function() {
	this.startTime = new Date().getTime();
	this.running = true;
	this.invalid = false;
	this.compiler.applyPluginsAsync("watch-run", this, function(err) {
		if(err) return this._done(err);
		this.compiler.compile(function onCompiled(err, compilation) {
			if(err) return this._done(err);
			if(this.invalid) return this._done();

			if(this.compiler.applyPluginsBailResult("should-emit", compilation) === false) {
				return this._done(null, compilation);
			}<commit_msg>Copy watchOptions properly in Compiler.js<commit_after>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tob<NAME> @sokra
*/
var path = require("path");
var assign = require("object-assign");
var Tapable = require("tapable");

var Compilation = require("./Compilation");
var Parser = require("./Parser");
var Resolver = require("enhanced-resolve/lib/Resolver");

var NormalModuleFactory = require("./NormalModuleFactory");
var ContextModuleFactory = require("./ContextModuleFactory");

function Watching(compiler, watchOptions, handler) {
	this.startTime = null;
	this.invalid = false;
	this.error = null;
	this.stats = null;
	this.handler = handler;
	if(typeof watchOptions === "number") {
		this.watchOptions = {
			aggregateTimeout: watchOptions
		};
	} else if(watchOptions && typeof watchOptions === "object") {
		this.watchOptions = assign({}, watchOptions);
	} else {
		this.watchOptions = {};
	}
	this.watchOptions.aggregateTimeout = this.watchOptions.aggregateTimeout || 200;
	this.compiler = compiler;
	this.running = true;
	this.compiler.readRecords(function(err) {
		if(err) return this._done(err);

		this._go();
	}.bind(this));
}

Watching.prototype._go = function() {
	this.startTime = new Date().getTime();
	this.running = true;
	this.invalid = false;
	this.compiler.applyPluginsAsync("watch-run", this, function(err) {
		if(err) return this._done(err);
		this.compiler.compile(function onCompiled(err, compilation) {
			if(err) return this._done(err);
			if(this.invalid) return this._done();

			if(this.compiler.applyPluginsBailResult("should-emit", compilation) === false) {
				return this._done(null, compilation);
			}
{'fraction_non_alphanumeric': 0.15313935681470137, 'fraction_numerical': 0.0018376722817764165, 'mean_word_length': 5.036968576709796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1495574', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1007, 'n_words': 208}