UNPKG

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