@@ -22,40 +22,40 @@ public class JsxTransformer : IJsxTransformer
2222 /// <summary>
2323 /// Cache key for JSX to JavaScript compilation
2424 /// </summary>
25- private const string JSX_CACHE_KEY = "JSX_v2_{0}" ;
25+ protected const string JSX_CACHE_KEY = "JSX_v2_{0}" ;
2626 /// <summary>
2727 /// Suffix to append to compiled files
2828 /// </summary>
29- private const string COMPILED_FILE_SUFFIX = ".generated.js" ;
29+ protected const string COMPILED_FILE_SUFFIX = ".generated.js" ;
3030 /// <summary>
3131 /// Suffix to append to source map files
3232 /// </summary>
33- private const string SOURE_MAP_FILE_SUFFIX = ".map" ;
33+ protected const string SOURE_MAP_FILE_SUFFIX = ".map" ;
3434 /// <summary>
3535 /// Number of lines in the header prepended to compiled JSX files.
3636 /// </summary>
37- private const int LINES_IN_HEADER = 5 ;
37+ protected const int LINES_IN_HEADER = 5 ;
3838
3939 /// <summary>
4040 /// Environment this JSX Transformer has been created in
4141 /// </summary>
42- private readonly IReactEnvironment _environment ;
42+ protected readonly IReactEnvironment _environment ;
4343 /// <summary>
4444 /// Cache used for storing compiled JSX
4545 /// </summary>
46- private readonly ICache _cache ;
46+ protected readonly ICache _cache ;
4747 /// <summary>
4848 /// File system wrapper
4949 /// </summary>
50- private readonly IFileSystem _fileSystem ;
50+ protected readonly IFileSystem _fileSystem ;
5151 /// <summary>
5252 /// Hash algorithm for file-based cache
5353 /// </summary>
54- private readonly IFileCacheHash _fileCacheHash ;
54+ protected readonly IFileCacheHash _fileCacheHash ;
5555 /// <summary>
5656 /// Site-wide configuration
5757 /// </summary>
58- private readonly IReactSiteConfiguration _config ;
58+ protected readonly IReactSiteConfiguration _config ;
5959
6060 /// <summary>
6161 /// Initializes a new instance of the <see cref="JsxTransformer"/> class.
@@ -80,7 +80,7 @@ public JsxTransformer(IReactEnvironment environment, ICache cache, IFileSystem f
8080 /// <param name="filename">Name of the file to load</param>
8181 /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
8282 /// <returns>JavaScript</returns>
83- public string TransformJsxFile ( string filename , bool ? useHarmony = null )
83+ public virtual string TransformJsxFile ( string filename , bool ? useHarmony = null )
8484 {
8585 return TransformJsxFileWithSourceMap ( filename , false , useHarmony ) . Code ;
8686 }
@@ -96,7 +96,7 @@ public string TransformJsxFile(string filename, bool? useHarmony = null)
9696 /// </param>
9797 /// <param name="useHarmony"><c>true</c> if support for ES6 syntax should be enabled</param>
9898 /// <returns>JavaScript and source map</returns>
99- public JavaScriptWithSourceMap TransformJsxFileWithSourceMap ( string filename , bool forceGenerateSourceMap = false , bool ? useHarmony = null )
99+ public virtual JavaScriptWithSourceMap TransformJsxFileWithSourceMap ( string filename , bool forceGenerateSourceMap = false , bool ? useHarmony = null )
100100 {
101101 var cacheKey = string . Format ( JSX_CACHE_KEY , filename ) ;
102102
@@ -152,7 +152,7 @@ public JavaScriptWithSourceMap TransformJsxFileWithSourceMap(string filename, bo
152152 /// <c>true</c> to re-transform the file if a cached version with no source map is available
153153 /// </param>
154154 /// <returns></returns>
155- private JavaScriptWithSourceMap LoadJsxFromFileCache ( string filename , string hash , bool forceGenerateSourceMap )
155+ protected virtual JavaScriptWithSourceMap LoadJsxFromFileCache ( string filename , string hash , bool forceGenerateSourceMap )
156156 {
157157 var cacheFilename = GetJsxOutputPath ( filename ) ;
158158 if ( ! _fileSystem . FileExists ( cacheFilename ) )
@@ -212,7 +212,7 @@ private JavaScriptWithSourceMap LoadJsxFromFileCache(string filename, string has
212212 /// <param name="hash">Hash of the input. If null, it will be calculated</param>
213213 /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
214214 /// <returns>JavaScript</returns>
215- private JavaScriptWithSourceMap TransformJsxWithHeader ( string filename , string contents , string hash = null , bool ? useHarmony = null )
215+ protected virtual JavaScriptWithSourceMap TransformJsxWithHeader ( string filename , string contents , string hash = null , bool ? useHarmony = null )
216216 {
217217 if ( string . IsNullOrEmpty ( hash ) )
218218 {
@@ -242,7 +242,7 @@ private JavaScriptWithSourceMap TransformJsxWithHeader(string filename, string c
242242 /// <param name="input">JSX</param>
243243 /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
244244 /// <returns>JavaScript</returns>
245- public string TransformJsx ( string input , bool ? useHarmony = null )
245+ public virtual string TransformJsx ( string input , bool ? useHarmony = null )
246246 {
247247 EnsureJsxTransformerSupported ( ) ;
248248 try
@@ -267,7 +267,7 @@ public string TransformJsx(string input, bool? useHarmony = null)
267267 /// <param name="input">JSX</param>
268268 /// <param name="useHarmony"><c>true</c> if support for ES6 syntax should be enabled</param>
269269 /// <returns>JavaScript and source map</returns>
270- public JavaScriptWithSourceMap TransformJsxWithSourceMap ( string input , bool ? useHarmony )
270+ public virtual JavaScriptWithSourceMap TransformJsxWithSourceMap ( string input , bool ? useHarmony )
271271 {
272272 EnsureJsxTransformerSupported ( ) ;
273273 try
@@ -290,7 +290,7 @@ public JavaScriptWithSourceMap TransformJsxWithSourceMap(string input, bool? use
290290 /// </summary>
291291 /// <param name="hash">Hash of the input</param>
292292 /// <returns>Header for the cache</returns>
293- private string GetFileHeader ( string hash )
293+ protected virtual string GetFileHeader ( string hash )
294294 {
295295 return string . Format (
296296@"{0}
@@ -307,7 +307,7 @@ private string GetFileHeader(string hash)
307307 /// </summary>
308308 /// <param name="path">Path of the JSX file</param>
309309 /// <returns>Output path of the compiled file</returns>
310- public string GetJsxOutputPath ( string path )
310+ public virtual string GetJsxOutputPath ( string path )
311311 {
312312 return Path . Combine (
313313 Path . GetDirectoryName ( path ) ,
@@ -321,7 +321,7 @@ public string GetJsxOutputPath(string path)
321321 /// </summary>
322322 /// <param name="path">Path of the JSX file</param>
323323 /// <returns>Output path of the source map</returns>
324- public string GetSourceMapOutputPath ( string path )
324+ public virtual string GetSourceMapOutputPath ( string path )
325325 {
326326 return GetJsxOutputPath ( path ) + SOURE_MAP_FILE_SUFFIX ;
327327 }
@@ -333,7 +333,7 @@ public string GetSourceMapOutputPath(string path)
333333 /// <param name="filename">Name of the file to load</param>
334334 /// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
335335 /// <returns>File contents</returns>
336- public string TransformAndSaveJsxFile ( string filename , bool ? useHarmony = null )
336+ public virtual string TransformAndSaveJsxFile ( string filename , bool ? useHarmony = null )
337337 {
338338 var outputPath = GetJsxOutputPath ( filename ) ;
339339 var sourceMapPath = GetSourceMapOutputPath ( filename ) ;
0 commit comments