UNPKG

@mdfriday/foundry

Version:

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

93 lines 3.1 kB
import { TemplateFactory, TemplateFs, TemplateFactoryConfig, TemplateFuncMap, CustomizedFunctions } from '../type'; import { TemplateEngine } from '../entity/template'; import { RegularTemplateNamespace, PartialTemplateNamespace, ShortcodeTemplateNamespace } from '../vo/namespace'; /** * Template factory implementation * TypeScript version of Go's template factory * Following Go's factory pattern with service injection */ export declare class Factory implements TemplateFactory { /** * Create template engine with file system (core functions only) */ create(fs: TemplateFs): Promise<TemplateEngine>; /** * Create template engine with configuration */ createWithConfig(fs: TemplateFs, config: TemplateFactoryConfig): Promise<TemplateEngine>; /** * Create template engine with services * TypeScript equivalent of Go's New(fs, cfs) function */ createWithServices(fs: TemplateFs, services: CustomizedFunctions): Promise<TemplateEngine>; } /** * Builder for constructing template engine with dependencies * TypeScript equivalent of Go's builder pattern */ export declare class Builder { private funcMap; private services?; private fs?; private templateNamespace?; private partialNamespace?; private shortcodeNamespace?; private lookup?; private parser?; private executor?; /** * Set file system */ withFs(fs: TemplateFs): Builder; /** * Set namespaces */ withNamespaces(templateNamespace: RegularTemplateNamespace, partialNamespace: PartialTemplateNamespace, shortcodeNamespace: ShortcodeTemplateNamespace): Builder; /** * Set function map directly */ withFuncMap(funcMap: TemplateFuncMap): Builder; /** * Set services (will generate function map from services) * TypeScript equivalent of Go's withCfs() */ withServices(services: CustomizedFunctions): Builder; /** * Build lookup component * TypeScript equivalent of Go's buildLookup() */ buildLookup(): Builder; /** * Build parser component * TypeScript equivalent of Go's buildParser() */ buildParser(): Builder; /** * Build executor component * TypeScript equivalent of Go's buildExecutor() */ buildExecutor(): Builder; /** * Build final template engine * TypeScript equivalent of Go's build() */ build(): Promise<TemplateEngine>; } /** * Create a new template factory */ export declare function newTemplateFactory(): Factory; /** * Create a new builder */ export declare function newBuilder(): Builder; /** * Convenience function to create template engine with defaults */ export declare function createTemplateEngine(fs: TemplateFs, funcMap?: TemplateFuncMap): Promise<TemplateEngine>; /** * Convenience function to create template engine with services * TypeScript equivalent of Go's factory.New() */ export declare function createTemplateEngineWithServices(fs: TemplateFs, services: CustomizedFunctions): Promise<TemplateEngine>; //# sourceMappingURL=template.d.ts.map