browserslist 4.17.0 → 4.17.4

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.
Files changed (3) hide show
  1. package/README.md +2 -644
  2. package/package.json +5 -5
  3. package/update-db.js +14 -19
package/README.md CHANGED
@@ -62,647 +62,5 @@ Browserslist will take queries from tool option,
62
62
  [Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
63
63
  [obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
64
64
 
65
- ## Table of Contents
66
-
67
- * [Tools](#tools)
68
- * [Text Editors](#text-editors)
69
- * [Best Practices](#best-practices)
70
- * [Browsers Data Updating](#browsers-data-updating)
71
- * [Queries](#queries)
72
- * [Query Composition](#query-composition)
73
- * [Full List](#full-list)
74
- * [Debug](#debug)
75
- * [Browsers](#browsers)
76
- * [Config File](#config-file)
77
- * [`package.json`](#packagejson)
78
- * [`.browserslistrc`](#browserslistrc)
79
- * [Shareable Configs](#shareable-configs)
80
- * [Configuring for Different Environments](#configuring-for-different-environments)
81
- * [Custom Usage Data](#custom-usage-data)
82
- * [JS API](#js-api)
83
- * [Environment Variables](#environment-variables)
84
- * [Cache](#cache)
85
- * [Security Contact](#security-contact)
86
- * [For Enterprise](#for-enterprise)
87
-
88
- ## Tools
89
-
90
- * [`browserl.ist`](https://browserl.ist/) is an online tool to check
91
- what browsers will be selected by some query.
92
- * [`browserslist-ga`] and [`browserslist-ga-export`] download your website
93
- browsers statistics to use it in `> 0.5% in my stats` query.
94
- * [`browserslist-useragent-regexp`] compiles Browserslist query to a RegExp
95
- to test browser useragent.
96
- * [`browserslist-useragent-ruby`] is a Ruby library to checks browser
97
- by user agent string to match Browserslist.
98
- * [`browserslist-browserstack`] runs BrowserStack tests for all browsers
99
- in Browserslist config.
100
- * [`browserslist-adobe-analytics`] use Adobe Analytics data to target browsers.
101
- * [`browserslist-new-relic`] generate a custom usage data file for Browserslist
102
- from your New Relic Browser data.
103
- * [`caniuse-api`] returns browsers which support some specific feature.
104
- * Run `npx browserslist` in your project directory to see project’s
105
- target browsers. This CLI tool is built-in and available in any project
106
- with Autoprefixer.
107
-
108
- [`browserslist-useragent-regexp`]: https://github.com/browserslist/browserslist-useragent-regexp
109
- [`browserslist-adobe-analytics`]: https://github.com/xeroxinteractive/browserslist-adobe-analytics
110
- [`browserslist-useragent-ruby`]: https://github.com/browserslist/browserslist-useragent-ruby
111
- [`browserslist-browserstack`]: https://github.com/xeroxinteractive/browserslist-browserstack
112
- [`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
113
- [`browserslist-useragent`]: https://github.com/pastelsky/browserslist-useragent
114
- [`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
115
- [`browserslist-new-relic`]: https://github.com/syntactic-salt/browserslist-new-relic
116
- [`caniuse-api`]: https://github.com/Nyalab/caniuse-api
117
-
118
-
119
- ### Text Editors
120
-
121
- These extensions will add syntax highlighting for `.browserslistrc` files.
122
-
123
- * [VS Code](https://marketplace.visualstudio.com/items?itemName=webben.browserslist)
124
- * [Vim](https://github.com/browserslist/vim-browserslist)
125
-
126
- ## Best Practices
127
-
128
- * There is a `defaults` query, which gives a reasonable configuration
129
- for most users:
130
-
131
- ```json
132
- "browserslist": [
133
- "defaults"
134
- ]
135
- ```
136
-
137
- * If you want to change the default set of browsers, we recommend combining
138
- `last 2 versions`, `not dead` with a usage number like `> 0.2%`. This is
139
- because `last n versions` on its own does not add popular old versions, while
140
- only using a percentage above `0.2%` will in the long run make popular
141
- browsers even more popular. We might run into a monopoly and stagnation
142
- situation, as we had with Internet Explorer 6. Please use this setting
143
- with caution.
144
- * Select browsers directly (`last 2 Chrome versions`) only if you are making
145
- a web app for a kiosk with one browser. There are a lot of browsers
146
- on the market. If you are making general web app you should respect
147
- browsers diversity.
148
- * Don’t remove browsers just because you don’t know them. Opera Mini has
149
- 100 million users in Africa and it is more popular in the global market
150
- than Microsoft Edge. Chinese QQ Browsers has more market share than Firefox
151
- and desktop Safari combined.
152
-
153
-
154
- ## Browsers Data Updating
155
-
156
- `npx browserslist@latest --update-db` updates `caniuse-lite` version
157
- in your npm, yarn or pnpm lock file.
158
-
159
- You need to do it regularly for two reasons:
160
-
161
- 1. To use the latest browser’s versions and statistics in queries like
162
- `last 2 versions` or `>1%`. For example, if you created your project
163
- 2 years ago and did not update your dependencies, `last 1 version`
164
- will return 2 year old browsers.
165
- 2. `caniuse-lite` deduplication: to synchronize version in different tools.
166
-
167
- > What is deduplication?
168
-
169
- Due to how npm architecture is setup, you may have a situation
170
- where you have multiple versions of a single dependency required.
171
-
172
- Imagine you begin a project, and you add `autoprefixer` as a dependency.
173
- npm looks for the latest `caniuse-lite` version (1.0.30000700) and adds it to
174
- `package-lock.json` under `autoprefixer` dependencies.
175
-
176
- A year later, you decide to add Babel. At this moment, we have a
177
- new version of `canuse-lite` (1.0.30000900). npm took the latest version
178
- and added it to your lock file under `@babel/preset-env` dependencies.
179
-
180
- Now your lock file looks like this:
181
-
182
- ```ocaml
183
- autoprefixer 7.1.4
184
- browserslist 3.1.1
185
- caniuse-lite 1.0.30000700
186
- @babel/preset-env 7.10.0
187
- browserslist 4.13.0
188
- caniuse-lite 1.0.30000900
189
- ```
190
-
191
- As you can see, we now have two versions of `caniuse-lite` installed.
192
-
193
-
194
- ## Queries
195
-
196
- Browserslist will use browsers and Node.js versions query
197
- from one of these sources:
198
-
199
- 1. `browserslist` key in `package.json` file in current or parent directories.
200
- **We recommend this way.**
201
- 2. `.browserslistrc` config file in current or parent directories.
202
- 3. `browserslist` config file in current or parent directories.
203
- 4. `BROWSERSLIST` environment variable.
204
- 5. If the above methods did not produce a valid result
205
- Browserslist will use defaults:
206
- `> 0.5%, last 2 versions, Firefox ESR, not dead`.
207
-
208
-
209
- ### Query Composition
210
-
211
- An `or` combiner can use the keyword `or` as well as `,`.
212
- `last 1 version or > 1%` is equal to `last 1 version, > 1%`.
213
-
214
- `and` query combinations are also supported to perform an
215
- intersection of all the previous queries:
216
- `last 1 version or chrome > 75 and > 1%` will select
217
- (`browser last version` or `Chrome since 76`) and `more than 1% marketshare`.
218
-
219
- There are 3 different ways to combine queries as depicted below. First you start
220
- with a single query and then we combine the queries to get our final list.
221
-
222
- Obviously you can *not* start with a `not` combiner, since there is no left-hand
223
- side query to combine it with. The left-hand is always resolved as `and`
224
- combiner even if `or` is used (this is an API implementation specificity).
225
-
226
- | Query combiner type | Illustration | Example |
227
- | ------------------- | :----------: | ------- |
228
- |`or`/`,` combiner <br> (union) | ![Union of queries](img/union.svg) | `> .5% or last 2 versions` <br> `> .5%, last 2 versions` |
229
- | `and` combiner <br> (intersection) | ![intersection of queries](img/intersection.svg) | `> .5% and last 2 versions` |
230
- | `not` combiner <br> (relative complement) | ![Relative complement of queries](img/complement.svg) | All those three are equivalent to the first one <br> `> .5% and not last 2 versions` <br> `> .5% or not last 2 versions` <br> `> .5%, not last 2 versions` |
231
-
232
- _A quick way to test your query is to do `npx browserslist '> 0.5%, not IE 11'`
233
- in your terminal._
234
-
235
- ### Full List
236
-
237
- You can specify the browser and Node.js versions by queries (case insensitive):
238
-
239
- * `defaults`: Browserslist’s default browsers
240
- (`> 0.5%, last 2 versions, Firefox ESR, not dead`).
241
- * By usage statistics:
242
- * `> 5%`: browsers versions selected by global usage statistics.
243
- `>=`, `<` and `<=` work too.
244
- * `> 5% in US`: uses USA usage statistics.
245
- It accepts [two-letter country code].
246
- * `> 5% in alt-AS`: uses Asia region usage statistics.
247
- List of all region codes can be found at [`caniuse-lite/data/regions`].
248
- * `> 5% in my stats`: uses [custom usage data].
249
- * `> 5% in browserslist-config-mycompany stats`: uses [custom usage data]
250
- from `browserslist-config-mycompany/browserslist-stats.json`.
251
- * `cover 99.5%`: most popular browsers that provide coverage.
252
- * `cover 99.5% in US`: same as above, with [two-letter country code].
253
- * `cover 99.5% in my stats`: uses [custom usage data].
254
- * Last versions:
255
- * `last 2 versions`: the last 2 versions for *each* browser.
256
- * `last 2 Chrome versions`: the last 2 versions of Chrome browser.
257
- * `last 2 major versions` or `last 2 iOS major versions`:
258
- all minor/patch releases of last 2 major versions.
259
- * `dead`: browsers without official support or updates for 24 months.
260
- Right now it is `IE 10`, `IE_Mob 11`, `BlackBerry 10`, `BlackBerry 7`,
261
- `Samsung 4` and `OperaMobile 12.1`.
262
- * Node.js versions:
263
- * `node 10` and `node 10.4`: selects latest Node.js `10.x.x`
264
- or `10.4.x` release.
265
- * `current node`: Node.js version used by Browserslist right now.
266
- * `maintained node versions`: all Node.js versions, which are [still maintained]
267
- by Node.js Foundation.
268
- * Browsers versions:
269
- * `iOS 7`: the iOS browser version 7 directly.
270
- * `Firefox > 20`: versions of Firefox newer than 20.
271
- `>=`, `<` and `<=` work too. It also works with Node.js.
272
- * `ie 6-8`: selects an inclusive range of versions.
273
- * `Firefox ESR`: the latest [Firefox Extended Support Release].
274
- * `PhantomJS 2.1` and `PhantomJS 1.9`: selects Safari versions similar
275
- to PhantomJS runtime.
276
- * `extends browserslist-config-mycompany`: take queries from
277
- `browserslist-config-mycompany` npm package.
278
- * `supports es6-module`: browsers with support for specific features.
279
- `es6-module` here is the `feat` parameter at the URL of the [Can I Use]
280
- page. A list of all available features can be found at
281
- [`caniuse-lite/data/features`].
282
- * `browserslist config`: the browsers defined in Browserslist config. Useful
283
- in Differential Serving to modify user’s config like
284
- `browserslist config and supports es6-module`.
285
- * `since 2015` or `last 2 years`: all versions released since year 2015
286
- (also `since 2015-03` and `since 2015-03-10`).
287
- * `unreleased versions` or `unreleased Chrome versions`:
288
- alpha and beta versions.
289
- * `not ie <= 8`: exclude IE 8 and lower from previous queries.
290
-
291
- You can add `not ` to any query.
292
-
293
- [`caniuse-lite/data/regions`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/regions
294
- [`caniuse-lite/data/features`]: https://github.com/ben-eb/caniuse-lite/tree/master/data/features
295
- [two-letter country code]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
296
- [custom usage data]: #custom-usage-data
297
- [still maintained]: https://github.com/nodejs/Release
298
- [Can I Use]: https://caniuse.com/
299
- [Firefox Extended Support Release]: https://support.mozilla.org/en-US/kb/choosing-firefox-update-channel
300
-
301
-
302
- ### Debug
303
-
304
- Run `npx browserslist` in project directory to see what browsers was selected
305
- by your queries.
306
-
307
- ```sh
308
- $ npx browserslist
309
- and_chr 61
310
- and_ff 56
311
- and_qq 1.2
312
- and_uc 11.4
313
- android 56
314
- baidu 7.12
315
- bb 10
316
- chrome 62
317
- edge 16
318
- firefox 56
319
- ios_saf 11
320
- opera 48
321
- safari 11
322
- samsung 5
323
- ```
324
-
325
-
326
- ### Browsers
327
-
328
- Names are case insensitive:
329
-
330
- * `Android` for Android WebView.
331
- * `Baidu` for Baidu Browser.
332
- * `BlackBerry` or `bb` for Blackberry browser.
333
- * `Chrome` for Google Chrome.
334
- * `ChromeAndroid` or `and_chr` for Chrome for Android
335
- * `Edge` for Microsoft Edge.
336
- * `Electron` for Electron framework. It will be converted to Chrome version.
337
- * `Explorer` or `ie` for Internet Explorer.
338
- * `ExplorerMobile` or `ie_mob` for Internet Explorer Mobile.
339
- * `Firefox` or `ff` for Mozilla Firefox.
340
- * `FirefoxAndroid` or `and_ff` for Firefox for Android.
341
- * `iOS` or `ios_saf` for iOS Safari.
342
- * `Node` for Node.js.
343
- * `Opera` for Opera.
344
- * `OperaMini` or `op_mini` for Opera Mini.
345
- * `OperaMobile` or `op_mob` for Opera Mobile.
346
- * `QQAndroid` or `and_qq` for QQ Browser for Android.
347
- * `Safari` for desktop Safari.
348
- * `Samsung` for Samsung Internet.
349
- * `UCAndroid` or `and_uc` for UC Browser for Android.
350
- * `kaios` for KaiOS Browser.
351
-
352
-
353
- ## Config File
354
-
355
- ### `package.json`
356
-
357
- If you want to reduce config files in project root, you can specify
358
- browsers in `package.json` with `browserslist` key:
359
-
360
- ```json
361
- {
362
- "private": true,
363
- "dependencies": {
364
- "autoprefixer": "^6.5.4"
365
- },
366
- "browserslist": [
367
- "last 1 version",
368
- "> 1%",
369
- "IE 10"
370
- ]
371
- }
372
- ```
373
-
374
-
375
- ### `.browserslistrc`
376
-
377
- Separated Browserslist config should be named `.browserslistrc`
378
- and have browsers queries split by a new line.
379
- Each line is combined with the `or` combiner. Comments starts with `#` symbol:
380
-
381
- ```yaml
382
- # Browsers that we support
383
-
384
- last 1 version
385
- > 1%
386
- IE 10 # sorry
387
- ```
388
-
389
- Browserslist will check config in every directory in `path`.
390
- So, if tool process `app/styles/main.css`, you can put config to root,
391
- `app/` or `app/styles`.
392
-
393
- You can specify direct path in `BROWSERSLIST_CONFIG` environment variables.
394
-
395
-
396
- ## Shareable Configs
397
-
398
- You can use the following query to reference an exported Browserslist config
399
- from another package:
400
-
401
- ```json
402
- "browserslist": [
403
- "extends browserslist-config-mycompany"
404
- ]
405
- ```
406
-
407
- For security reasons, external configuration only supports packages that have
408
- the `browserslist-config-` prefix. npm scoped packages are also supported, by
409
- naming or prefixing the module with `@scope/browserslist-config`, such as
410
- `@scope/browserslist-config` or `@scope/browserslist-config-mycompany`.
411
-
412
- If you don’t accept Browserslist queries from users, you can disable the
413
- validation by using the or `BROWSERSLIST_DANGEROUS_EXTEND` environment variable.
414
-
415
- ```sh
416
- BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack
417
- ```
418
-
419
- Because this uses `npm`'s resolution, you can also reference specific files
420
- in a package:
421
-
422
- ```json
423
- "browserslist": [
424
- "extends browserslist-config-mycompany/desktop",
425
- "extends browserslist-config-mycompany/mobile"
426
- ]
427
- ```
428
-
429
- When writing a shared Browserslist package, just export an array.
430
- `browserslist-config-mycompany/index.js`:
431
-
432
- ```js
433
- module.exports = [
434
- 'last 1 version',
435
- '> 1%',
436
- 'ie 10'
437
- ]
438
- ```
439
-
440
- You can also include a `browserslist-stats.json` file as part of your shareable
441
- config at the root and query it using
442
- `> 5% in browserslist-config-mycompany stats`. It uses the same format
443
- as `extends` and the `dangerousExtend` property as above.
444
-
445
- You can export configs for different environments and select environment
446
- by `BROWSERSLIST_ENV` or `env` option in your tool:
447
-
448
- ```js
449
- module.exports = {
450
- development: [
451
- 'last 1 version'
452
- ],
453
- production: [
454
- 'last 1 version',
455
- '> 1%',
456
- 'ie 10'
457
- ]
458
- }
459
- ```
460
-
461
-
462
- ## Configuring for Different Environments
463
-
464
- You can also specify different browser queries for various environments.
465
- Browserslist will choose query according to `BROWSERSLIST_ENV` or `NODE_ENV`
466
- variables. If none of them is declared, Browserslist will firstly look
467
- for `production` queries and then use defaults.
468
-
469
- In `package.json`:
470
-
471
- ```js
472
- "browserslist": {
473
- "production": [
474
- "> 1%",
475
- "ie 10"
476
- ],
477
- "modern": [
478
- "last 1 chrome version",
479
- "last 1 firefox version"
480
- ],
481
- "ssr": [
482
- "node 12"
483
- ]
484
- }
485
- ```
486
-
487
- In `.browserslistrc` config:
488
-
489
- ```ini
490
- [production]
491
- > 1%
492
- ie 10
493
-
494
- [modern]
495
- last 1 chrome version
496
- last 1 firefox version
497
-
498
- [ssr]
499
- node 12
500
- ```
501
-
502
-
503
- ## Custom Usage Data
504
-
505
- If you have a website, you can query against the usage statistics of your site.
506
- [`browserslist-ga`] will ask access to Google Analytics and then generate
507
- `browserslist-stats.json`:
508
-
509
- ```
510
- npx browserslist-ga
511
- ```
512
-
513
- Or you can use [`browserslist-ga-export`] to convert Google Analytics data without giving a password for Google account.
514
-
515
- You can generate usage statistics file by any other method. File format should
516
- be like:
517
-
518
- ```js
519
- {
520
- "ie": {
521
- "6": 0.01,
522
- "7": 0.4,
523
- "8": 1.5
524
- },
525
- "chrome": {
526
-
527
- },
528
-
529
- }
530
- ```
531
-
532
- Note that you can query against your custom usage data while also querying
533
- against global or regional data. For example, the query
534
- `> 1% in my stats, > 5% in US, 10%` is permitted.
535
-
536
- [`browserslist-ga-export`]: https://github.com/browserslist/browserslist-ga-export
537
- [`browserslist-ga`]: https://github.com/browserslist/browserslist-ga
538
- [Can I Use]: https://caniuse.com/
539
-
540
-
541
- ## JS API
542
-
543
- ```js
544
- const browserslist = require('browserslist')
545
-
546
- // Your CSS/JS build tool code
547
- function process (source, opts) {
548
- const browsers = browserslist(opts.overrideBrowserslist, {
549
- stats: opts.stats,
550
- path: opts.file,
551
- env: opts.env
552
- })
553
- // Your code to add features for selected browsers
554
- }
555
- ```
556
-
557
- Queries can be a string `"> 1%, IE 10"`
558
- or an array `['> 1%', 'IE 10']`.
559
-
560
- If a query is missing, Browserslist will look for a config file.
561
- You can provide a `path` option (that can be a file) to find the config file
562
- relatively to it.
563
-
564
- Options:
565
-
566
- * `path`: file or a directory path to look for config file. Default is `.`.
567
- * `env`: what environment section use from config. Default is `production`.
568
- * `stats`: custom usage statistics data.
569
- * `config`: path to config if you want to set it manually.
570
- * `ignoreUnknownVersions`: do not throw on direct query (like `ie 12`).
571
- Default is `false`.
572
- * `dangerousExtend`: Disable security checks for `extend` query.
573
- Default is `false`.
574
- * `mobileToDesktop`: Use desktop browsers if Can I Use doesn’t have data
575
- about this mobile version. For instance, Browserslist will return
576
- `chrome 20` on `and_chr 20` query (Can I Use has only data only about
577
- latest versions of mobile browsers). Default is `false`.
578
-
579
- For non-JS environment and debug purpose you can use CLI tool:
580
-
581
- ```sh
582
- browserslist "> 1%, IE 10"
583
- ```
584
-
585
- You can get total users coverage for selected browsers by JS API:
586
-
587
- ```js
588
- browserslist.coverage(browserslist('> 1%'))
589
- //=> 81.4
590
- ```
591
-
592
- ```js
593
- browserslist.coverage(browserslist('> 1% in US'), 'US')
594
- //=> 83.1
595
- ```
596
-
597
- ```js
598
- browserslist.coverage(browserslist('> 1% in my stats'), 'my stats')
599
- //=> 83.1
600
- ```
601
-
602
- ```js
603
- browserslist.coverage(browserslist('> 1% in my stats', { stats }), stats)
604
- //=> 82.2
605
- ```
606
-
607
- Or by CLI:
608
-
609
- ```sh
610
- $ browserslist --coverage "> 1%"
611
- These browsers account for 81.4% of all users globally
612
- ```
613
-
614
- ```sh
615
- $ browserslist --coverage=US "> 1% in US"
616
- These browsers account for 83.1% of all users in the US
617
- ```
618
-
619
- ```sh
620
- $ browserslist --coverage "> 1% in my stats"
621
- These browsers account for 83.1% of all users in custom statistics
622
- ```
623
-
624
- ```sh
625
- $ browserslist --coverage "> 1% in my stats" --stats=./stats.json
626
- These browsers account for 83.1% of all users in custom statistics
627
- ```
628
-
629
-
630
- ## Environment Variables
631
-
632
- If a tool uses Browserslist inside, you can change the Browserslist settings
633
- with [environment variables]:
634
-
635
- * `BROWSERSLIST` with browsers queries.
636
-
637
- ```sh
638
- BROWSERSLIST="> 5%" npx webpack
639
- ```
640
-
641
- * `BROWSERSLIST_CONFIG` with path to config file.
642
-
643
- ```sh
644
- BROWSERSLIST_CONFIG=./config/browserslist npx webpack
645
- ```
646
-
647
- * `BROWSERSLIST_ENV` with environments string.
648
-
649
- ```sh
650
- BROWSERSLIST_ENV="development" npx webpack
651
- ```
652
-
653
- * `BROWSERSLIST_STATS` with path to the custom usage data
654
- for `> 1% in my stats` query.
655
-
656
- ```sh
657
- BROWSERSLIST_STATS=./config/usage_data.json npx webpack
658
- ```
659
-
660
- * `BROWSERSLIST_DISABLE_CACHE` if you want to disable config reading cache.
661
-
662
- ```sh
663
- BROWSERSLIST_DISABLE_CACHE=1 npx webpack
664
- ```
665
-
666
- * `BROWSERSLIST_DANGEROUS_EXTEND` to disable security shareable config
667
- name check.
668
-
669
- ```sh
670
- BROWSERSLIST_DANGEROUS_EXTEND=1 npx webpack
671
- ```
672
-
673
- [environment variables]: https://en.wikipedia.org/wiki/Environment_variable
674
-
675
-
676
- ## Cache
677
-
678
- Browserslist caches the configuration it reads from `package.json` and
679
- `browserslist` files, as well as knowledge about the existence of files,
680
- for the duration of the hosting process.
681
-
682
- To clear these caches, use:
683
-
684
- ```js
685
- browserslist.clearCaches()
686
- ```
687
-
688
- To disable the caching altogether, set the `BROWSERSLIST_DISABLE_CACHE`
689
- environment variable.
690
-
691
-
692
- ## Security Contact
693
-
694
- To report a security vulnerability, please use the [Tidelift security contact].
695
- Tidelift will coordinate the fix and disclosure.
696
-
697
- [Tidelift security contact]: https://tidelift.com/security
698
-
699
-
700
- ## For Enterprise
701
-
702
- Available as part of the Tidelift Subscription.
703
-
704
- The maintainers of `browserslist` and thousands of other packages are working
705
- with Tidelift to deliver commercial support and maintenance for the open source
706
- dependencies you use to build your applications. Save time, reduce risk,
707
- and improve code health, while paying the maintainers of the exact dependencies
708
- you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-browserslist?utm_source=npm-browserslist&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
65
+ ## Docs
66
+ Read **[full docs](https://github.com/browserslist/browserslist#readme)** on GitHub.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserslist",
3
- "version": "4.17.0",
3
+ "version": "4.17.4",
4
4
  "description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
5
5
  "keywords": [
6
6
  "caniuse",
@@ -15,11 +15,11 @@
15
15
  "license": "MIT",
16
16
  "repository": "browserslist/browserslist",
17
17
  "dependencies": {
18
- "caniuse-lite": "^1.0.30001254",
19
- "colorette": "^1.3.0",
20
- "electron-to-chromium": "^1.3.830",
18
+ "caniuse-lite": "^1.0.30001265",
19
+ "electron-to-chromium": "^1.3.867",
21
20
  "escalade": "^3.1.1",
22
- "node-releases": "^1.1.75"
21
+ "node-releases": "^2.0.0",
22
+ "picocolors": "^1.0.0"
23
23
  },
24
24
  "engines": {
25
25
  "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
package/update-db.js CHANGED
@@ -1,16 +1,11 @@
1
1
  var childProcess = require('child_process')
2
- var colorette = require('colorette')
3
2
  var escalade = require('escalade/sync')
3
+ var pico = require('picocolors')
4
4
  var path = require('path')
5
5
  var fs = require('fs')
6
6
 
7
7
  var BrowserslistError = require('./error')
8
8
 
9
- var red = colorette.red
10
- var bold = colorette.bold
11
- var green = colorette.green
12
- var yellow = colorette.yellow
13
-
14
9
  function detectLockfile () {
15
10
  var packageDir = escalade('.', function (dir, names) {
16
11
  return names.indexOf('package.json') !== -1 ? dir : ''
@@ -97,9 +92,9 @@ function diffBrowsersLists (old, current) {
97
92
  return intersection.indexOf(version) === -1
98
93
  })
99
94
  return removedVersions.map(function (version) {
100
- return red('- ' + browser + ' ' + version)
95
+ return pico.red('- ' + browser + ' ' + version)
101
96
  }).concat(addedVersions.map(function (version) {
102
- return green('+ ' + browser + ' ' + version)
97
+ return pico.green('+ ' + browser + ' ' + version)
103
98
  }))
104
99
  })
105
100
  .reduce(function (result, array) {
@@ -212,8 +207,8 @@ function updatePackageManually (print, lock, latest) {
212
207
  if (caniuseVersions.length === 1 &&
213
208
  caniuseVersions[0] === latest.version) {
214
209
  print(
215
- 'Installed version: ' + bold(green(latest.version)) + '\n' +
216
- bold(green('caniuse-lite is up to date')) + '\n'
210
+ 'Installed version: ' + pico.bold(pico.green(latest.version)) + '\n' +
211
+ pico.bold(pico.green('caniuse-lite is up to date')) + '\n'
217
212
  )
218
213
  return
219
214
  }
@@ -224,7 +219,7 @@ function updatePackageManually (print, lock, latest) {
224
219
  print(
225
220
  'Installed version' +
226
221
  (caniuseVersions.length === 1 ? ': ' : 's: ') +
227
- bold(red(caniuseVersions.join(', '))) +
222
+ pico.bold(pico.red(caniuseVersions.join(', '))) +
228
223
  '\n' +
229
224
  'Removing old caniuse-lite from lock file\n'
230
225
  )
@@ -233,13 +228,13 @@ function updatePackageManually (print, lock, latest) {
233
228
  var install = lock.mode === 'yarn' ? 'yarn add -W' : lock.mode + ' install'
234
229
  print(
235
230
  'Installing new caniuse-lite version\n' +
236
- yellow('$ ' + install + ' caniuse-lite') + '\n'
231
+ pico.yellow('$ ' + install + ' caniuse-lite') + '\n'
237
232
  )
238
233
  try {
239
234
  childProcess.execSync(install + ' caniuse-lite')
240
235
  } catch (e) /* istanbul ignore next */ {
241
236
  print(
242
- red(
237
+ pico.red(
243
238
  '\n' +
244
239
  e.stack + '\n\n' +
245
240
  'Problem with `' + install + ' caniuse-lite` call. ' +
@@ -252,7 +247,7 @@ function updatePackageManually (print, lock, latest) {
252
247
  var del = lock.mode === 'yarn' ? 'yarn remove -W' : lock.mode + ' uninstall'
253
248
  print(
254
249
  'Cleaning package.json dependencies from caniuse-lite\n' +
255
- yellow('$ ' + del + ' caniuse-lite') + '\n'
250
+ pico.yellow('$ ' + del + ' caniuse-lite') + '\n'
256
251
  )
257
252
  childProcess.execSync(del + ' caniuse-lite')
258
253
  }
@@ -270,20 +265,20 @@ module.exports = function updateDB (print) {
270
265
  }
271
266
 
272
267
  print(
273
- 'Latest version: ' + bold(green(latest.version)) + '\n'
268
+ 'Latest version: ' + pico.bold(pico.green(latest.version)) + '\n'
274
269
  )
275
270
 
276
271
  if (lock.mode === 'yarn' && lock.version !== 1) {
277
272
  var update = 'yarn up -R'
278
273
  print(
279
274
  'Updating caniuse-lite version\n' +
280
- yellow('$ ' + update + ' caniuse-lite') + '\n'
275
+ pico.yellow('$ ' + update + ' caniuse-lite') + '\n'
281
276
  )
282
277
  try {
283
278
  childProcess.execSync(update + ' caniuse-lite')
284
279
  } catch (e) /* istanbul ignore next */ {
285
280
  print(
286
- red(
281
+ pico.red(
287
282
  '\n' +
288
283
  e.stack + '\n\n' +
289
284
  'Problem with `' + update + ' caniuse-lite` call. ' +
@@ -309,7 +304,7 @@ module.exports = function updateDB (print) {
309
304
 
310
305
  if (browsersListRetrievalError) {
311
306
  print(
312
- red(
307
+ pico.red(
313
308
  '\n' +
314
309
  browsersListRetrievalError.stack + '\n\n' +
315
310
  'Problem with browser list retrieval.\n' +
@@ -325,7 +320,7 @@ module.exports = function updateDB (print) {
325
320
  print('\nTarget browser changes:\n')
326
321
  print(targetBrowserChanges + '\n')
327
322
  } else {
328
- print('\n' + green('No target browser changes') + '\n')
323
+ print('\n' + pico.green('No target browser changes') + '\n')
329
324
  }
330
325
  }
331
326
  }