1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | declare function browserslist(
|
13 | queries?: string | readonly string[] | null,
|
14 | opts?: browserslist.Options
|
15 | ): string[]
|
16 |
|
17 | declare namespace browserslist {
|
18 | interface Query {
|
19 | compose: 'or' | 'and'
|
20 | type: string
|
21 | query: string
|
22 | not?: true
|
23 | }
|
24 |
|
25 | interface Options {
|
26 | |
27 |
|
28 |
|
29 | path?: string | false
|
30 | |
31 |
|
32 |
|
33 |
|
34 | env?: string
|
35 | |
36 |
|
37 |
|
38 | stats?: Stats | string
|
39 | |
40 |
|
41 |
|
42 | config?: string
|
43 | |
44 |
|
45 |
|
46 | ignoreUnknownVersions?: boolean
|
47 | |
48 |
|
49 |
|
50 | throwOnMissing?: boolean
|
51 | |
52 |
|
53 |
|
54 | dangerousExtend?: boolean
|
55 | |
56 |
|
57 |
|
58 |
|
59 | mobileToDesktop?: boolean
|
60 | }
|
61 |
|
62 | type Config = {
|
63 | defaults: string[]
|
64 | [section: string]: string[] | undefined
|
65 | }
|
66 |
|
67 | interface Stats {
|
68 | [browser: string]: {
|
69 | [version: string]: number
|
70 | }
|
71 | }
|
72 |
|
73 | |
74 |
|
75 |
|
76 | let aliases: {
|
77 | [alias: string]: string | undefined
|
78 | }
|
79 |
|
80 | |
81 |
|
82 |
|
83 | let versionAliases: {
|
84 | [browser: string]:
|
85 | | {
|
86 | [version: string]: string | undefined
|
87 | }
|
88 | | undefined
|
89 | }
|
90 |
|
91 | |
92 |
|
93 |
|
94 |
|
95 |
|
96 | let desktopNames: {
|
97 | [browser: string]: string | undefined
|
98 | }
|
99 |
|
100 | let data: {
|
101 | [browser: string]:
|
102 | | {
|
103 | name: string
|
104 | versions: string[]
|
105 | released: string[]
|
106 | releaseDate: {
|
107 | [version: string]: number | undefined | null
|
108 | }
|
109 | }
|
110 | | undefined
|
111 | }
|
112 |
|
113 | let nodeVersions: string[]
|
114 |
|
115 | interface Usage {
|
116 | [version: string]: number
|
117 | }
|
118 |
|
119 | let usage: {
|
120 | global?: Usage
|
121 | custom?: Usage | null
|
122 | [country: string]: Usage | undefined | null
|
123 | }
|
124 |
|
125 | let cache: {
|
126 | [feature: string]: {
|
127 | [name: string]: {
|
128 | [version: string]: string
|
129 | }
|
130 | }
|
131 | }
|
132 |
|
133 | |
134 |
|
135 |
|
136 | let defaults: readonly string[]
|
137 |
|
138 | |
139 |
|
140 |
|
141 |
|
142 | type StatsOptions = string | 'my stats' | Stats | { dataByBrowser: Stats }
|
143 |
|
144 | |
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | function coverage(browsers: readonly string[], stats?: StatsOptions): number
|
156 |
|
157 | /**
|
158 | * Get queries AST to analyze the config content.
|
159 | *
|
160 | * @param queries Browser queries.
|
161 | * @param opts Options.
|
162 | * @returns An array of the data of each query in the config.
|
163 | */
|
164 | function parse(
|
165 | queries?: string | readonly string[] | null,
|
166 | opts?: browserslist.Options
|
167 | ): Query[]
|
168 |
|
169 | /**
|
170 | * Return queries for specific file inside the project.
|
171 | *
|
172 | * ```js
|
173 | * browserslist.loadConfig({
|
174 | * file: process.cwd()
|
175 | * }) ?? browserslist.defaults
|
176 | * ```
|
177 | */
|
178 | function loadConfig(options: LoadConfigOptions): string[] | undefined
|
179 |
|
180 | function clearCaches(): void
|
181 |
|
182 | function parseConfig(string: string): Config
|
183 |
|
184 | function readConfig(file: string): Config
|
185 |
|
186 | function findConfig(...pathSegments: string[]): Config | undefined
|
187 |
|
188 | function findConfigFile(...pathSegments: string[]): string | undefined
|
189 |
|
190 | interface LoadConfigOptions {
|
191 | /**
|
192 | * Path to config file
|
193 | * */
|
194 | config?: string
|
195 |
|
196 | /**
|
197 | * Path to file inside the project to find Browserslist config
|
198 | * in closest folder
|
199 | */
|
200 | path?: string
|
201 |
|
202 | /**
|
203 | * Environment to choose part of config.
|
204 | */
|
205 | env?: string
|
206 | }
|
207 | }
|
208 |
|
209 | declare global {
|
210 | namespace NodeJS {
|
211 | interface ProcessEnv {
|
212 | BROWSERSLIST?: string
|
213 | BROWSERSLIST_CONFIG?: string
|
214 | BROWSERSLIST_DANGEROUS_EXTEND?: string
|
215 | BROWSERSLIST_DISABLE_CACHE?: string
|
216 | BROWSERSLIST_ENV?: string
|
217 | BROWSERSLIST_IGNORE_OLD_DATA?: string
|
218 | BROWSERSLIST_STATS?: string
|
219 | BROWSERSLIST_ROOT_PATH?: string
|
220 | }
|
221 | }
|
222 | }
|
223 |
|
224 | export = browserslist
|
225 |
|
\ | No newline at end of file |