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