@@ -212,7 +212,7 @@ module Utils {
212212 }
213213
214214 var result = "" ;
215- ts . forEach ( Object . getOwnPropertyNames ( flags ) , ( v : any ) => {
215+ ts . forEach ( Object . getOwnPropertyNames ( flags ) , ( v : any ) => {
216216 if ( isFinite ( v ) ) {
217217 v = + v ;
218218 if ( f === + v ) {
@@ -410,7 +410,7 @@ module Harness {
410410 deleteFile ( fileName : string ) : void ;
411411 listFiles ( path : string , filter : RegExp , options ?: { recursive ?: boolean } ) : string [ ] ;
412412 log ( text : string ) : void ;
413- getMemoryUsage ? ( ) : number ;
413+ getMemoryUsage ?( ) : number ;
414414 }
415415
416416 module IOImpl {
@@ -794,7 +794,7 @@ module Harness {
794794
795795 public reset ( ) { this . fileCollection = { } ; }
796796
797- public toArray ( ) : { fileName : string ; file : WriterAggregator ; } [ ] {
797+ public toArray ( ) : { fileName : string ; file : WriterAggregator ; } [ ] {
798798 var result : { fileName : string ; file : WriterAggregator ; } [ ] = [ ] ;
799799 for ( var p in this . fileCollection ) {
800800 if ( this . fileCollection . hasOwnProperty ( p ) ) {
@@ -1166,6 +1166,12 @@ module Harness {
11661166 options . inlineSources = setting . value === 'true' ;
11671167 break ;
11681168
1169+ case 'jsx' :
1170+ options . jsx = setting . value . toLowerCase ( ) === 'react' ? ts . JsxEmit . React :
1171+ setting . value . toLowerCase ( ) === 'preserve' ? ts . JsxEmit . Preserve :
1172+ ts . JsxEmit . None ;
1173+ break ;
1174+
11691175 default :
11701176 throw new Error ( 'Unsupported compiler setting ' + setting . flag ) ;
11711177 }
@@ -1229,7 +1235,7 @@ module Harness {
12291235 }
12301236
12311237 var dTsFileName = ts . removeFileExtension ( sourceFileName ) + ".d.ts" ;
1232-
1238+
12331239 return ts . forEach ( result . declFilesCode , declFile => declFile . fileName === dTsFileName ? declFile : undefined ) ;
12341240 }
12351241
@@ -1428,13 +1434,20 @@ module Harness {
14281434 return stringEndsWith ( fileName , '.ts' ) ;
14291435 }
14301436
1437+ export function isTSX ( fileName : string ) {
1438+ return stringEndsWith ( fileName , '.tsx' ) ;
1439+ }
1440+
14311441 export function isDTS ( fileName : string ) {
14321442 return stringEndsWith ( fileName , '.d.ts' ) ;
14331443 }
14341444
14351445 export function isJS ( fileName : string ) {
14361446 return stringEndsWith ( fileName , '.js' ) ;
14371447 }
1448+ export function isJSX ( fileName : string ) {
1449+ return stringEndsWith ( fileName , '.jsx' ) ;
1450+ }
14381451
14391452 export function isJSMap ( fileName : string ) {
14401453 return stringEndsWith ( fileName , '.js.map' ) ;
@@ -1455,7 +1468,7 @@ module Harness {
14551468 if ( isDTS ( emittedFile . fileName ) ) {
14561469 // .d.ts file, add to declFiles emit
14571470 this . declFilesCode . push ( emittedFile ) ;
1458- } else if ( isJS ( emittedFile . fileName ) ) {
1471+ } else if ( isJS ( emittedFile . fileName ) || isJSX ( emittedFile . fileName ) ) {
14591472 // .js file, add to files
14601473 this . files . push ( emittedFile ) ;
14611474 } else if ( isJSMap ( emittedFile . fileName ) ) {
@@ -1495,6 +1508,16 @@ module Harness {
14951508 // Regex for parsing options in the format "@Alpha: Value of any sort"
14961509 var optionRegex = / ^ [ \/ ] { 2 } \s * @ ( \w + ) \s * : \s * ( \S * ) / gm; // multiple matches on multiple lines
14971510
1511+ // List of allowed metadata names
1512+ var fileMetadataNames = [ "filename" , "comments" , "declaration" , "module" ,
1513+ "nolib" , "sourcemap" , "target" , "out" , "outdir" , "noemithelpers" , "noemitonerror" ,
1514+ "noimplicitany" , "noresolve" , "newline" , "normalizenewline" , "emitbom" ,
1515+ "errortruncation" , "usecasesensitivefilenames" , "preserveconstenums" ,
1516+ "includebuiltfile" , "suppressimplicitanyindexerrors" , "stripinternal" ,
1517+ "isolatedmodules" , "inlinesourcemap" , "maproot" , "sourceroot" ,
1518+ "inlinesources" , "emitdecoratormetadata" , "experimentaldecorators" ,
1519+ "skipdefaultlibcheck" , "jsx" ] ;
1520+
14981521 function extractCompilerSettings ( content : string ) : CompilerSetting [ ] {
14991522
15001523 var opts : CompilerSetting [ ] = [ ] ;
0 commit comments