@mdfriday/foundry
Version:
The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.
64 lines • 2.55 kB
TypeScript
import { Resources as IResources, Resource, OpenReadSeekCloser, Workspace, MinifierClient as IMinifierClient, IntegrityClient as IIntegrityClient, TemplateClient as ITemplateClient, TemplateSvc } from '../type';
/**
* Resources aggregation root - the main entry point for all resource operations
* Implements the four main operations: GetResource, ExecuteAsTemplate, Minify, Fingerprint
*
* This is the main aggregation root for the Resources domain following DDD principles.
* All resource operations should go through this class.
*/
export declare class Resources implements IResources {
private cache;
private workspace;
private fsSvc;
private urlSvc;
private templateSvc;
private publisher;
private minifierClient;
private integrityClient;
private templateClient;
constructor(workspace: Workspace);
setTemplateSvc(templateSvc: TemplateSvc): void;
/**
* GetResource - First primary operation: get a resource by pathname
* Supports caching for performance optimization
*/
getResource(pathname: string): Promise<Resource | null>;
/**
* GetResourceWithOpener - Alternative way to get resource with custom opener
*/
getResourceWithOpener(pathname: string, opener: OpenReadSeekCloser): Promise<Resource | null>;
/**
* ExecuteAsTemplate - Second primary operation: execute resource as template
* Supports template execution with data binding
*/
executeAsTemplate(resource: Resource, targetPath: string, data: any): Promise<Resource>;
/**
* Minify - Third primary operation: minify a resource
* Supports CSS, JS, HTML, JSON, SVG, and XML minification
*/
minify(resource: Resource): Promise<Resource>;
/**
* Fingerprint - Fourth primary operation: add fingerprint to resource
* Supports integrity generation and filename fingerprinting
*/
fingerprint(resource: Resource): Promise<Resource>;
cacheKey(key: string): string;
/**
* Client accessors for external access
*/
getMinifierClient(): IMinifierClient;
getIntegrityClient(): IIntegrityClient;
setTemplateClient(client: ITemplateClient): void;
/**
* Private helper methods
*/
private buildResource;
private getMediaTypeFromExtension;
private createReadSeekCloser;
/**
* Create ReadSeekCloser from string content
* This follows golang's NewReadSeekerNoOpCloserFromString pattern
*/
private newReadSeekerNoOpCloserFromString;
}
//# sourceMappingURL=resources.d.ts.map