<commit_before>'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var applySourceMap = require('vinyl-sourcemaps-apply');
var objectAssign = require('object-assign');
var traceur = require('traceur');

module.exports = function (opts) {
	return through.obj(function (file, enc, cb) {
		if (file.isNull()) {
			cb(null, file);
			return;
		}

		if (file.isStream()) {
			cb(new gutil.PluginError('gulp-traceur', 'Streaming not supported'));
			return;
		}

		opts = objectAssign({
			modules: 'commonjs',
			inputSourceMap: file.sourceMap
		}, opts);

		try {
			var compiler = new traceur.NodeCompiler(opts);
			var ret = compiler.compile(file.contents.toString(), file.relative, file.relative, file.base);
			var sourceMap = file.sourceMap && compiler.getSourceMap();

			if (ret) {
				file.contents = new Buffer(ret);
			}

			if (sourceMap) {
				applySourceMap(file, sourceMap);
			}

			this.push(file);
		} catch (errs) {
			this.emit('error', new gutil.PluginError('gulp-traceur', errs.join('\n'), {
				fileName: file.path,
				showStack: false
			}));
		}

		cb();
	});
};

module.exports.RUNTIME_PATH = traceur.RUNTIME_PATH;
<commit_msg>Fix issue #67: errs.join is not a function.<commit_after>'use strict';
var gutil = require('gulp-util');
var through = require('through2');
var applySourceMap = require('vinyl-sourcemaps-apply');
var objectAssign = require('object-assign');
var traceur = require('traceur');

module.exports = function (opts) {
	return through.obj(function (file, enc, cb) {
		if (file.isNull()) {
			cb(null, file);
			return;
		}

		if (file.isStream()) {
			cb(new gutil.PluginError('gulp-traceur', 'Streaming not supported'));
			return;
		}

		opts = objectAssign({
			modules: 'commonjs',
			inputSourceMap: file.sourceMap
		}, opts);

		try {
			var compiler = new traceur.NodeCompiler(opts);
			var ret = compiler.compile(file.contents.toString(), file.relative, file.relative, file.base);
			var sourceMap = file.sourceMap && compiler.getSourceMap();

			if (ret) {
				file.contents = new Buffer(ret);
			}

			if (sourceMap) {
				applySourceMap(file, sourceMap);
			}

			this.push(file);
		} catch (e) {
			var message = Array.isArray(e) ? e.join('\n') : e.message;
			this.emit('error', new gutil.PluginError('gulp-traceur', message, {
				fileName: file.path,
				showStack: false
			}));
		}

		cb();
	});
};

module.exports.RUNTIME_PATH = traceur.RUNTIME_PATH;

{'fraction_non_alphanumeric': 0.16222859483818108, 'fraction_numerical': 0.0016386726751331422, 'mean_word_length': 3.8356435643564355, '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': '6655609', 'n_tokens_mistral': 939, 'n_tokens_neox': 816, 'n_words': 178}