Skip to content

Commit

Permalink
feat: add the typescript declaration file (#241)
Browse files Browse the repository at this point in the history
Co-authored-by: Favna <[email protected]>
  • Loading branch information
himself65 and favna authored Mar 17, 2020
1 parent bccf485 commit 37bb7a1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"engines": {
"node": ">=6"
},
"types": "./types/index.d.ts",
"homepage": "https://github.com/egoist/rollup-plugin-postcss#readme",
"devDependencies": {
"@babel/core": "^7.2.2",
Expand Down
44 changes: 44 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Plugin } from 'rollup'
import { CreateFilter } from 'rollup-pluginutils'

type FunctionType<T = any, U = any> = (...args: T[]) => U;

type onExtract = (asset: {
code: any
map: any
codeFileName: string
mapFileName: string
}) => boolean

export type PostCSSPluginConf = {
inject?: boolean | { [key: string]: any } | ((cssVariableName: string, id: string) => string)
extract?: boolean | string
onExtract?: onExtract
modules?: boolean | { [key: string]: any }
extensions?: string[]
plugins?: any[]
autoModules?: boolean
namedExports?: boolean | ((id: string) => boolean)
minimize?: boolean | any
parser?: string | FunctionType
stringifier?: string | FunctionType
syntax?: string | FunctionType
exec?: boolean
config?: boolean | {
path: string
ctx: any
};
to?: string
name?: any[] | any[][]
loaders?: any[]
onImport?: (id: string) => void
use?: string[] | { [key in 'sass' | 'stylus' | 'less']: any }
/**
* @default: false
**/
sourceMap?: boolean | 'inline'
include?: Parameters<CreateFilter>[0]
exclude?: Parameters<CreateFilter>[1]
}

export default function (options: PostCSSPluginConf): Plugin

0 comments on commit 37bb7a1

Please sign in to comment.