Skip to content

Commit 42b6779

Browse files
committed
Converted indent to tabs, added config
1 parent 739eed6 commit 42b6779

File tree

4 files changed

+63
-51
lines changed

4 files changed

+63
-51
lines changed

src/React/IJsxTransformer.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ public interface IJsxTransformer
1818
/// Transforms a JSX file. Results of the JSX to JavaScript transformation are cached.
1919
/// </summary>
2020
/// <param name="filename">Name of the file to load</param>
21-
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
21+
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
2222
/// <returns>JavaScript</returns>
2323
string TransformJsxFile(string filename, bool useHarmony = false);
2424

25-
/// <summary>
26-
/// Transforms JSX into regular JavaScript. The result is not cached. Use
27-
/// <see cref="TransformJsxFile"/> if loading from a file since this will cache the result.
28-
/// </summary>
29-
/// <param name="input">JSX</param>
30-
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
31-
/// <returns>JavaScript</returns>
32-
string TransformJsx(string input, bool useHarmony = false);
25+
/// <summary>
26+
/// Transforms JSX into regular JavaScript. The result is not cached. Use
27+
/// <see cref="TransformJsxFile"/> if loading from a file since this will cache the result.
28+
/// </summary>
29+
/// <param name="input">JSX</param>
30+
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
31+
/// <returns>JavaScript</returns>
32+
string TransformJsx(string input, bool useHarmony = false);
3333

34-
/// <summary>
35-
/// Transforms a JSX file to JavaScript, and saves the result into a ".generated.js" file
36-
/// alongside the original file.
37-
/// </summary>
38-
/// <param name="filename">Name of the file to load</param>
39-
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
40-
/// <returns>File contents</returns>
41-
string TransformAndSaveJsxFile(string filename, bool useHarmony = false);
34+
/// <summary>
35+
/// Transforms a JSX file to JavaScript, and saves the result into a ".generated.js" file
36+
/// alongside the original file.
37+
/// </summary>
38+
/// <param name="filename">Name of the file to load</param>
39+
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
40+
/// <returns>File contents</returns>
41+
string TransformAndSaveJsxFile(string filename, bool useHarmony = false);
4242

4343
/// <summary>
4444
/// Returns the path the specified JSX file's compilation will be cached to

src/React/IReactSiteConfiguration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,11 @@ public interface IReactSiteConfiguration
3131
/// Gets a list of all the scripts that have been added to this configuration.
3232
/// </summary>
3333
IList<string> Scripts { get; }
34+
35+
/// <summary>
36+
/// A value indicating if es6 syntax should be rewritten.
37+
/// </summary>
38+
/// <returns><c>true</c> if support for es6 syntax should be rewritten.</returns>
39+
bool UseHarmony { get; set; }
3440
}
3541
}

src/React/JsxTransformer.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public JsxTransformer(IReactEnvironment environment, ICache cache, IFileSystem f
5959
_fileCacheHash = fileCacheHash;
6060
}
6161

62-
/// <summary>
63-
/// Transforms a JSX file. Results of the JSX to JavaScript transformation are cached.
64-
/// </summary>
65-
/// <param name="filename">Name of the file to load</param>
66-
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
67-
/// <returns>JavaScript</returns>
68-
public string TransformJsxFile(string filename, bool useHarmony = false)
62+
/// <summary>
63+
/// Transforms a JSX file. Results of the JSX to JavaScript transformation are cached.
64+
/// </summary>
65+
/// <param name="filename">Name of the file to load</param>
66+
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
67+
/// <returns>JavaScript</returns>
68+
public string TransformJsxFile(string filename, bool useHarmony = false)
6969
{
7070
var fullPath = _fileSystem.MapPath(filename);
7171

@@ -97,15 +97,15 @@ public string TransformJsxFile(string filename, bool useHarmony = false)
9797
);
9898
}
9999

