Skip to content

Commit 1b0e7cd

Browse files
committed
Added xml-doc
1 parent 2240f18 commit 1b0e7cd

File tree

2 files changed

+49
-42
lines changed

2 files changed

+49
-42
lines changed

src/React/IJsxTransformer.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +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>
2122
/// <returns>JavaScript</returns>
2223
string TransformJsxFile(string filename, bool useHarmony = false);
2324

24-
/// <summary>
25-
/// Transforms JSX into regular JavaScript. The result is not cached. Use
26-
/// <see cref="TransformJsxFile"/> if loading from a file since this will cache the result.
27-
/// </summary>
28-
/// <param name="input">JSX</param>
29-
/// <returns>JavaScript</returns>
30-
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);
3133

32-
/// <summary>
33-
/// Transforms a JSX file to JavaScript, and saves the result into a ".generated.js" file
34-
/// alongside the original file.
35-
/// </summary>
36-
/// <param name="filename">Name of the file to load</param>
37-
/// <returns>File contents</returns>
38-
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);
3942

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

src/React/JsxTransformer.cs

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +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-
/// <returns>JavaScript</returns>
67-
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)
6869
{
6970
var fullPath = _fileSystem.MapPath(filename);
7071

@@ -96,14 +97,15 @@ public string TransformJsxFile(string filename, bool useHarmony = false)
9697
);
9798
}
9899

99-
/// <summary>
100-
/// Transforms JSX into regular JavaScript, and prepends a header used for caching
101-
/// purposes.
102-
/// </summary>
103-
/// <param name="contents">Contents of the input file</param>
104-
/// <param name="hash">Hash of the input. If null, it will be calculated</param>
105-
/// <returns>JavaScript</returns>
106-
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)
107109
{
108110
if (string.IsNullOrEmpty(hash))
109111
{
@@ -112,13 +114,14 @@ private string TransformJsxWithHeader(string contents, string hash = null, bool
112114
return GetFileHeader(hash) + TransformJsx(contents, useHarmony);
113115
}
114116

115-
/// <summary>
116-
/// Transforms JSX into regular JavaScript. The result is not cached. Use
117-
/// <see cref="TransformJsxFile"/> if loading from a file since this will cache the result.
118-
/// </summary>
119-
/// <param name="input">JSX</param>
120-
/// <returns>JavaScript</returns>
121-
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)
122125
{
123126
// Just return directly if there's no JSX annotation
124127
if (!input.Contains("@jsx"))
@@ -173,13 +176,14 @@ public string GetJsxOutputPath(string path)
173176
);
174177
}
175178

176-
/// <summary>
177-
/// Transforms a JSX file to JavaScript, and saves the result into a ".generated.js" file
178-
/// alongside the original file.
179-
/// </summary>
180-
/// <param name="filename">Name of the file to load</param>
181-
/// <returns>File contents</returns>
182-
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)
183187
{
184188
var outputPath = GetJsxOutputPath(filename);
185189
var contents = _fileSystem.ReadAsString(filename);

0 commit comments

Comments
 (0)