Skip to content

Commit fb107ad

Browse files
committed
feat: support quickjs arm64 for linux and macOS
1 parent f5b6067 commit fb107ad

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ installing engines to make eshost automatically find the installed engines.
4242
| [Hermes][] | `hermes` || | | | | ||
4343
| [LibJS][] | `serenity-js` ||| || | | |
4444
| [JavaScriptCore][] | `jsc`, `javascriptcore` ||| || | ||
45-
| [QuickJS][] | `quickjs`, `quickjs-run-test262` || ||| |||
45+
| [QuickJS][] | `quickjs`, `quickjs-run-test262` || ||| |||
4646
| [SpiderMonkey][] | `sm`, `spidermonkey` ||||| |||
4747
| [V8][] | `v8` ||||| |||
4848
| [XS][] | `xs` ||| ||| ||

package-lock.json

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

src/engines/quickjs.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ function getFilename() {
1616
return 'win-i686';
1717
case 'win32-x64':
1818
return 'win-x86_64';
19+
case 'linux-arm64':
20+
return 'linux-aarch64';
1921
default:
2022
throw new Error(`No QuickJS builds available for ${platform}`);
2123
}
@@ -29,6 +31,9 @@ class QuickJSInstaller extends Installer {
2931
}
3032

3133
static resolveVersion(version) {
34+
if (['darwin-arm64', 'darwin-x64', 'linux-arm64'].includes(platform)) {
35+
return '6.0.0'
36+
}
3237
if (version === 'latest') {
3338
return fetch('https://bellard.org/quickjs/binary_releases/LATEST.json')
3439
.then((r) => r.json())
@@ -38,8 +43,14 @@ class QuickJSInstaller extends Installer {
3843
}
3944

4045
getDownloadURL(version) {
46+
if (platform === 'darwin-arm64') {
47+
return `https://github.com/napi-bindings/quickjs-build/releases/download/${version}/qjs-macOS-arm64.zip`;
48+
}
4149
if (platform === 'darwin-x64') {
42-
return 'https://github.com/napi-bindings/quickjs-build/releases/download/5.2.0/qjs-macOS.zip';
50+
return `https://github.com/napi-bindings/quickjs-build/releases/download/${version}/qjs-macOS.zip`;
51+
}
52+
if (platform === 'linux-arm64') {
53+
return `https://github.com/napi-bindings/quickjs-build/releases/download/${version}/qjs-linux-arm64.zip`;
4354
}
4455
return `https://bellard.org/quickjs/binary_releases/quickjs-${getFilename()}-${version}.zip`;
4556
}
@@ -49,7 +60,7 @@ class QuickJSInstaller extends Installer {
4960
}
5061

5162
async install() {
52-
if (platform === 'darwin-x64') {
63+
if (platform === 'darwin-x64' || platform === 'darwin-arm64' || platform === 'linux-arm64') {
5364
this.binPath = await this.registerBinary('quickjs');
5465
await this.registerBinary('run-test262', 'quickjs-run-test262');
5566
} else if (platform.startsWith('win')) {

0 commit comments

Comments
 (0)