Merge branch 'master' of github.com:bestiejs/lodash

Former-commit-id: f3bd8611110e0656b448fd5e7bd6fb88dc7a7213
This commit is contained in:
John-David Dalton
2013-05-20 22:58:22 -07:00

View File

@@ -60,15 +60,30 @@
}());
/**
* Java command-line options used for faster minification.
* Retrieves the Java command-line options used for faster minification by
* the Closure Compiler, invoking the `callback` when finished. Subsequent
* invocations will lazily return the original options. The callback is
* invoked with one argument: `(javaOptions)`.
*
* See https://code.google.com/p/closure-compiler/wiki/FAQ#What_are_the_recommended_Java_VM_command-line_options?.
*
* @param {Function} callback The function called once the options have
* been retrieved.
*/
function getJavaOptions(callback) {
var javaOptions = [];
cp.exec('java -version -client -d32', function(error) {
if (!error && process.platform != 'win32') {
javaOptions.push('-client', '-d32');
}
getJavaOptions = function getJavaOptions(callback) {
process.nextTick(function () {
callback(javaOptions);
});
};
callback(javaOptions);
});
}
/** The Closure Compiler optimization modes */
var optimizationModes = {
@@ -386,6 +401,8 @@
if (isMapped) {
options.push('--create_source_map=' + mapPath, '--source_map_format=V3');
}
getJavaOptions(function onJavaOptions(javaOptions) {
var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options));
if (!this.isSilent) {
console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...');
@@ -437,6 +454,7 @@
// proxy the standard input to the Closure Compiler
compiler.stdin.end(source);
}.bind(this));
}
/**