baseline-browser-mapping 2.4.3 → 2.5.0-beta
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 +27 -13
- package/dist/index.cjs +1 -0
- package/dist/index.js +1 -2
- package/dist/scripts/baseline-browser-versions.d.ts +1 -1
- package/dist/scripts/expose-data.d.ts +34 -0
- package/package.json +31 -11
- package/dist/data/downstream-browsers.json +0 -1532
- package/dist/scripts/baseline-browser-versions.js +0 -465
package/README.md
CHANGED
|
@@ -5,33 +5,47 @@ By the [W3C WebDX Community Group](https://www.w3.org/community/webdx/) and cont
|
|
|
5
5
|
`baseline-browser-mapping` exposes arrays of browsers compatible with Baseline Widely available and specified Baseline year feature sets.
|
|
6
6
|
You can use `baseline-browser-mapping` to help you determine minimum browser version support for your chosen Baseline feature set.
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
To use this package, you'll need:
|
|
11
|
-
|
|
12
|
-
- Node.js (a supported [current, active LTS, or maintenance LTS release](https://nodejs.org/en/about/previous-releases))
|
|
13
|
-
|
|
14
|
-
## Install
|
|
8
|
+
## Install for local development
|
|
15
9
|
|
|
16
10
|
To install the package, run:
|
|
17
11
|
|
|
18
|
-
`npm install --save baseline-browser-mapping`
|
|
12
|
+
`npm install --save-dev baseline-browser-mapping`
|
|
19
13
|
|
|
20
|
-
`baseline-browser-mapping` depends on `web-features` and `@mdn/browser-compat-data` for version selection. This package
|
|
14
|
+
`baseline-browser-mapping` depends on `web-features` and `@mdn/browser-compat-data` for version selection. This package checks for updates to those modules and [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
15
|
|
|
22
16
|
```javascript
|
|
23
17
|
"scripts": [
|
|
24
|
-
"refresh-baseline-browser-mapping": "npm i --save baseline-browser-mapping@latest"
|
|
18
|
+
"refresh-baseline-browser-mapping": "npm i --save-dev baseline-browser-mapping@latest"
|
|
25
19
|
]
|
|
26
20
|
```
|
|
27
21
|
|
|
28
|
-
##
|
|
22
|
+
## Importing `baseline-browser-mapping`
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
This module exposes two functions: `getCompatibleVersions()` and `getAllVersions()`, both which can be imported directly from `baseline-browser-mapping`:
|
|
31
25
|
|
|
32
26
|
```javascript
|
|
33
27
|
import { getCompatibleVersions } from "baseline-browser-mapping";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If you want to load the script and data directly in a web page without hosting it yourself, consider using a CDN:
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<script type="module">
|
|
34
|
+
import { getCompatibleVersions } from "https://cdn.jsdelivr.net/npm/baseline-browser-mapping";
|
|
35
|
+
</script>
|
|
36
|
+
```
|
|
34
37
|
|
|
38
|
+
`baseline-browser-mapping` runs 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:
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
const { getCompatibleVersions } = require("baseline-browser-mapping/legacy");
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Get Baseline Widely available browser versions or Baseline year browser versions
|
|
45
|
+
|
|
46
|
+
To get the current list of minimum browser versions compatible with Baseline Widely available features from the core browser set, call the `getCompatibleVersions()` function:
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
35
49
|
getCompatibleVersions();
|
|
36
50
|
```
|
|
37
51
|
|
|
@@ -116,7 +130,7 @@ Returns the following versions:
|
|
|
116
130
|
|
|
117
131
|
#### `widelyAvailableOnDate`
|
|
118
132
|
|
|
119
|
-
The `widelyAvailableOnDate` option returns the minimum versions compatible with Baseline Widely available on a specified date in the
|
|
133
|
+
The `widelyAvailableOnDate` option returns the minimum versions compatible with Baseline Widely available on a specified date in the format `YYYY-MM-DD`:
|
|
120
134
|
|
|
121
135
|
```javascript
|
|
122
136
|
getCompatibleVersions({
|