uniapp-x.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. interface PostcssRemToRpxOptions {
  2. remUnit?: number;
  3. remPrecision?: number;
  4. rpxRatio?: number;
  5. }
  6. interface TailwindTransformOptions extends PostcssRemToRpxOptions {
  7. }
  8. /**
  9. * Vite 插件:自动转换 .uvue 文件中的 Tailwind 类名为安全字符
  10. * 并自动注入 rem 转 rpx 的 PostCSS 插件
  11. * @param options 配置项
  12. * @returns Vite 插件对象
  13. */
  14. export declare function tailwindTransformPlugin(options?: TailwindTransformOptions): {
  15. name: string;
  16. enforce: "pre";
  17. config(): {
  18. css: {
  19. postcss: {
  20. plugins: {
  21. postcssPlugin: string;
  22. prepare(): {
  23. Rule(rule: any): void;
  24. Declaration(decl: any): void;
  25. };
  26. }[];
  27. };
  28. };
  29. };
  30. transform(code: string, id: string): {
  31. code: string;
  32. map: {
  33. mappings: string;
  34. };
  35. } | null;
  36. };
  37. /**
  38. * uniappX 入口,自动注入 Tailwind 类名转换插件
  39. * @param options 配置项
  40. * @returns Vite 插件数组
  41. */
  42. export declare function uniappX(options?: {
  43. tailwind?: TailwindTransformOptions;
  44. }): {
  45. name: string;
  46. enforce: "pre";
  47. config(): {
  48. css: {
  49. postcss: {
  50. plugins: {
  51. postcssPlugin: string;
  52. prepare(): {
  53. Rule(rule: any): void;
  54. Declaration(decl: any): void;
  55. };
  56. }[];
  57. };
  58. };
  59. };
  60. transform(code: string, id: string): {
  61. code: string;
  62. map: {
  63. mappings: string;
  64. };
  65. } | null;
  66. }[];
  67. export {};