<commit_before>var fs = require('fs')
var path = require('path')
var _ = require('underscore')
var mkdirp = require('mkdirp')
var CachingWriter = require('broccoli-glob-caching-writer')
var SourcemapConcat = require('fast-sourcemap-concat')

var Concat = function(inputTree, options) {
	if (!(this instanceof Concat)) return new Concat(inputTree, options)
	if (!options) options = {}
	if (options.dest === undefined) throw new Error('Option "dest" is required')
	options = _.defaults(options, {
		enabled: true,
		separator: '\n',
		mapDest: options.dest + '.map'
	})
	options.mapUrl = path.basename(options.mapDest)
	CachingWriter.apply(this, arguments)
}

Concat.prototype = Object.create(CachingWriter.prototype)
Concat.prototype.description = 'SourcemapConcat'

Concat.prototype.updateCache = function(srcDir, destDir, files) {
	if (!files.length) return
	if (this.options.enabled) this.concatWithMaps(srcDir, destDir, files)
	else this.simpleConcat(srcDir, destDir, files)
}

Concat.prototype.concatWithMaps = function(srcDir, destDir, files) {
	var sourcemap = new SourcemapConcat({
		outputFile: path.join(destDir, this.options.dest),
		mapFile: path.join(destDir, this.options.mapDest),
		mapURL: this.options.mapUrl,
		mapCommentType: this.options.mapCommentType,
		baseDir: srcDir
	})
	if (this.options.header) {<commit_msg>Fix returning promise in sourcemapConcatPlugin<commit_after>var fs = require('fs')
var path = require('path')
var _ = require('underscore')
var mkdirp = require('mkdirp')
var CachingWriter = require('broccoli-glob-caching-writer')
var SourcemapConcat = require('fast-sourcemap-concat')

var Concat = function(inputTree, options) {
	if (!(this instanceof Concat)) return new Concat(inputTree, options)
	if (!options) options = {}
	if (options.dest === undefined) throw new Error('Option "dest" is required')
	options = _.defaults(options, {
		enabled: true,
		separator: '\n',
		mapDest: options.dest + '.map'
	})
	options.mapUrl = path.basename(options.mapDest)
	CachingWriter.apply(this, arguments)
}

Concat.prototype = Object.create(CachingWriter.prototype)
Concat.prototype.description = 'SourcemapConcat'

Concat.prototype.updateCache = function(srcDir, destDir, files) {
	if (!files.length) return
	if (this.options.enabled) return this.concatWithMaps(srcDir, destDir, files)
	else this.simpleConcat(srcDir, destDir, files)
}

Concat.prototype.concatWithMaps = function(srcDir, destDir, files) {
	var sourcemap = new SourcemapConcat({
		outputFile: path.join(destDir, this.options.dest),
		mapFile: path.join(destDir, this.options.mapDest),
		mapURL: this.options.mapUrl,
		mapCommentType: this.options.mapCommentType,
		baseDir: srcDir
	})
	if (this.options.header) {
{'fraction_non_alphanumeric': 0.13367799113737075, 'fraction_numerical': 0.0, 'mean_word_length': 5.806532663316583, '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': '7541100', 'n_tokens_mistral': 900, 'n_tokens_neox': 875, 'n_words': 197}