This repository was archived by the owner on Jun 5, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 */
2222( function ( global ) {
2323
24- if ( ( typeof window != 'undefined' && ! ! window . window ) || typeof require != 'function' ) {
24+ if ( typeof require != 'function' || ! module || ! module . exports || ! process ) {
2525 throw ( new Error ( "ClosureCompiler.js can only be used within node.js" ) ) ;
2626 }
2727
175175 files = [ files ] ;
176176 }
177177 for ( i = 0 ; i < files . length ; i ++ ) {
178- if ( typeof files [ i ] != 'string' || files [ i ] . indexOf ( '"' ) >= 0 ) {
178+ if ( typeof files [ i ] != 'string' ) {
179179 throw ( new Error ( "Illegal source file: " + files [ i ] ) ) ;
180180 }
181- stat = fs . statSync ( files [ i ] ) ;
182- if ( ! stat . isFile ( ) ) {
183- throw ( new Error ( "Source file not found: " + files [ i ] ) ) ;
181+ if ( files [ i ] . indexOf ( '"' ) >= 0 ) {
182+ args . push ( '--js=' + files [ i ] ) ;
183+ } else {
184+ stat = fs . statSync ( files [ i ] ) ;
185+ if ( ! stat . isFile ( ) ) {
186+ throw ( new Error ( "Source file not found: " + files [ i ] ) ) ;
187+ }
188+ args . push ( '--js' , files [ i ] ) ;
184189 }
185- args . push ( '--js' , files [ i ] ) ;
186190 }
187191
188192 // Externs files
265269 }
266270 callback ( err , stdout , stderr ) ;
267271 } ) ;
272+ process . on ( 'error' , function ( err ) {
273+ callback ( err , stdout , stderr ) ;
274+ } ) ;
268275 }
269276
270277 // Run it
You can’t perform that action at this time.
0 commit comments