browserslist 4.28.1 → 4.28.3

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright 2014 Andrey Sitnik <andrey@sitnik.ru> and other contributors
3
+ Copyright 2014 Andrey Sitnik <andrey@sitnik.es> and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -6,13 +6,13 @@
6
6
  The config to share target browsers and Node.js versions between different
7
7
  front-end tools. It is used in:
8
8
 
9
- * [Autoprefixer]
10
- * [Babel]
11
- * [postcss-preset-env]
12
- * [eslint-plugin-compat]
13
- * [stylelint-no-unsupported-browser-features]
14
- * [postcss-normalize]
15
- * [obsolete-webpack-plugin]
9
+ - [Autoprefixer]
10
+ - [Babel]
11
+ - [postcss-preset-env]
12
+ - [eslint-plugin-compat]
13
+ - [stylelint-no-unsupported-browser-features]
14
+ - [postcss-normalize]
15
+ - [obsolete-webpack-plugin]
16
16
 
17
17
  All tools will find target browsers automatically,
18
18
  when you add the following to `package.json`:
@@ -50,16 +50,12 @@ You can check how config works at our playground: [`browsersl.ist`](https://brow
50
50
  </div>
51
51
 
52
52
  [stylelint-no-unsupported-browser-features]: https://github.com/ismay/stylelint-no-unsupported-browser-features
53
- [obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
54
- [eslint-plugin-compat]: https://github.com/amilajack/eslint-plugin-compat
55
- [Browserslist Example]: https://github.com/browserslist/browserslist-example
56
- [postcss-preset-env]: https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env
57
- [postcss-normalize]: https://github.com/csstools/postcss-normalize
58
- [`browsersl.ist`]: https://browsersl.ist/
59
- [`caniuse-lite`]: https://github.com/ben-eb/caniuse-lite
60
- [Autoprefixer]: https://github.com/postcss/autoprefixer
61
- [Can I Use]: https://caniuse.com/
62
- [Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
63
-
64
- ## Docs
65
- Read full docs **[here](https://github.com/browserslist/browserslist#readme)**.
53
+ [obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
54
+ [eslint-plugin-compat]: https://github.com/amilajack/eslint-plugin-compat
55
+ [postcss-preset-env]: https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env
56
+ [postcss-normalize]: https://github.com/csstools/postcss-normalize
57
+ [`browsersl.ist`]: https://browsersl.ist/
58
+ [`caniuse-lite`]: https://github.com/ben-eb/caniuse-lite
59
+ [Autoprefixer]: https://github.com/postcss/autoprefixer
60
+ [Can I Use]: https://caniuse.com/
61
+ [Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
package/cli.js CHANGED
@@ -38,7 +38,6 @@ if (isArg('--help') || isArg('-h')) {
38
38
  } else if (isArg('--version') || isArg('-v')) {
39
39
  process.stdout.write('browserslist ' + pkg.version + '\n')
40
40
  } else if (isArg('--update-db')) {
41
- /* c8 ignore next 8 */
42
41
  process.stdout.write(
43
42
  'The --update-db command is deprecated.\n' +
44
43
  'Please use npx update-browserslist-db@latest instead.\n'
package/index.js CHANGED
@@ -7,14 +7,13 @@ var path = require('path')
7
7
 
8
8
  var BrowserslistError = require('./error')
9
9
  var env = require('./node')
10
- var parseWithoutCache = require('./parse') // Will load browser.js in webpack
10
+ var parseWithoutCache = require('./parse')
11
11
 
12
12
  var YEAR = 365.259641 * 24 * 60 * 60 * 1000
13
13
  var ANDROID_EVERGREEN_FIRST = '37'
14
14
  var OP_MOB_BLINK_FIRST = 14
15
15
  var FIREFOX_ESR_VERSION = '140'
16
16
 
17
- // Helpers
18
17
 
19
18
  function isVersionsMatch(versionA, versionB) {
20
19
  return (versionA + '.').indexOf(versionB + '.') === 0
@@ -150,14 +149,11 @@ function compareSemver(a, b) {
150
149
  )
151
150
  }
152
151
 
153
- // this follows the npm-like semver behavior
154
152
  function semverFilterLoose(operator, range) {
155
153
  range = range.split('.').map(parseSimpleInt)
156
154
  if (typeof range[1] === 'undefined') {
157
155
  range[1] = 'x'
158
156
  }
159
- // ignore any patch version because we only return minor versions
160
- // range[2] = 'x'
161
157
  switch (operator) {
162
158
  case '<=':
163
159
  return function (version) {
@@ -173,7 +169,6 @@ function semverFilterLoose(operator, range) {
173
169
  }
174
170
  }
175
171
 
176
- // this follows the npm-like semver behavior
177
172
  function compareSemverLoose(version, range) {
178
173
  if (version[0] !== range[0]) {
179
174
  return version[0] < range[0] ? -1 : +1
@@ -255,10 +250,14 @@ function normalizeAndroidVersions(androidVersions, chromeVersions) {
255
250
  .concat(chromeVersions.slice(iFirstEvergreen))
256
251
  }
257
252
 
253
+ var DANGEROUS_KEYS = ['__proto__', 'constructor', 'prototype']
254
+
258
255
  function copyObject(obj) {
259
256
  var copy = {}
260
257
  for (var key in obj) {
261
- copy[key] = obj[key]
258
+ if (DANGEROUS_KEYS.indexOf(key) === -1) {
259
+ copy[key] = obj[key]
260
+ }
262
261
  }
263
262
  return copy
264
263
  }
@@ -290,8 +289,6 @@ function unknownQuery(query) {
290
289
  )
291
290
  }
292
291
 
293
- // Adjusts last X versions queries for some mobile browsers,
294
- // where caniuse data jumps from a legacy version to the latest
295
292
  function filterJumps(list, name, nVersions, context) {
296
293
  var jump = 1
297
294
  switch (name) {
@@ -414,7 +411,6 @@ function browserslist(queries, opts) {
414
411
  mobileToDesktop: opts.mobileToDesktop,
415
412
  env: opts.env
416
413
  }
417
- // Removing to avoid using context.path without marking query as needsPath
418
414
  if (needsPath) {
419
415
  context.path = opts.path
420
416
  }
@@ -435,9 +431,6 @@ function browserslist(queries, opts) {
435
431
  name1 = name1.split(' ')
436
432
  name2 = name2.split(' ')
437
433
  if (name1[0] === name2[0]) {
438
- // assumptions on caniuse data
439
- // 1) version ranges never overlaps
440
- // 2) if version is not a range, it never contains `-`
441
434
  var version1 = name1[1].split('-')[0]
442
435
  var version2 = name2[1].split('-')[0]
443
436
  return compareSemver(version2.split('.'), version1.split('.'))
@@ -482,7 +475,6 @@ browserslist.parse = function (queries, opts) {
482
475
  return parseQueries(queries)
483
476
  }
484
477
 
485
- // Will be filled by Can I Use data below
486
478
  browserslist.cache = {}
487
479
  browserslist.data = {}
488
480
  browserslist.usage = {
@@ -490,10 +482,8 @@ browserslist.usage = {
490
482
  custom: null
491
483
  }
492
484
 
493
- // Default browsers query
494
485
  browserslist.defaults = ['> 0.5%', 'last 2 versions', 'Firefox ESR', 'not dead']
495
486
 
496
- // Browser names aliases
497
487
  browserslist.aliases = {
498
488
  fx: 'firefox',
499
489
  ff: 'firefox',
@@ -509,17 +499,13 @@ browserslist.aliases = {
509
499
  qqandroid: 'and_qq'
510
500
  }
511
501
 
512
- // Can I Use only provides a few versions for some browsers (e.g. and_chr).
513
- // Fallback to a similar browser for unknown versions
514
- // Note op_mob is not included as its chromium versions are not in sync with Opera desktop
515
502
  browserslist.desktopNames = {
516
503
  and_chr: 'chrome',
517
504
  and_ff: 'firefox',
518
505
  ie_mob: 'ie',
519
- android: 'chrome' // has extra processing logic
506
+ android: 'chrome'
520
507
  }
521
508
 
522
- // Aliases to work with joined versions like `ios_saf 7.0-7.1`
523
509
  browserslist.versionAliases = {}
524
510
 
525
511
  browserslist.clearCaches = env.clearCaches
@@ -812,20 +798,14 @@ var QUERIES = {
812
798
  },
813
799
  baseline: {
814
800
  matches: ['year', 'availability', 'date', 'downstream', 'kaios'],
815
- // Matches:
816
- // baseline 2024
817
- // baseline newly available
818
- // baseline widely available
819
- // baseline widely available on 2024-06-01
820
- // ...with downstream
821
- // ...including kaios
822
801
  regexp:
823
802
  /^baseline\s+(?:(\d+)|(newly|widely)\s+available(?:\s+on\s+(\d{4}-\d{2}-\d{2}))?)?(\s+with\s+downstream)?(\s+including\s+kaios)?$/i,
824
803
  select: function (context, node) {
825
804
  var baselineVersions
826
805
  var includeDownstream = !!node.downstream
827
806
  var includeKaiOS = !!node.kaios
828
- if (node.availability === 'newly' && node.date) {
807
+ var availability = node.availability && node.availability.toLowerCase()
808
+ if (availability === 'newly' && node.date) {
829
809
  throw new BrowserslistError(
830
810
  'Using newly available with a date is not supported, please use "widely available on YYYY-MM-DD" and add 30 months to the date you specified.'
831
811
  )
@@ -844,7 +824,7 @@ var QUERIES = {
844
824
  includeKaiOS: includeKaiOS,
845
825
  suppressWarnings: true
846
826
  })
847
- } else if (node.availability === 'newly') {
827
+ } else if (availability === 'newly') {
848
828
  var future30months = new Date().setMonth(new Date().getMonth() + 30)
849
829
  baselineVersions = bbm.getCompatibleVersions({
850
830
  widelyAvailableOnDate: future30months,
@@ -1016,7 +996,6 @@ var QUERIES = {
1016
996
  var result = []
1017
997
  for (var name in features) {
1018
998
  var data = byName(name, context)
1019
- // Only check desktop when latest released mobile has support
1020
999
  var iMax = data.released.length - 1
1021
1000
  while (iMax >= 0) {
1022
1001
  if (data.released[iMax] in features[name]) break
@@ -1298,7 +1277,6 @@ var QUERIES = {
1298
1277
  }
1299
1278
  }
1300
1279
 
1301
- // Get and convert Can I Use data
1302
1280
 
1303
1281
  ;(function () {
1304
1282
  for (var name in agents) {
package/node.js CHANGED
@@ -27,7 +27,7 @@ function checkExtend(name) {
27
27
  'Browserslist config needs `browserslist-config-` prefix. ' + use
28
28
  )
29
29
  }
30
- if (name.replace(/^@[^/]+\//, '').indexOf('.') !== -1) {
30
+ if (name.replace(/^@[^/]+\
31
31
  throw new BrowserslistError(
32
32
  '`.` not allowed in Browserslist config name. ' + use
33
33
  )
@@ -44,7 +44,6 @@ function getPathType(filepath) {
44
44
  try {
45
45
  stats = fs.existsSync(filepath) && fs.statSync(filepath)
46
46
  } catch (err) {
47
- /* c8 ignore start */
48
47
  if (
49
48
  err.code !== 'ENOENT' &&
50
49
  err.code !== 'EACCES' &&
@@ -52,7 +51,6 @@ function getPathType(filepath) {
52
51
  ) {
53
52
  throw err
54
53
  }
55
- /* c8 ignore end */
56
54
  }
57
55
 
58
56
  if (stats && stats.isDirectory()) return PATHTYPE_DIR
@@ -239,8 +237,6 @@ function normalizeStats(data, stats) {
239
237
  function normalizeUsageData(usageData, data) {
240
238
  for (var browser in usageData) {
241
239
  var browserUsage = usageData[browser]
242
- // https://github.com/browserslist/browserslist/issues/431#issuecomment-565230615
243
- // caniuse-db returns { 0: "percentage" } for `and_*` regional stats
244
240
  if ('0' in browserUsage) {
245
241
  var versions = data[browser].versions
246
242
  browserUsage[versions[versions.length - 1]] = browserUsage[0]
@@ -279,7 +275,6 @@ module.exports = {
279
275
  checkExtend(name)
280
276
  }
281
277
  var stats = require(
282
- // Use forward slashes for module paths, also on Windows.
283
278
  require.resolve(path.posix.join(name, 'browserslist-stats.json'), {
284
279
  paths: ['.']
285
280
  })
@@ -337,7 +332,7 @@ module.exports = {
337
332
  }
338
333
  var usageData = region(compressed)
339
334
  normalizeUsageData(usageData, data)
340
- usage[country] = {}
335
+ usage[country] = Object.create(null)
341
336
  for (var i in usageData) {
342
337
  for (var j in usageData[i]) {
343
338
  usage[country][i + ' ' + j] = usageData[i][j]
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "browserslist",
3
- "version": "4.28.1",
3
+ "version": "4.28.3",
4
4
  "description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
5
5
  "keywords": [
6
- "caniuse",
7
6
  "browsers",
7
+ "caniuse",
8
8
  "target"
9
9
  ],
10
+ "license": "MIT",
11
+ "author": "Andrey Sitnik <andrey@sitnik.es>",
12
+ "repository": "browserslist/browserslist",
10
13
  "funding": [
11
14
  {
12
15
  "type": "opencollective",
@@ -21,25 +24,22 @@
21
24
  "url": "https://github.com/sponsors/ai"
22
25
  }
23
26
  ],
24
- "author": "Andrey Sitnik <andrey@sitnik.ru>",
25
- "license": "MIT",
26
- "repository": "browserslist/browserslist",
27
- "dependencies": {
28
- "baseline-browser-mapping": "^2.9.0",
29
- "caniuse-lite": "^1.0.30001759",
30
- "electron-to-chromium": "^1.5.263",
31
- "node-releases": "^2.0.27",
32
- "update-browserslist-db": "^1.2.0"
33
- },
34
- "engines": {
35
- "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
36
- },
37
27
  "bin": {
38
28
  "browserslist": "cli.js"
39
29
  },
40
- "types": "./index.d.ts",
41
30
  "browser": {
42
31
  "./node.js": "./browser.js",
43
32
  "path": false
33
+ },
34
+ "types": "./index.d.ts",
35
+ "dependencies": {
36
+ "baseline-browser-mapping": "^2.10.38",
37
+ "caniuse-lite": "^1.0.30001799",
38
+ "electron-to-chromium": "^1.5.376",
39
+ "node-releases": "^2.0.48",
40
+ "update-browserslist-db": "^1.2.3"
41
+ },
42
+ "engines": {
43
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
44
44
  }
45
45
  }