google-closure-compiler
Advanced tools
Comparing version 20151128.2.0 to 20151128.3.0
@@ -18,3 +18,6 @@ /* | ||
/** | ||
* @fileoverview Grunt task for closure-compiler | ||
* @fileoverview Grunt task for closure-compiler. | ||
* The task is simply a grunt wrapper for the gulp plugin. The gulp plugin | ||
* is used to stream multiple input files in via stdin as this alleviates | ||
* problems with the windows command shell and command length limitations. | ||
* | ||
@@ -47,2 +50,3 @@ * @author Chad Killingsworth (chadkillingsworth@gmail.com) | ||
function logFile(cb) { | ||
// If an error was encoutered, it will have already been logged | ||
if (!hadError) { | ||
@@ -63,5 +67,11 @@ if (options.js_output_file) { | ||
if (files) { | ||
// Source files were provided by grunt. Read these | ||
// in to a stream of vinyl files and pipe them through | ||
// the compiler task | ||
stream = vinylfs.src(files, {base: process.cwd()}) | ||
.pipe(gulpCompiler(options, gulpCompilerOptions)) | ||
} else { | ||
// No source files were provided. Assume the options specify | ||
// --js flags and invoke the compiler without any grunt inputs. | ||
// Manually end the stream to force compilation to begin. | ||
stream = gulpCompiler(options, gulpCompilerOptions); | ||
@@ -104,2 +114,3 @@ stream.end(); | ||
// Invoke the compiler once for each set of source files | ||
taskObject.files.forEach(function (f) { | ||
@@ -138,2 +149,4 @@ var options = getCompilerOptions(); | ||
// Multiple invocations of the compiler can occur for a single task target. Wait until | ||
// they are all completed before calling the "done" method. | ||
Promise.all(compileTasks).then(function () { | ||
@@ -140,0 +153,0 @@ asyncDone(); |
@@ -54,2 +54,3 @@ /* | ||
// Buffer the files into an array | ||
function bufferContents(file, enc, cb) { | ||
@@ -76,2 +77,3 @@ // ignore empty files | ||
if (fileList.length > 0) { | ||
// Input files are present. Convert them to a JSON encoded string | ||
stdInData = filesToJson(fileList); | ||
@@ -87,7 +89,11 @@ } else { | ||
// Add the gulp-specific argument so the compiler will understand the JSON encoded input | ||
// for gulp, the stream mode will be 'BOTH', but when invoked from grunt, we only use | ||
// a stream mode of 'IN' | ||
compiler.command_arguments.push('--json_streams', streamMode); | ||
var compiler_process = compiler.run(); | ||
var gulpStream = this; | ||
var stdOutData = '', stdErrData = ''; | ||
compiler_process.stdout.on('data', function (data) { | ||
@@ -111,3 +117,3 @@ stdOutData += data; | ||
// Standard output will be a string of JSON encoded files. | ||
// If present, standard output will be a string of JSON encoded files. | ||
// Convert these back to vinyl | ||
@@ -137,9 +143,2 @@ if (stdOutData.trim().length > 0) { | ||
if (fileList.length === 0) { | ||
stdInData = "[]"; | ||
} | ||
var CHUNK_SIZE = 1024, i = 0; | ||
var num_chunks = Math.ceil(stdInData.length / CHUNK_SIZE); | ||
compiler_process.stdin.on('error', function(err) { | ||
@@ -151,2 +150,5 @@ gulpStream.emit('Error', new PluginError(pluginName, | ||
var CHUNK_SIZE = 1024, i = 0; | ||
var num_chunks = Math.ceil(stdInData.length / CHUNK_SIZE); | ||
// Write the data to the stdin stream | ||
@@ -178,2 +180,2 @@ // Be attentive to back-pressure. | ||
}; | ||
} | ||
}; |
{ | ||
"name": "google-closure-compiler", | ||
"version": "20151128.2.0", | ||
"version": "20151128.3.0", | ||
"description": "Check, compile, optimize and compress Javascript with Closure-Compiler", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10423667
155661