Skip to content

Commit 52a069a

Browse files
authored
add arm64 for sm and jsc (#28)
1 parent ab5efa6 commit 52a069a

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ installing engines to make eshost automatically find the installed engines.
4040
| [engine262][] | `engine262` |||||||
4141
| [GraalJS][] | `graaljs` || | || ||
4242
| [Hermes][] | `hermes` || | | | ||
43-
| [JavaScriptCore][] | `jsc`, `javascriptcore` || | || ||
43+
| [JavaScriptCore][] | `jsc`, `javascriptcore` || | || ||
4444
| [QuickJS][] | `quickjs`, `quickjs-run-test262` || |||||
45-
| [SpiderMonkey][] | `sm`, `spidermonkey` || |||||
45+
| [SpiderMonkey][] | `sm`, `spidermonkey` || |||||
4646
| [V8][] | `v8` |||||||
4747
| [XS][] | `xs` || |||||
4848

src/engines/javascriptcore.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const execa = require('execa');
2121
const Installer = require('../installer');
2222
const { platform, unzip } = require('../common');
2323

24+
function buildURL(builder) {
25+
return `https://build.webkit.org/api/v2/builders/${builder}/builds?limit=1&order=-number&property=got_revision&complete=true`;
26+
}
27+
2428
class JavaScriptCoreInstaller extends Installer {
2529
constructor(...args) {
2630
super(...args);
@@ -44,13 +48,15 @@ class JavaScriptCoreInstaller extends Installer {
4448
.then((r) => r.text())
4549
.then((n) => n.trim().replace('.zip', ''));
4650
case 'win32-x64': {
47-
const body = await fetch('https://build.webkit.org/api/v2/builders/27/builds?limit=1&order=-number&property=got_revision&complete=true')
48-
.then((r) => r.json());
51+
const body = await fetch(buildURL(27)).then((r) => r.json());
4952
return body.builds[0].properties.got_revision[0];
5053
}
5154
case 'darwin-x64': {
52-
const body = await fetch('https://build.webkit.org/api/v2/builders/54/builds?limit=1&order=-number&property=got_revision&complete=true')
53-
.then((r) => r.json());
55+
const body = await fetch(buildURL(54)).then((r) => r.json());
56+
return body.builds[0].properties.got_revision[0];
57+
}
58+
case 'darwin-arm64': {
59+
const body = await fetch(buildURL(29)).then((r) => r.json());
5460
return body.builds[0].properties.got_revision[0];
5561
}
5662
default:
@@ -64,6 +70,8 @@ class JavaScriptCoreInstaller extends Installer {
6470
switch (platform) {
6571
case 'darwin-x64':
6672
return `https://s3-us-west-2.amazonaws.com/minified-archives.webkit.org/mac-catalina-x86_64-release/${version}.zip`;
73+
case 'darwin-arm64':
74+
return `https://s3-us-west-2.amazonaws.com/minified-archives.webkit.org/mac-bigsur-x86_64%20arm64-release/${version}.zip`;
6775
case 'linux-ia32':
6876
return `https://webkitgtk.org/jsc-built-products/x86_32/release/${version}.zip`;
6977
case 'linux-x64':
@@ -81,7 +89,8 @@ class JavaScriptCoreInstaller extends Installer {
8189

8290
async install() {
8391
switch (platform) {
84-
case 'darwin-x64': {
92+
case 'darwin-x64':
93+
case 'darwin-arm64': {
8594
await this.registerAssets('Release/JavaScriptCore.framework/**');
8695
const jsc = await this.registerAsset('Release/jsc');
8796
const source = `DYLD_FRAMEWORK_PATH="${this.installPath}/Release" DYLD_LIBRARY_PATH="${this.installPath}/Release" "${jsc}"`;
@@ -137,6 +146,7 @@ JavaScriptCoreInstaller.config = {
137146
'linux-x64',
138147
'win32-x64',
139148
'darwin-x64',
149+
'darwin-arm64',
140150
],
141151
};
142152

src/engines/spidermonkey.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const { platform, unzip } = require('../common');
99
function getFilename() {
1010
switch (platform) {
1111
case 'darwin-x64':
12+
case 'darwin-arm64':
1213
return 'mac';
1314
case 'linx32':
1415
return 'linux-i686';
@@ -78,6 +79,7 @@ class SpiderMonkeyInstaller extends Installer {
7879
async install() {
7980
switch (platform) {
8081
case 'darwin-x64':
82+
case 'darwin-arm64':
8183
await this.registerAssets('*.dylib');
8284
await this.registerBinary('js', 'sm');
8385
this.binPath = await this.registerBinary('js', 'spidermonkey');
@@ -121,7 +123,7 @@ SpiderMonkeyInstaller.config = {
121123
supported: [
122124
'linux-ia32', 'linux-x64',
123125
'win32-ia32', 'win32-x64',
124-
'darwin-x64',
126+
'darwin-x64', 'darwin-arm64',
125127
],
126128
};
127129

0 commit comments

Comments
 (0)