@manuth/woltlab-compiler
Version:
A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components
110 lines • 3.04 kB
JavaScript
import path from "upath";
import { SelfContainedPHPInstructionCompiler } from "../../Compilation/PackageSystem/Instructions/SelfContainedPHPInstructionCompiler.js";
import { ApplicationFileSystemInstruction } from "./FileSystem/ApplicationFileSystemInstruction.js";
import { InstructionSet } from "./InstructionSet.js";
import { PHPInstruction } from "./PHPInstruction.js";
const { dirname, join } = path;
/**
* Represents an instruction which uploads and executes `.php`-code.
*/
export class SelfContainedPHPInstruction extends ApplicationFileSystemInstruction {
/**
* Initializes a new instance of the {@link SelfContainedPHPInstruction `SelfContainedPHPInstruction`} class.
*
* @param options
* The options of the self-contained php instruction.
*/
constructor(options) {
super(options);
this.Destination = options.Destination;
}
/**
* @inheritdoc
*/
get Compiler() {
return new SelfContainedPHPInstructionCompiler(this);
}
/**
* Gets or sets the path to load the `.php`-file from.
*/
get Source() {
return super.Source;
}
/**
* @inheritdoc
*/
set Source(value) {
super.Source = value;
}
/**
* @inheritdoc
*/
get FileName() {
return super.FileName;
}
/**
* @inheritdoc
*/
set FileName(value) {
super.FileName = value;
}
/**
* Gets or sets the path to save the `.php`-file to.
*/
get Destination() {
return this.destination;
}
/**
* @inheritdoc
*/
set Destination(value) {
this.destination = value;
}
/**
* Gets the file-instruction contained by this instruction.
*/
get FileInstruction() {
let collection = new InstructionSet(this.Collection.Package);
collection.Directory = this.Collection.Directory;
let result = new ApplicationFileSystemInstruction({
Application: this.Application,
Source: null,
FileName: this.FileName
});
collection.push(result);
return result;
}
/**
* Gets the php-instruction contained by this instruction.
*/
get PHPInstruction() {
let collection = new InstructionSet(this.Collection.Package);
collection.Directory = this.Collection.Directory;
let result = new PHPInstruction({
Application: this.Application,
FileName: this.Destination,
Standalone: this.Standalone
});
collection.push(result);
return result;
}
/**
* @inheritdoc
*/
get AssetDirectoryName() {
return join("scripts", "php");
}
/**
* @inheritdoc
*
* @param source
* The source of the instruction.
*
* @returns
* The default name of the asset file.
*/
GetAssetFileName(source) {
return super.GetAssetFileName(dirname(source));
}
}
//# sourceMappingURL=SelfContainedPHPInstruction.js.map