@@ -21,6 +21,7 @@ interface Dependency {
2121}
2222
2323interface Options {
24+ silent : boolean ;
2425 instance : string ;
2526 compiler : string ;
2627 configFileName : string ;
@@ -86,6 +87,12 @@ function findConfigFile(compiler: typeof typescript, searchPath: string, configF
8687
8788function ensureTypeScriptInstance ( options : Options , loader : any ) : TSInstance {
8889
90+ function log ( ...messages : string [ ] ) : void {
91+ if ( ! options . silent ) {
92+ console . log . apply ( console , messages ) ;
93+ }
94+ }
95+
8996 var compiler = require ( options . compiler ) ;
9097 var files = < TSFiles > { } ;
9198
@@ -100,7 +107,7 @@ function ensureTypeScriptInstance(options: Options, loader: any): TSInstance {
100107 var filesToLoad = [ ] ;
101108 var configFilePath = findConfigFile ( compiler , path . dirname ( loader . resourcePath ) , options . configFileName ) ;
102109 if ( configFilePath ) {
103- console . log ( 'Using config file at ' . green + configFilePath . blue ) ;
110+ log ( 'Using config file at ' . green + configFilePath . blue ) ;
104111 var configFile = compiler . readConfigFile ( configFilePath ) ;
105112 // TODO: when 1.5 stable comes out, this will never be undefined. Instead it will
106113 // have an 'error' property
@@ -166,7 +173,7 @@ function ensureTypeScriptInstance(options: Options, loader: any): TSInstance {
166173 getCompilationSettings : ( ) => compilerOptions ,
167174 getDefaultLibFileName : options => libFileName ,
168175 getNewLine : ( ) => { return os . EOL } ,
169- log : message => console . log ( message )
176+ log : log
170177 } ;
171178
172179 var languageService = compiler . createLanguageService ( servicesHost , compiler . createDocumentRegistry ( ) )
@@ -280,4 +287,4 @@ function loader(contents) {
280287 callback ( null , contents , sourceMap )
281288}
282289
283- export = loader ;
290+ export = loader ;
0 commit comments