/// import connect from 'connect'; import { default as ejs_2 } from 'ejs'; import type { FSWatcher } from 'chokidar'; import http from 'http'; import { Liquid } from 'liquidjs'; import MarkdownIt from 'markdown-it'; import path from 'path'; import * as ulka from '@ulkajs/template-engine'; export declare function box(str: string, padding?: number, fn?: Function): string; export declare function build(ulka: Ulka): Promise; export declare function clearConsole(): void; export declare class Collection { ulka: Ulka; name: string; contents: Template[]; config?: ValidContentConfig; constructor(ulka: Ulka, name: string); updateConfig(config: ContentConfig): this; read(): Promise; write(): Promise; getContents(cwd?: string): Promise; paginate(): void; } export declare interface Configs { input: string; output: string; layout: string; contents: { [key: string]: ContentConfig; }; verbose: boolean; plugins: PluginConfig[]; copy: ({ match: string[] | string; output: (path: string) => string; } | string | string[])[]; metaData: { [key: string]: any; }; concurrency: number; } export declare type ContentConfig = Partial; export declare function defineConfig(configs: Partial | ((ulka: Ulka) => Partial) | ((ulka: Ulka) => Promise>)): Partial | ((ulka: Ulka) => Partial) | ((ulka: Ulka) => Promise>); export declare class EjsTemplate extends Template { static ejs: typeof ejs_2; static reset(): void; compile(): Promise<(ctx?: object) => Promise>; get hasMatter(): boolean; get buildExt(): string; } export declare interface Engines { '.ejs': typeof EjsTemplate; '.liquid': typeof LiquidTemplate; '.md': typeof MdTemplate; '.ulka': typeof UlkaTemplate; default: typeof Template; [key: string]: typeof Template; } export declare class FileInfo { filepath: string; parsedpath: path.ParsedPath; buffer: Buffer | undefined; constructor(filepath: string); read(): Promise; get str(): string; } export declare class LiquidTemplate extends Template { static liquid: Liquid; static reset(): void; compile(): Promise<(ctx?: object) => Promise>; get hasMatter(): boolean; get buildExt(): string; } export declare class MdTemplate extends Template { static md: MarkdownIt; static reset(): void; compile(): Promise<(ctx?: object) => Promise>; get hasMatter(): boolean; get buildExt(): string; } declare type Plugin_2 = (options: T) => Partial<{ [key in PluginName]: PluginFunction; }>; export { Plugin_2 as Plugin } export declare type PluginArg = T extends 'beforeRender' | 'afterRender' | 'beforeWrite' | 'afterWrite' | 'beforeCreateContext' | 'afterCreateContext' ? { template: Template; ulka: Ulka; } : { ulka: Ulka; }; export declare type PluginConfig = string | { plugin: string; options: { [key: string]: any; }; } | Plugin_2; export declare type PluginFunction = (arg: PluginArg) => any; export declare type PluginName = 'afterSetup' | 'beforeBuild' | 'afterBuild' | 'beforeCreateContext' | 'afterCreateContext' | 'beforeRender' | 'afterRender' | 'beforeWrite' | 'afterWrite'; export declare type PluginsList = { [key in PluginName]: PluginFunction[]; }; export declare function resolvePlugin(pluginConfig: PluginConfig, ulka: Ulka): void; export declare function runPlugins(name: T, options: PluginArg): Promise; export declare function setup(cwd: string, task: string, cpath: string): Promise; export declare const slugify: (str: string) => string; export declare class Template { ulka: Ulka; fileinfo: FileInfo; configName?: string | undefined; configLayout?: string | ((temp: Template) => string) | null | undefined; configLink?: string | ((temp: Template) => string) | null | undefined; content: string | Buffer; link: string; buildPath: string; context: { [key: string]: any; }; constructor(ulka: Ulka, fileinfo: FileInfo, configName?: string | undefined, configLayout?: string | ((temp: Template) => string) | null | undefined, configLink?: string | ((temp: Template) => string) | null | undefined); static reset(): void; clone(): Template; compile(): Promise<(_ctx?: object) => Promise>; protected layout(content: string | Buffer, ctx?: { [key: string]: any; }): Promise; render(ctx?: object): Promise; write(content?: string | Buffer): Promise; createCtx(ctx?: object): this; readMatter(): this; getBuildPath(ext?: string): { link: string; buildPath: string; }; log(): void; _renderUlkaTemplate(data: string, context?: object): string; get hasMatter(): boolean; get buildExt(): string; get contentShouldBeString(): boolean; } export declare class Ulka { cwd: string; task: string; configpath: string; port: number; engines: Engines; layout?: Collection; configs: Configs; server: UlkaServer; plugins: PluginsList; collections: { [key: string]: Collection; }; collectionContents: any; private constructor(); private _setup; static init(cwd: string, task: string, configpath: string, port?: number): Promise; reset(): Promise; getLayouts(): Promise; getCollections(): Promise; write(): Promise; copy(cwd?: string): Promise; } export declare class UlkaError extends Error { custom: string; constructor(message: string, custom: string); } export declare class UlkaServer { base: string; port: number; app: connect.Server; server: http.Server; wss: { send(data: string): void; reload(): void; reloadCss(): void; }; use: { (fn: connect.NextHandleFunction): connect.Server; (fn: connect.HandleFunction): connect.Server; (route: string, fn: connect.NextHandleFunction): connect.Server; (route: string, fn: connect.HandleFunction): connect.Server; }; constructor(base: string, port: number); findPort(): Promise; listen(fn?: Function): void; log(): void; staticServer(port: number, base: string): connect.NextHandleFunction; } export declare class UlkaTemplate extends Template { static ulka: typeof ulka; compile(): Promise<(ctx?: object) => Promise>; static reset(): void; get hasMatter(): boolean; get buildExt(): string; } export declare interface ValidContentConfig { forEach: (temp: Template, index: number, temps: Template[]) => any; sort: (a: Template, b: Template) => any; match: string | string[]; ignore: string[]; layout: ((temp: Template) => string) | string | null; link: ((temp: Template) => string) | string | null; } export declare function watch(ulka: Ulka, verbose?: boolean, customFn?: Function): Promise; export { }