Property | Type | Description | |
---|---|---|---|
_babelConfig | string | ||
_cache | ICache | ||
_config | IReactSiteConfiguration | ||
_environment | IReactEnvironment | ||
_fileCacheHash | IFileCacheHash | ||
_fileSystem | IFileSystem |
Method | Description | |
---|---|---|
Babel ( IReactEnvironment environment, ICache cache, IFileSystem fileSystem, IFileCacheHash fileCacheHash, IReactSiteConfiguration siteConfig ) : System |
Initializes a new instance of the Babel class.
|
|
CacheIsValid ( string inputFileContents, string outputPath ) : bool |
Checks whether an input file (given as inputFileContents) should be transpiled by calculating the hash and comparing it to the hash value stored in the file given by outputPath. If the outputPath file does not exist the input file should always be transpiled.
|
|
GetOutputPath ( string path ) : string |
Returns the path the specified file's compilation will be cached to
|
|
GetSourceMapOutputPath ( string path ) : string |
Returns the path the specified file's source map will be cached to if TransformAndSaveFile is called.
|
|
Transform ( string input, string filename = "unknown" ) : string |
Transforms JavaScript via Babel. The result is not cached. Use TransformFile if loading from a file since this will cache the result.
|
|
TransformAndSaveFile ( string filename ) : string |
Transforms JavaScript via Babel and saves the result into a ".generated.js" file alongside the original file.
|
|
TransformFile ( string filename ) : string |
Transforms a JavaScript file. Results of the transformation are cached.
|
|
TransformFileWithSourceMap ( string filename, bool forceGenerateSourceMap = false ) : |
Transforms a JavaScript file via Babel and also returns a source map to map the compiled source to the original version. Results of the transformation are cached.
|
|
TransformWithSourceMap ( string input, string filename = "unknown" ) : |
Transforms JavaScript via Babel and also returns a source map to map the compiled source to the original version. The result is not cached.
|
Method | Description | |
---|---|---|
GetFileHeader ( string hash, string babelVersion ) : string |
Gets the header prepended to transformed files. Contains a hash that is used to validate the cache.
|
|
LoadFromFileCache ( string filename, string hash, bool forceGenerateSourceMap ) : |
Loads a transformed JavaScript file from the disk cache. If the cache is invalid or there is no cached version, returns
|
|
TransformWithHeader ( string filename, string contents, string hash = null ) : |
Transforms JavaScript via Babel, and prepends a header used for caching purposes.
|
public Babel ( IReactEnvironment environment, ICache cache, IFileSystem fileSystem, IFileCacheHash fileCacheHash, IReactSiteConfiguration siteConfig ) : System | ||
environment | IReactEnvironment | The ReactJS.NET environment |
cache | ICache | The cache to use for compilation |
fileSystem | IFileSystem | File system wrapper |
fileCacheHash | IFileCacheHash | Hash algorithm for file-based cache |
siteConfig | IReactSiteConfiguration | Site-wide configuration |
return | System |
public CacheIsValid ( string inputFileContents, string outputPath ) : bool | ||
inputFileContents | string | The contents of the input file. |
outputPath | string | The output path of the (possibly previously) generated file. |
return | bool |
protected GetFileHeader ( string hash, string babelVersion ) : string | ||
hash | string | Hash of the input |
babelVersion | string | Version of Babel used to perform this transformation |
return | string |
public GetOutputPath ( string path ) : string | ||
path | string | Path of the input file |
return | string |
public GetSourceMapOutputPath ( string path ) : string | ||
path | string | Path of the input file |
return | string |
protected LoadFromFileCache ( string filename, string hash, bool forceGenerateSourceMap ) : |
||
filename | string | Name of the file to load |
hash | string | Hash of the input file, to validate the cache |
forceGenerateSourceMap | bool |
/// |
return |
public Transform ( string input, string filename = "unknown" ) : string | ||
input | string | JavaScript |
filename | string | Name of the file being transformed |
return | string |
public TransformAndSaveFile ( string filename ) : string | ||
filename | string | Name of the file to load |
return | string |
public TransformFile ( string filename ) : string | ||
filename | string | Name of the file to load |
return | string |
public TransformFileWithSourceMap ( string filename, bool forceGenerateSourceMap = false ) : |
||
filename | string | Name of the file to load |
forceGenerateSourceMap | bool |
/// |
return |
protected TransformWithHeader ( string filename, string contents, string hash = null ) : |
||
filename | string | Name of the file being transformed |
contents | string | Contents of the input file |
hash | string | Hash of the input. If null, it will be calculated |
return |
public TransformWithSourceMap ( string input, string filename = "unknown" ) : |
||
input | string | JavaScript |
filename | string | Name of the file being transformed |
return |