<commit_before>var version = function() { return '(loading)'; }
var compileJSON = function() { return ''; }
addEventListener('message', function(e) {
	var data = e.data;
	var missingInputs = [];
	switch (data.cmd) {
		case 'loadVersion':
			delete Module;
			version = null;
			compileJSON = null;

			importScripts(data.data);
			version = Module.cwrap("version", "string", []);
			if ('_compileJSONCallback' in Module)
			{
				compileJSONInternal = Module.cwrap("compileJSONCallback", "string", ["string", "number", "number"]);
				var missingInputCallback = Module.Runtime.addFunction(function(path) {
					missingInputs.push(Module.Pointer_stringify(path));
				});
				compileJSON = function(input, optimize) {
					return compileJSONInternal(input, optimize, missingInputCallback);
				};
			}
			else if ('_compileJSONMulti' in Module)
				compileJSON = Module.cwrap("compileJSONMulti", "string", ["string", "number"]);
			else
				compileJSON = Module.cwrap("compileJSON", "string", ["string", "number"]);
			postMessage({
				cmd: 'versionLoaded',
				data: version(),
				acceptsMultipleFiles: ('_compileJSONMulti' in Module)
			});
			break;
		case 'compile':
			missingInputs
			postMessage({cmd: 'compiled', data: compileJSON(data.source, data.optimize)}, missingInputs: missingInputs);
			break;
	}
}, false);<commit_msg>Fix worker implementation.<commit_after>var version = function() { return '(loading)'; }
var compileJSON = function() { return ''; }
var missingInputs = [];
addEventListener('message', function(e) {
	var data = e.data;
	switch (data.cmd) {
		case 'loadVersion':
			delete Module;
			version = null;
			compileJSON = null;

			importScripts(data.data);
			version = Module.cwrap("version", "string", []);
			if ('_compileJSONCallback' in Module)
			{
				compileJSONInternal = Module.cwrap("compileJSONCallback", "string", ["string", "number", "number"]);
				var missingInputCallback = Module.Runtime.addFunction(function(path) {
					missingInputs.push(Module.Pointer_stringify(path));
				});
				compileJSON = function(input, optimize) {
					return compileJSONInternal(input, optimize, missingInputCallback);
				};
			}
			else if ('_compileJSONMulti' in Module)
				compileJSON = Module.cwrap("compileJSONMulti", "string", ["string", "number"]);
			else
				compileJSON = Module.cwrap("compileJSON", "string", ["string", "number"]);
			postMessage({
				cmd: 'versionLoaded',
				data: version(),
				acceptsMultipleFiles: ('_compileJSONMulti' in Module)
			});
			break;
		case 'compile':
                        missingInputs.length = 0;
			postMessage({cmd: 'compiled', data: compileJSON(data.source, data.optimize)}, missingInputs: missingInputs);
			break;
	}
}, false);
{'fraction_non_alphanumeric': 0.15237394184762607, 'fraction_numerical': 0.000368052999631947, 'mean_word_length': 4.403578528827038, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4382434', 'n_tokens_mistral': 933, 'n_tokens_neox': 790, 'n_words': 180}