UNPKG

@manuth/generator-wsc-package

Version:

A Generator for WoltLab Suite Core Packages.

70 lines 2.45 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { InstructionFileMapping } from "./InstructionFileMapping.js"; /** * Provides the functionality to generate instruction-files for local instructions. * * @template TSettings * The type of the generator-settings. * * @template TOptions * The type of the generator-options. * * @template TComponentOptions * The type of the component-options. */ export class LocalFileInstructionMapping extends InstructionFileMapping { /** * Initializes a new instance of the {@link LocalFileInstructionMapping `LocalFileInstructionMapping<TSettings, TOptions, TComponentOptions>`} class. * * @param component * The component to create an instruction-file for. */ constructor(component) { super(component); this.localInstructionComponent = component; } /** * @inheritdoc */ get Component() { return this.localInstructionComponent; } /** * @inheritdoc */ get InstructionOptions() { let options = super.InstructionOptions; options.addPropertyAssignment({ name: "Source", initializer: this.GetPathJoin(this.Component.ComponentOptions.Source).getFullText() }); return options; } /** * @inheritdoc * * @param file * The {@link SourceFile `SourceFile`} to transform. * * @returns * The transformed file. */ Transform(file) { const _super = Object.create(null, { Transform: { get: () => super.Transform } }); return __awaiter(this, void 0, void 0, function* () { this.ApplyPathJoin(file); return _super.Transform.call(this, file); }); } } //# sourceMappingURL=LocalFileInstructionMapping.js.map