100-
/// <summary>
101-
/// Transforms JSX into regular JavaScript, and prepends a header used for caching
102-
/// purposes.
103-
/// </summary>
104-
/// <param name="contents">Contents of the input file</param>
105-
/// <param name="hash">Hash of the input. If null, it will be calculated</param>
106-
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
107-
/// <returns>JavaScript</returns>
108-
private string TransformJsxWithHeader(string contents, string hash = null, bool useHarmony = false)
100+
/// <summary>
101+
/// Transforms JSX into regular JavaScript, and prepends a header used for caching
102+
/// purposes.
103+
/// </summary>
104+
/// <param name="contents">Contents of the input file</param>
105+
/// <param name="hash">Hash of the input. If null, it will be calculated</param>
106+
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
107+
/// <returns>JavaScript</returns>
108+
private string TransformJsxWithHeader(string contents, string hash = null, bool useHarmony = false)
109109
{
110110
if (string.IsNullOrEmpty(hash))
111111
{
@@ -114,14 +114,14 @@ private string TransformJsxWithHeader(string contents, string hash = null, bool
114114
return GetFileHeader(hash) + TransformJsx(contents, useHarmony);
115115
}
116116

117-
/// <summary>
118-
/// Transforms JSX into regular JavaScript. The result is not cached. Use
119-
/// <see cref="TransformJsxFile"/> if loading from a file since this will cache the result.
120-
/// </summary>
121-
/// <param name="input">JSX</param>
122-
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
123-
/// <returns>JavaScript</returns>
124-
public string TransformJsx(string input, bool useHarmony = false)
117+
/// <summary>
118+
/// Transforms JSX into regular JavaScript. The result is not cached. Use
119+
/// <see cref="TransformJsxFile"/> if loading from a file since this will cache the result.
120+
/// </summary>
121+
/// <param name="input">JSX</param>
122+
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
123+
/// <returns>JavaScript</returns>
124+
public string TransformJsx(string input, bool useHarmony = false)
125125
{
126126
// Just return directly if there's no JSX annotation
127127
if (!input.Contains("@jsx"))
@@ -135,7 +135,7 @@ public string TransformJsx(string input, bool useHarmony = false)
135135
var output = _environment.ExecuteWithLargerStackIfRequired<string>(
136136
"ReactNET_transform",
137137
input,
138-
useHarmony
138+
useHarmony
139139
);
140140
return output;
141141
}
@@ -176,14 +176,14 @@ public string GetJsxOutputPath(string path)
176176
);
177177
}
178178

179-
/// <summary>
180-
/// Transforms a JSX file to JavaScript, and saves the result into a ".generated.js" file
181-
/// alongside the original file.
182-
/// </summary>
183-
/// <param name="filename">Name of the file to load</param>
184-
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
185-
/// <returns>File contents</returns>
186-
public string TransformAndSaveJsxFile(string filename, bool useHarmony = false)
179+
/// <summary>
180+
/// Transforms a JSX file to JavaScript, and saves the result into a ".generated.js" file
181+
/// alongside the original file.
182+
/// </summary>
183+
/// <param name="filename">Name of the file to load</param>
184+
/// <param name="useHarmony"><c>true</c> if support for es6 syntax should be rewritten.</param>
185+
/// <returns>File contents</returns>
186+
public string TransformAndSaveJsxFile(string filename, bool useHarmony = false)
187187
{
188188
var outputPath = GetJsxOutputPath(filename);
189189
var contents = _fileSystem.ReadAsString(filename);

src/React/ReactSiteConfiguration.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ public IReactSiteConfiguration AddScript(string filename)
4848
public IList<string> Scripts
4949
{
5050
get { return new ReadOnlyCollection<string>(_scriptFiles); }
51-
}
51+
}
52+
53+
/// <summary>
54+
/// A value indicating if es6 syntax should be rewritten.
55+
/// </summary>
56+
/// <returns><c>true</c> if support for es6 syntax should be rewritten.</returns>
57+
public bool UseHarmony { get; set; }
5258
}
5359
}

0 commit comments

Comments
 (0)