baseline-browser-mapping 2.2.2 → 2.4.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
|
@@ -165,16 +165,34 @@ By default, this function returns an `Array` of `Objects` and excludes downstrea
|
|
|
165
165
|
[
|
|
166
166
|
...
|
|
167
167
|
{
|
|
168
|
-
browser:
|
|
169
|
-
version:
|
|
170
|
-
release_date:
|
|
171
|
-
year:
|
|
172
|
-
|
|
168
|
+
browser: "firefox_android", // Browser name
|
|
169
|
+
version: "125", // Browser version
|
|
170
|
+
release_date: "2024-04-16", // Release date
|
|
171
|
+
year: 2023, // Baseline year feature set the version supports
|
|
172
|
+
wa_compatible: true // Whether the browser version supports Widely available
|
|
173
173
|
},
|
|
174
174
|
...
|
|
175
175
|
]
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
### Understanding which browsers support Newly available features
|
|
179
|
+
|
|
180
|
+
You may want to understand which recent browser versions support all Newly available features. You can replace the `wa_compatible` property with a `supports` property using the `useSupport` option:
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
getAllVersions({
|
|
184
|
+
useSupports: true,
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The `supports` property has three possible values:
|
|
189
|
+
|
|
190
|
+
- `year_only` for browser versions that do not support all Baseline Widely available Newly Available features.
|
|
191
|
+
- `widely` for browser versions that support all Widely available features.
|
|
192
|
+
- `newly` for browser versions that support all Newly available features.
|
|
193
|
+
|
|
194
|
+
Browser versions that support all Newly available features also support all Widely available features.
|
|
195
|
+
|
|
178
196
|
### `getAllVersions()` Configuration options
|
|
179
197
|
|
|
180
198
|
`getAllVersions()` accepts an `Object` as an argument with configuration options. The defaults are as follows:
|
|
@@ -202,13 +220,13 @@ Downstream browsers include the same properties as core browsers, as well as the
|
|
|
202
220
|
[
|
|
203
221
|
...
|
|
204
222
|
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"
|
|
223
|
+
browser: "samsunginternet_android",
|
|
224
|
+
version: "27.0",
|
|
225
|
+
release_date: "2024-11-06",
|
|
226
|
+
engine: "Blink",
|
|
227
|
+
engine_version: "125",
|
|
228
|
+
year: 2023,
|
|
229
|
+
supports: "widely"
|
|
212
230
|
},
|
|
213
231
|
...
|
|
214
232
|
]
|
|
@@ -233,7 +251,7 @@ In thise case, `getAllVersions()` returns a nested object with the browser [IDs
|
|
|
233
251
|
"chrome": {
|
|
234
252
|
"53": {
|
|
235
253
|
"year": 2016,
|
|
236
|
-
"
|
|
254
|
+
"supports": "year_only",
|
|
237
255
|
"release_date": "2016-09-07"
|
|
238
256
|
},
|
|
239
257
|
...
|
|
@@ -248,7 +266,7 @@ Downstream browsers will include extra fields for `engine` and `engine_versions`
|
|
|
248
266
|
"webview_android": {
|
|
249
267
|
"53": {
|
|
250
268
|
"year": 2016,
|
|
251
|
-
"
|
|
269
|
+
"supports": "year_only",
|
|
252
270
|
"release_date": "2016-09-07",
|
|
253
271
|
"engine": "Blink",
|
|
254
272
|
"engine_version": "53"
|
|
@@ -268,10 +286,13 @@ getAllVersions({
|
|
|
268
286
|
`getAllVersions` returns a `String` with a header row and comma-separated values for each browser version that you can write to a file or pass to another service. Core browsers will have "NULL" as the value for their `engine` and `engine_version`:
|
|
269
287
|
|
|
270
288
|
```csv
|
|
271
|
-
"browser","version","year","
|
|
272
|
-
"chrome","53","2016","
|
|
289
|
+
"browser","version","year","supports","release_date","engine","engine_version"
|
|
290
|
+
"chrome","53","2016","year_only","2016-09-07","NULL","NULL"
|
|
291
|
+
...
|
|
292
|
+
"firefox","135","2024","widely","2025-02-04","NULL","NULL"
|
|
293
|
+
"firefox","136","2024","newly","2025-03-04","NULL","NULL"
|
|
273
294
|
...
|
|
274
|
-
"ya_android","20.12","2020","
|
|
295
|
+
"ya_android","20.12","2020","year_only","2020-12-20","Blink","87"
|
|
275
296
|
...
|
|
276
297
|
```
|
|
277
298
|
|
|
@@ -286,10 +307,18 @@ The outputs of `getAllVersions()` are available as JSON or CSV files generated o
|
|
|
286
307
|
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_array.json)
|
|
287
308
|
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_object.json)
|
|
288
309
|
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions.csv)
|
|
310
|
+
Core browsers only, with `supports` property
|
|
311
|
+
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_array_with_supports.json)
|
|
312
|
+
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_object_with_supports.json)
|
|
313
|
+
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_with_supports.csv)
|
|
289
314
|
- Including downstream browsers
|
|
290
315
|
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_array.json)
|
|
291
316
|
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_object.json)
|
|
292
317
|
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions.csv)
|
|
318
|
+
- Including downstream browsers with `supports` property
|
|
319
|
+
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_array_with_supports.json)
|
|
320
|
+
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_object_with_supports.json)
|
|
321
|
+
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_with_supports.csv)
|
|
293
322
|
|
|
294
323
|
These files are updated on a daily basis.
|
|
295
324
|
|
|
@@ -652,6 +652,24 @@
|
|
|
652
652
|
"engine_version": "130",
|
|
653
653
|
"status": "unknown",
|
|
654
654
|
"release_date": "2024-11-30"
|
|
655
|
+
},
|
|
656
|
+
"25.2": {
|
|
657
|
+
"engine": "Blink",
|
|
658
|
+
"engine_version": "132",
|
|
659
|
+
"status": "unknown",
|
|
660
|
+
"release_date": "2025-04-24"
|
|
661
|
+
},
|
|
662
|
+
"25.3": {
|
|
663
|
+
"engine": "Blink",
|
|
664
|
+
"engine_version": "132",
|
|
665
|
+
"status": "unknown",
|
|
666
|
+
"release_date": "2025-04-23"
|
|
667
|
+
},
|
|
668
|
+
"25.4": {
|
|
669
|
+
"engine": "Blink",
|
|
670
|
+
"engine_version": "134",
|
|
671
|
+
"status": "unknown",
|
|
672
|
+
"release_date": "2025-04-23"
|
|
655
673
|
}
|
|
656
674
|
}
|
|
657
675
|
},
|
|
@@ -1504,5 +1522,5 @@
|
|
|
1504
1522
|
}
|
|
1505
1523
|
}
|
|
1506
1524
|
},
|
|
1507
|
-
"lastUpdated": "2025-04-
|
|
1525
|
+
"lastUpdated": "2025-04-30T13:52:05.731Z"
|
|
1508
1526
|
}
|
|
@@ -6,18 +6,13 @@ type BrowserVersion = {
|
|
|
6
6
|
engine_version?: string;
|
|
7
7
|
};
|
|
8
8
|
interface AllBrowsersBrowserVersion extends BrowserVersion {
|
|
9
|
-
year: number;
|
|
10
|
-
|
|
9
|
+
year: number | string;
|
|
10
|
+
supports?: string;
|
|
11
|
+
wa_compatible?: boolean;
|
|
11
12
|
}
|
|
12
13
|
type NestedBrowserVersions = {
|
|
13
14
|
[browser: string]: {
|
|
14
|
-
[version: string]:
|
|
15
|
-
year: number;
|
|
16
|
-
wa_compatible: boolean;
|
|
17
|
-
release_date?: string;
|
|
18
|
-
engine?: string;
|
|
19
|
-
engine_version?: string;
|
|
20
|
-
};
|
|
15
|
+
[version: string]: AllBrowsersBrowserVersion;
|
|
21
16
|
};
|
|
22
17
|
};
|
|
23
18
|
type Options = {
|
|
@@ -38,7 +33,7 @@ type Options = {
|
|
|
38
33
|
*/
|
|
39
34
|
widelyAvailableOnDate?: string | number;
|
|
40
35
|
/**
|
|
41
|
-
* Pass a year between
|
|
36
|
+
* Pass a year between 2015 and the current year to get browser versions compatible with all
|
|
42
37
|
* Newly Available features as of the end of the year specified.
|
|
43
38
|
* > NOTE: cannot be used with `widelyAvailableOnDate`.
|
|
44
39
|
*/
|
|
@@ -65,6 +60,11 @@ type AllVersionsOptions = {
|
|
|
65
60
|
* Defaults to `false`.
|
|
66
61
|
*/
|
|
67
62
|
includeDownstreamBrowsers?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether to use the new "supports" property in place of "wa_compatible"
|
|
65
|
+
* Defaults to `false`
|
|
66
|
+
*/
|
|
67
|
+
useSupports?: boolean;
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
70
|
* Returns all browser versions known to this module with their level of Baseline support either as an `Array` or a `String` CSV.
|
|
@@ -23,7 +23,15 @@ const downstreamBrowserData = [
|
|
|
23
23
|
...Object.entries(bcdBrowsers.browsers).filter(([browserName]) => bcdDownstreamBrowserNames.includes(browserName)),
|
|
24
24
|
...Object.entries(otherBrowsers.browsers),
|
|
25
25
|
];
|
|
26
|
-
const acceptableStatuses = [
|
|
26
|
+
const acceptableStatuses = [
|
|
27
|
+
"current",
|
|
28
|
+
"esr",
|
|
29
|
+
"retired",
|
|
30
|
+
"unknown",
|
|
31
|
+
"beta",
|
|
32
|
+
"nightly",
|
|
33
|
+
];
|
|
34
|
+
let suppressPre2015Warning = false;
|
|
27
35
|
const stripLTEPrefix = (str) => {
|
|
28
36
|
if (!str) {
|
|
29
37
|
return str;
|
|
@@ -136,8 +144,11 @@ const getSubsequentVersions = (minimumVersions) => {
|
|
|
136
144
|
return subsequentVersions;
|
|
137
145
|
};
|
|
138
146
|
const getCoreVersionsByDate = (date, listAllCompatibleVersions = false) => {
|
|
139
|
-
if (date.getFullYear() <
|
|
140
|
-
|
|
147
|
+
if (date.getFullYear() < 2015 && !suppressPre2015Warning) {
|
|
148
|
+
console.warn(new Error("There are no browser versions compatible with Baseline before 2015. You may receive unexpected results."));
|
|
149
|
+
}
|
|
150
|
+
if (date.getFullYear() < 2002) {
|
|
151
|
+
throw new Error("None of the browsers in the core set were released before 2002. Please use a date after 2002.");
|
|
141
152
|
}
|
|
142
153
|
if (date.getFullYear() > new Date().getFullYear()) {
|
|
143
154
|
throw new Error("There are no browser versions compatible with Baseline in the future");
|
|
@@ -269,13 +280,15 @@ export function getCompatibleVersions(userOptions) {
|
|
|
269
280
|
* - `outputFormat`: `array` (default), `object` or `csv`
|
|
270
281
|
*/
|
|
271
282
|
export function getAllVersions(userOptions) {
|
|
283
|
+
suppressPre2015Warning = true;
|
|
272
284
|
let incomingOptions = userOptions ?? {};
|
|
273
285
|
let options = {
|
|
274
286
|
outputFormat: incomingOptions.outputFormat ?? "array",
|
|
275
287
|
includeDownstreamBrowsers: incomingOptions.includeDownstreamBrowsers ?? false,
|
|
288
|
+
useSupports: incomingOptions.useSupports ?? false,
|
|
276
289
|
};
|
|
277
290
|
let nextYear = new Date().getFullYear() + 1;
|
|
278
|
-
const yearArray = [...Array(nextYear).keys()].slice(
|
|
291
|
+
const yearArray = [...Array(nextYear).keys()].slice(2002);
|
|
279
292
|
const yearMinimumVersions = {};
|
|
280
293
|
yearArray.forEach((year) => {
|
|
281
294
|
yearMinimumVersions[year] = {};
|
|
@@ -289,8 +302,17 @@ export function getAllVersions(userOptions) {
|
|
|
289
302
|
waMinimumVersions.forEach((version) => {
|
|
290
303
|
waObject[version.browser] = version;
|
|
291
304
|
});
|
|
305
|
+
const thirtyMonthsFromToday = new Date();
|
|
306
|
+
thirtyMonthsFromToday.setMonth(thirtyMonthsFromToday.getMonth() + 30);
|
|
307
|
+
const naMinimumVersions = getCompatibleVersions({
|
|
308
|
+
widelyAvailableOnDate: thirtyMonthsFromToday.toISOString().slice(0, 10),
|
|
309
|
+
});
|
|
310
|
+
const naObject = {};
|
|
311
|
+
naMinimumVersions.forEach((version) => {
|
|
312
|
+
naObject[version.browser] = version;
|
|
313
|
+
});
|
|
292
314
|
const allVersions = getCompatibleVersions({
|
|
293
|
-
targetYear:
|
|
315
|
+
targetYear: 2002,
|
|
294
316
|
listAllCompatibleVersions: true,
|
|
295
317
|
});
|
|
296
318
|
const outputArray = new Array();
|
|
@@ -301,6 +323,7 @@ export function getAllVersions(userOptions) {
|
|
|
301
323
|
return compareVersions(a.version, b.version);
|
|
302
324
|
});
|
|
303
325
|
let waVersion = waObject[browserName]?.version ?? "0";
|
|
326
|
+
let naVersion = naObject[browserName]?.version ?? "0";
|
|
304
327
|
yearArray.forEach((year) => {
|
|
305
328
|
if (yearMinimumVersions[year]) {
|
|
306
329
|
let minBrowserVersionInfo = yearMinimumVersions[year][browserName] ?? {
|
|
@@ -312,12 +335,25 @@ export function getAllVersions(userOptions) {
|
|
|
312
335
|
? thisBrowserAllVersions
|
|
313
336
|
: thisBrowserAllVersions.slice(0, sliceIndex);
|
|
314
337
|
subArray.forEach((version) => {
|
|
315
|
-
let
|
|
316
|
-
|
|
338
|
+
let isWaCcompatible = compareVersions(version.version, waVersion) >= 0 ? true : false;
|
|
339
|
+
let isNaCompatible = compareVersions(version.version, naVersion) >= 0 ? true : false;
|
|
340
|
+
let versionToPush = {
|
|
317
341
|
...version,
|
|
318
|
-
year: year - 1,
|
|
319
|
-
|
|
320
|
-
|
|
342
|
+
year: year <= 2015 ? "pre_baseline" : year - 1,
|
|
343
|
+
};
|
|
344
|
+
if (options.useSupports) {
|
|
345
|
+
if (isWaCcompatible)
|
|
346
|
+
versionToPush.supports = "widely";
|
|
347
|
+
if (isNaCompatible)
|
|
348
|
+
versionToPush.supports = "newly";
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
versionToPush = {
|
|
352
|
+
...versionToPush,
|
|
353
|
+
wa_compatible: isWaCcompatible,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
outputArray.push(versionToPush);
|
|
321
357
|
});
|
|
322
358
|
thisBrowserAllVersions = thisBrowserAllVersions.slice(sliceIndex, thisBrowserAllVersions.length);
|
|
323
359
|
}
|
|
@@ -329,24 +365,48 @@ export function getAllVersions(userOptions) {
|
|
|
329
365
|
let correspondingChromiumVersion = outputArray.find((upstreamVersion) => upstreamVersion.browser === "chrome" &&
|
|
330
366
|
upstreamVersion.version === version.engine_version);
|
|
331
367
|
if (correspondingChromiumVersion) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
368
|
+
if (options.useSupports) {
|
|
369
|
+
outputArray.push({
|
|
370
|
+
...version,
|
|
371
|
+
year: correspondingChromiumVersion.year,
|
|
372
|
+
supports: correspondingChromiumVersion.supports,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
outputArray.push({
|
|
377
|
+
...version,
|
|
378
|
+
year: correspondingChromiumVersion.year,
|
|
379
|
+
wa_compatible: correspondingChromiumVersion.wa_compatible,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
337
382
|
}
|
|
338
383
|
});
|
|
339
384
|
}
|
|
340
385
|
outputArray.sort((a, b) => {
|
|
341
|
-
|
|
386
|
+
// Sort by year: "pre_baseline" first, then numerical year in ascending order
|
|
387
|
+
if (a.year === "pre_baseline" && b.year !== "pre_baseline") {
|
|
342
388
|
return -1;
|
|
343
389
|
}
|
|
344
|
-
|
|
390
|
+
if (b.year === "pre_baseline" && a.year !== "pre_baseline") {
|
|
345
391
|
return 1;
|
|
346
392
|
}
|
|
347
|
-
|
|
348
|
-
|
|
393
|
+
if (a.year !== "pre_baseline" && b.year !== "pre_baseline") {
|
|
394
|
+
if (a.year < b.year) {
|
|
395
|
+
return -1;
|
|
396
|
+
}
|
|
397
|
+
if (a.year > b.year) {
|
|
398
|
+
return 1;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
// Sort by browser alphabetically
|
|
402
|
+
if (a.browser < b.browser) {
|
|
403
|
+
return -1;
|
|
404
|
+
}
|
|
405
|
+
if (a.browser > b.browser) {
|
|
406
|
+
return 1;
|
|
349
407
|
}
|
|
408
|
+
// Sort by version using compareVersions
|
|
409
|
+
return compareVersions(a.version, b.version);
|
|
350
410
|
});
|
|
351
411
|
if (options.outputFormat === "object") {
|
|
352
412
|
const outputObject = {};
|
|
@@ -354,30 +414,52 @@ export function getAllVersions(userOptions) {
|
|
|
354
414
|
if (!outputObject[version.browser]) {
|
|
355
415
|
outputObject[version.browser] = {};
|
|
356
416
|
}
|
|
357
|
-
|
|
358
|
-
outputObject[version.browser][version.version] = {
|
|
417
|
+
let versionToAdd = {
|
|
359
418
|
year: version.year,
|
|
360
|
-
wa_compatible: version.wa_compatible,
|
|
361
419
|
release_date: version.release_date,
|
|
362
420
|
engine: version.engine,
|
|
363
421
|
engine_version: version.engine_version,
|
|
364
422
|
};
|
|
423
|
+
if (options.useSupports) {
|
|
424
|
+
//@ts-ignore
|
|
425
|
+
outputObject[version.browser][version.version] = version.supports
|
|
426
|
+
? { ...versionToAdd, supports: version.supports }
|
|
427
|
+
: versionToAdd;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
//@ts-ignores
|
|
431
|
+
outputObject[version.browser][version.version] = {
|
|
432
|
+
...versionToAdd,
|
|
433
|
+
wa_compatible: version.wa_compatible,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
365
436
|
});
|
|
366
437
|
return outputObject ?? {};
|
|
367
438
|
}
|
|
368
439
|
if (options.outputFormat === "csv") {
|
|
369
|
-
let outputString = `"browser","version","year"
|
|
440
|
+
let outputString = `"browser","version","year",` +
|
|
441
|
+
`"${options.useSupports ? "supports" : "wa_compatible"}",` +
|
|
442
|
+
`"release_date","engine","engine_version"`;
|
|
370
443
|
outputArray.forEach((version) => {
|
|
371
444
|
let outputs = {
|
|
372
445
|
browser: version.browser,
|
|
373
446
|
version: version.version,
|
|
374
447
|
year: version.year,
|
|
375
|
-
wa_compatible: version.wa_compatible,
|
|
376
448
|
release_date: version.release_date ?? "NULL",
|
|
377
449
|
engine: version.engine ?? "NULL",
|
|
378
450
|
engine_version: version.engine_version ?? "NULL",
|
|
379
451
|
};
|
|
380
|
-
|
|
452
|
+
outputs = options.useSupports
|
|
453
|
+
? { ...outputs, supports: version.supports ?? "" }
|
|
454
|
+
: { ...outputs, wa_compatible: version.wa_compatible };
|
|
455
|
+
outputString +=
|
|
456
|
+
`\n"${outputs.browser}","` +
|
|
457
|
+
`${outputs.version}","` +
|
|
458
|
+
`${outputs.year}","` +
|
|
459
|
+
`${options.useSupports ? outputs.supports : outputs.wa_compatible}","` +
|
|
460
|
+
`${outputs.release_date}","` +
|
|
461
|
+
`${outputs.engine}","` +
|
|
462
|
+
`${outputs.engine_version}"`;
|
|
381
463
|
});
|
|
382
464
|
return outputString;
|
|
383
465
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseline-browser-mapping",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
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"
|
|
@@ -20,14 +20,12 @@
|
|
|
20
20
|
"refresh-static": "npx tsx scripts/refresh-static.ts"
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@mdn/browser-compat-data": "^6.0.1",
|
|
25
|
-
"web-features": "^2.31.0"
|
|
26
|
-
},
|
|
27
23
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^22.
|
|
24
|
+
"@types/node": "^22.15.17",
|
|
29
25
|
"prettier": "^3.5.3",
|
|
30
|
-
"typescript": "^5.7.2"
|
|
26
|
+
"typescript": "^5.7.2",
|
|
27
|
+
"@mdn/browser-compat-data": "^6.0.13",
|
|
28
|
+
"web-features": "^2.34.2"
|
|
31
29
|
},
|
|
32
30
|
"repository": "git+https://github.com/web-platform-dx/baseline-browser-mapping.git"
|
|
33
31
|
}
|