google-closure-compiler
Advanced tools
Comparing version 20151125.0.0 to 20151125.1.0
@@ -32,2 +32,7 @@ /* | ||
var through = require('through2'); | ||
var gulpCompilerOptions = { | ||
streamMode: 'IN', | ||
logger: grunt.log, | ||
pluginName: 'grunt-google-closure-compiler' | ||
}; | ||
@@ -40,4 +45,11 @@ /** | ||
function compilationPromise(files, options) { | ||
var hadError = false; | ||
function logFile(cb) { | ||
grunt.log.ok(chalk.cyan(options.js_output_file || 'file') + ' created.'); | ||
if (!hadError) { | ||
if (options.js_output_file) { | ||
grunt.log.ok(chalk.cyan(options.js_output_file) + ' created.'); | ||
} else { | ||
grunt.log.ok('Compilation succeeded.'); | ||
} | ||
} | ||
cb(); | ||
@@ -52,13 +64,18 @@ } | ||
stream = vinylfs.src(files, {base: process.cwd()}) | ||
.pipe(gulpCompiler(options, {streamMode: 'IN'})) | ||
.pipe(loggingStream); | ||
.pipe(gulpCompiler(options, gulpCompilerOptions)) | ||
} else { | ||
stream = gulpCompiler(options, {streamMode: 'IN'}); | ||
stream = gulpCompiler(options, gulpCompilerOptions); | ||
stream.end(); | ||
stream.pipe(loggingStream); | ||
} | ||
stream.on('error', function(err) { | ||
hadError = true; | ||
reject(err); | ||
}); | ||
stream.on('end', function(err) { | ||
resolve(); | ||
}); | ||
stream.pipe(loggingStream); | ||
stream.resume(); //logging stream doesn't output files, so we have to manually resume; | ||
}); | ||
@@ -126,3 +143,3 @@ } | ||
}, function (err) { | ||
grunt.fail.warn('Compilation failed: ' + err.message); | ||
grunt.fail.warn('Compilation error'); | ||
asyncDone(); | ||
@@ -129,0 +146,0 @@ }); |
@@ -49,2 +49,4 @@ /* | ||
var streamMode = pluginOptions.streamMode || 'BOTH'; | ||
var log = pluginOptions.logger || gutil.log; | ||
var pluginName = pluginOptions.pluginName || PLUGIN_NAME; | ||
@@ -61,3 +63,3 @@ var fileList = []; | ||
if (file.isStream()) { | ||
this.emit('error', new PluginError(PLUGIN_NAME, 'Streaming not supported')); | ||
this.emit('error', new PluginError(pluginName, 'Streaming not supported')); | ||
cb(); | ||
@@ -73,3 +75,3 @@ return; | ||
function endStream(cb) { | ||
var stdInData, logger = gutil.log.warn ? gutil.log.warn : gutil.log; | ||
var stdInData, logger = log.warn ? log.warn : log; | ||
if (fileList.length > 0) { | ||
@@ -100,3 +102,3 @@ stdInData = filesToJson(fileList); | ||
if (code !== 0) { | ||
gulpStream.emit('error', new PluginError(PLUGIN_NAME, | ||
gulpStream.emit('error', new PluginError(pluginName, | ||
'Compilation error: \n\n' + compiler.prependFullCommand(stdErrData))); | ||
@@ -107,3 +109,3 @@ } | ||
if (stdErrData.trim().length > 0) { | ||
logger(gutil.colors.yellow(PLUGIN_NAME) + ': ' + stdErrData); | ||
logger(gutil.colors.yellow(pluginName) + ': ' + stdErrData); | ||
} | ||
@@ -118,3 +120,3 @@ | ||
} catch (e) { | ||
this.emit('error', new PluginError(PLUGIN_NAME, 'Error parsing json encoded files')); | ||
this.emit('error', new PluginError(pluginName, 'Error parsing json encoded files')); | ||
cb(); | ||
@@ -132,3 +134,3 @@ return; | ||
compiler_process.on('error', function (err) { | ||
gulpStream.emit('error', new PluginError(PLUGIN_NAME, | ||
gulpStream.emit('error', new PluginError(pluginName, | ||
'Process spawn error. Is java in the path?\n' + err.message)); | ||
@@ -146,3 +148,3 @@ cb(); | ||
compiler_process.stdin.on('error', function(err) { | ||
gulpStream.emit('Error', new PluginError(PLUGIN_NAME, | ||
gulpStream.emit('Error', new PluginError(pluginName, | ||
'Error writing to stdin of the compiler.\n' + err.message)); | ||
@@ -149,0 +151,0 @@ cb(); |
{ | ||
"name": "google-closure-compiler", | ||
"version": "20151125.0.0", | ||
"version": "20151125.1.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
10430155
155886