baseline-browser-mapping 0.2.1 → 0.2.3

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
@@ -14,14 +14,22 @@ The browser versions in this module come from two different sources:
14
14
 
15
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
16
 
17
- 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.
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.
18
19
 
19
- > **TODO** Add details on how downstream mappings were created and are updated once script and action are in place and tested in @tonypconway 's fork.
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.:
20
21
 
21
- Unfortunately, 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.
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`
22
23
 
23
- > **Note**
24
- > 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.
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.
25
33
 
26
34
  ## Prerequisites
27
35
 
@@ -44,20 +52,14 @@ Updating this module and `@mdn/browser-compat-data` regularly is recommended to
44
52
 
45
53
  ## Usage
46
54
 
47
- ### Import the module
48
-
49
- First, import the module:
50
-
51
- ```javascript
52
- import baselineBrowserMapping from "baseline-browser-mapping";
53
- ```
54
-
55
55
  ### Get Baseline Widely Available browser versions
56
56
 
57
57
  To get the current list of minimum browser versions compatible with Baseline Widely Available features from the core browser set, call the `getMinimumWidelyAvailable` method:
58
58
 
59
59
  ```javascript
60
- baselineBrowserMapping.getMinimumWidelyAvailable();
60
+ import { getMinimumWidelyAvailable } from "baseline-browser-mapping";
61
+
62
+ getMinimumWidelyAvailable();
61
63
  ```
62
64
 
63
65
  Executed on 29th November 2024, the above code returns the final version of each core browser released on or before 24th May 2022 i.e. 30 months before the date of execution:
@@ -116,10 +118,12 @@ Executed on 29th November 2024, the above code returns the final version of each
116
118
  ];
117
119
  ```
118
120
 
119
- If you need a list of _all_ compatible versions, you can call:
121
+ If you need a list of _all_ compatible versions, you can import and call:
120
122
 
121
123
  ```javascript
122
- baselineBrowserMapping.getAllWidelyAvailable();
124
+ import { getMinimumWidelyAvailable } from "baseline-browser-mapping";
125
+
126
+ getAllWidelyAvailable();
123
127
  ```
124
128
 
125
129
  ### Get Baseline Widely Available compatible browser versions as of a specific date
@@ -127,17 +131,37 @@ baselineBrowserMapping.getAllWidelyAvailable();
127
131
  To get the minimum browser versions that supported Baseline Widely Available on a specific date, call `getMinimumWidelyAvailableOnDate` or `geAllWidelyAvailableOnDate`, passing the desired date in the format `YYYY-MM-DD`:
128
132
 
129
133
  ```javascript
130
- baselineBrowserMapping.getMinimumWidelyAvailableOnDate("2021-03-19");
134
+ import { getMinimumWidelyAvailableOnDate } from "baseline-browser-mapping";
135
+
136
+ getMinimumWidelyAvailableOnDate("2021-03-19");
131
137
  ```
132
138
 
133
139
  This would return the final version of each core browser released on or before 19th September 2018 i.e. 30 months before 19th March 2021.
134
140
 
141
+ If you need a list of _all_ compatible versions, you can import and call:
142
+
143
+ ```javascript
144
+ import { getAllWidelyAvailableOnDate } from "baseline-browser-mapping";
145
+
146
+ getAllWidelyAvailableOnDate("2021-03-19");
147
+ ```
148
+
135
149
  ### Get Baseline year compatible browser versions
136
150
 
137
151
  To get the list of browser versions that support a particular year's Baseline feature set, call `getMinimumByYear` or `getAllByYear` passing the desired year in the format YYYY:
138
152
 
139
153
  ```javascript
140
- baselineBrowserMapping.getMinimumByYear("2020");
154
+ import { getMinimumByYear } from "baseline-browser-mapping";
155
+
156
+ getMinimumByYear("2020");
157
+ ```
158
+
159
+ If you need a list of _all_ compatible versions, you can import and call:
160
+
161
+ ```javascript
162
+ import { getAllByYear } from "baseline-browser-mapping";
163
+
164
+ getAllByYear("2020");
141
165
  ```
142
166
 
143
167
  ### Including downstreambrowsers
@@ -145,11 +169,11 @@ baselineBrowserMapping.getMinimumByYear("2020");
145
169
  Each of the methods above can take an optional final boolean parameter `includeDownstream`. The default for this in all functions is `false`. To include downstream browsers, pass `true` as the final parameter when you call the function:
146
170
 
147
171
  ```javascript
148
- baselineBrowserMapping.getAllWidelyAvailable(true)
172
+ getAllWidelyAvailable(true)
149
173
 
150
- baselineBrowserMapping.getMinimumWidelyAvailableOnDate('2021-03-19' true)
174
+ getMinimumWidelyAvailableOnDate('2021-03-19' true)
151
175
 
152
- baselineBrowserMapping.getMinimumByYear('2020', true)
176
+ getMinimumByYear('2020', true)
153
177
  ```
154
178
 
155
179
  Passing `true` will include the appropriate versions of the browsers listed as "Core" = `false` below.
@@ -170,11 +194,11 @@ Passing `true` will include the appropriate versions of the browsers listed as "
170
194
  | Samsung Internet | `samsunginternet_android` | `false` | MDN `browser-compat-data` |
171
195
  | WebView Android | `webview_android` | `false` | MDN `browser-compat-data` |
172
196
  | QQ Browser Mobile | `qq_android` | `false` | useragents.io |
173
- | UC Browser Mobile | `UC_android` | `false` | useragents.io |
197
+ | UC Browser Mobile | `uc_android` | `false` | useragents.io |
174
198
  | Yandex Browser Mobile | `ya_android` | `false` | useragents.io |
175
199
 
176
200
  > **Note**
177
- > All the non-core browsers currently included implement Chromium. Their inclusion in any of the above functions is based on the Baseline feature set supported by the Chromium version they implement, not their release date.
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.
178
202
 
179
203
  ## Helping out and getting help
180
204
 
@@ -118,7 +118,7 @@ const getDownstreamBrowsers = (inputArray = [], minOnly = true) => {
118
118
  if (versionData.engine != "Blink") {
119
119
  return false;
120
120
  }
121
- if (compareVersions(versionData.engine_version, minimumChromeVersion) == 0) {
121
+ if (parseInt(versionData.engine_version) < parseInt(minimumChromeVersion)) {
122
122
  return false;
123
123
  }
124
124
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseline-browser-mapping",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
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"