autoprefixer.d.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { Plugin } from 'postcss'
  2. import { Stats } from 'browserslist'
  3. declare function autoprefixer<T extends string[]>(
  4. ...args: [...T, autoprefixer.Options]
  5. ): Plugin & autoprefixer.ExportedAPI
  6. declare function autoprefixer(
  7. browsers: string[],
  8. options?: autoprefixer.Options
  9. ): Plugin & autoprefixer.ExportedAPI
  10. declare function autoprefixer(
  11. options?: autoprefixer.Options
  12. ): Plugin & autoprefixer.ExportedAPI
  13. declare namespace autoprefixer {
  14. type GridValue = 'autoplace' | 'no-autoplace'
  15. interface Options {
  16. /** environment for `Browserslist` */
  17. env?: string
  18. /** should Autoprefixer use Visual Cascade, if CSS is uncompressed */
  19. cascade?: boolean
  20. /** should Autoprefixer add prefixes. */
  21. add?: boolean
  22. /** should Autoprefixer [remove outdated] prefixes */
  23. remove?: boolean
  24. /** should Autoprefixer add prefixes for @supports parameters. */
  25. supports?: boolean
  26. /** should Autoprefixer add prefixes for flexbox properties */
  27. flexbox?: boolean | 'no-2009'
  28. /** should Autoprefixer add IE 10-11 prefixes for Grid Layout properties */
  29. grid?: boolean | GridValue
  30. /** custom usage statistics for > 10% in my stats browsers query */
  31. stats?: Stats
  32. /**
  33. * list of queries for target browsers.
  34. * Try to not use it.
  35. * The best practice is to use `.browserslistrc` config or `browserslist` key in `package.json`
  36. * to share target browsers with Babel, ESLint and Stylelint
  37. */
  38. overrideBrowserslist?: string | string[]
  39. /** do not raise error on unknown browser version in `Browserslist` config. */
  40. ignoreUnknownVersions?: boolean
  41. }
  42. interface ExportedAPI {
  43. /** Autoprefixer data */
  44. data: {
  45. browsers: { [browser: string]: object | undefined }
  46. prefixes: { [prefixName: string]: object | undefined }
  47. }
  48. /** Autoprefixer default browsers */
  49. defaults: string[]
  50. /** Inspect with default Autoprefixer */
  51. info(options?: { from?: string }): string
  52. options: Options
  53. browsers: string | string[]
  54. }
  55. /** Autoprefixer data */
  56. let data: ExportedAPI['data']
  57. /** Autoprefixer default browsers */
  58. let defaults: ExportedAPI['defaults']
  59. /** Inspect with default Autoprefixer */
  60. let info: ExportedAPI['info']
  61. let postcss: true
  62. }
  63. declare global {
  64. namespace NodeJS {
  65. interface ProcessEnv {
  66. AUTOPREFIXER_GRID?: autoprefixer.GridValue
  67. }
  68. }
  69. }
  70. export = autoprefixer