UNPKG

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