baseline-browser-mapping 1.0.0 → 2.0.0-beta.2
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 +107 -107
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/scripts/baseline-browser-versions.d.ts +23 -6
- package/dist/scripts/baseline-browser-versions.js +33 -63
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,32 +5,6 @@ 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
|
-
## Limitations
|
|
9
|
-
|
|
10
|
-
The browser versions in this module come from two different sources:
|
|
11
|
-
|
|
12
|
-
- MDN's `browser-compat-data` module.
|
|
13
|
-
- Parsed user agent strings provided by [useragents.io](https://useragents.io/)
|
|
14
|
-
|
|
15
|
-
MDN `browser-compat-data` is an authoritative source of information for the browsers it contains. The release dates for the Baseline core browser set and the mapping of downstream browsers to Chromium versions should be considered accurate.
|
|
16
|
-
|
|
17
|
-
> **Note**
|
|
18
|
-
> At present, the selection criteria for core browser versions compatible with a given feature set is: the final version of each browser prior to the cut off date for that feature set. In the case of Widely Available, this is 30 months in the past and in the case of Baseline years, this is the end of the year specified. In future, when the `web-features` repository is data complete, it should be possible to determine if earlier browser versions support the specified feature set.
|
|
19
|
-
|
|
20
|
-
Browser mappings from useragents.io are provided on a best effort basis. They assume that browser vendors are accurately stating the Chromium version they have implemented. The initial set of version mappings was derived from a bulk export in November 2024. This version was iterated over with a Regex match looking for a major Chrome version and a corresponding version of the browser in question, e.g.:
|
|
21
|
-
|
|
22
|
-
`Mozilla/5.0 (Linux; U; Android 10; en-US; STK-L21 Build/HUAWEISTK-L21) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.58 UCBrowser/13.8.2.1324 Mobile Safari/537.36`
|
|
23
|
-
|
|
24
|
-
Shows UC Browse Mobile 13.8 implementing Chromium 100, and:
|
|
25
|
-
|
|
26
|
-
`Mozilla/5.0 (Linux; arm_64; Android 11; Redmi Note 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.123 YaBrowser/24.10.2.123.00 SA/3 Mobile Safari/537.36`
|
|
27
|
-
|
|
28
|
-
Shows Yandex Browser Mobile 24.10 implementing Chromium 128. The Chromium version from this string is mapped to the main Chrome version from MDN `browser-compat-data`.
|
|
29
|
-
|
|
30
|
-
> **Note** Where possible, approximate release dates have been included based on useragents.io "first seen" data. However, useragents.io does not have "first seen" dates prior to June 2020. However, these browsers' Baseline compatibility is determined by their Chromium version, so their release dates are more informative than critical.
|
|
31
|
-
|
|
32
|
-
This data is updated on a daily basis using a [script](https://github.com/web-platform-dx/web-features/tree/main/scripts/refresh-downstream.ts) triggered by a GitHub [action](https://github.com/web-platform-dx/web-features/tree/main/.github/workflows/refresh_downstream.yml). Useragents.io provides a private API for this module which exposes the last 7 days of newly seen user agents for the currently tracked browsers. If a new major version of one of the tracked browsers is encountered with a Chromium version that meets or exceeds the previous latest version of that browser, it is added to the [src/data/downstream-browsers.json](src/data/downstream-browsers.json) file with the date it was first seen by useragents.io as its release date.
|
|
33
|
-
|
|
34
8
|
## Prerequisites
|
|
35
9
|
|
|
36
10
|
To use this package, you'll need:
|
|
@@ -43,142 +17,168 @@ To install the package, run:
|
|
|
43
17
|
|
|
44
18
|
`npm install --save baseline-browser-mapping`
|
|
45
19
|
|
|
46
|
-
|
|
47
|
-
Run:
|
|
20
|
+
`baseline-browser-mapping` depends on `web-features` and `@mdn/browser-compat-data` for version selection. It is strongly recommended that you update this module and it's dependencies often to ensure you have the most accurate data. Consider adding a script to your `package.json` and using it as a build step:
|
|
48
21
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
22
|
+
```javascript
|
|
23
|
+
"scripts": [
|
|
24
|
+
"refresh-baseline-browser-mapping": "npm i --save baseline-browser-mapping@latest web-features@latest @mdn/browser-compat-data@latest"
|
|
25
|
+
]
|
|
26
|
+
```
|
|
52
27
|
|
|
53
28
|
## Usage
|
|
54
29
|
|
|
55
30
|
### Get Baseline Widely Available browser versions
|
|
56
31
|
|
|
57
|
-
To get the current list of minimum browser versions compatible with Baseline Widely Available features from the core browser set, call the `
|
|
32
|
+
To get the current list of minimum browser versions compatible with Baseline Widely Available features from the core browser set, call the `getCompatibleVersions()` function with:
|
|
58
33
|
|
|
59
34
|
```javascript
|
|
60
|
-
import {
|
|
35
|
+
import { getCompatibleVersions } from "baseline-browser-mapping";
|
|
61
36
|
|
|
62
|
-
|
|
37
|
+
getCompatibleVersions();
|
|
63
38
|
```
|
|
64
39
|
|
|
65
|
-
Executed on
|
|
40
|
+
Executed on 7th March 2025, the above code returns the following browser versions:
|
|
66
41
|
|
|
67
42
|
```javascript
|
|
68
43
|
[
|
|
69
|
-
{
|
|
70
|
-
browser: "chrome",
|
|
71
|
-
version: "102",
|
|
72
|
-
release_date: "2022-05-24",
|
|
73
|
-
engine: null,
|
|
74
|
-
engine_version: null,
|
|
75
|
-
},
|
|
44
|
+
{ browser: "chrome", version: "105", release_date: "2022-09-02" },
|
|
76
45
|
{
|
|
77
46
|
browser: "chrome_android",
|
|
78
|
-
version: "
|
|
79
|
-
release_date: "2022-
|
|
80
|
-
engine: null,
|
|
81
|
-
engine_version: null,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
browser: "edge",
|
|
85
|
-
version: "101",
|
|
86
|
-
release_date: "2022-04-28",
|
|
87
|
-
engine: null,
|
|
88
|
-
engine_version: null,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
browser: "firefox",
|
|
92
|
-
version: "100",
|
|
93
|
-
release_date: "2022-05-03",
|
|
94
|
-
engine: null,
|
|
95
|
-
engine_version: null,
|
|
47
|
+
version: "105",
|
|
48
|
+
release_date: "2022-09-02",
|
|
96
49
|
},
|
|
50
|
+
{ browser: "edge", version: "105", release_date: "2022-09-02" },
|
|
51
|
+
{ browser: "firefox", version: "104", release_date: "2022-08-23" },
|
|
97
52
|
{
|
|
98
53
|
browser: "firefox_android",
|
|
99
|
-
version: "
|
|
100
|
-
release_date: "2022-
|
|
101
|
-
engine: null,
|
|
102
|
-
engine_version: null,
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
browser: "safari",
|
|
106
|
-
version: "15.5",
|
|
107
|
-
release_date: "2022-05-16",
|
|
108
|
-
engine: null,
|
|
109
|
-
engine_version: null,
|
|
54
|
+
version: "104",
|
|
55
|
+
release_date: "2022-08-23",
|
|
110
56
|
},
|
|
57
|
+
{ browser: "safari", version: "15.6", release_date: "2022-09-02" },
|
|
111
58
|
{
|
|
112
59
|
browser: "safari_ios",
|
|
113
|
-
version: "15.
|
|
114
|
-
release_date: "2022-
|
|
115
|
-
engine: null,
|
|
116
|
-
engine_version: null,
|
|
60
|
+
version: "15.6",
|
|
61
|
+
release_date: "2022-09-02",
|
|
117
62
|
},
|
|
118
63
|
];
|
|
119
64
|
```
|
|
120
65
|
|
|
121
|
-
|
|
66
|
+
> [!NOTE]
|
|
67
|
+
> 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.
|
|
122
68
|
|
|
123
|
-
|
|
124
|
-
|
|
69
|
+
### Configuration options
|
|
70
|
+
|
|
71
|
+
`getCompatibleVersions()` accepts an `Object` as an argument with configuration options. The defaults are as follows:
|
|
125
72
|
|
|
126
|
-
|
|
73
|
+
```javascript
|
|
74
|
+
{
|
|
75
|
+
targetYear: undefined,
|
|
76
|
+
widelyAvailableOnDate: undefined,
|
|
77
|
+
includeDownstreamBrowsers: false,
|
|
78
|
+
listAllCompatibleVersions: false
|
|
79
|
+
}
|
|
127
80
|
```
|
|
128
81
|
|
|
129
|
-
|
|
82
|
+
#### `targetYear`
|
|
130
83
|
|
|
131
|
-
|
|
84
|
+
The `targetYear` option returns the minimum browser versions compatible with all interoperable features at the end of the specific calendar year. For example, calling:
|
|
132
85
|
|
|
133
86
|
```javascript
|
|
134
|
-
|
|
87
|
+
getCompatibleVersions({
|
|
88
|
+
targetYear: 2020,
|
|
89
|
+
});
|
|
90
|
+
```
|
|
135
91
|
|
|
136
|
-
|
|
92
|
+
Returns the following versions:
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
[
|
|
96
|
+
{ browser: "chrome", version: "87", release_date: "2020-11-19" },
|
|
97
|
+
{
|
|
98
|
+
browser: "chrome_android",
|
|
99
|
+
version: "87",
|
|
100
|
+
release_date: "2020-11-19",
|
|
101
|
+
},
|
|
102
|
+
{ browser: "edge", version: "87", release_date: "2020-11-19" },
|
|
103
|
+
{ browser: "firefox", version: "83", release_date: "2020-11-17" },
|
|
104
|
+
{
|
|
105
|
+
browser: "firefox_android",
|
|
106
|
+
version: "83",
|
|
107
|
+
release_date: "2020-11-17",
|
|
108
|
+
},
|
|
109
|
+
{ browser: "safari", version: "14", release_date: "2020-09-16" },
|
|
110
|
+
{ browser: "safari_ios", version: "14", release_date: "2020-09-16" },
|
|
111
|
+
];
|
|
137
112
|
```
|
|
138
113
|
|
|
139
|
-
|
|
114
|
+
> [!NOTE]
|
|
115
|
+
> The minimum version of each browser is not necessarily the final version released in that calendar year. In the above example, Firefox 84 was the final version released in 2020; however Firefox 83 supported all of the features that were interoperable at the end of 2020.
|
|
140
116
|
|
|
141
|
-
|
|
117
|
+
> [!WARNING]
|
|
118
|
+
> You cannot use `targetYear` and `widelyAavailableDate` together. Please only use one of these options at a time.
|
|
142
119
|
|
|
143
|
-
|
|
144
|
-
|
|
120
|
+
#### `widelyAvailableOnDate`
|
|
121
|
+
|
|
122
|
+
The `widelyAvailableOnDate` options returns the minimum versions compatible with Baseline Widely Available on a specified date in the formay `YYYY-MM-DD`:
|
|
145
123
|
|
|
146
|
-
|
|
124
|
+
```javascript
|
|
125
|
+
getCompatibleVersions({
|
|
126
|
+
widelyAvailableOnDate: `2023-04-05`,
|
|
127
|
+
});
|
|
147
128
|
```
|
|
148
129
|
|
|
149
|
-
|
|
130
|
+
> [!TIP]
|
|
131
|
+
> This can be particularly useful if you provide a versioned library that target Baseline Widely Available on each version's release date and want to provide a table of minimum supported browsers in your documentation.
|
|
150
132
|
|
|
151
|
-
|
|
133
|
+
#### `includeDownstreamBrowsers`
|
|
152
134
|
|
|
153
|
-
|
|
154
|
-
import { getMinimumByYear } from "baseline-browser-mapping";
|
|
135
|
+
Setting `includeDownstreamBrowsers` to `true` will include browsers outside of the Baseline core browser set where it is possible to map those browsers to an upstream Chromium version:
|
|
155
136
|
|
|
156
|
-
|
|
137
|
+
```javascript
|
|
138
|
+
getCompatibleVersions({
|
|
139
|
+
widelyAvailableOnDate: `2023-04-05`,
|
|
140
|
+
});
|
|
157
141
|
```
|
|
158
142
|
|
|
159
|
-
|
|
143
|
+
For more information on downstream browsers, see [the section on downstream browsers](#downstream-browsers) below.
|
|
160
144
|
|
|
161
|
-
|
|
162
|
-
import { getAllByYear } from "baseline-browser-mapping";
|
|
145
|
+
#### `listAllCompatibleVersions`
|
|
163
146
|
|
|
164
|
-
|
|
147
|
+
If you need a list of all compatible versions, pass an object with the `listAllCompatibleVersions` :
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
getCompatibleVersions({
|
|
151
|
+
listAllCompatibleVersions: true,
|
|
152
|
+
});
|
|
165
153
|
```
|
|
166
154
|
|
|
167
|
-
|
|
155
|
+
## Downstream browsers
|
|
168
156
|
|
|
169
|
-
|
|
157
|
+
### Limitations
|
|
170
158
|
|
|
171
|
-
|
|
172
|
-
getAllWidelyAvailable(true)
|
|
159
|
+
The browser versions in this module come from two different sources:
|
|
173
160
|
|
|
174
|
-
|
|
161
|
+
- MDN's `browser-compat-data` module.
|
|
162
|
+
- Parsed user agent strings provided by [useragents.io](https://useragents.io/)
|
|
175
163
|
|
|
176
|
-
|
|
177
|
-
|
|
164
|
+
MDN `browser-compat-data` is an authoritative source of information for the browsers it contains. The release dates for the Baseline core browser set and the mapping of downstream browsers to Chromium versions should be considered accurate.
|
|
165
|
+
|
|
166
|
+
Browser mappings from useragents.io are provided on a best effort basis. They assume that browser vendors are accurately stating the Chromium version they have implemented. The initial set of version mappings was derived from a bulk export in November 2024. This version was iterated over with a Regex match looking for a major Chrome version and a corresponding version of the browser in question, e.g.:
|
|
178
167
|
|
|
179
|
-
|
|
168
|
+
`Mozilla/5.0 (Linux; U; Android 10; en-US; STK-L21 Build/HUAWEISTK-L21) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.58 UCBrowser/13.8.2.1324 Mobile Safari/537.36`
|
|
169
|
+
|
|
170
|
+
Shows UC Browser Mobile 13.8 implementing Chromium 100, and:
|
|
171
|
+
|
|
172
|
+
`Mozilla/5.0 (Linux; arm_64; Android 11; Redmi Note 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.123 YaBrowser/24.10.2.123.00 SA/3 Mobile Safari/537.36`
|
|
173
|
+
|
|
174
|
+
Shows Yandex Browser Mobile 24.10 implementing Chromium 128. The Chromium version from this string is mapped to the main Chrome version from MDN `browser-compat-data`.
|
|
175
|
+
|
|
176
|
+
> [!NOTE]
|
|
177
|
+
> Where possible, approximate release dates have been included based on useragents.io "first seen" data. useragents.io does not have "first seen" dates prior to June 2020. However, these browsers' Baseline compatibility is determined by their Chromium version, so their release dates are more informative than critical.
|
|
178
|
+
|
|
179
|
+
This data is updated on a daily basis using a [script](https://github.com/web-platform-dx/web-features/tree/main/scripts/refresh-downstream.ts) triggered by a GitHub [action](https://github.com/web-platform-dx/web-features/tree/main/.github/workflows/refresh_downstream.yml). Useragents.io provides a private API for this module which exposes the last 7 days of newly seen user agents for the currently tracked browsers. If a new major version of one of the tracked browsers is encountered with a Chromium version that meets or exceeds the previous latest version of that browser, it is added to the [src/data/downstream-browsers.json](src/data/downstream-browsers.json) file with the date it was first seen by useragents.io as its release date.
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
### List of downstream browsers
|
|
182
182
|
|
|
183
183
|
| Browser | ID | Core | Source |
|
|
184
184
|
| --------------------- | ------------------------- | ------- | ------------------------- |
|
|
@@ -197,7 +197,7 @@ Passing `true` will include the appropriate versions of the browsers listed as "
|
|
|
197
197
|
| UC Browser Mobile | `uc_android` | `false` | useragents.io |
|
|
198
198
|
| Yandex Browser Mobile | `ya_android` | `false` | useragents.io |
|
|
199
199
|
|
|
200
|
-
>
|
|
200
|
+
> [!NOTE]
|
|
201
201
|
> All the non-core browsers currently included implement Chromium. Their inclusion in any of the above methods is based on the Baseline feature set supported by the Chromium version they implement, not their release date.
|
|
202
202
|
|
|
203
203
|
## Helping out and getting help
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { getCompatibleVersions } from "./scripts/baseline-browser-versions.js";
|
|
2
|
+
export { getCompatibleVersions };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { getCompatibleVersions } from "./scripts/baseline-browser-versions.js";
|
|
2
|
+
export { getCompatibleVersions };
|
|
@@ -5,10 +5,27 @@ type BrowserVersion = {
|
|
|
5
5
|
engine?: string;
|
|
6
6
|
engine_version?: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether to include only the minimum compatible browser versions or all compatible versions.
|
|
11
|
+
* Defaults to `false`.
|
|
12
|
+
*/
|
|
13
|
+
listAllCompatibleVersions?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to include browsers that use the same engines as a core Baseline browser.
|
|
16
|
+
* Defaults to `false`.
|
|
17
|
+
*/
|
|
18
|
+
includeDownstreamBrowsers?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely available on the specified date.
|
|
21
|
+
* If left undefined and a `targetYear` is not passed, defaults to Widely Available as of the current date.
|
|
22
|
+
*/
|
|
23
|
+
widelyAvailableOnDate?: string | number;
|
|
24
|
+
/**
|
|
25
|
+
* Pass a year between 2016 and the current year to get browser versions compatible with all
|
|
26
|
+
* Newly Available features as of the end of the year specified.
|
|
27
|
+
*/
|
|
28
|
+
targetYear?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function getCompatibleVersions(userOptions: Options): BrowserVersion[];
|
|
14
31
|
export {};
|
|
@@ -132,7 +132,7 @@ const getSubsequentVersions = (minimumVersions) => {
|
|
|
132
132
|
});
|
|
133
133
|
return subsequentVersions;
|
|
134
134
|
};
|
|
135
|
-
const getCoreVersionsByDate = (date,
|
|
135
|
+
const getCoreVersionsByDate = (date, listAllCompatibleVersions = false) => {
|
|
136
136
|
if (date.getFullYear() < 2015) {
|
|
137
137
|
throw new Error("There are no browser versions compatible with Baseline before 2015");
|
|
138
138
|
}
|
|
@@ -141,7 +141,7 @@ const getCoreVersionsByDate = (date, minOnly = true) => {
|
|
|
141
141
|
}
|
|
142
142
|
const compatibleFeatures = getCompatibleFeaturesByDate(date);
|
|
143
143
|
const minimumVersions = getMinimumVersionsFromFeatures(compatibleFeatures);
|
|
144
|
-
if (
|
|
144
|
+
if (!listAllCompatibleVersions) {
|
|
145
145
|
return minimumVersions;
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
@@ -158,7 +158,7 @@ const getCoreVersionsByDate = (date, minOnly = true) => {
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
-
const getDownstreamBrowsers = (inputArray = [],
|
|
161
|
+
const getDownstreamBrowsers = (inputArray = [], listAllCompatibleVersions = true) => {
|
|
162
162
|
let minimumChromeVersion = undefined;
|
|
163
163
|
if (inputArray && inputArray.length > 0) {
|
|
164
164
|
minimumChromeVersion = inputArray
|
|
@@ -205,7 +205,7 @@ const getDownstreamBrowsers = (inputArray = [], minOnly = true) => {
|
|
|
205
205
|
outputObject.engine_version = versionData.engine_version;
|
|
206
206
|
}
|
|
207
207
|
downstreamArray.push(outputObject);
|
|
208
|
-
if (
|
|
208
|
+
if (!listAllCompatibleVersions) {
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
@@ -214,67 +214,37 @@ const getDownstreamBrowsers = (inputArray = [], minOnly = true) => {
|
|
|
214
214
|
let outputArray = [...inputArray, ...downstreamArray];
|
|
215
215
|
return outputArray;
|
|
216
216
|
};
|
|
217
|
-
export function
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
export function getCompatibleVersions(userOptions) {
|
|
218
|
+
let incomingOptions = userOptions ?? {};
|
|
219
|
+
let options = {
|
|
220
|
+
listAllCompatibleVersions: incomingOptions.listAllCompatibleVersions ?? false,
|
|
221
|
+
includeDownstreamBrowsers: incomingOptions.includeDownstreamBrowsers ?? false,
|
|
222
|
+
widelyAvailableOnDate: incomingOptions.widelyAvailableOnDate ?? undefined,
|
|
223
|
+
targetYear: incomingOptions.targetYear ?? undefined,
|
|
224
|
+
};
|
|
225
|
+
let targetDate = new Date();
|
|
226
|
+
if (!options.widelyAvailableOnDate && !options.targetYear) {
|
|
227
|
+
targetDate = new Date();
|
|
228
|
+
}
|
|
229
|
+
else if (options.targetYear && options.widelyAvailableOnDate) {
|
|
230
|
+
console.log(new Error("You cannot use targetYear and widelyAvailableOnDate at the same time. Please remove one of these options and try again."));
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
else if (options.widelyAvailableOnDate) {
|
|
234
|
+
targetDate = new Date(options.widelyAvailableOnDate);
|
|
235
|
+
}
|
|
236
|
+
else if (options.targetYear) {
|
|
237
|
+
targetDate = new Date(`${options.targetYear}-12-31`);
|
|
238
|
+
}
|
|
239
|
+
// Sets a cutoff date for feature interoperability 30 months before the stated date
|
|
240
|
+
if (options.widelyAvailableOnDate || options.targetYear === undefined) {
|
|
241
|
+
targetDate.setMonth(new Date().getMonth() - 30);
|
|
242
|
+
}
|
|
243
|
+
let coreBrowserArray = getCoreVersionsByDate(targetDate, options.listAllCompatibleVersions);
|
|
244
|
+
if (options.includeDownstreamBrowsers === false) {
|
|
222
245
|
return coreBrowserArray;
|
|
223
246
|
}
|
|
224
247
|
else {
|
|
225
|
-
return getDownstreamBrowsers(coreBrowserArray);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
export function getAllWidelyAvailable(includeDownstream = false) {
|
|
229
|
-
let date30MonthsAgo = new Date();
|
|
230
|
-
date30MonthsAgo.setMonth(new Date().getMonth() - 30);
|
|
231
|
-
let coreBrowserArray = getCoreVersionsByDate(date30MonthsAgo, false);
|
|
232
|
-
if (!includeDownstream) {
|
|
233
|
-
return coreBrowserArray;
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
return getDownstreamBrowsers(coreBrowserArray, false);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
export function getMinimumWidelyAvailableOnDate(dateString, includeDownstream = false) {
|
|
240
|
-
const givenDate = new Date(Date.parse(dateString));
|
|
241
|
-
const givenDateLess30Months = new Date(givenDate.setMonth(givenDate.getMonth() - 30));
|
|
242
|
-
let coreBrowserArray = getCoreVersionsByDate(givenDateLess30Months);
|
|
243
|
-
if (!includeDownstream) {
|
|
244
|
-
return coreBrowserArray;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
return getDownstreamBrowsers(coreBrowserArray);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
export function getAllWidelyAvailableOnDate(dateString, includeDownstream = false) {
|
|
251
|
-
const givenDate = new Date(Date.parse(dateString));
|
|
252
|
-
const givenDateLess30Months = new Date(givenDate.setMonth(givenDate.getMonth() - 30));
|
|
253
|
-
let coreBrowserArray = getCoreVersionsByDate(givenDateLess30Months, false);
|
|
254
|
-
if (!includeDownstream) {
|
|
255
|
-
return coreBrowserArray;
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
return getDownstreamBrowsers(coreBrowserArray, false);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
export function getMinimumByYear(year, includeDownstream = false) {
|
|
262
|
-
const date = new Date(parseInt(year) + 1, 0, 1);
|
|
263
|
-
let coreBrowserArray = getCoreVersionsByDate(date);
|
|
264
|
-
if (!includeDownstream) {
|
|
265
|
-
return coreBrowserArray;
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
return getDownstreamBrowsers(coreBrowserArray);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
export function getAllByYear(year, includeDownstream = false) {
|
|
272
|
-
const date = new Date(parseInt(year) + 1, 0, 1);
|
|
273
|
-
let coreBrowserArray = getCoreVersionsByDate(date, false);
|
|
274
|
-
if (!includeDownstream) {
|
|
275
|
-
return coreBrowserArray;
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
return getDownstreamBrowsers(coreBrowserArray, false);
|
|
248
|
+
return getDownstreamBrowsers(coreBrowserArray, options.listAllCompatibleVersions);
|
|
279
249
|
}
|
|
280
250
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseline-browser-mapping",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "A library for obtaining browser versions with their maximum supported Baseline feature set and Widely Available status.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|