baseline-browser-mapping 2.2.2 → 2.3.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
|
|
|
@@ -7,17 +7,12 @@ type BrowserVersion = {
|
|
|
7
7
|
};
|
|
8
8
|
interface AllBrowsersBrowserVersion extends BrowserVersion {
|
|
9
9
|
year: number;
|
|
10
|
-
|
|
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 = {
|
|
@@ -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.
|
|
@@ -273,6 +273,7 @@ export function getAllVersions(userOptions) {
|
|
|
273
273
|
let options = {
|
|
274
274
|
outputFormat: incomingOptions.outputFormat ?? "array",
|
|
275
275
|
includeDownstreamBrowsers: incomingOptions.includeDownstreamBrowsers ?? false,
|
|
276
|
+
useSupports: incomingOptions.useSupports ?? false,
|
|
276
277
|
};
|
|
277
278
|
let nextYear = new Date().getFullYear() + 1;
|
|
278
279
|
const yearArray = [...Array(nextYear).keys()].slice(2016);
|
|
@@ -289,6 +290,15 @@ export function getAllVersions(userOptions) {
|
|
|
289
290
|
waMinimumVersions.forEach((version) => {
|
|
290
291
|
waObject[version.browser] = version;
|
|
291
292
|
});
|
|
293
|
+
const thirtyMonthsFromToday = new Date();
|
|
294
|
+
thirtyMonthsFromToday.setMonth(thirtyMonthsFromToday.getMonth() + 30);
|
|
295
|
+
const naMinimumVersions = getCompatibleVersions({
|
|
296
|
+
widelyAvailableOnDate: thirtyMonthsFromToday.toISOString().slice(0, 10),
|
|
297
|
+
});
|
|
298
|
+
const naObject = {};
|
|
299
|
+
naMinimumVersions.forEach((version) => {
|
|
300
|
+
naObject[version.browser] = version;
|
|
301
|
+
});
|
|
292
302
|
const allVersions = getCompatibleVersions({
|
|
293
303
|
targetYear: 2016,
|
|
294
304
|
listAllCompatibleVersions: true,
|
|
@@ -301,6 +311,7 @@ export function getAllVersions(userOptions) {
|
|
|
301
311
|
return compareVersions(a.version, b.version);
|
|
302
312
|
});
|
|
303
313
|
let waVersion = waObject[browserName]?.version ?? "0";
|
|
314
|
+
let naVersion = naObject[browserName]?.version ?? "0";
|
|
304
315
|
yearArray.forEach((year) => {
|
|
305
316
|
if (yearMinimumVersions[year]) {
|
|
306
317
|
let minBrowserVersionInfo = yearMinimumVersions[year][browserName] ?? {
|
|
@@ -312,12 +323,30 @@ export function getAllVersions(userOptions) {
|
|
|
312
323
|
? thisBrowserAllVersions
|
|
313
324
|
: thisBrowserAllVersions.slice(0, sliceIndex);
|
|
314
325
|
subArray.forEach((version) => {
|
|
315
|
-
let
|
|
316
|
-
|
|
326
|
+
let isWaCcompatible = compareVersions(version.version, waVersion) >= 0 ? true : false;
|
|
327
|
+
let isNaCompatible = compareVersions(version.version, naVersion) >= 0 ? true : false;
|
|
328
|
+
let versionToPush = {
|
|
317
329
|
...version,
|
|
318
330
|
year: year - 1,
|
|
319
|
-
|
|
320
|
-
|
|
331
|
+
};
|
|
332
|
+
if (options.useSupports) {
|
|
333
|
+
let supports = "year_only";
|
|
334
|
+
if (isWaCcompatible && isNaCompatible)
|
|
335
|
+
supports = "newly";
|
|
336
|
+
if (isWaCcompatible && !isNaCompatible)
|
|
337
|
+
supports = "widely";
|
|
338
|
+
versionToPush = {
|
|
339
|
+
...versionToPush,
|
|
340
|
+
supports: supports,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
versionToPush = {
|
|
345
|
+
...versionToPush,
|
|
346
|
+
wa_compatible: isWaCcompatible,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
outputArray.push(versionToPush);
|
|
321
350
|
});
|
|
322
351
|
thisBrowserAllVersions = thisBrowserAllVersions.slice(sliceIndex, thisBrowserAllVersions.length);
|
|
323
352
|
}
|
|
@@ -329,11 +358,20 @@ export function getAllVersions(userOptions) {
|
|
|
329
358
|
let correspondingChromiumVersion = outputArray.find((upstreamVersion) => upstreamVersion.browser === "chrome" &&
|
|
330
359
|
upstreamVersion.version === version.engine_version);
|
|
331
360
|
if (correspondingChromiumVersion) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
361
|
+
if (options.useSupports) {
|
|
362
|
+
outputArray.push({
|
|
363
|
+
...version,
|
|
364
|
+
year: correspondingChromiumVersion.year,
|
|
365
|
+
supports: correspondingChromiumVersion.supports,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
outputArray.push({
|
|
370
|
+
...version,
|
|
371
|
+
year: correspondingChromiumVersion.year,
|
|
372
|
+
wa_compatible: correspondingChromiumVersion.wa_compatible,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
337
375
|
}
|
|
338
376
|
});
|
|
339
377
|
}
|
|
@@ -354,30 +392,43 @@ export function getAllVersions(userOptions) {
|
|
|
354
392
|
if (!outputObject[version.browser]) {
|
|
355
393
|
outputObject[version.browser] = {};
|
|
356
394
|
}
|
|
357
|
-
|
|
358
|
-
outputObject[version.browser][version.version] = {
|
|
395
|
+
let versionToAdd = {
|
|
359
396
|
year: version.year,
|
|
360
|
-
wa_compatible: version.wa_compatible,
|
|
361
397
|
release_date: version.release_date,
|
|
362
398
|
engine: version.engine,
|
|
363
399
|
engine_version: version.engine_version,
|
|
364
400
|
};
|
|
401
|
+
//@ts-ignore
|
|
402
|
+
outputObject[version.browser][version.version] = options.useSupports
|
|
403
|
+
? { ...versionToAdd, supports: version.supports }
|
|
404
|
+
: { ...versionToAdd, wa_compatible: version.wa_compatible };
|
|
365
405
|
});
|
|
366
406
|
return outputObject ?? {};
|
|
367
407
|
}
|
|
368
408
|
if (options.outputFormat === "csv") {
|
|
369
|
-
let outputString = `"browser","version","year"
|
|
409
|
+
let outputString = `"browser","version","year",` +
|
|
410
|
+
`"${options.useSupports ? "supports" : "wa_compatible"}",` +
|
|
411
|
+
`"release_date","engine","engine_version"`;
|
|
370
412
|
outputArray.forEach((version) => {
|
|
371
413
|
let outputs = {
|
|
372
414
|
browser: version.browser,
|
|
373
415
|
version: version.version,
|
|
374
416
|
year: version.year,
|
|
375
|
-
wa_compatible: version.wa_compatible,
|
|
376
417
|
release_date: version.release_date ?? "NULL",
|
|
377
418
|
engine: version.engine ?? "NULL",
|
|
378
419
|
engine_version: version.engine_version ?? "NULL",
|
|
379
420
|
};
|
|
380
|
-
|
|
421
|
+
outputs = options.useSupports
|
|
422
|
+
? { ...outputs, supports: version.supports }
|
|
423
|
+
: { ...outputs, wa_compatible: version.wa_compatible };
|
|
424
|
+
outputString +=
|
|
425
|
+
`\n"${outputs.browser}","` +
|
|
426
|
+
`${outputs.version}","` +
|
|
427
|
+
`${outputs.year}","` +
|
|
428
|
+
`${options.useSupports ? outputs.supports : outputs.wa_compatible}","` +
|
|
429
|
+
`${outputs.release_date}","` +
|
|
430
|
+
`${outputs.engine}","` +
|
|
431
|
+
`${outputs.engine_version}"`;
|
|
381
432
|
});
|
|
382
433
|
return outputString;
|
|
383
434
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseline-browser-mapping",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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"
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@mdn/browser-compat-data": "^6.0.
|
|
25
|
-
"web-features": "^2.
|
|
24
|
+
"@mdn/browser-compat-data": "^6.0.9",
|
|
25
|
+
"web-features": "^2.34.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^22.
|
|
28
|
+
"@types/node": "^22.15.3",
|
|
29
29
|
"prettier": "^3.5.3",
|
|
30
30
|
"typescript": "^5.7.2"
|
|
31
31
|
},
|