This repository has been archived by the owner on May 11, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 158
Use external Electron to Chromium library #144
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c6ebef4
Replace manual electron-to-chromium list and function with external l…
Kilian 322f54c
test fixtures for electron: Switch to electron 1.4, with known chrome…
Kilian 0f141a0
update tests: electron 1.0 used chrome 49, not 50
Kilian e4be555
import only the relevant function from electron-to-chromium
Kilian 494853b
electron fixtures: Use number instead of string
Kilian 8dcbff6
If both chrome and electron are defined, choose the lower version to …
Kilian b45923b
Add to test cases to verify correct handling of chrome number
Kilian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import browserslist from "browserslist"; | ||
|
||
import builtInsList from "../data/built-ins.json"; | ||
import defaultInclude from "./default-includes"; | ||
import electronToChromium from "../data/electron-to-chromium"; | ||
import { electronToChromium } from "electron-to-chromium"; | ||
import moduleTransformations from "./module-transformations"; | ||
import normalizeOptions from "./normalize-options.js"; | ||
import pluginList from "../data/plugins.json"; | ||
|
@@ -82,26 +81,6 @@ export const getCurrentNodeVersion = () => { | |
return parseFloat(process.versions.node); | ||
}; | ||
|
||
export const electronVersionToChromeVersion = (semverVer) => { | ||
semverVer = String(semverVer); | ||
|
||
if (semverVer === "1") { | ||
semverVer = "1.0"; | ||
} | ||
|
||
const m = semverVer.match(/^(\d+\.\d+)/); | ||
if (!m) { | ||
throw new Error("Electron version must be a semver version"); | ||
} | ||
|
||
const result = electronToChromium[m[1]]; | ||
if (!result) { | ||
throw new Error(`Electron version ${m[1]} is either too old or too new`); | ||
} | ||
|
||
return result; | ||
}; | ||
|
||
const _extends = Object.assign || function (target) { | ||
for (let i = 1; i < arguments.length; i++) { | ||
const source = arguments[i]; | ||
|
@@ -124,7 +103,18 @@ export const getTargets = (targets = {}) => { | |
|
||
// Rewrite Electron versions to their Chrome equivalents | ||
if (targetOps.electron) { | ||
targetOps.chrome = electronVersionToChromeVersion(targetOps.electron); | ||
const electronChromeVersion = parseInt(electronToChromium(targetOps.electron), 10); | ||
|
||
if (!electronChromeVersion) { | ||
throw new Error(`Electron version ${targetOps.electron} is either too old or too new`); | ||
} | ||
|
||
if (targetOps.chrome) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be a good test case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're right! will add it tonight. |
||
targetOps.chrome = Math.min(targetOps.chrome, electronChromeVersion); | ||
} else { | ||
targetOps.chrome = electronChromeVersion; | ||
} | ||
|
||
delete targetOps.electron; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import "core-js/modules/es7.object.values"; | ||
import "core-js/modules/es7.object.entries"; | ||
import "core-js/modules/es7.object.get-own-property-descriptors"; | ||
import "core-js/modules/es7.string.pad-start"; | ||
import "core-js/modules/es7.string.pad-end"; | ||
import "core-js/modules/web.timers"; | ||
import "core-js/modules/web.immediate"; | ||
import "core-js/modules/web.dom.iterable"; | ||
|
||
|
||
a ** b; | ||
a ** b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think
parseInt(a, 10);
is necessary anymore in ES5? Can remove later