UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

82 lines 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Module = void 0; exports.newModule = newModule; const module_1 = require("../../../domain/config/vo/module"); /** * Module entity holds module configuration */ class Module { constructor(moduleConfig) { this.moduleConfig = moduleConfig; } /** * Get import paths from module imports */ importPaths() { return this.moduleConfig.imports.map(imp => imp.path); } /** * Get the module configuration */ getModuleConfig() { return this.moduleConfig; } /** * Get all imports */ getImports() { return this.moduleConfig.imports; } /** * Get all mounts */ getMounts() { return this.moduleConfig.mounts; } /** * Get import count */ importCount() { return this.moduleConfig.imports.length; } /** * Get mount count */ mountCount() { return this.moduleConfig.mounts.length; } /** * Check if module has imports */ hasImports() { return this.moduleConfig.imports.length > 0; } /** * Check if module has mounts */ hasMounts() { return this.moduleConfig.mounts.length > 0; } /** * Find import by path */ findImport(path) { return this.moduleConfig.imports.find(imp => imp.path === path); } /** * Find mount by source */ findMount(source) { return this.moduleConfig.mounts.find(mount => mount.source === source); } } exports.Module = Module; /** * Create a new Module instance from provider data */ function newModule(data) { const moduleConfig = (0, module_1.decodeModuleConfig)(data); return new Module(moduleConfig); } //# sourceMappingURL=module.js.map