@@ -80,7 +80,6 @@ class BroccoliTypeScriptCompiler extends Plugin {
80
80
fse . mkdirsSync ( path . dirname ( outputFilePath ) ) ;
81
81
fs . linkSync ( absoluteFilePath , outputFilePath ) ;
82
82
} ) ;
83
- return ;
84
83
} else {
85
84
this . _fileRegistry [ tsFilePath ] . version = entry . mtime ;
86
85
pathsToEmit . push ( tsFilePath ) ;
@@ -94,7 +93,7 @@ class BroccoliTypeScriptCompiler extends Plugin {
94
93
pathsToEmit . forEach ( tsFilePath => {
95
94
var output = this . _tsService . getEmitOutput ( tsFilePath ) ;
96
95
if ( output . emitSkipped ) {
97
- var errorFound = this . collectErrors ( tsFilePath ) ;
96
+ var errorFound = this . _collectErrors ( tsFilePath ) ;
98
97
if ( errorFound ) {
99
98
pathsWithErrors . push ( tsFilePath ) ;
100
99
errorMessages . push ( errorFound ) ;
@@ -129,7 +128,7 @@ class BroccoliTypeScriptCompiler extends Plugin {
129
128
this . _tsService = ts . createLanguageService ( this . _tsServiceHost , ts . createDocumentRegistry ( ) ) ;
130
129
}
131
130
132
- collectErrors ( tsFilePath ) {
131
+ _collectErrors ( tsFilePath ) {
133
132
var allDiagnostics = this . _tsService . getCompilerOptionsDiagnostics ( )
134
133
. concat ( this . _tsService . getSyntacticDiagnostics ( tsFilePath ) )
135
134
. concat ( this . _tsService . getSemanticDiagnostics ( tsFilePath ) ) ;
@@ -156,7 +155,7 @@ class BroccoliTypeScriptCompiler extends Plugin {
156
155
157
156
// Find the entry, update the registry.
158
157
let allEntries = this . listEntries ( ) ;
159
- allEntries . forEach ( entry => this . _addNewFileEntry ( entry ) ) ;
158
+ allEntries . forEach ( entry => this . _addNewFileEntry ( entry , false ) ) ;
160
159
161
160
allFiles . forEach ( sourceFile => {
162
161
const registry = this . _fileRegistry [ path . resolve ( this . inputPaths [ 0 ] , sourceFile . fileName ) ] ;
@@ -166,19 +165,19 @@ class BroccoliTypeScriptCompiler extends Plugin {
166
165
167
166
if ( emitResult . emitSkipped ) {
168
167
var allDiagnostics = ts . getPreEmitDiagnostics ( program ) . concat ( emitResult . diagnostics ) ;
169
- var errorMessages_1 = [ ] ;
168
+ var errorMessages = [ ] ;
170
169
allDiagnostics . forEach ( function ( diagnostic ) {
171
170
var pos = '' ;
172
171
if ( diagnostic . file ) {
173
172
var _a = diagnostic . file . getLineAndCharacterOfPosition ( diagnostic . start ) , line = _a . line , character = _a . character ;
174
173
pos = diagnostic . file . fileName + ' (' + ( line + 1 ) + ', ' + ( character + 1 ) + '): ' ;
175
174
}
176
175
var message = ts . flattenDiagnosticMessageText ( diagnostic . messageText , '\n' ) ;
177
- errorMessages_1 . push ( ' ' + pos + message ) ;
176
+ errorMessages . push ( ' ' + pos + message ) ;
178
177
} ) ;
179
- if ( errorMessages_1 . length ) {
178
+ if ( errorMessages . length ) {
180
179
this . previousRunFailed = true ;
181
- var error = new Error ( 'Typescript found the following errors:\n' + errorMessages_1 . join ( '\n' ) ) ;
180
+ var error = new Error ( 'Typescript found the following errors:\n' + errorMessages . join ( '\n' ) ) ;
182
181
error [ 'showStack' ] = false ;
183
182
throw error ;
184
183
} else {
@@ -206,10 +205,14 @@ class BroccoliTypeScriptCompiler extends Plugin {
206
205
fs . linkSync ( absoluteFilePath , outputFilePath ) ;
207
206
}
208
207
209
- _addNewFileEntry ( entry ) {
208
+ _addNewFileEntry ( entry , checkDuplicates /* = true */ ) {
209
+ if ( checkDuplicates === undefined ) {
210
+ checkDuplicates = true ;
211
+ }
212
+
210
213
const p = path . join ( this . inputPaths [ 0 ] , entry . relativePath ) ;
211
- if ( this . _fileRegistry [ p ] ) {
212
- throw new Error ( ' Trying to add a new entry to an already existing one: ' + p ) ;
214
+ if ( checkDuplicates && this . _fileRegistry [ p ] ) {
215
+ throw ` Trying to add a new entry to an already existing one: " ${ p } ` ;
213
216
}
214
217
215
218
this . _fileRegistry [ p ] = {
0 commit comments