UNPKG

2.99 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Context } from './context';
3import { TagClass, TagImplOptions, FilterImplOptions, Template } from './template';
4import { LookupType } from './fs/loader';
5import { Render } from './render';
6import { Parser } from './parser';
7import { LiquidOptions, NormalizedFullOptions, RenderOptions, RenderFileOptions } from './liquid-options';
8export declare class Liquid {
9 readonly options: NormalizedFullOptions;
10 readonly renderer: Render;
11 readonly parser: Parser;
12 readonly filters: Record<string, FilterImplOptions>;
13 readonly tags: Record<string, TagClass>;
14 constructor(opts?: LiquidOptions);
15 parse(html: string, filepath?: string): Template[];
16 _render(tpl: Template[], scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator<any>;
17 render(tpl: Template[], scope?: object, renderOptions?: RenderOptions): Promise<any>;
18 renderSync(tpl: Template[], scope?: object, renderOptions?: RenderOptions): any;
19 renderToNodeStream(tpl: Template[], scope?: object, renderOptions?: RenderOptions): NodeJS.ReadableStream;
20 _parseAndRender(html: string, scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator<any>;
21 parseAndRender(html: string, scope?: Context | object, renderOptions?: RenderOptions): Promise<any>;
22 parseAndRenderSync(html: string, scope?: Context | object, renderOptions?: RenderOptions): any;
23 _parsePartialFile(file: string, sync?: boolean, currentFile?: string): Generator<unknown, Template[], string | Template[]>;
24 _parseLayoutFile(file: string, sync?: boolean, currentFile?: string): Generator<unknown, Template[], string | Template[]>;
25 _parseFile(file: string, sync?: boolean, lookupType?: LookupType, currentFile?: string): Generator<unknown, Template[]>;
26 parseFile(file: string, lookupType?: LookupType): Promise<Template[]>;
27 parseFileSync(file: string, lookupType?: LookupType): Template[];
28 _renderFile(file: string, ctx: Context | object | undefined, renderFileOptions: RenderFileOptions): Generator<any>;
29 renderFile(file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions): Promise<any>;
30 renderFileSync(file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions): any;
31 renderFileToNodeStream(file: string, scope?: object, renderOptions?: RenderOptions): Promise<NodeJS.ReadableStream>;
32 _evalValue(str: string, scope?: object | Context): IterableIterator<any>;
33 evalValue(str: string, scope?: object | Context): Promise<any>;
34 evalValueSync(str: string, scope?: object | Context): any;
35 registerFilter(name: string, filter: FilterImplOptions): void;
36 registerTag(name: string, tag: TagClass | TagImplOptions): void;
37 plugin(plugin: (this: Liquid, L: typeof Liquid) => void): void;
38 express(): (this: any, filePath: string, ctx: object, callback: (err: Error | null, rendered: string) => void) => void;
39}