@@ -128,11 +128,16 @@ var Project = (function () {
128128 line : endPos . line ,
129129 character : endPos . character
130130 } ;
131- err . message = gutil . colors . red ( filename + '(' + startPos . line + ',' + startPos . character + '): ' ) + info . code + ' ' + tsApi . flattenDiagnosticMessageText ( this . typescript , info . messageText ) ;
131+ err . message = gutil . colors . red ( filename + '(' + startPos . line + ',' + startPos . character + '): ' )
132+ + info . code + ' '
133+ + tsApi . flattenDiagnosticMessageText ( this . typescript , info . messageText ) ;
132134 return err ;
133135 } ;
134136 Project . prototype . lazyCompile = function ( jsStream , declStream ) {
135- if ( this . isFileChanged === false && Object . keys ( this . currentFiles ) . length === Object . keys ( this . previousFiles ) . length && this . previousOutputJS !== undefined && this . previousOutputDts !== undefined ) {
137+ if ( this . isFileChanged === false
138+ && Object . keys ( this . currentFiles ) . length === Object . keys ( this . previousFiles ) . length
139+ && this . previousOutputJS !== undefined
140+ && this . previousOutputDts !== undefined ) {
136141 // Emit files from previous build, since they are the same.
137142 // JavaScript files
138143 for ( var i = 0 ; i < this . previousOutputJS . length ; i ++ ) {
@@ -170,35 +175,7 @@ var Project = (function () {
170175 } ;
171176 Project . prototype . resolve = function ( session , file ) {
172177 var _this = this ;
173- var references = file . ts . referencedFiles . map ( function ( item ) {
174- return path . join ( path . dirname ( tsApi . getFileName ( file . ts ) ) , tsApi . getFileName ( item ) ) ;
175- } ) ;
176- this . typescript . forEachChild ( file . ts , function ( node ) {
177- if ( node . kind === _this . typescript . SyntaxKind . ImportDeclaration ) {
178- var importNode = node ;
179- if ( importNode . moduleReference === undefined || importNode . moduleReference . kind !== _this . typescript . SyntaxKind . ExternalModuleReference ) {
180- return ;
181- }
182- var reference = importNode . moduleReference ;
183- if ( reference . expression === undefined || reference . expression . kind !== _this . typescript . SyntaxKind . StringLiteral ) {
184- return ;
185- }
186- if ( typeof reference . text !== 'string' ) {
187- return ;
188- }
189- var ref = path . join ( path . dirname ( tsApi . getFileName ( file . ts ) ) , reference . text ) ;
190- // Don't know if this name is defined with `declare module 'foo'`, but let's load it to be sure.
191- // We guess what file the user wants. This will be right in most cases.
192- // The advantage of guessing is that we can now use fs.readFile (async) instead of fs.readFileSync.
193- // If we guessed wrong, the file will be loaded with fs.readFileSync in Host#getSourceFile (host.ts)
194- if ( ref . substr ( - 3 ) . toLowerCase ( ) === '.ts' ) {
195- references . push ( ref ) ;
196- }
197- else {
198- references . push ( ref + '.ts' ) ;
199- }
200- }
201- } ) ;
178+ var references = file . ts . referencedFiles . map ( function ( item ) { return path . join ( path . dirname ( tsApi . getFileName ( file . ts ) ) , tsApi . getFileName ( item ) ) ; } ) ;
202179 for ( var i = 0 ; i < references . length ; ++ i ) {
203180 ( function ( i ) {
204181 var ref = references [ i ] ;
@@ -347,9 +324,7 @@ var Project = (function () {
347324 oldFiles = Object . keys ( _this . currentFiles ) ;
348325 }
349326 else {
350- oldFiles = [
351- originalName
352- ] ;
327+ oldFiles = [ originalName ] ;
353328 }
354329 var generator = sourceMap . SourceMapGenerator . fromSourceMap ( new sourceMap . SourceMapConsumer ( parsedMap ) ) ;
355330 for ( var i = 0 ; i < oldFiles . length ; i ++ ) {
@@ -380,9 +355,7 @@ var Project = (function () {
380355 done [ originalName ] = true ;
381356 var inputFile = _this . currentFiles [ originalName ] ;
382357 var tsFile = _this . program . getSourceFile ( originalName ) ;
383- var references = tsFile . referencedFiles . map ( function ( file ) {
384- return tsApi . getFileName ( file ) ;
385- } ) ;
358+ var references = tsFile . referencedFiles . map ( function ( file ) { return tsApi . getFileName ( file ) ; } ) ;
386359 for ( var j = 0 ; j < outputJS . length ; ++ j ) {
387360 var other = outputJS [ j ] ;
388361 var otherName = _this . getOriginalName ( other . path ) ;
0 commit comments