UNPKG

2.07 kBTypeScriptView Raw
1// Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts
2
3/// <reference types="node" />
4
5import Promise = require("bluebird");
6
7declare var cons: Consolidate;
8
9export = cons;
10
11type SupportedTemplateEngines =
12 | "arc-templates"
13 | "atpl"
14 | "bracket"
15 | "dot"
16 | "dust"
17 | "eco"
18 | "ejs"
19 | "ect"
20 | "haml"
21 | "haml-coffee"
22 | "hamlet"
23 | "handlebars"
24 | "hogan"
25 | "htmling"
26 | "jade"
27 | "jazz"
28 | "jqtpl"
29 | "just"
30 | "liquid"
31 | "liquor"
32 | "lodash"
33 | "marko"
34 | "mote"
35 | "mustache"
36 | "nunjucks"
37 | "plates"
38 | "pug"
39 | "qejs"
40 | "ractive"
41 | "razor"
42 | "react"
43 | "slm"
44 | "squirrelly"
45 | "swig"
46 | "teacup"
47 | "templayed"
48 | "toffee"
49 | "twig"
50 | "underscore"
51 | "vash"
52 | "velocityjs"
53 | "walrus"
54 | "whiskers";
55
56type Requires = SupportedTemplateEngines | "extend" | "ReactDOM" | "babel";
57
58type ConsolidateType = {
59 [engine in SupportedTemplateEngines]: RendererInterface;
60};
61
62type RequiresType = {
63 [engine in Requires]: any;
64};
65
66interface Consolidate extends ConsolidateType {
67 /**
68 * expose the instance of the engine
69 */
70 requires: RequiresType;
71
72 /**
73 * Clear the cache.
74 *
75 * @api public
76 */
77 clearCache(): void;
78}
79
80interface RendererInterface {
81 render(path: string, fn: (err: Error, html: string) => any): any;
82
83 render(
84 path: string,
85 options: { cache?: boolean | undefined; [otherOptions: string]: any },
86 fn: (err: Error, html: string) => any,
87 ): any;
88
89 render(path: string, options?: { cache?: boolean | undefined; [otherOptions: string]: any }): Promise<string>;
90
91 (path: string, fn: (err: Error, html: string) => any): any;
92
93 (
94 path: string,
95 options: { cache?: boolean | undefined; [otherOptions: string]: any },
96 fn: (err: Error, html: string) => any,
97 ): any;
98
99 (path: string, options?: { cache?: boolean | undefined; [otherOptions: string]: any }): Promise<string>;
100}