Commit 226fd01
authored
Reduce frequency of data staleness warnings (#108)
* Data staleness warnings are now only shown if the `getCompatibleVersions()` or `getAllVersions()` functions are called - previously they were shown whenever the module was loaded, which meant many `browserslist` consumers were seeing the warning despite not targeting Baseline, especially those who were consuming `browserslist` in a pre-compiled format via `next.js`.
* Adds new conditions for these warnings to be displayed which should only warn users for whom data freshness is critical:
* The feature cut off data must be within the last two months, i.e. `widelyAvailableOnDate: today + >2 years and 4 months` or `newly available` in a `browserslist` query.
* The module data must be more than 2 months old.
* None of the suppression mechanisms below are in use.
* Introduces suppression options for these warning via the `options` objects and environment variables:
* Adds a new `suppressWarnings` boolean to the `getCompatibleVersions()` and `getAllVersions()`
* Respects the existing [`BROWSERSLIST_IGNORE_OLD_DATA`](browserslist/browserslist@0ae7155) environment variable.
* Respects a new `BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA` environment variable.
* Adds explanatory text to the docs for how to avoid such warnings when reproducible builds are a requirement.
* Change warning text to be package manager agnostic and mention the possibility of pre-compiled data.
Fixes: #105 #107 #1091 parent 6d43e5a commit 226fd01
File tree
10 files changed
+259
-105
lines changed- spec/tests
- src
- data
- scripts
10 files changed
+259
-105
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
98 | | - | |
| 106 | + | |
| 107 | + | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
| |||
185 | 194 | | |
186 | 195 | | |
187 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
188 | 207 | | |
189 | 208 | | |
190 | 209 | | |
| |||
237 | 256 | | |
238 | 257 | | |
239 | 258 | | |
240 | | - | |
| 259 | + | |
| 260 | + | |
241 | 261 | | |
242 | 262 | | |
243 | 263 | | |
| |||
280 | 300 | | |
281 | 301 | | |
282 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
283 | 313 | | |
284 | 314 | | |
285 | 315 | | |
| |||
0 commit comments