UNPKG

@manuth/woltlab-compiler

Version:

A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components

108 lines 2.59 kB
import path from "upath"; import { InstructionCompiler } from "../../Compilation/PackageSystem/Instructions/InstructionCompiler.js"; const { join } = path; /** * Represents a step of a package-installation. */ export class Instruction { /** * Initializes a new instance of the {@link Instruction `Instruction`} class. * * @param options * The options of the instruction. */ constructor(options) { /** * The package this instruction belongs to. */ this.collection = null; /** * The name of the file to save the compiled instruction to. */ this.fileName = null; /** * A value indicating whether the instruction should be executed in standalone-mode. */ this.standalone = false; this.FileName = options.FileName; } /** * @inheritdoc */ get Collection() { return this.collection; } /** * @inheritdoc */ set Collection(value) { var _a, _b; if (this.Collection !== value) { if ((_a = this.Collection) === null || _a === void 0 ? void 0 : _a.includes(this)) { this.Collection.splice(this.Collection.indexOf(this), 1); } if ((_b = value === null || value === void 0 ? void 0 : value.includes(this)) !== null && _b !== void 0 ? _b : true) { this.collection = value; } else { value.push(this); } } } /** * @inheritdoc */ get Package() { var _a; return (_a = this.Collection) === null || _a === void 0 ? void 0 : _a.Package; } /** * @inheritdoc */ get DestinationRoot() { return join(this.Collection.Directory); } /** * @inheritdoc */ get FileName() { return this.fileName; } /** * @inheritdoc */ set FileName(value) { this.fileName = value; } /** * @inheritdoc */ get FullName() { return join(this.DestinationRoot, this.FileName); } /** * @inheritdoc */ get Standalone() { return this.standalone; } /** * @inheritdoc */ set Standalone(value) { this.standalone = value; } /** * Gets the compiler for compiling the instruction. */ get Compiler() { return new InstructionCompiler(this); } /** * @inheritdoc */ get ObjectsByID() { return {}; } } //# sourceMappingURL=Instruction.js.map