index.d.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import pug from "pug";
  2. interface ICompilerOptions {
  3. /**
  4. * If set to true, the function source will be included in the compiled template
  5. * for better error messages. It is not enabled by default.
  6. */
  7. debug?: boolean;
  8. /**
  9. * Any configurations to be passed to pug
  10. */
  11. pug?: pug.Options;
  12. }
  13. declare const _default: {
  14. new (): {
  15. /**
  16. * Compiles a pupper template to a Javascript module
  17. * @param template The template to be compiled
  18. * @param options
  19. * @returns
  20. */
  21. compileToString(template: string, options?: ICompilerOptions): string;
  22. /**
  23. * Compiles a pupper template into HTML.
  24. * @param template The template to be compiled
  25. * @param options
  26. * @returns
  27. */
  28. compileTemplate(template: string, options?: ICompilerOptions): string;
  29. /**
  30. * Parses the compiler options into pug options
  31. * and put our plugins into it
  32. * @param options The compiler options
  33. * @returns
  34. */
  35. getPugOptions(options?: ICompilerOptions): pug.Options & {
  36. contents?: string;
  37. };
  38. };
  39. /**
  40. * Creates a new pupper.js compiler
  41. * @returns
  42. */
  43. createCompiler(): {
  44. /**
  45. * Compiles a pupper template to a Javascript module
  46. * @param template The template to be compiled
  47. * @param options
  48. * @returns
  49. */
  50. compileToString(template: string, options?: ICompilerOptions): string;
  51. /**
  52. * Compiles a pupper template into HTML.
  53. * @param template The template to be compiled
  54. * @param options
  55. * @returns
  56. */
  57. compileTemplate(template: string, options?: ICompilerOptions): string;
  58. /**
  59. * Parses the compiler options into pug options
  60. * and put our plugins into it
  61. * @param options The compiler options
  62. * @returns
  63. */
  64. getPugOptions(options?: ICompilerOptions): pug.Options & {
  65. contents?: string;
  66. };
  67. };
  68. };
  69. export = _default;