@@ -64,7 +64,7 @@ public JsxTransformer(IReactEnvironment environment, ICache cache, IFileSystem f
64
64
/// </summary>
65
65
/// <param name="filename">Name of the file to load</param>
66
66
/// <returns>JavaScript</returns>
67
- public string TransformJsxFile ( string filename )
67
+ public string TransformJsxFile ( string filename , bool useHarmony = false )
68
68
{
69
69
var fullPath = _fileSystem . MapPath ( filename ) ;
70
70
@@ -91,7 +91,7 @@ public string TransformJsxFile(string filename)
91
91
}
92
92
93
93
// 3. Not cached, perform the transformation
94
- return TransformJsxWithHeader ( contents , hash ) ;
94
+ return TransformJsxWithHeader ( contents , hash , useHarmony ) ;
95
95
}
96
96
) ;
97
97
}
@@ -103,13 +103,13 @@ public string TransformJsxFile(string filename)
103
103
/// <param name="contents">Contents of the input file</param>
104
104
/// <param name="hash">Hash of the input. If null, it will be calculated</param>
105
105
/// <returns>JavaScript</returns>
106
- private string TransformJsxWithHeader ( string contents , string hash = null )
106
+ private string TransformJsxWithHeader ( string contents , string hash = null , bool useHarmony = false )
107
107
{
108
108
if ( string . IsNullOrEmpty ( hash ) )
109
109
{
110
110
hash = _fileCacheHash . CalculateHash ( contents ) ;
111
111
}
112
- return GetFileHeader ( hash ) + TransformJsx ( contents ) ;
112
+ return GetFileHeader ( hash ) + TransformJsx ( contents , useHarmony ) ;
113
113
}
114
114
115
115
/// <summary>
@@ -118,7 +118,7 @@ private string TransformJsxWithHeader(string contents, string hash = null)
118
118
/// </summary>
119
119
/// <param name="input">JSX</param>
120
120
/// <returns>JavaScript</returns>
121
- public string TransformJsx ( string input )
121
+ public string TransformJsx ( string input , bool useHarmony = false )
122
122
{
123
123
// Just return directly if there's no JSX annotation
124
124
if ( ! input . Contains ( "@jsx" ) )
@@ -131,7 +131,8 @@ public string TransformJsx(string input)
131
131
{
132
132
var output = _environment . ExecuteWithLargerStackIfRequired < string > (
133
133
"ReactNET_transform" ,
134
- input
134
+ input ,
135
+ useHarmony
135
136
) ;
136
137
return output ;
137
138
}
@@ -178,11 +179,11 @@ public string GetJsxOutputPath(string path)
178
179
/// </summary>
179
180
/// <param name="filename">Name of the file to load</param>
180
181
/// <returns>File contents</returns>
181
- public string TransformAndSaveJsxFile ( string filename )
182
+ public string TransformAndSaveJsxFile ( string filename , bool useHarmony = false )
182
183
{
183
184
var outputPath = GetJsxOutputPath ( filename ) ;
184
185
var contents = _fileSystem . ReadAsString ( filename ) ;
185
- var result = TransformJsxWithHeader ( contents ) ;
186
+ var result = TransformJsxWithHeader ( contents , useHarmony : useHarmony ) ;
186
187
_fileSystem . WriteAsString ( outputPath , result ) ;
187
188
return outputPath ;
188
189
}
0 commit comments