You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. ### Made by [@kilianvalkhof](https://twitter.com/kilianvalkhof)
  2. #### Other projects:
  3. - 💻 [Polypane](https://polypane.app) - Develop responsive websites and apps twice as fast on multiple screens at once
  4. - 🖌️ [Superposition](https://superposition.design) - Kickstart your design system by extracting design tokens from your website
  5. - 🗒️ [FromScratch](https://fromscratch.rocks) - A smart but simple autosaving scratchpad
  6. ---
  7. # Electron-to-Chromium [![npm](https://img.shields.io/npm/v/electron-to-chromium.svg)](https://www.npmjs.com/package/electron-to-chromium) [![travis](https://img.shields.io/travis/Kilian/electron-to-chromium/master.svg)](https://travis-ci.org/Kilian/electron-to-chromium) [![npm-downloads](https://img.shields.io/npm/dm/electron-to-chromium.svg)](https://www.npmjs.com/package/electron-to-chromium) [![codecov](https://codecov.io/gh/Kilian/electron-to-chromium/branch/master/graph/badge.svg)](https://codecov.io/gh/Kilian/electron-to-chromium)
  8. [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium?ref=badge_shield)
  9. This repository provides a mapping of Electron versions to the Chromium version that it uses.
  10. This package is used in [Browserslist](https://github.com/ai/browserslist), so you can use e.g. `electron >= 1.4` in [Autoprefixer](https://github.com/postcss/autoprefixer), [Stylelint](https://github.com/stylelint/stylelint), [babel-preset-env](https://github.com/babel/babel-preset-env) and [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat).
  11. ## Install
  12. Install using `npm install electron-to-chromium`.
  13. ## Usage
  14. To include Electron-to-Chromium, require it:
  15. ```js
  16. var e2c = require('electron-to-chromium');
  17. ```
  18. ### Properties
  19. The Electron-to-Chromium object has 4 properties to use:
  20. #### `versions`
  21. An object of key-value pairs with a _major_ Electron version as the key, and the corresponding major Chromium version as the value.
  22. ```js
  23. var versions = e2c.versions;
  24. console.log(versions['1.4']);
  25. // returns "53"
  26. ```
  27. #### `fullVersions`
  28. An object of key-value pairs with a Electron version as the key, and the corresponding full Chromium version as the value.
  29. ```js
  30. var versions = e2c.fullVersions;
  31. console.log(versions['1.4.11']);
  32. // returns "53.0.2785.143"
  33. ```
  34. #### `chromiumVersions`
  35. An object of key-value pairs with a _major_ Chromium version as the key, and the corresponding major Electron version as the value.
  36. ```js
  37. var versions = e2c.chromiumVersions;
  38. console.log(versions['54']);
  39. // returns "1.4"
  40. ```
  41. #### `fullChromiumVersions`
  42. An object of key-value pairs with a Chromium version as the key, and an array of the corresponding major Electron versions as the value.
  43. ```js
  44. var versions = e2c.fullChromiumVersions;
  45. console.log(versions['54.0.2840.101']);
  46. // returns ["1.5.1", "1.5.0"]
  47. ```
  48. ### Functions
  49. #### `electronToChromium(query)`
  50. Arguments:
  51. * Query: string or number, required. A major or full Electron version.
  52. A function that returns the corresponding Chromium version for a given Electron function. Returns a string.
  53. If you provide it with a major Electron version, it will return a major Chromium version:
  54. ```js
  55. var chromeVersion = e2c.electronToChromium('1.4');
  56. // chromeVersion is "53"
  57. ```
  58. If you provide it with a full Electron version, it will return the full Chromium version.
  59. ```js
  60. var chromeVersion = e2c.electronToChromium('1.4.11');
  61. // chromeVersion is "53.0.2785.143"
  62. ```
  63. If a query does not match a Chromium version, it will return `undefined`.
  64. ```js
  65. var chromeVersion = e2c.electronToChromium('9000');
  66. // chromeVersion is undefined
  67. ```
  68. #### `chromiumToElectron(query)`
  69. Arguments:
  70. * Query: string or number, required. A major or full Chromium version.
  71. Returns a string with the corresponding Electron version for a given Chromium query.
  72. If you provide it with a major Chromium version, it will return a major Electron version:
  73. ```js
  74. var electronVersion = e2c.chromiumToElectron('54');
  75. // electronVersion is "1.4"
  76. ```
  77. If you provide it with a full Chrome version, it will return an array of full Electron versions.
  78. ```js
  79. var electronVersions = e2c.chromiumToElectron('56.0.2924.87');
  80. // electronVersions is ["1.6.3", "1.6.2", "1.6.1", "1.6.0"]
  81. ```
  82. If a query does not match an Electron version, it will return `undefined`.
  83. ```js
  84. var electronVersion = e2c.chromiumToElectron('10');
  85. // chromeVersion is undefined
  86. ```
  87. #### `electronToBrowserList(query)` **DEPRECATED**
  88. Arguments:
  89. * Query: string or number, required. A major Electron version.
  90. _**Deprecated**: Browserlist already includes electron-to-chromium._
  91. A function that returns a [Browserslist](https://github.com/ai/browserslist) query that matches the given major Electron version. Returns a string.
  92. If you provide it with a major Electron version, it will return a Browserlist query string that matches the Chromium capabilities:
  93. ```js
  94. var query = e2c.electronToBrowserList('1.4');
  95. // query is "Chrome >= 53"
  96. ```
  97. If a query does not match a Chromium version, it will return `undefined`.
  98. ```js
  99. var query = e2c.electronToBrowserList('9000');
  100. // query is undefined
  101. ```
  102. ### Importing just versions, fullVersions, chromiumVersions and fullChromiumVersions
  103. All lists can be imported on their own, if file size is a concern.
  104. #### `versions`
  105. ```js
  106. var versions = require('electron-to-chromium/versions');
  107. ```
  108. #### `fullVersions`
  109. ```js
  110. var fullVersions = require('electron-to-chromium/full-versions');
  111. ```
  112. #### `chromiumVersions`
  113. ```js
  114. var chromiumVersions = require('electron-to-chromium/chromium-versions');
  115. ```
  116. #### `fullChromiumVersions`
  117. ```js
  118. var fullChromiumVersions = require('electron-to-chromium/full-chromium-versions');
  119. ```
  120. ## Updating
  121. This package will be updated with each new Electron release.
  122. To update the list, run `npm run build.js`. Requires internet access as it downloads from the canonical list of Electron versions.
  123. To verify correct behaviour, run `npm test`.
  124. ## License
  125. [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium?ref=badge_large)