browserslist 4.17.5 → 4.19.0

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/browser.js CHANGED
@@ -1,36 +1,40 @@
1
1
  var BrowserslistError = require('./error')
2
2
 
3
- function noop () { }
3
+ function noop() {}
4
4
 
5
5
  module.exports = {
6
- loadQueries: function loadQueries () {
6
+ loadQueries: function loadQueries() {
7
7
  throw new BrowserslistError(
8
- 'Sharable configs are not supported in client-side build of Browserslist')
8
+ 'Sharable configs are not supported in client-side build of Browserslist'
9
+ )
9
10
  },
10
11
 
11
- getStat: function getStat (opts) {
12
+ getStat: function getStat(opts) {
12
13
  return opts.stats
13
14
  },
14
15
 
15
- loadConfig: function loadConfig (opts) {
16
+ loadConfig: function loadConfig(opts) {
16
17
  if (opts.config) {
17
18
  throw new BrowserslistError(
18
- 'Browserslist config are not supported in client-side build')
19
+ 'Browserslist config are not supported in client-side build'
20
+ )
19
21
  }
20
22
  },
21
23
 
22
- loadCountry: function loadCountry () {
24
+ loadCountry: function loadCountry() {
23
25
  throw new BrowserslistError(
24
26
  'Country statistics are not supported ' +
25
- 'in client-side build of Browserslist')
27
+ 'in client-side build of Browserslist'
28
+ )
26
29
  },
27
30
 
28
- loadFeature: function loadFeature () {
31
+ loadFeature: function loadFeature() {
29
32
  throw new BrowserslistError(
30
- 'Supports queries are not available in client-side build of Browserslist')
33
+ 'Supports queries are not available in client-side build of Browserslist'
34
+ )
31
35
  },
32
36
 
33
- currentNode: function currentNode (resolve, context) {
37
+ currentNode: function currentNode(resolve, context) {
34
38
  return resolve(['maintained node versions'], context)[0]
35
39
  },
36
40
 
package/cli.js CHANGED
@@ -8,26 +8,28 @@ var pkg = require('./package.json')
8
8
 
9
9
  var args = process.argv.slice(2)
10
10
 
11
- var USAGE = 'Usage:\n' +
12
- ' npx browserslist\n' +
13
- ' npx browserslist "QUERIES"\n' +
14
- ' npx browserslist --json "QUERIES"\n' +
15
- ' npx browserslist --config="path/to/browserlist/file"\n' +
16
- ' npx browserslist --coverage "QUERIES"\n' +
17
- ' npx browserslist --coverage=US "QUERIES"\n' +
18
- ' npx browserslist --coverage=US,RU,global "QUERIES"\n' +
19
- ' npx browserslist --env="environment name defined in config"\n' +
20
- ' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
21
- ' npx browserslist --mobile-to-desktop\n' +
22
- ' npx browserslist --update-db'
23
-
24
- function isArg (arg) {
11
+ var USAGE =
12
+ 'Usage:\n' +
13
+ ' npx browserslist\n' +
14
+ ' npx browserslist "QUERIES"\n' +
15
+ ' npx browserslist --json "QUERIES"\n' +
16
+ ' npx browserslist --config="path/to/browserlist/file"\n' +
17
+ ' npx browserslist --coverage "QUERIES"\n' +
18
+ ' npx browserslist --coverage=US "QUERIES"\n' +
19
+ ' npx browserslist --coverage=US,RU,global "QUERIES"\n' +
20
+ ' npx browserslist --env="environment name defined in config"\n' +
21
+ ' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
22
+ ' npx browserslist --mobile-to-desktop\n' +
23
+ ' npx browserslist --ignore-unknown-versions' +
24
+ ' npx browserslist --update-db'
25
+
26
+ function isArg(arg) {
25
27
  return args.some(function (str) {
26
28
  return str === arg || str.indexOf(arg + '=') === 0
27
29
  })
28
30
  }
29
31
 
30
- function error (msg) {
32
+ function error(msg) {
31
33
  process.stderr.write('browserslist: ' + msg + '\n')
32
34
  process.exit(1)
33
35
  }
@@ -37,12 +39,13 @@ if (isArg('--help') || isArg('-h')) {
37
39
  } else if (isArg('--version') || isArg('-v')) {
38
40
  process.stdout.write('browserslist ' + pkg.version + '\n')
39
41
  } else if (isArg('--update-db')) {
42
+ /* c8 ignore next 3 */
40
43
  updateDb(function (str) {
41
44
  process.stdout.write(str)
42
45
  })
43
46
  } else {
44
47
  var mode = 'browsers'
45
- var opts = { }
48
+ var opts = {}
46
49
  var queries
47
50
  var areas
48
51
 
@@ -74,7 +77,11 @@ if (isArg('--help') || isArg('-h')) {
74
77
  } else if (name === '--json') {
75
78
  mode = 'json'
76
79
  } else if (name === '--mobile-to-desktop') {
80
+ /* c8 ignore next */
77
81
  opts.mobileToDesktop = true
82
+ } else if (name === '--ignore-unknown-versions') {
83
+ /* c8 ignore next */
84
+ opts.ignoreUnknownVersions = true
78
85
  } else {
79
86
  error('Unknown arguments ' + args[i] + '.\n\n' + USAGE)
80
87
  }
@@ -86,9 +93,9 @@ if (isArg('--help') || isArg('-h')) {
86
93
  } catch (e) {
87
94
  if (e.name === 'BrowserslistError') {
88
95
  error(e.message)
89
- } else {
96
+ } else /* c8 ignore start */ {
90
97
  throw e
91
- }
98
+ } /* c8 ignore end */
92
99
  }
93
100
 
94
101
  var coverage
@@ -138,7 +145,7 @@ if (isArg('--help') || isArg('-h')) {
138
145
  data.coverage = coverage.reduce(function (object, j) {
139
146
  object[j[0]] = j[1]
140
147
  return object
141
- }, { })
148
+ }, {})
142
149
  }
143
150
  process.stdout.write(JSON.stringify(data, null, ' ') + '\n')
144
151
  }
package/error.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  declare class BrowserslistError extends Error {
2
- constructor(message: any);
3
- name: 'BrowserslistError';
4
- browserslist: true;
2
+ constructor(message: any)
3
+ name: 'BrowserslistError'
4
+ browserslist: true
5
5
  }
6
6
 
7
- export = BrowserslistError;
7
+ export = BrowserslistError
package/error.js CHANGED
@@ -1,4 +1,4 @@
1
- function BrowserslistError (message) {
1
+ function BrowserslistError(message) {
2
2
  this.name = 'BrowserslistError'
3
3
  this.message = message
4
4
  this.browserslist = true
package/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @param queries Browser queries.
9
9
  * @returns Array with browser names in Can I Use.
10
10
  */
11
- declare function browserslist (
11
+ declare function browserslist(
12
12
  queries?: string | readonly string[] | null,
13
13
  opts?: browserslist.Options
14
14
  ): string[]
@@ -136,15 +136,15 @@ declare namespace browserslist {
136
136
  * @param stats Which statistics should be used.
137
137
  * @returns Total market coverage for all selected browsers.
138
138
  */
139
- function coverage (browsers: readonly string[], stats?: StatsOptions): number
139
+ function coverage(browsers: readonly string[], stats?: StatsOptions): number
140
140
 
141
- function clearCaches (): void
141
+ function clearCaches(): void
142
142
 
143
- function parseConfig (string: string): Config
143
+ function parseConfig(string: string): Config
144
144
 
145
- function readConfig (file: string): Config
145
+ function readConfig(file: string): Config
146
146
 
147
- function findConfig (...pathSegments: string[]): Config | undefined
147
+ function findConfig(...pathSegments: string[]): Config | undefined
148
148
 
149
149
  interface LoadConfigOptions {
150
150
  config?: string
@@ -152,7 +152,7 @@ declare namespace browserslist {
152
152
  env?: string
153
153
  }
154
154
 
155
- function loadConfig (options: LoadConfigOptions): string[] | undefined
155
+ function loadConfig(options: LoadConfigOptions): string[] | undefined
156
156
  }
157
157
 
158
158
  declare global {