forked from parcel-bundler/parcel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostcss.js.flow
77 lines (64 loc) · 1.62 KB
/
postcss.js.flow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// @flow
// (Only covers the API that Parcel uses)
// Derived from the PostCSS docs available at
// http://api.postcss.org/postcss.html.
import type {SourceMapGenerator} from 'source-map';
declare module 'postcss' {
declare class Processor {
process(css: string | Result, opts?: processOptions): Promise<Result>;
}
declare type processOptions = {|
from?: string,
to?: string,
map?: MapOptions,
parser?: parser,
stringifier?: stringifier,
syntax?: {|
parser: parser,
stringifier: stringifier,
|},
|};
declare type MapOptions = {|
inline?: boolean,
prev?: string | any | false | function,
sourcesContent?: boolean,
annotation?: false | string,
from?: string,
|};
declare type parser = (
css: string,
optsopt: {|from?: string, map?: MapOptions|},
) => Root;
declare type Plugin = {|
postcss(...args: Array<any>): void,
|};
declare type pluginFunction = (root: Root, result: Result) => void;
declare type Root = any;
declare type Result = {
content: string,
css: string,
map: SourceMapGenerator,
messages: Array<Message>,
opts: processOptions,
processor: Processor,
root: Root,
toString(): string,
...
};
declare type Message = {|
type: string,
plugin: string,
|};
declare type builder = (
part: string,
node: Root,
typeopt?: 'start' | 'end',
) => void;
declare type stringifier = (root: Root, builder: builder) => void;
declare module.exports: {
(plugins?: Array<Plugin | pluginFunction> | Processor): Processor,
parse: parser,
stringify: stringifier,
...
};
}