UNPKG

@maizzle/framework

Version:

Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.

49 lines (48 loc) 2.1 kB
import { EventManager } from "../events/index.js"; import { MaizzleConfig } from "../types/config.js"; import { Renderer } from "./createRenderer.js"; //#region src/render/buildTemplate.d.ts interface BuildTemplateContext { config: MaizzleConfig; renderer: Renderer; events: EventManager; outputPath: string; outputExtension: string; contentBase: string; } interface BuildTemplateResult { /** Output files written for this template (html + optional plaintext). */ files: string[]; /** * Number of SFC-registered `afterBuild` handlers seen while rendering. They * only fire once at end of build on the main thread, so a worker can't run * them — the count lets the orchestrator warn instead of silently dropping. */ sfcAfterBuildCount: number; } /** * Render a single template through the full pipeline and write its output. * * Shared by the sequential build loop and the parallel build worker so both * paths produce byte-identical output. `events` is the manager the per-template * events fire on (config handlers registered via `registerConfig`, SFC handlers * registered here from the render). The caller owns build-scoped events * (`beforeCreate`/`afterBuild`). */ declare function buildTemplate(templatePath: string, ctx: BuildTemplateContext): Promise<BuildTemplateResult>; /** * Extract the static (non-glob) prefix from content patterns. * * For example, `['/abs/path/emails/**\/*.vue']` → `'/abs/path/emails'` * * Used to strip the content base from template paths so the output preserves * only the subdirectory structure. * * With multiple positive patterns (multi-root setups), returns their common * ancestor directory so templates from every root keep a clean relative path. */ declare function computeContentBase(patterns: string[]): string; declare function resolveOutputPath(templatePath: string, outputDir: string, extension: string, contentBase: string): string; //#endregion export { BuildTemplateContext, BuildTemplateResult, buildTemplate, computeContentBase, resolveOutputPath }; //# sourceMappingURL=buildTemplate.d.ts.map