CompilerBase
Direct Subclass:
This class is the base interface for compilers that are used by electron-compile. If your compiler library only supports a synchronous API, use SimpleCompilerBase instead.
Static Method Summary
Static Public Methods | ||
public static abstract |
getInputMimeTypes(): string[] This method describes the MIME types that your compiler supports as input. |
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
|
Method Summary
Public Methods | ||
public abstract |
Compiles the file |
|
public abstract |
compileSync(sourceCode: string, fileName: string, compilerContext: object): object Compiles the file |
|
public abstract |
determineDependentFiles(sourceCode: string, fileName: string, compilerContext: object): string[] Returns the dependent files of this file. |
|
public abstract |
determineDependentFilesSync(sourceCode: string, fileName: string, compilerContext: object): string[] Returns the dependent files of this file. |
|
public abstract |
Returns a version number representing the version of the underlying compiler library. |
|
public abstract |
shouldCompileFile(fileName: string, compilerContext: object): bool Determines whether a file should be compiled |
|
public abstract |
shouldCompileFileSync(fileName: string, compilerContext: object): bool Determines whether a file should be compiled |
Static Public Methods
public static abstract getInputMimeTypes(): string[] source
This method describes the MIME types that your compiler supports as input. Many precompiled file types don't have a specific MIME type, so if it's not recognized by the mime-types package, you need to patch rig-mime-types in electron-compile.
Public Constructors
public constructor source
Public Members
public compilerOptions: * source
Public Methods
public abstract compile(sourceCode: string, fileName: string, compilerContext: object): object source
Compiles the file
public abstract compileSync(sourceCode: string, fileName: string, compilerContext: object): object source
Compiles the file
public abstract determineDependentFiles(sourceCode: string, fileName: string, compilerContext: object): string[] source
Returns the dependent files of this file. This is used for languages such as LESS which allow you to import / reference other related files. In future versions of electron-compile, we will use this information to invalidate all of the parent files if a child file changes.
Return:
string[] | An array of dependent file paths, or an empty array if there are no dependent files. |
public abstract determineDependentFilesSync(sourceCode: string, fileName: string, compilerContext: object): string[] source
Returns the dependent files of this file. This is used for languages such as LESS which allow you to import / reference other related files. In future versions of electron-compile, we will use this information to invalidate all of the parent files if a child file changes.
Return:
string[] | An array of dependent file paths, or an empty array if there are no dependent files. |
public abstract getCompilerVersion(): string source
Returns a version number representing the version of the underlying compiler library. When this number changes, electron-compile knows to throw all away its generated code.
Return:
string | A version number. Note that this string isn't parsed in any way, just compared to the previous one for equality. |
public abstract shouldCompileFile(fileName: string, compilerContext: object): bool source
Determines whether a file should be compiled
Return:
bool | True if you are able to compile this file. |