@@ -205,8 +205,7 @@ class BroccoliTypeScriptCompiler extends Plugin {
205
205
}
206
206
207
207
fse . mkdirsSync ( path . dirname ( absoluteFilePath ) ) ;
208
- const content = this . fixSourceMapSources ( fileContent , inputFilePath ) ;
209
- fs . writeFileSync ( absoluteFilePath , content , FS_OPTS ) ;
208
+ fs . writeFileSync ( absoluteFilePath , fileContent , FS_OPTS ) ;
210
209
211
210
fse . mkdirsSync ( path . dirname ( outputFilePath ) ) ;
212
211
try {
@@ -232,52 +231,6 @@ class BroccoliTypeScriptCompiler extends Plugin {
232
231
outputs : new Set ( )
233
232
} ;
234
233
}
235
-
236
- /**
237
- * There is a bug in TypeScript 1.6, where the sourceRoot and inlineSourceMap properties
238
- * are exclusive. This means that the sources property always contains relative paths
239
- * (e.g, ../../../../@angular/di/injector.ts).
240
- *
241
- * Here, we normalize the sources property and remove the ../../../
242
- *
243
- * This issue is fixed in https://github.com/Microsoft/TypeScript/pull/5620.
244
- * Once we switch to TypeScript 1.8, we can remove this method.
245
- */
246
- fixSourceMapSources ( content , inputFilePath ) {
247
- try {
248
- const marker = '//# sourceMappingURL=data:application/json;base64,' ;
249
-
250
- let index = content . indexOf ( marker ) ;
251
- if ( index == - 1 ) {
252
- const pathMarker = '//# sourceMappingURL=' ;
253
- index = content . indexOf ( pathMarker ) ;
254
- if ( index == - 1 ) {
255
- return content ;
256
- }
257
-
258
- // We have a regular path, make it relative to the input path.
259
- let base = content . substring ( 0 , index + pathMarker . length ) ;
260
- let mapPath = content . substring ( index + pathMarker . length ) ;
261
- if ( mapPath . startsWith ( this . outputPath ) ) {
262
- mapPath = mapPath . replace ( this . outputPath , this . inputPaths [ 0 ] ) ;
263
- } else if ( ! mapPath . startsWith ( this . inputPaths [ 0 ] ) ) {
264
- mapPath = path . join ( this . inputPaths [ 0 ] , path . dirname ( this . _tsConfigPath ) , mapPath ) ;
265
- }
266
-
267
- mapPath = path . relative ( path . dirname ( inputFilePath ) , mapPath ) ;
268
- return '' + base + mapPath ;
269
- }
270
-
271
- var base = content . substring ( 0 , index + marker . length ) ;
272
- var sourceMapBit = new Buffer ( content . substring ( index + marker . length ) , 'base64' ) . toString ( 'utf8' ) ;
273
- var sourceMaps = JSON . parse ( sourceMapBit ) ;
274
- var source = sourceMaps . sources [ 0 ] ;
275
- sourceMaps . sources = [ source . substring ( source . lastIndexOf ( '../' ) + 3 ) ] ;
276
- return '' + base + new Buffer ( JSON . stringify ( sourceMaps ) ) . toString ( 'base64' ) ;
277
- } catch ( e ) {
278
- return content ;
279
- }
280
- }
281
234
}
282
235
283
236
class CustomLanguageServiceHost {
0 commit comments