Skip to content

Commit

Permalink
feat: support quickjs arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
gengjiawen committed Jan 31, 2023
1 parent 0cc505a commit 48717f5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ installing engines to make eshost automatically find the installed engines.
| [Hermes][] | `hermes` || | | | | ||
| [LibJS][] | `serenity-js` ||| || | | |
| [JavaScriptCore][] | `jsc`, `javascriptcore` ||| || | ||
| [QuickJS][] | `quickjs`, `quickjs-run-test262` || ||| |||
| [QuickJS][] | `quickjs`, `quickjs-run-test262` || ||| |||
| [SpiderMonkey][] | `sm`, `spidermonkey` ||||| |||
| [V8][] | `v8` ||||| |||
| [XS][] | `xs` || ||| | ||
Expand Down
63 changes: 30 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/engines/quickjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function getFilename() {
return 'win-i686';
case 'win32-x64':
return 'win-x86_64';
case 'linux-arm64':
return 'linux-aarch64';
default:
throw new Error(`No QuickJS builds available for ${platform}`);
}
Expand All @@ -39,7 +41,10 @@ class QuickJSInstaller extends Installer {

getDownloadURL(version) {
if (platform === 'darwin-x64') {
return 'https://github.com/napi-bindings/quickjs-build/releases/download/5.2.0/qjs-macOS.zip';
return 'https://github.com/napi-bindings/quickjs-build/releases/download/5.3.0/qjs-macOS.zip';
}
if (platform === 'linux-arm64') {
return 'https://github.com/napi-bindings/quickjs-build/releases/download/5.3.0/qjs-linux-arm64.zip';
}
return `https://bellard.org/quickjs/binary_releases/quickjs-${getFilename()}-${version}.zip`;
}
Expand All @@ -49,7 +54,7 @@ class QuickJSInstaller extends Installer {
}

async install() {
if (platform === 'darwin-x64') {
if (platform === 'darwin-x64' || platform === 'linux-arm64') {
this.binPath = await this.registerBinary('quickjs');
await this.registerBinary('run-test262', 'quickjs-run-test262');
} else if (platform.startsWith('win')) {
Expand Down

0 comments on commit 48717f5

Please sign in to comment.