What is electron-to-chromium?
The electron-to-chromium package provides a mapping between Electron versions and Chromium versions. It allows developers to determine which version of Chromium is used in a given version of Electron. This is particularly useful for web developers targeting Electron applications, as it helps in understanding browser compatibility and feature support.
What are electron-to-chromium's main functionalities?
Get Chromium version for a specific Electron version
This feature allows you to get the Chromium version that corresponds to a specific Electron version.
"const electronToChromium = require('electron-to-chromium');
const chromiumVersion = electronToChromium.electronToChromium('9.0.0');
console.log(chromiumVersion); // Outputs the Chromium version used in Electron 9.0.0"
Get Electron versions for a specific Chromium version
This feature allows you to get all Electron versions that use a specific Chromium version.
"const electronToChromium = require('electron-to-chromium');
const electronVersions = electronToChromium.chromiumToElectron('83.0.4103.122');
console.log(electronVersions); // Outputs an array of Electron versions using Chromium 83.0.4103.122"
Get full list of Electron-to-Chromium mappings
This feature provides the full list of mappings between Electron and Chromium versions.
"const electronToChromium = require('electron-to-chromium');
const fullList = electronToChromium.fullList;
console.log(fullList); // Outputs the complete list of mappings"
Other packages similar to electron-to-chromium
browserslist
The browserslist package allows you to share target browsers and Node.js versions between different front-end tools. It is similar to electron-to-chromium in that it helps developers target specific browser versions, but it is more general and not limited to Electron's Chromium versions.
caniuse-lite
caniuse-lite is a lighter version of the caniuse database, providing browser support tables for front-end technologies. While it does not directly map Electron versions to Chromium, it serves a similar purpose in informing developers about feature support and compatibility across different browsers and versions.
electron-releases
electron-releases is a package that provides information about Electron releases, including version numbers, release dates, and more. It is similar to electron-to-chromium in that it provides data about Electron versions, but it does not focus on the mapping to Chromium versions.
Electron-to-Chromium
This repository provides a mapping of Electron versions to the Chromium version that it uses.
This package is used in Browserslist, so you can use e.g. electron >= 1.4
in Autoprefixer, Stylelint, babel-present-env and eslint-plugin-compat.
Install
Install using npm install electron-to-chromium
.
Usage
to include electron-to-chromium, require it:
var e2c = require('electron-to-chromium');
Properties
The Electron-to-Chromium object has 4 properties to use:
versions
An object with all major Electron versions as keys and their respective major Chromium version as string value.
var versions = e2c.versions;
console.log(versions['1.4']);
fullVersions
An object with all Electron versions as keys and their respective Chromium version as value.
var versions = e2c.fullVersions;
console.log(versions['1.4.11']);
electronToChromium(query)
Arguments:
- Query: string or number, required. A major or full electron version.
A function that returns the corresponding Chromium version for a given Electron function. Returns a string.
If you provide it with a major Electron version, it will return a major Chromium version:
var chromeVersion = e2c.electronToChromium('1.4');
If you provide it with a full Electron version, it will return the full Chromium version.
var chromeVersion = e2c.electronToChromium('1.4.11');
If a query does not match a Chromium version, it will return undefined
.
var chromeVersion = e2c.electronToChromium('9000');
electronToBrowserList(query) DEPRECATED
Arguments:
- Query: string or number, required. A major Electron version.
Deprecated: Browserlist already includes electron-to-chromium.
A function that returns a Browserlist query that matches the given major Electron version. Returns a string.
If you provide it with a major Electron version, it will return a Browserlist query string that matches the chromium capabilities:
var query = e2c.electronToBrowserList('1.4');
If a query does not match a Chromium version, it will return undefined
.
var query = e2c.electronToBrowserList('9000');
importing just versions or fullVersions
Both the versions and the fullVersions list can be imported on their own, if file-size is a concern.
versions
var versions = require('electron-to-chromium/versions');
fullVersions
var fullVersions = require('electron-to-chromium/full-versions');
Updating
This package will be updated with each new Electron release.
To update the list, run npm run build.js
. Requires internet access as it downloads from the canonical list of Electron versions.