@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
80 lines (79 loc) • 2.01 kB
TypeScript
/**
* Provides the functionality to compile a component.
*
* @template T
* The type of the item which can be compiled by this compiler.
*/
export declare abstract class Compiler<T> {
/**
* The item to compile.
*/
private item;
/**
* The path to save the compiled item to.
*/
private destinationPath;
/**
* Initializes a new instance of the {@link Compiler `Compiler<T>`} class.
*
* @param item
* The item to compile.
*/
constructor(item: T);
/**
* Gets the item to compile.
*/
get Item(): T;
/**
* Gets or sets the path to save the compiled item to.
*/
get DestinationPath(): string;
/**
* @inheritdoc
*/
set DestinationPath(value: string);
/**
* Compiles the item.
*/
Execute(): Promise<void>;
/**
* Compiles the item.
*/
protected abstract Compile(): Promise<void>;
/**
* Copies files using `ejs`.
*
* @param source
* The source to copy the files from.
*
* @param destination
* The destination to copy the files to.
*
* @param context
* The context to use.
*
* @param delimiter
* The delimiter of the ejs-tags.
*/
protected CopyTemplate(source: string, destination: string, context?: Record<string, unknown>, delimiter?: string): Promise<void>;
/**
* Joins the paths and returns the path contained by the destination-folder.
*
* @param path
* The path that is to be joined.
*
* @returns
* The joined path relative to the destination-folder.
*/
protected MakeDestinationPath(...path: string[]): string;
/**
* Compresses a folder and saves the result to a specified file.
*
* @param source
* The folder that is to be compressed.
*
* @param destination
* The filename to save the compressed file to.
*/
protected Compress(source: string, destination: string): Promise<void>;
}