UNPKG

@mdfriday/foundry

Version:

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

129 lines 3.04 kB
import { Module as IModule, Mount as IMount, Import, ModuleMetadata } from '../type'; import { Fs } from '../../fs/type'; import { Mount } from './mount'; /** * Module value object representing a downloaded module * TypeScript version of Go's Module struct */ export declare class Module implements IModule { private fs; private absoluteDir; private modulePath; private parentModule; private mountDirs; private metadata; constructor(fs: Fs, absoluteDir: string, modulePath: string, parent?: Module | null); /** * Get module owner (parent) */ owner(): Module | null; /** * Get module mounts */ mounts(): IMount[]; /** * Get module directory */ dir(): string; /** * Get module path */ path(): string; /** * Set module metadata */ setMetadata(metadata: ModuleMetadata): void; /** * Get module metadata */ getMetadata(): ModuleMetadata | null; /** * Apply mounts from import configuration */ applyMounts(moduleImport: Import): Promise<void>; /** * Add a mount */ appendMount(mount: Mount): void; /** * Remove a mount */ removeMount(mount: Mount): boolean; /** * Get mount by target path */ getMountByTarget(targetPath: string): Mount | null; /** * Get mounts by component */ getMountsByComponent(component: string): Mount[]; /** * Check if module is downloaded */ isDownloaded(): boolean; /** * Check if module is being downloaded */ isDownloading(): boolean; /** * Check if module download failed */ isDownloadFailed(): boolean; /** * Check if directory exists */ exists(): Promise<boolean>; /** * Get module info summary */ getSummary(): { path: string; dir: string; mountCount: number; downloaded: boolean; hasParent: boolean; }; /** * Create a copy of this module */ copy(): Module; /** * String representation */ toString(): string; } /** * Project module - special module representing the main project */ export declare class ProjectModule { private module; constructor(module: Module); /** * Get the underlying module */ getModule(): Module; /** * Append mount to project module */ appendMount(mount: Mount): void; /** * Apply default project mounts */ applyDefaultMounts(): void; /** * Delegate methods to underlying module */ owner(): Module | null; mounts(): IMount[]; dir(): string; path(): string; } /** * Creates a new Module instance */ export declare function newModule(fs: Fs, absoluteDir: string, modulePath: string, parent?: Module): Module; /** * Creates a new ProjectModule instance */ export declare function newProjectModule(fs: Fs, absoluteDir: string, modulePath: string): ProjectModule; //# sourceMappingURL=module.d.ts.map