Skip to content

Commit 82a0610

Browse files
authored
Use GraalJS standalone when installing graaljs. (#36)
1 parent 9ea9b7f commit 82a0610

File tree

3 files changed

+30
-32
lines changed

3 files changed

+30
-32
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ selected.
3434
If you're using [eshost-cli][], you can run `eshost --configure-esvu` after
3535
installing engines to make eshost automatically find the installed engines.
3636

37-
| Engine | Binary Names | `darwin-x64` | `darwin-arm64` | `linux-ia32` | `linux-x64` | `win32-ia32` | `win32-x64` |
38-
| ------------------ | -------------------------------- | ------------ | -------------- | ------------ | ----------- | ------------ | ----------- |
39-
| [Chakra][] | `ch`, `chakra` || | ||||
40-
| [engine262][] | `engine262` |||||||
41-
| [GraalJS][] | `graaljs` || | || ||
42-
| [Hermes][] | `hermes` || | | | ||
43-
| [LibJS][] | `serenity-js` | | | || | |
44-
| [JavaScriptCore][] | `jsc`, `javascriptcore` ||| || ||
45-
| [QuickJS][] | `quickjs`, `quickjs-run-test262` || |||||
46-
| [SpiderMonkey][] | `sm`, `spidermonkey` |||||||
47-
| [V8][] | `v8` |||||||
48-
| [XS][] | `xs` || ||| ||
37+
| Engine | Binary Names | `darwin-x64` | `darwin-arm64` | `linux-ia32` | `linux-x64` | `linux-arm64` | `win32-ia32` | `win32-x64` |
38+
| ------------------ | -------------------------------- | ------------ | -------------- | ------------ | ----------- | ------------- | ------------ | ----------- |
39+
| [Chakra][] | `ch`, `chakra` || | || | ||
40+
| [engine262][] | `engine262` ||||| |||
41+
| [GraalJS][] | `graaljs` || | || | ||
42+
| [Hermes][] | `hermes` || | | | | ||
43+
| [LibJS][] | `serenity-js` | | | || | | |
44+
| [JavaScriptCore][] | `jsc`, `javascriptcore` ||| || | ||
45+
| [QuickJS][] | `quickjs`, `quickjs-run-test262` || ||| | ||
46+
| [SpiderMonkey][] | `sm`, `spidermonkey` ||||| | ||
47+
| [V8][] | `v8` ||||| | ||
48+
| [XS][] | `xs` || ||| | ||
4949

5050
Some binaries may be exposed as batch/shell scripts to properly handling shared library loading. Some binaries on
5151
64-bit systems may be natively 32-bit.

src/engines/chakra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ChakraInstaller extends Installer {
8383
ChakraInstaller.config = {
8484
name: 'Chakra',
8585
id: 'ch',
86-
supports: ['linux-x64', 'darwin-x64', 'win32-ia32', 'win32-x64'],
86+
supported: ['linux-x64', 'darwin-x64', 'win32-ia32', 'win32-x64'],
8787
};
8888

8989
module.exports = ChakraInstaller;

src/engines/graaljs.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ const { platform, untar, unzip } = require('../common');
99
function getFilename() {
1010
switch (platform) {
1111
case 'darwin-x64':
12-
return 'darwin-amd64';
12+
return 'macos-amd64';
1313
case 'linux-x64':
1414
return 'linux-amd64';
1515
case 'win32-x64':
1616
return 'windows-amd64';
17+
case 'darwin-arm64':
18+
return 'macos-aarch64';
19+
case 'linux-arm64':
20+
return 'linux-aarch64';
1721
default:
1822
throw new Error(`No GraalJS builds available for ${platform}`);
1923
}
@@ -30,14 +34,9 @@ class GraalJSInstaller extends Installer {
3034
this.binPath = undefined;
3135
}
3236

33-
static shouldInstallByDefault() {
34-
// Graal VM archives are >400mb, so don't download by default.
35-
return false;
36-
}
37-
3837
static async resolveVersion(version) {
3938
if (version === 'latest') {
40-
const body = await fetch('https://api.github.com/repos/graalvm/graalvm-ce-builds/releases')
39+
const body = await fetch('https://api.github.com/repos/oracle/graaljs/releases')
4140
.then((r) => r.json());
4241
return body
4342
.filter((b) => !b.prerelease)
@@ -48,7 +47,7 @@ class GraalJSInstaller extends Installer {
4847
}
4948

5049
async getDownloadURL(version) {
51-
return `https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${version}/graalvm-ce-java11-${getFilename()}-${version}${getArchiveExtension()}`;
50+
return `https://github.com/oracle/graaljs/releases/download/vm-${version}/graaljs-${version}-${getFilename()}${getArchiveExtension()}`;
5251
}
5352

5453
async extract() {
@@ -60,20 +59,19 @@ class GraalJSInstaller extends Installer {
6059
}
6160

6261
async install() {
63-
const root = `graalvm-ce-java11-${this.version}`;
62+
const root = `graaljs-${this.version}-${getFilename()}`;
63+
let graaljs;
6464
if (platform === 'darwin-x64') {
65-
await this.registerAsset(`${root}/Contents/Home/languages/js/graaljs.jar`);
66-
await this.registerAsset(`${root}/Contents/Home/languages/js/lib/libjsvm.dylib`);
67-
this.binPath = await this.registerBinary(`${root}/Contents/Home/languages/js/bin/js`, 'graaljs');
65+
await this.registerAsset(`${root}/Contents/Home/lib/libjsvm.dylib`);
66+
graaljs = await this.registerAsset(`${root}/Contents/Home/bin/js`);
6867
} else if (platform === 'win32-x64') {
69-
await this.registerAsset(`${root}/languages/js/graaljs.jar`);
70-
await this.registerAsset(`${root}/languages/js/lib/jsvm.dll`);
71-
this.binPath = await this.registerBinary(`${root}/languages/js/bin/js.exe`, 'graaljs.exe');
68+
await this.registerAsset(`${root}/lib/jsvm.dll`);
69+
graaljs = await this.registerAsset(`${root}/bin/js.exe`);
7270
} else {
73-
await this.registerAsset(`${root}/languages/js/graaljs.jar`);
74-
await this.registerAsset(`${root}/languages/js/lib/libjsvm.so`);
75-
this.binPath = await this.registerBinary(`${root}/languages/js/bin/js`, 'graaljs');
71+
await this.registerAsset(`${root}/lib/libjsvm.so`);
72+
graaljs = await this.registerAsset(`${root}/bin/js`);
7673
}
74+
this.binPath = await this.registerScript('graaljs', `${graaljs}`);
7775
}
7876

7977
async test() {
@@ -91,7 +89,7 @@ GraalJSInstaller.config = {
9189
name: 'GraalJS',
9290
id: 'graaljs',
9391
supported: [
94-
'linux-x64', 'win32-x64', 'darwin-x64',
92+
'linux-x64', 'win32-x64', 'darwin-x64', 'linux-arm64', 'darwin-arm64',
9593
],
9694
};
9795

0 commit comments

Comments
 (0)