baseline-browser-mapping 2.2.0 → 2.2.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
CHANGED
|
@@ -216,7 +216,48 @@ Downstream browsers include the same properties as core browsers, as well as the
|
|
|
216
216
|
|
|
217
217
|
#### `outputFormat`
|
|
218
218
|
|
|
219
|
-
By default, this function returns an `Array` of `Objects` which can be manipulated in Javascript or output to JSON.
|
|
219
|
+
By default, this function returns an `Array` of `Objects` which can be manipulated in Javascript or output to JSON.
|
|
220
|
+
|
|
221
|
+
To return an `Object` that nests keys , set `outputFormat` to `object`:
|
|
222
|
+
|
|
223
|
+
```javascript
|
|
224
|
+
getAllVersions({
|
|
225
|
+
outputFormat: "object",
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
In thise case, `getAllVersions()` returns a nested object with the browser [IDs listed below](#list-of-downstream-browsers) as keys, and versions as keys within them:
|
|
230
|
+
|
|
231
|
+
```javascript
|
|
232
|
+
{
|
|
233
|
+
"chrome": {
|
|
234
|
+
"53": {
|
|
235
|
+
"year": 2016,
|
|
236
|
+
"wa_compatible": false,
|
|
237
|
+
"release_date": "2016-09-07"
|
|
238
|
+
},
|
|
239
|
+
...
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Downstream browsers will include extra fields for `engine` and `engine_versions`
|
|
244
|
+
|
|
245
|
+
```javascript
|
|
246
|
+
{
|
|
247
|
+
...
|
|
248
|
+
"webview_android": {
|
|
249
|
+
"53": {
|
|
250
|
+
"year": 2016,
|
|
251
|
+
"waCompatible": false,
|
|
252
|
+
"release_date": "2016-09-07",
|
|
253
|
+
"engine": "Blink",
|
|
254
|
+
"engine_version": "53"
|
|
255
|
+
},
|
|
256
|
+
...
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
To return a `String` in CSV format, set `outputFormat` to `csv`:
|
|
220
261
|
|
|
221
262
|
```javascript
|
|
222
263
|
getAllVersions({
|
|
@@ -227,7 +268,7 @@ getAllVersions({
|
|
|
227
268
|
`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`:
|
|
228
269
|
|
|
229
270
|
```csv
|
|
230
|
-
"browser","version","year","
|
|
271
|
+
"browser","version","year","wa_compatible","release_date","engine","engine_version"
|
|
231
272
|
"chrome","53","2016","false","2016-09-07","NULL","NULL"
|
|
232
273
|
...
|
|
233
274
|
"ya_android","20.12","2020","false","2020-12-20","Blink","87"
|
|
@@ -237,6 +278,21 @@ getAllVersions({
|
|
|
237
278
|
> [!NOTE]
|
|
238
279
|
> The above example uses `"includeDownstreamBrowsers": true`
|
|
239
280
|
|
|
281
|
+
### Static resources
|
|
282
|
+
|
|
283
|
+
The outputs of `getAllVersions()` are available as JSON or CSV files generated on a daily basis and hosted on GitHub pages:
|
|
284
|
+
|
|
285
|
+
- Core browsers only
|
|
286
|
+
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_array.json)
|
|
287
|
+
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions_object.json)
|
|
288
|
+
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/all_versions.csv)
|
|
289
|
+
- Including downstream browsers
|
|
290
|
+
- [Array](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_array.json)
|
|
291
|
+
- [Object](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions_object.json)
|
|
292
|
+
- [CSV](https://web-platform-dx.github.io/baseline-browser-mapping/with_downstream/all_versions.csv)
|
|
293
|
+
|
|
294
|
+
These files are updated on a daily basis.
|
|
295
|
+
|
|
240
296
|
## Downstream browsers
|
|
241
297
|
|
|
242
298
|
### Limitations
|
|
@@ -995,6 +995,12 @@
|
|
|
995
995
|
"engine_version": "100",
|
|
996
996
|
"status": "unknown",
|
|
997
997
|
"release_date": "2025-02-26"
|
|
998
|
+
},
|
|
999
|
+
"17.5": {
|
|
1000
|
+
"engine": "Blink",
|
|
1001
|
+
"engine_version": "100",
|
|
1002
|
+
"status": "unknown",
|
|
1003
|
+
"release_date": "2025-04-08"
|
|
998
1004
|
}
|
|
999
1005
|
}
|
|
1000
1006
|
},
|
|
@@ -1498,5 +1504,5 @@
|
|
|
1498
1504
|
}
|
|
1499
1505
|
}
|
|
1500
1506
|
},
|
|
1501
|
-
"lastUpdated": "2025-
|
|
1507
|
+
"lastUpdated": "2025-04-09T14:12:33.205Z"
|
|
1502
1508
|
}
|
|
@@ -7,8 +7,19 @@ type BrowserVersion = {
|
|
|
7
7
|
};
|
|
8
8
|
interface AllBrowsersBrowserVersion extends BrowserVersion {
|
|
9
9
|
year: number;
|
|
10
|
-
|
|
10
|
+
wa_compatible: boolean;
|
|
11
11
|
}
|
|
12
|
+
type NestedBrowserVersions = {
|
|
13
|
+
[browser: string]: {
|
|
14
|
+
[version: string]: {
|
|
15
|
+
year: number;
|
|
16
|
+
wa_compatible: boolean;
|
|
17
|
+
release_date?: string;
|
|
18
|
+
engine?: string;
|
|
19
|
+
engine_version?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
12
23
|
type Options = {
|
|
13
24
|
/**
|
|
14
25
|
* Whether to include only the minimum compatible browser versions or all compatible versions.
|
|
@@ -59,7 +70,7 @@ type AllVersionsOptions = {
|
|
|
59
70
|
* Returns all browser versions known to this module with their level of Baseline support either as an `Array` or a `String` CSV.
|
|
60
71
|
* Takes an object as an argument with two optional properties:
|
|
61
72
|
* - `includeDownstreamBrowsers`: `true` (default) or `false`
|
|
62
|
-
* - `outputFormat`: `array` (default) or `csv`
|
|
73
|
+
* - `outputFormat`: `array` (default), `object` or `csv`
|
|
63
74
|
*/
|
|
64
|
-
export declare function getAllVersions(userOptions?: AllVersionsOptions): AllBrowsersBrowserVersion[] | string;
|
|
75
|
+
export declare function getAllVersions(userOptions?: AllVersionsOptions): AllBrowsersBrowserVersion[] | NestedBrowserVersions | string;
|
|
65
76
|
export {};
|
|
@@ -249,7 +249,7 @@ export function getCompatibleVersions(userOptions) {
|
|
|
249
249
|
}
|
|
250
250
|
// Sets a cutoff date for feature interoperability 30 months before the stated date
|
|
251
251
|
if (options.widelyAvailableOnDate || options.targetYear === undefined) {
|
|
252
|
-
targetDate.setMonth(
|
|
252
|
+
targetDate.setMonth(targetDate.getMonth() - 30);
|
|
253
253
|
}
|
|
254
254
|
let coreBrowserArray = getCoreVersionsByDate(targetDate, options.listAllCompatibleVersions);
|
|
255
255
|
if (options.includeDownstreamBrowsers === false) {
|
|
@@ -266,7 +266,7 @@ export function getCompatibleVersions(userOptions) {
|
|
|
266
266
|
* Returns all browser versions known to this module with their level of Baseline support either as an `Array` or a `String` CSV.
|
|
267
267
|
* Takes an object as an argument with two optional properties:
|
|
268
268
|
* - `includeDownstreamBrowsers`: `true` (default) or `false`
|
|
269
|
-
* - `outputFormat`: `array` (default) or `csv`
|
|
269
|
+
* - `outputFormat`: `array` (default), `object` or `csv`
|
|
270
270
|
*/
|
|
271
271
|
export function getAllVersions(userOptions) {
|
|
272
272
|
let incomingOptions = userOptions ?? {};
|
|
@@ -312,11 +312,11 @@ export function getAllVersions(userOptions) {
|
|
|
312
312
|
? thisBrowserAllVersions
|
|
313
313
|
: thisBrowserAllVersions.slice(0, sliceIndex);
|
|
314
314
|
subArray.forEach((version) => {
|
|
315
|
-
let
|
|
315
|
+
let iswa_compatible = compareVersions(version.version, waVersion) >= 0 ? true : false;
|
|
316
316
|
outputArray.push({
|
|
317
317
|
...version,
|
|
318
318
|
year: year - 1,
|
|
319
|
-
|
|
319
|
+
wa_compatible: iswa_compatible,
|
|
320
320
|
});
|
|
321
321
|
});
|
|
322
322
|
thisBrowserAllVersions = thisBrowserAllVersions.slice(sliceIndex, thisBrowserAllVersions.length);
|
|
@@ -332,7 +332,7 @@ export function getAllVersions(userOptions) {
|
|
|
332
332
|
outputArray.push({
|
|
333
333
|
...version,
|
|
334
334
|
year: correspondingChromiumVersion.year,
|
|
335
|
-
|
|
335
|
+
wa_compatible: correspondingChromiumVersion.wa_compatible,
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
});
|
|
@@ -348,19 +348,36 @@ export function getAllVersions(userOptions) {
|
|
|
348
348
|
return compareVersions(a.version, b.version);
|
|
349
349
|
}
|
|
350
350
|
});
|
|
351
|
+
if (options.outputFormat === "object") {
|
|
352
|
+
const outputObject = {};
|
|
353
|
+
outputArray.forEach((version) => {
|
|
354
|
+
if (!outputObject[version.browser]) {
|
|
355
|
+
outputObject[version.browser] = {};
|
|
356
|
+
}
|
|
357
|
+
//@ts-ignore
|
|
358
|
+
outputObject[version.browser][version.version] = {
|
|
359
|
+
year: version.year,
|
|
360
|
+
wa_compatible: version.wa_compatible,
|
|
361
|
+
release_date: version.release_date,
|
|
362
|
+
engine: version.engine,
|
|
363
|
+
engine_version: version.engine_version,
|
|
364
|
+
};
|
|
365
|
+
});
|
|
366
|
+
return outputObject ?? {};
|
|
367
|
+
}
|
|
351
368
|
if (options.outputFormat === "csv") {
|
|
352
|
-
let outputString = `"browser","version","year","
|
|
369
|
+
let outputString = `"browser","version","year","wa_compatible","release_date","engine","engine_version"`;
|
|
353
370
|
outputArray.forEach((version) => {
|
|
354
371
|
let outputs = {
|
|
355
372
|
browser: version.browser,
|
|
356
373
|
version: version.version,
|
|
357
374
|
year: version.year,
|
|
358
|
-
|
|
375
|
+
wa_compatible: version.wa_compatible,
|
|
359
376
|
release_date: version.release_date ?? "NULL",
|
|
360
377
|
engine: version.engine ?? "NULL",
|
|
361
378
|
engine_version: version.engine_version ?? "NULL",
|
|
362
379
|
};
|
|
363
|
-
outputString += `\n"${outputs.browser}","${outputs.version}","${outputs.year}","${outputs.
|
|
380
|
+
outputString += `\n"${outputs.browser}","${outputs.version}","${outputs.year}","${outputs.wa_compatible}","${outputs.release_date}","${outputs.engine}","${outputs.engine_version}"`;
|
|
364
381
|
});
|
|
365
382
|
return outputString;
|
|
366
383
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseline-browser-mapping",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.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"
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
18
18
|
"prepare": "rm -rf dist; prettier . --write; tsc",
|
|
19
|
-
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts"
|
|
19
|
+
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts",
|
|
20
|
+
"refresh-static": "npx tsx scripts/refresh-static.ts"
|
|
20
21
|
},
|
|
21
22
|
"license": "Apache-2.0",
|
|
22
23
|
"dependencies": {
|
|
@@ -28,5 +29,5 @@
|
|
|
28
29
|
"prettier": "^3.5.3",
|
|
29
30
|
"typescript": "^5.7.2"
|
|
30
31
|
},
|
|
31
|
-
"repository": "web-platform-dx/baseline-browser-mapping"
|
|
32
|
+
"repository": "git+https://github.com/web-platform-dx/baseline-browser-mapping.git"
|
|
32
33
|
}
|