browserslist 4.20.4 → 4.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ var updateDb = require('update-browserslist-db')
3
4
  var fs = require('fs')
4
5
 
5
6
  var browserslist = require('./')
6
- var updateDb = require('./update-db')
7
7
  var pkg = require('./package.json')
8
8
 
9
9
  var args = process.argv.slice(2)
@@ -20,8 +20,7 @@ var USAGE =
20
20
  ' npx browserslist --env="environment name defined in config"\n' +
21
21
  ' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
22
22
  ' npx browserslist --mobile-to-desktop\n' +
23
- ' npx browserslist --ignore-unknown-versions\n' +
24
- ' npx browserslist --update-db'
23
+ ' npx browserslist --ignore-unknown-versions\n'
25
24
 
26
25
  function isArg(arg) {
27
26
  return args.some(function (str) {
@@ -93,7 +92,7 @@ if (isArg('--help') || isArg('-h')) {
93
92
  } catch (e) {
94
93
  if (e.name === 'BrowserslistError') {
95
94
  error(e.message)
96
- } else /* c8 ignore start */ {
95
+ } /* c8 ignore start */ else {
97
96
  throw e
98
97
  } /* c8 ignore end */
99
98
  }
package/index.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  * ```
7
7
  *
8
8
  * @param queries Browser queries.
9
+ * @param opts Options.
9
10
  * @returns Array with browser names in Can I Use.
10
11
  */
11
12
  declare function browserslist(
@@ -14,6 +15,13 @@ declare function browserslist(
14
15
  ): string[]
15
16
 
16
17
  declare namespace browserslist {
18
+ interface Query {
19
+ compose: 'or' | 'and'
20
+ type: string
21
+ query: string
22
+ not?: true
23
+ }
24
+
17
25
  interface Options {
18
26
  /**
19
27
  * Path to processed file. It will be used to find config files.
@@ -144,6 +152,18 @@ declare namespace browserslist {
144
152
  */
145
153
  function coverage(browsers: readonly string[], stats?: StatsOptions): number
146
154
 
155
+ /**
156
+ * Get queries AST to analyze the config content.
157
+ *
158
+ * @param queries Browser queries.
159
+ * @param opts Options.
160
+ * @returns An array of the data of each query in the config.
161
+ */
162
+ function parse(
163
+ queries?: string | readonly string[] | null,
164
+ opts?: browserslist.Options
165
+ ): Query[]
166
+
147
167
  function clearCaches(): void
148
168
 
149
169
  function parseConfig(string: string): Config