index.d.ts 2.3 KB

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