Skip to content

Commit 35f2efc

Browse files
authored
Add support for KaiOS in downstream browsers (#97)
* Implements opt-in support for KaiOS including tests, docs changes and new CLI option * Updating static files to include KaiOS and most recent data changes * Remove erroneously introduced version of Yandex (99.9) * Update @mdn/browser-compat-data to v7.0.0
1 parent da5a18c commit 35f2efc

15 files changed

+229
-70
lines changed

README.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ getCompatibleVersions({
149149
150150
#### `includeDownstreamBrowsers`
151151

152-
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:
152+
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 or Gecko version:
153153

154154
```javascript
155155
getCompatibleVersions({
@@ -159,6 +159,20 @@ getCompatibleVersions({
159159

160160
For more information on downstream browsers, see [the section on downstream browsers](#downstream-browsers) below.
161161

162+
#### `includeKaiOS`
163+
164+
KaiOS is an operating system and app framework based on the Gecko engine from Firefox. KaiOS is based on the Gecko engine and feature support can be derived from the upstream Gecko version that each KaiOS version implements. However KaiOS requires other considerations beyond feature compatibility to ensure a good user experience as it runs on device types that do not have either mouse and keyboard or touch screen input in the way that all the other browsers supported by this module do.
165+
166+
```javascript
167+
getCompatibleVersions({
168+
includeDownstreamBrowsers: true,
169+
includeKaiOS: true,
170+
});
171+
```
172+
173+
> [!NOTE]
174+
> Including KaiOS requires you to include all downstream browsers using the `includeDownstreamBrowsers` option.
175+
162176
#### `listAllCompatibleVersions`
163177

164178
Setting `listAllCompatibleVersions` to true will include the minimum versions of each compatible browser, and all the subsequent versions:
@@ -227,7 +241,7 @@ Browser versions that do not support Widely or Newly available will not include
227241

228242
#### `includeDownstreamBrowsers` (in `getAllVersions()` output)
229243

230-
As with `getCompatibleVersions()`, you can set `includeDownstreamBrowsers` to `true` to include the Chromium downstream browsers [listed below](#list-of-downstream-browsers).
244+
As with `getCompatibleVersions()`, you can set `includeDownstreamBrowsers` to `true` to include the Chromium and Gecko downstream browsers [listed below](#list-of-downstream-browsers).
231245

232246
```javascript
233247
getAllVersions({
@@ -253,6 +267,17 @@ Downstream browsers include the same properties as core browsers, as well as the
253267
]
254268
```
255269

270+
#### `includeKaiOS` (in `getAllVersions()` output)
271+
272+
As with `getCompatibleVersions()` you can include KaiOS in your output. The same requirement to have `includeDownstreamBrowsers: true` applies.
273+
274+
```javascript
275+
getAllVersions({
276+
includeDownstreamBrowsers: true,
277+
includeKaiOS: true,
278+
});
279+
```
280+
256281
#### `outputFormat`
257282

258283
By default, this function returns an `Array` of `Objects` which can be manipulated in Javascript or output to JSON.
@@ -374,10 +399,12 @@ Shows UC Browser Mobile 13.8 implementing Chromium 100, and:
374399
Shows Yandex Browser Mobile 24.10 implementing Chromium 128. The Chromium version from this string is mapped to the corresponding Chrome version from MDN `browser-compat-data`.
375400
376401
> [!NOTE]
377-
> 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.
402+
> 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 or Gecko version, so their release dates are more informative than critical.
378403
379404
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.
380405
406+
KaiOS is an exception - its upstream version mappings are handled separately from the other browsers because they happen very infrequently.
407+
381408
### List of downstream browsers
382409
383410
| Browser | ID | Core | Source |
@@ -396,6 +423,7 @@ This data is updated on a daily basis using a [script](https://github.com/web-pl
396423
| QQ Browser Mobile | `qq_android` | `false` | useragents.io |
397424
| UC Browser Mobile | `uc_android` | `false` | useragents.io |
398425
| Yandex Browser Mobile | `ya_android` | `false` | useragents.io |
426+
| KaiOS | `kai_os` | `false` | Manual |
399427
400428
> [!NOTE]
401-
> 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.
429+
> All the non-core browsers currently included implement Chromium or Gecko. Their inclusion in any of the above methods is based on the Baseline feature set supported by the Chromium or Gecko version they implement, not their release date.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
"baseline-browser-mapping": "./dist/cli.js"
2727
},
2828
"scripts": {
29+
"fix-cli-permissions": "output=$(npx baseline-browser-mapping 2>&1); [[ \"$output\" =~ sh:\\ ([^:]+):\\ Permission\\ denied ]] && path=\"${BASH_REMATCH[1]}\" && echo \"Permission denied for: $path\" && echo \"Removing $path ...\" && rm -rf \"$path\" || echo \"$output\"",
2930
"test:format": "npx prettier --check .",
3031
"test:lint": "npx eslint .",
3132
"test:bcb": "mkdir test-bcb && cd test-bcb && npm init -y && npm i ../../baseline-browser-mapping browserslist browserslist-config-baseline &&jq '. += {\"browserslist\":[\"extends browserslist-config-baseline\"]}' package.json >p && mv p package.json && npx browserslist && cd ../ && rm -rf test-bcb",
3233
"test:jasmine": "npx jasmine",
33-
"test": "npm run build && rm -rf test-bcb && npm run test:format && npm run test:lint && npx jasmine && npm run test:bcb",
34+
"test": "npm run build && npm run fix-cli-permissions && rm -rf test-bcb && npm run test:format && npm run test:lint && npx jasmine && npm run test:bcb",
3435
"build": "rm -rf dist; npx prettier . --write; rollup -c; rm -rf ./dist/scripts/expose-data.d.ts ./dist/cli.d.ts",
3536
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts",
3637
"refresh-static": "npx tsx scripts/refresh-static.ts",
@@ -40,7 +41,7 @@
4041
},
4142
"license": "Apache-2.0",
4243
"devDependencies": {
43-
"@mdn/browser-compat-data": "^6.1.4",
44+
"@mdn/browser-compat-data": "^7.0.0",
4445
"@rollup/plugin-terser": "^0.4.4",
4546
"@rollup/plugin-typescript": "^12.1.3",
4647
"@types/node": "^22.15.17",

scripts/refresh-static.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ writeFileSync(
4949
JSON.stringify(
5050
getAllVersions({
5151
includeDownstreamBrowsers: true,
52+
includeKaiOS: true,
5253
}),
5354
),
5455
{ encoding: "utf-8" },
@@ -59,6 +60,7 @@ writeFileSync(
5960
getAllVersions({
6061
outputFormat: "object",
6162
includeDownstreamBrowsers: true,
63+
includeKaiOS: true,
6264
}),
6365
),
6466
{ encoding: "utf-8" },
@@ -68,6 +70,7 @@ writeFileSync(
6870
getAllVersions({
6971
outputFormat: "csv",
7072
includeDownstreamBrowsers: true,
73+
includeKaiOS: true,
7174
}).toString(),
7275
{ encoding: "utf-8" },
7376
);
@@ -77,6 +80,7 @@ writeFileSync(
7780
JSON.stringify(
7881
getAllVersions({
7982
includeDownstreamBrowsers: true,
83+
includeKaiOS: true,
8084
useSupports: true,
8185
}),
8286
),
@@ -88,6 +92,7 @@ writeFileSync(
8892
getAllVersions({
8993
outputFormat: "object",
9094
includeDownstreamBrowsers: true,
95+
includeKaiOS: true,
9196
useSupports: true,
9297
}),
9398
),
@@ -98,6 +103,7 @@ writeFileSync(
98103
getAllVersions({
99104
outputFormat: "csv",
100105
includeDownstreamBrowsers: true,
106+
includeKaiOS: true,
101107
useSupports: true,
102108
}).toString(),
103109
{ encoding: "utf-8" },

spec/tests/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,22 @@ describe("getCompatibleVersions default", () => {
4949
).version,
5050
).toBe("20.12");
5151
});
52+
53+
it("Includes KaiOS 3.0 in Baseline 2020 when includeKaiOS: true is used", () => {
54+
expect(
55+
getCompatibleVersions({
56+
includeDownstreamBrowsers: true,
57+
includeKaiOS: true,
58+
targetYear: 2020,
59+
}),
60+
).toContain({
61+
browser: "kai_os",
62+
version: "3.0",
63+
release_date: "2021-09-01",
64+
engine: "Gecko",
65+
engine_version: "84",
66+
});
67+
});
5268
});
5369

5470
describe("getAllVersions default", () => {

src/cli.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const { values } = parseArgs({
1414
"widely-available-on-date": { type: "string" },
1515
"include-downstream-browsers": { type: "boolean" },
1616
"list-all-compatible-versions": { type: "boolean" },
17+
"include-kaios": { type: "boolean" },
1718
help: { type: "boolean", short: "h" },
1819
},
1920
strict: true,
@@ -32,6 +33,7 @@ Options:
3233
--widely-available-on-date Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely
3334
available on the specified date.
3435
--include-downstream-browsers Whether to include browsers that use the same engines as a core Baseline browser.
36+
--include-kaios Whether to include KaiOS in downstream browsers. Requires --include-downstream-browsers.
3537
--list-all-compatible-versions Whether to include only the minimum compatible browser versions or all compatible versions.
3638
-h, --help Show help
3739
@@ -53,5 +55,6 @@ console.log(
5355
widelyAvailableOnDate: values["widely-available-on-date"],
5456
includeDownstreamBrowsers: values["include-downstream-browsers"],
5557
listAllCompatibleVersions: values["list-all-compatible-versions"],
58+
includeKaiOS: values["include-kaios"],
5659
}),
5760
);

src/data/data.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,6 @@ const data = {
12461246
["25.2", "2025-04-24", "u", "b", "132"],
12471247
["25.3", "2025-04-23", "u", "b", "132"],
12481248
["25.4", "2025-04-23", "u", "b", "134"],
1249-
["99.9", "2025-05-27", "u", "b", "800"],
12501249
],
12511250
},
12521251
uc_android: {
@@ -1402,6 +1401,16 @@ const data = {
14021401
["19.2", "2025-07-15", "u", "b", "121"],
14031402
],
14041403
},
1404+
kai_os: {
1405+
releases: [
1406+
["1.0", "2017-03-01", "u", "g", "37"],
1407+
["2.0", "2017-07-01", "u", "g", "48"],
1408+
["2.5", "2017-07-01", "u", "g", "48"],
1409+
["3.0", "2021-09-01", "u", "g", "84"],
1410+
["3.1", "2022-03-01", "u", "g", "84"],
1411+
["4.0", "2025-05-01", "u", "g", "123"],
1412+
],
1413+
},
14051414
},
14061415
features: [
14071416
[
@@ -5686,5 +5695,5 @@ const data = {
56865695
],
56875696
],
56885697
};
5689-
const lastUpdated = 1755785424708;
5698+
const lastUpdated = 1756204101749;
56905699
export { data, lastUpdated };

src/data/downstream-browsers.json

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -670,12 +670,6 @@
670670
"engine_version": "134",
671671
"status": "unknown",
672672
"release_date": "2025-04-23"
673-
},
674-
"99.9": {
675-
"engine": "Blink",
676-
"engine_version": "800",
677-
"status": "unknown",
678-
"release_date": "2025-05-27"
679673
}
680674
}
681675
},
@@ -1562,7 +1556,50 @@
15621556
"release_date": "2025-07-15"
15631557
}
15641558
}
1559+
},
1560+
"kai_os": {
1561+
"name": "KaiOS",
1562+
"type": "mobile",
1563+
"upstream": "firefox_android",
1564+
"releases": {
1565+
"1.0": {
1566+
"engine": "Gecko",
1567+
"engine_version": "37",
1568+
"status": "unknown",
1569+
"release_date": "2017-03-01"
1570+
},
1571+
"2.0": {
1572+
"engine": "Gecko",
1573+
"engine_version": "48",
1574+
"status": "unknown",
1575+
"release_date": "2017-07-01"
1576+
},
1577+
"2.5": {
1578+
"engine": "Gecko",
1579+
"engine_version": "48",
1580+
"status": "unknown",
1581+
"release_date": "2017-07-01"
1582+
},
1583+
"3.0": {
1584+
"engine": "Gecko",
1585+
"engine_version": "84",
1586+
"status": "unknown",
1587+
"release_date": "2021-09-01"
1588+
},
1589+
"3.1": {
1590+
"engine": "Gecko",
1591+
"engine_version": "84",
1592+
"status": "unknown",
1593+
"release_date": "2022-03-01"
1594+
},
1595+
"4.0": {
1596+
"engine": "Gecko",
1597+
"engine_version": "123",
1598+
"status": "unknown",
1599+
"release_date": "2025-05-01"
1600+
}
1601+
}
15651602
}
15661603
},
1567-
"lastUpdated": "2025-08-17T14:08:36.165Z"
1604+
"lastUpdated": "2025-08-26T11:11:36.165Z"
15681605
}

0 commit comments

Comments
 (0)