UNPKG

2.18 kBTypeScriptView Raw
1import type { UnknownObject, HelperDelegateObject, ConfigOptions, Engine, TemplateSpecificationObject, TemplateDelegateObject, FsCache, PartialTemplateOptions, PartialsDirObject, RenderOptions, RenderViewOptions, RenderCallback, HandlebarsImport, CompiledCache, PrecompiledCache } from "../types";
2export default class ExpressHandlebars {
3 config: ConfigOptions;
4 engine: Engine;
5 encoding: BufferEncoding;
6 layoutsDir: string;
7 extname: string;
8 compiled: CompiledCache;
9 precompiled: PrecompiledCache;
10 _fsCache: FsCache;
11 partialsDir: string | PartialsDirObject | (string | PartialsDirObject)[];
12 compilerOptions: CompileOptions;
13 runtimeOptions: RuntimeOptions;
14 helpers: HelperDelegateObject;
15 defaultLayout: string;
16 handlebars: HandlebarsImport;
17 constructor(config?: ConfigOptions);
18 getPartials(options?: PartialTemplateOptions): Promise<TemplateSpecificationObject | TemplateDelegateObject>;
19 getTemplate(filePath: string, options?: PartialTemplateOptions): Promise<HandlebarsTemplateDelegate | TemplateSpecification>;
20 getTemplates(dirPath: string, options?: PartialTemplateOptions): Promise<HandlebarsTemplateDelegate | TemplateSpecification>;
21 render(filePath: string, context?: UnknownObject, options?: RenderOptions): Promise<string>;
22 renderView(viewPath: string): Promise<string>;
23 renderView(viewPath: string, options: RenderViewOptions): Promise<string>;
24 renderView(viewPath: string, callback: RenderCallback): Promise<null>;
25 renderView(viewPath: string, options: RenderViewOptions, callback: RenderCallback): Promise<null>;
26 resetCache(filePathsOrFilter?: string | string[] | ((template: string) => boolean)): void;
27 protected _compileTemplate(template: string, options?: RuntimeOptions): HandlebarsTemplateDelegate;
28 protected _precompileTemplate(template: string, options?: RuntimeOptions): TemplateSpecification;
29 protected _renderTemplate(template: HandlebarsTemplateDelegate, context?: UnknownObject, options?: RuntimeOptions): string;
30 private _getDir;
31 private _getFile;
32 private _getTemplateName;
33 private _resolveViewsPath;
34 private _resolveLayoutPath;
35}