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 |
compileSync(sourceCode: *, filePath: *, compilerContext: *) |
|
public abstract |
determineDependentFiles(sourceCode: string, fileName: string, compilerContext: Object): Promise<string[]> Returns the dependent files of this file. |
|
public |
determineDependentFilesSync(sourceCode: *, filePath: *, compilerContext: *) |
|
public |
Returns a version number representing the version of the underlying compiler library. |
|
public abstract |
shouldCompileFile(fileName: string, compilerContext: Object): Promise<bool> Determines whether a file should be compiled |
|
public |
shouldCompileFileSync(fileName: *, compilerContext: *) |
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): Promise<Object> source
Compiles the file
public compileSync(sourceCode: *, filePath: *, compilerContext: *) source
Params:
Name | Type | Attribute | Description |
sourceCode | * | ||
filePath | * | ||
compilerContext | * |
public abstract determineDependentFiles(sourceCode: string, fileName: string, compilerContext: Object): Promise<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.
public determineDependentFilesSync(sourceCode: *, filePath: *, compilerContext: *) source
Params:
Name | Type | Attribute | Description |
sourceCode | * | ||
filePath | * | ||
compilerContext | * |
public 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): Promise<bool> source
Determines whether a file should be compiled
public shouldCompileFileSync(fileName: *, compilerContext: *) source
Params:
Name | Type | Attribute | Description |
fileName | * | ||
compilerContext | * |