source: trip-planner-front/node_modules/browserslist/index.d.ts@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/**
2 * Return array of browsers by selection queries.
3 *
4 * ```js
5 * browserslist('IE >= 10, IE 8') //=> ['ie 11', 'ie 10', 'ie 8']
6 * ```
7 *
8 * @param queries Browser queries.
9 * @returns Array with browser names in Can I Use.
10 */
11declare function browserslist (
12 queries?: string | readonly string[] | null,
13 opts?: browserslist.Options
14): string[]
15
16declare namespace browserslist {
17 interface Options {
18 /**
19 * Path to processed file. It will be used to find config files.
20 */
21 path?: string | false
22 /**
23 * Processing environment. It will be used to take right queries
24 * from config file.
25 */
26 env?: string
27 /**
28 * Custom browser usage statistics for "> 1% in my stats" query.
29 */
30 stats?: Stats | string
31 /**
32 * Path to config file with queries.
33 */
34 config?: string
35 /**
36 * Do not throw on unknown version in direct query.
37 */
38 ignoreUnknownVersions?: boolean
39 /**
40 * Disable security checks for extend query.
41 */
42 dangerousExtend?: boolean
43 /**
44 * Alias mobile browsers to the desktop version when Can I Use
45 * doesn’t have data about the specified version.
46 */
47 mobileToDesktop?: boolean
48 }
49
50 type Config = {
51 defaults: string[]
52 [section: string]: string[] | undefined
53 }
54
55 interface Stats {
56 [browser: string]: {
57 [version: string]: number
58 }
59 }
60
61 /**
62 * Browser names aliases.
63 */
64 let aliases: {
65 [alias: string]: string | undefined
66 }
67
68 /**
69 * Aliases to work with joined versions like `ios_saf 7.0-7.1`.
70 */
71 let versionAliases: {
72 [browser: string]:
73 | {
74 [version: string]: string | undefined
75 }
76 | undefined
77 }
78
79 /**
80 * Can I Use only provides a few versions for some browsers (e.g. `and_chr`).
81 *
82 * Fallback to a similar browser for unknown versions.
83 */
84 let desktopNames: {
85 [browser: string]: string | undefined
86 }
87
88 let data: {
89 [browser: string]:
90 | {
91 name: string
92 versions: string[]
93 released: string[]
94 releaseDate: {
95 [version: string]: number | undefined | null
96 }
97 }
98 | undefined
99 }
100
101 interface Usage {
102 [version: string]: number
103 }
104
105 let usage: {
106 global?: Usage
107 custom?: Usage | null
108 [country: string]: Usage | undefined | null
109 }
110
111 let cache: {
112 [feature: string]: {
113 [name: string]: 'y' | 'n'
114 }
115 }
116
117 /**
118 * Default browsers query
119 */
120 let defaults: readonly string[]
121
122 /**
123 * Which statistics should be used. Country code or custom statistics.
124 * Pass `"my stats"` to load statistics from `Browserslist` files.
125 */
126 type StatsOptions = string | 'my stats' | Stats | { dataByBrowser: Stats }
127
128 /**
129 * Return browsers market coverage.
130 *
131 * ```js
132 * browserslist.coverage(browserslist('> 1% in US'), 'US') //=> 83.1
133 * ```
134 *
135 * @param browsers Browsers names in Can I Use.
136 * @param stats Which statistics should be used.
137 * @returns Total market coverage for all selected browsers.
138 */
139 function coverage (browsers: readonly string[], stats?: StatsOptions): number
140
141 function clearCaches (): void
142
143 function parseConfig (string: string): Config
144
145 function readConfig (file: string): Config
146
147 function findConfig (...pathSegments: string[]): Config | undefined
148
149 interface LoadConfigOptions {
150 config?: string
151 path?: string
152 env?: string
153 }
154
155 function loadConfig (options: LoadConfigOptions): string[] | undefined
156}
157
158declare global {
159 namespace NodeJS {
160 interface ProcessEnv {
161 BROWSERSLIST?: string
162 BROWSERSLIST_CONFIG?: string
163 BROWSERSLIST_DANGEROUS_EXTEND?: string
164 BROWSERSLIST_DISABLE_CACHE?: string
165 BROWSERSLIST_ENV?: string
166 BROWSERSLIST_IGNORE_OLD_DATA?: string
167 BROWSERSLIST_STATS?: string
168 }
169 }
170}
171
172export = browserslist
Note: See TracBrowser for help on using the repository browser.