index.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import type { Plugin } from "postcss";
  2. declare type GenerateScopedNameFunction = (
  3. name: string,
  4. filename: string,
  5. css: string
  6. ) => string;
  7. declare type LocalsConventionFunction = (
  8. originalClassName: string,
  9. generatedClassName: string,
  10. inputFile: string
  11. ) => string;
  12. declare class Loader {
  13. constructor(root: string, plugins: Plugin[]);
  14. fetch(
  15. file: string,
  16. relativeTo: string,
  17. depTrace: string
  18. ): Promise<{ [key: string]: string }>;
  19. finalSource?: string | undefined;
  20. }
  21. declare interface Options {
  22. getJSON?(
  23. cssFilename: string,
  24. json: { [name: string]: string },
  25. outputFilename?: string
  26. ): void;
  27. localsConvention?:
  28. | "camelCase"
  29. | "camelCaseOnly"
  30. | "dashes"
  31. | "dashesOnly"
  32. | LocalsConventionFunction;
  33. scopeBehaviour?: "global" | "local";
  34. globalModulePaths?: RegExp[];
  35. generateScopedName?: string | GenerateScopedNameFunction;
  36. hashPrefix?: string;
  37. exportGlobals?: boolean;
  38. root?: string;
  39. Loader?: typeof Loader;
  40. resolve?: (file: string) => string | Promise<string>;
  41. }
  42. declare interface PostcssModulesPlugin {
  43. (options: Options): Plugin;
  44. postcss: true;
  45. }
  46. declare const PostcssModulesPlugin: PostcssModulesPlugin;
  47. export = PostcssModulesPlugin;