UNPKG

3.08 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 /**
12 * @deprecated will be removed. In tags use `this.parser` instead
13 */
14 readonly parser: Parser;
15 readonly filters: Record<string, FilterImplOptions>;
16 readonly tags: Record<string, TagClass>;
17 constructor(opts?: LiquidOptions);
18 parse(html: string, filepath?: string): Template[];
19 _render(tpl: Template[], scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator<any>;
20 render(tpl: Template[], scope?: object, renderOptions?: RenderOptions): Promise<any>;
21 renderSync(tpl: Template[], scope?: object, renderOptions?: RenderOptions): any;
22 renderToNodeStream(tpl: Template[], scope?: object, renderOptions?: RenderOptions): NodeJS.ReadableStream;
23 _parseAndRender(html: string, scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator<any>;
24 parseAndRender(html: string, scope?: Context | object, renderOptions?: RenderOptions): Promise<any>;
25 parseAndRenderSync(html: string, scope?: Context | object, renderOptions?: RenderOptions): any;
26 _parsePartialFile(file: string, sync?: boolean, currentFile?: string): Generator<unknown, Template[], string | Template[]>;
27 _parseLayoutFile(file: string, sync?: boolean, currentFile?: string): Generator<unknown, Template[], string | Template[]>;
28 _parseFile(file: string, sync?: boolean, lookupType?: LookupType, currentFile?: string): Generator<unknown, Template[]>;
29 parseFile(file: string, lookupType?: LookupType): Promise<Template[]>;
30 parseFileSync(file: string, lookupType?: LookupType): Template[];
31 _renderFile(file: string, ctx: Context | object | undefined, renderFileOptions: RenderFileOptions): Generator<any>;
32 renderFile(file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions): Promise<any>;
33 renderFileSync(file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions): any;
34 renderFileToNodeStream(file: string, scope?: object, renderOptions?: RenderOptions): Promise<NodeJS.ReadableStream>;
35 _evalValue(str: string, scope?: object | Context): IterableIterator<any>;
36 evalValue(str: string, scope?: object | Context): Promise<any>;
37 evalValueSync(str: string, scope?: object | Context): any;
38 registerFilter(name: string, filter: FilterImplOptions): void;
39 registerTag(name: string, tag: TagClass | TagImplOptions): void;
40 plugin(plugin: (this: Liquid, L: typeof Liquid) => void): void;
41 express(): (this: any, filePath: string, ctx: object, callback: (err: Error | null, rendered: string) => void) => void;
42}