@@ -12,8 +12,12 @@ var ProjectCompiler = (function () {
1212 }
1313 ProjectCompiler . prototype . prepare = function ( project ) {
1414 this . project = project ;
15+ this . hasSourceMap = false ;
16+ } ;
17+ ProjectCompiler . prototype . inputFile = function ( file ) {
18+ if ( file . gulp . sourceMap )
19+ this . hasSourceMap = true ;
1520 } ;
16- ProjectCompiler . prototype . inputFile = function ( file ) { } ;
1721 ProjectCompiler . prototype . inputDone = function ( ) {
1822 var _this = this ;
1923 if ( ! this . project . input . firstSourceFile ) {
@@ -27,6 +31,7 @@ var ProjectCompiler = (function () {
2731 . map ( function ( fileName ) { return _this . project . input . getFile ( fileName ) . gulp . base ; } ) ) ;
2832 }
2933 }
34+ this . project . options . sourceMap = this . hasSourceMap ;
3035 var currentDirectory = utils . getCommonBasePathOfArray ( rootFilenames . map ( function ( fileName ) { return _this . project . input . getFile ( fileName ) . gulp . cwd ; } ) ) ;
3136 this . host = new host_1 . Host ( this . project . typescript , currentDirectory , this . project . input , this . project . options ) ;
3237 this . program = this . project . typescript . createProgram ( rootFilenames , this . project . options , this . host , this . program ) ;
@@ -57,7 +62,6 @@ var ProjectCompiler = (function () {
5762 this . project . output . finish ( result ) ;
5863 } ;
5964 ProjectCompiler . prototype . emitFile = function ( result , currentDirectory , file ) {
60- var _this = this ;
6165 var jsFileName ;
6266 var dtsFileName ;
6367 var jsContent ;
@@ -69,7 +73,7 @@ var ProjectCompiler = (function () {
6973 case 'js' :
7074 case 'jsx' :
7175 jsFileName = fileName ;
72- jsContent = _this . removeSourceMapComment ( content ) ;
76+ jsContent = content ;
7377 break ;
7478 case 'd.ts' :
7579 dtsFileName = fileName ;
@@ -106,6 +110,9 @@ var ProjectCompiler = (function () {
106110 base = jsFileName . substring ( 0 , jsFileName . length - outFile . length ) ;
107111 }
108112 if ( jsContent !== undefined ) {
113+ if ( jsMapContent !== undefined ) {
114+ jsContent = this . removeSourceMapComment ( jsContent ) ;
115+ }
109116 this . project . output . writeJs ( base , jsFileName , jsContent , jsMapContent , file ? file . gulp . cwd : currentDirectory , file ) ;
110117 }
111118 if ( dtsContent !== undefined ) {
0 commit comments