<commit_before>var requirejs = require( 'requirejs' ),
	path = require( 'path' ),
	fs = require( 'fs' );

module.exports = function( grunt ) {
	var config = grunt.config.get( 'global' ),
		outputFile = path.join( config.dirs.output, config.names.root ),
		helpers = config.helpers;

	grunt.config.set( 'js', {
		require: {
			baseUrl: 'js',
			name: 'jquery.mobile',
			exclude:[
				'jquery',
				'../external/requirejs/order',
				'../external/requirejs/depend',
				'../external/requirejs/text',
				'../external/requirejs/text!../version.txt'
			],
			out: outputFile + '.compiled.js',
			pragmasOnSave: { jqmBuildExclude: true },
			wrap: { startFile: 'build/wrap.start', endFile: 'build/wrap.end' },
			findNestedDependencies: true,
			skipModuleInsertion: true,
			optimize: 'none'
		}
	});

	grunt.registerTask( 'js_without_deps', 'compile and minify the js', function() {
		var done = this.async(), require = grunt.config.get( 'js' ).require;

		helpers.asyncConfig(function( config ) {
			// pull the includes together using require js
			requirejs.optimize( require );

			// dump the versioned header into the normal js file
			grunt.file.write( outputFile + '.js',  config.ver.header );

			// add the compiled js to the normal js file, replace the version tag
			// with the contents from version.txt
			helpers.appendFrom( outputFile + '.js', require.out, function( fileContents ) {
				return fileContents.replace( /__version__/, '"' + config.ver.official + '"' );
			});

			helpers.minify({
				output: outputFile + '.min.js',
				input: outputFile + '.js',
				header: config.ver.min,
				minCallback: function( unminified ) {
					return grunt.helper( 'uglify', unminified, {});
				}
			});

			// remove the requirejs compile output
			fs.unlink( require.out );
			done();
		});
	});

	// NOTE custom dasks don't accept dependencies so we alias
	grunt.registerTask( 'js', 'custom_init js_without_deps' );
};<commit_msg>switch js to async config task<commit_after>var requirejs = require( 'requirejs' ),
	path = require( 'path' ),
	fs = require( 'fs' );

module.exports = function( grunt ) {
	var config = grunt.config.get( 'global' ),
		outputFile = path.join( config.dirs.output, config.names.root ),
		helpers = config.helpers;

	grunt.config.set( 'js', {
		require: {
			baseUrl: 'js',
			name: 'jquery.mobile',
			exclude:[
				'jquery',
				'../external/requirejs/order',
				'../external/requirejs/depend',
				'../external/requirejs/text',
				'../external/requirejs/text!../version.txt'
			],
			out: outputFile + '.compiled.js',
			pragmasOnSave: { jqmBuildExclude: true },
			wrap: { startFile: 'build/wrap.start', endFile: 'build/wrap.end' },
			findNestedDependencies: true,
			skipModuleInsertion: true,
			optimize: 'none'
		}
	});

	grunt.registerTask( 'js_without_deps', 'compile and minify the js', function() {
		var done = this.async(),
			require = grunt.config.get( 'js' ).require,
			global_config = grunt.config.get( 'global' );

		// pull the includes together using require js
		requirejs.optimize( require );

		// dump the versioned header into the normal js file
		grunt.file.write( outputFile + '.js',  global_config.ver.header );

		// add the compiled js to the normal js file, replace the version tag
		// with the contents from version.txt
		helpers.appendFrom( outputFile + '.js', require.out, function( fileContents ) {
			return fileContents.replace( /__version__/, '"' + global_config.ver.official + '"' );
		});

		helpers.minify({
			output: outputFile + '.min.js',
			input: outputFile + '.js',
			header: global_config.ver.min,
			minCallback: function( unminified ) {
				return grunt.helper( 'uglify', unminified, {});
			}
		});

		// remove the requirejs compile output
		fs.unlink( require.out );
		done();
	});

	// NOTE custom dasks don't accept dependencies so we alias
	grunt.registerTask( 'js', 'custom_init config:async js_without_deps' );
};
{'fraction_non_alphanumeric': 0.1544943820224719, 'fraction_numerical': 0.0, 'mean_word_length': 3.3912556053811658, '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': '2309387', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1271, 'n_words': 321}