baseline-browser-mapping 2.4.4 → 2.5.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/README.md CHANGED
@@ -2,36 +2,65 @@
2
2
 
3
3
  By the [W3C WebDX Community Group](https://www.w3.org/community/webdx/) and contributors.
4
4
 
5
- `baseline-browser-mapping` exposes arrays of browsers compatible with Baseline Widely available and specified Baseline year feature sets.
6
- You can use `baseline-browser-mapping` to help you determine minimum browser version support for your chosen Baseline feature set.
5
+ `baseline-browser-mapping` provides:
7
6
 
8
- ## Prerequisites
7
+ - An `Array` of browsers compatible with Baseline Widely available and Baseline year feature sets via the [`getCompatibleVersions()` function](#get-baseline-widely-available-browser-versions-or-baseline-year-browser-versions).
8
+ - An `Array`, `Object` or `CSV` as a string describing the Baseline feature set support of all browser versions included in the module's data set via the [`getAllVersions()` function](#get-data-for-all-browser-versions).
9
9
 
10
- To use this package, you'll need:
10
+ You can use `baseline-browser-mapping` to help you determine minimum browser version support for your chosen Baseline feature set; or to analyse the level of support for different Baseline feature sets in your site's traffic by joining the data with your analytics data.
11
11
 
12
- - Node.js (a supported [current, active LTS, or maintenance LTS release](https://nodejs.org/en/about/previous-releases))
13
-
14
- ## Install
12
+ ## Install for local development
15
13
 
16
14
  To install the package, run:
17
15
 
18
- `npm install --save baseline-browser-mapping`
16
+ `npm install --save-dev baseline-browser-mapping`
19
17
 
20
- `baseline-browser-mapping` depends on `web-features` and `@mdn/browser-compat-data` for version selection. This package uses dependabot to automatically update both modules on all minor and patch version releases and is updated frequently. Consider adding a script to your `package.json` to update `basesline-browser-mapping` and using it as a build step:
18
+ `baseline-browser-mapping` depends on `web-features` and `@mdn/browser-compat-data` for core browser version selection, but the data is pre-packaged and minified. This package checks for updates to those modules and the supported [downstream browsers](#downstream-browsers) on a daily basis and is updated frequently. Consider adding a script to your `package.json` to update `basesline-browser-mapping` and using it as part of your build process to ensure your data is as up to date as possible:
21
19
 
22
20
  ```javascript
23
21
  "scripts": [
24
- "refresh-baseline-browser-mapping": "npm i --save baseline-browser-mapping@latest"
22
+ "refresh-baseline-browser-mapping": "npm i --save-dev baseline-browser-mapping@latest"
25
23
  ]
26
24
  ```
27
25
 
26
+ If your installed version of `baseline-browser-mapping` is greater than 2 months old, you will receive a console warning advising you to update to the latest version.
27
+
28
+ ## Importing `baseline-browser-mapping`
29
+
30
+ This module exposes two functions: `getCompatibleVersions()` and `getAllVersions()`, both which can be imported directly from `baseline-browser-mapping`:
31
+
32
+ ```javascript
33
+ import {
34
+ getCompatibleVersions,
35
+ getAllVersions,
36
+ } from "baseline-browser-mapping";
37
+ ```
38
+
39
+ If you want to load the script and data directly in a web page without hosting it yourself, consider using a CDN:
40
+
41
+ ```html
42
+ <script type="module">
43
+ import {
44
+ getCompatibleVersions,
45
+ getAllVersions,
46
+ } from "https://cdn.jsdelivr.net/npm/baseline-browser-mapping";
47
+ </script>
48
+ ```
49
+
50
+ `baseline-browser-mapping` is packaged as an ES module by default. If you need to run it in a legacy environment that doesn't support ES modules, use the `/legacy` version:
51
+
52
+ ```javascript
53
+ const {
54
+ getCompatibleVersions,
55
+ getAllVersions,
56
+ } = require("baseline-browser-mapping/legacy");
57
+ ```
58
+
28
59
  ## Get Baseline Widely available browser versions or Baseline year browser versions
29
60
 
30
61
  To get the current list of minimum browser versions compatible with Baseline Widely available features from the core browser set, call the `getCompatibleVersions()` function:
31
62
 
32
63
  ```javascript
33
- import { getCompatibleVersions } from "baseline-browser-mapping";
34
-
35
64
  getCompatibleVersions();
36
65
  ```
37
66
 
@@ -62,7 +91,7 @@ Executed on 7th March 2025, the above code returns the following browser version
62
91
  ```
63
92
 
64
93
  > [!NOTE]
65
- > The minimum versions of each browser are not strictly the final release before the Widely available cutoff date of `TODAY - 30 MONTHS`. Some earlier versions will have supported the full Widely available feature set.
94
+ > The minimum versions of each browser are not necessarily the final release before the Widely available cutoff date of `TODAY - 30 MONTHS`. Some earlier versions will have supported the full Widely available feature set.
66
95
 
67
96
  ### `getCompatibleVersions()` configuration options
68
97
 
@@ -116,7 +145,7 @@ Returns the following versions:
116
145
 
117
146
  #### `widelyAvailableOnDate`
118
147
 
119
- The `widelyAvailableOnDate` option returns the minimum versions compatible with Baseline Widely available on a specified date in the formay `YYYY-MM-DD`:
148
+ The `widelyAvailableOnDate` option returns the minimum versions compatible with Baseline Widely available on a specified date in the format `YYYY-MM-DD`:
120
149
 
121
150
  ```javascript
122
151
  getCompatibleVersions({