index.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { HtmlTagDescriptor, PluginOption } from 'vite';
  2. import { Options as Options$1 } from 'ejs';
  3. import { Options } from 'html-minifier-terser';
  4. interface InjectOptions {
  5. /**
  6. * @description Data injected into the html template
  7. */
  8. data?: Record<string, any>;
  9. tags?: HtmlTagDescriptor[];
  10. /**
  11. * @description esj options configuration
  12. */
  13. ejsOptions?: Options$1;
  14. }
  15. interface PageOption {
  16. filename: string;
  17. template: string;
  18. entry?: string;
  19. injectOptions?: InjectOptions;
  20. }
  21. declare type Pages = PageOption[];
  22. interface UserOptions {
  23. /**
  24. * @description Page options
  25. */
  26. pages?: Pages;
  27. /**
  28. * @description Minimize options
  29. */
  30. minify?: Options | boolean;
  31. /**
  32. * page entry
  33. */
  34. entry?: string;
  35. /**
  36. * template path
  37. */
  38. template?: string;
  39. /**
  40. * @description inject options
  41. */
  42. inject?: InjectOptions;
  43. /**
  44. * output warning log
  45. * @default false
  46. */
  47. verbose?: boolean;
  48. }
  49. declare function createHtmlPlugin(userOptions?: UserOptions): PluginOption[];
  50. export { createHtmlPlugin };