@@ -22,7 +22,7 @@ public class JsxTransformer : IJsxTransformer
2222 /// <summary>
2323 /// Cache key for JSX to JavaScript compilation
2424 /// </summary>
25- protected const string JSX_CACHE_KEY = "JSX_v2_ {0}" ;
25+ protected const string JSX_CACHE_KEY = "JSX_v3_ {0}" ;
2626 /// <summary>
2727 /// Suffix to append to compiled files
2828 /// </summary>
@@ -78,15 +78,10 @@ public JsxTransformer(IReactEnvironment environment, ICache cache, IFileSystem f
7878 /// Transforms a JSX file. Results of the JSX to JavaScript transformation are cached.
7979 /// </summary>
8080 /// <param name="filename">Name of the file to load</param>
81- /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
82- /// <param name="stripTypes">
83- /// Whether Flow types should be stripped out. Defaults to the value set in the site
84- /// configuration.
85- /// </param>
8681 /// <returns>JavaScript</returns>
87- public virtual string TransformJsxFile ( string filename , bool ? useHarmony = null , bool ? stripTypes = null )
82+ public virtual string TransformJsxFile ( string filename )
8883 {
89- return TransformJsxFileWithSourceMap ( filename , false , useHarmony , stripTypes ) . Code ;
84+ return TransformJsxFileWithSourceMap ( filename , false ) . Code ;
9085 }
9186
9287 /// <summary>
@@ -98,17 +93,10 @@ public virtual string TransformJsxFile(string filename, bool? useHarmony = null,
9893 /// <param name="forceGenerateSourceMap">
9994 /// <c>true</c> to re-transform the file if a cached version with no source map is available
10095 /// </param>
101- /// <param name="useHarmony"><c>true</c> if support for ES6 syntax should be enabled</param>
102- /// <param name="stripTypes">
103- /// Whether Flow types should be stripped out. Defaults to the value set in the site
104- /// configuration.
105- /// </param>
10696 /// <returns>JavaScript and source map</returns>
10797 public virtual JavaScriptWithSourceMap TransformJsxFileWithSourceMap (
10898 string filename ,
109- bool forceGenerateSourceMap = false ,
110- bool ? useHarmony = null ,
111- bool ? stripTypes = null
99+ bool forceGenerateSourceMap = false
112100 )
113101 {
114102 var cacheKey = string . Format ( JSX_CACHE_KEY , filename ) ;
@@ -131,7 +119,7 @@ public virtual JavaScriptWithSourceMap TransformJsxFileWithSourceMap(
131119 // 3. Not cached, perform the transformation
132120 try
133121 {
134- output = TransformJsxWithHeader ( filename , contents , hash , useHarmony , stripTypes ) ;
122+ output = TransformJsxWithHeader ( filename , contents , hash ) ;
135123 }
136124 catch ( JsxException ex )
137125 {
@@ -223,26 +211,19 @@ protected virtual JavaScriptWithSourceMap LoadJsxFromFileCache(string filename,
223211 /// <param name="filename">Name of the file being transformed</param>
224212 /// <param name="contents">Contents of the input file</param>
225213 /// <param name="hash">Hash of the input. If null, it will be calculated</param>
226- /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
227- /// <param name="stripTypes">
228- /// Whether Flow types should be stripped out. Defaults to the value set in the site
229- /// configuration.
230- /// </param>
231214 /// <returns>JavaScript</returns>
232215 protected virtual JavaScriptWithSourceMap TransformJsxWithHeader (
233216 string filename ,
234217 string contents ,
235- string hash = null ,
236- bool ? useHarmony = null ,
237- bool ? stripTypes = null
218+ string hash = null
238219 )
239220 {
240221 if ( string . IsNullOrEmpty ( hash ) )
241222 {
242223 hash = _fileCacheHash . CalculateHash ( contents ) ;
243224 }
244225 var header = GetFileHeader ( hash ) ;
245- var result = TransformJsxWithSourceMap ( header + contents , useHarmony , stripTypes ) ;
226+ var result = TransformJsxWithSourceMap ( header + contents ) ;
246227 result . Hash = hash ;
247228 if ( result . SourceMap != null )
248229 {
@@ -262,21 +243,14 @@ protected virtual JavaScriptWithSourceMap TransformJsxWithHeader(
262243 /// <see cref="TransformJsxFile"/> if loading from a file since this will cache the result.
263244 /// </summary>
264245 /// <param name="input">JSX</param>
265- /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
266- /// <param name="stripTypes">
267- /// Whether Flow types should be stripped out. Defaults to the value set in the site
268- /// configuration.
269- /// </param>
270246 /// <returns>JavaScript</returns>
271- public virtual string TransformJsx ( string input , bool ? useHarmony = null , bool ? stripTypes = null )
247+ public virtual string TransformJsx ( string input )
272248 {
273249 try
274250 {
275251 var output = _environment . ExecuteWithLargerStackIfRequired < string > (
276252 "ReactNET_transform" ,
277- input ,
278- useHarmony ?? _config . UseHarmony ,
279- stripTypes ?? _config . StripTypes
253+ input
280254 ) ;
281255 return output ;
282256 }
@@ -291,25 +265,16 @@ public virtual string TransformJsx(string input, bool? useHarmony = null, bool?
291265 /// source to the original version. The result is not cached.
292266 /// </summary>
293267 /// <param name="input">JSX</param>
294- /// <param name="useHarmony"><c>true</c> if support for ES6 syntax should be enabled</param>
295- /// <param name="stripTypes">
296- /// Whether Flow types should be stripped out. Defaults to the value set in the site
297- /// configuration.
298- /// </param>
299268 /// <returns>JavaScript and source map</returns>
300269 public virtual JavaScriptWithSourceMap TransformJsxWithSourceMap (
301- string input ,
302- bool ? useHarmony = null ,
303- bool ? stripTypes = null
270+ string input
304271 )
305272 {
306273 try
307274 {
308275 return _environment . ExecuteWithLargerStackIfRequired < JavaScriptWithSourceMap > (
309276 "ReactNET_transform_sourcemap" ,
310- input ,
311- useHarmony ?? _config . UseHarmony ,
312- stripTypes ?? _config . StripTypes
277+ input
313278 ) ;
314279 }
315280 catch ( Exception ex )
@@ -365,22 +330,15 @@ public virtual string GetSourceMapOutputPath(string path)
365330 /// alongside the original file.
366331 /// </summary>
367332 /// <param name="filename">Name of the file to load</param>
368- /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
369- /// <param name="stripTypes">
370- /// Whether Flow types should be stripped out. Defaults to the value set in the site
371- /// configuration.
372- /// </param>
373333 /// <returns>File contents</returns>
374334 public virtual string TransformAndSaveJsxFile (
375- string filename ,
376- bool ? useHarmony = null ,
377- bool ? stripTypes = null
335+ string filename
378336 )
379337 {
380338 var outputPath = GetJsxOutputPath ( filename ) ;
381339 var sourceMapPath = GetSourceMapOutputPath ( filename ) ;
382340 var contents = _fileSystem . ReadAsString ( filename ) ;
383- var result = TransformJsxWithHeader ( filename , contents , null , useHarmony , stripTypes ) ;
341+ var result = TransformJsxWithHeader ( filename , contents , null ) ;
384342 _fileSystem . WriteAsString ( outputPath , result . Code ) ;
385343 _fileSystem . WriteAsString ( sourceMapPath , result . SourceMap == null ? string . Empty : result . SourceMap . ToJson ( ) ) ;
386344 return outputPath ;
0 commit comments