Skip to content

Commit c2fd5ef

Browse files
committed
update documentation after Graal.js moved to an installable component
1 parent 4ae2f77 commit c2fd5ef

File tree

9 files changed

+106
-49
lines changed

9 files changed

+106
-49
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changelog may include unreleased versions.
66
See [version roadmap](https://www.graalvm.org/release-notes/version-roadmap/) for release dates.
77

88
## Version 22.2.0
9+
* GraalVM JavaScript is now an installable component of GraalVM. It can be installed with `gu install js`.
910
* Removed experimental option `commonjs-global-properties`. The same functionality can be achieved in user code with a direct call to `require()` after context creation.
1011

1112
## Version 22.1.0

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@ The goals of GraalVM JavaScript are:
1414

1515

1616
## Getting Started
17-
See the documentation on the [GraalVM website](https://www.graalvm.org/docs/getting-started/) how to install and use GraalVM JavaScript.
17+
The preferred way to run GraalVM JavaScript is from a [GraalVM](https://www.graalvm.org/downloads/).
18+
Starting with GraalVM 22.2., GraalVM JavaScript is an installable component that needs to be installed with `gu install js` after downloading GraalVM.
19+
See the documentation on the [GraalVM website](https://www.graalvm.org/docs/getting-started/) for more information on how to install and use GraalVM JavaScript.
20+
21+
Installing GraalVM JavaScript using the _GraalVM Updater_:
22+
23+
```shell
24+
$ $GRAALVM/bin/gu install js
25+
$ $GRAALVM/bin/js --version
26+
```
27+
28+
After installation, the `js` shell can be executed and used to run JavaScript code or execute JavaScript files.
1829

1930
```
2031
$ $GRAALVM/bin/js
@@ -23,8 +34,9 @@ Hello JavaScript
2334
>
2435
```
2536

26-
The preferred way to run GraalVM JavaScript is from a [GraalVM](https://www.graalvm.org/downloads/).
2737
If you prefer running it on a stock JVM, please have a look at the documentation in [`RunOnJDK.md`](https://github.com/graalvm/graaljs/blob/master/docs/user/RunOnJDK.md).
38+
Note that in this mode many features and optimizations of GraalVM are not available.
39+
Due to those limitations, running on a stock JVM is not a supported feature - please use a GraalVM instead.
2840

2941
## Documentation
3042

@@ -36,8 +48,9 @@ For contributors, a guide how to build GraalVM JavaScript from source code can b
3648
## Current Status
3749

3850
GraalVM JavaScript is compatible with the [ECMAScript 2021 specification](https://262.ecma-international.org/12.0/).
39-
Starting with GraalVM 22.0.0, ECMAScript 2022 - currently at the draft stage - is the default compatibility level.
51+
Starting with GraalVM 22.0.0, [ECMAScript 2022](https://262.ecma-international.org/13.0/) - currently at the draft stage - is the default compatibility level.
4052
New features, e.g. `ECMAScript proposals` scheduled to land in future editions, are added frequently and are accessible behind a flag.
53+
See the [CHANGELOG.md](https://github.com/graalvm/graaljs/tree/master/CHANGELOG.md) for the proposals already adopted.
4154

4255
In addition, some popular extensions of other engines are supported, see [`JavaScriptCompatibility.md`](https://github.com/graalvm/graaljs/tree/master/docs/user/JavaScriptCompatibility.md).
4356

@@ -48,7 +61,8 @@ It provides high compatibility with existing npm packages, with high likelyhood
4861
This includes npm packages with native implementations.
4962
Note that some npm modules will require to be re-compiled from source with GraalVM JavaScript if they ship with binaries that have been compiled for Node.js based on V8.
5063

51-
Node.js support is not included in the main GraalVM distribution (since 21.1) but packaged as a separate component that can be installed using the _GraalVM Updater_:
64+
Similar to JavaScript itself, Node.js is a separately installable component of GraalVM (since 21.1).
65+
It can be installed using the _GraalVM Updater_:
5266

5367
```shell
5468
$ $GRAALVM/bin/gu install nodejs
@@ -58,10 +72,7 @@ $ $GRAALVM/bin/node --version
5872
### Compatibility on Operating Systems
5973

6074
The core JavaScript engine is a Java application and is thus in principle compatible with every operating system that provides a compatible JVM, [see `RunOnJDK.md`](https://github.com/graalvm/graaljs/tree/master/docs/user/RunOnJDK.md).
61-
We test and support GraalVM JavaScript currently in full extent on Linux and MacOS.
62-
For Windows, a preliminary preview version is available.
63-
64-
Some features, including the Node.js support, are currently not supported on all platforms (e.g. Windows).
75+
We test and support GraalVM JavaScript currently in full extent on Linux AMD64, Linux AArch64, MacOS, and Windows.
6576

6677
## GraalVM JavaScript Reference Manual
6778

docs/Building.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ The average user will prefer the pre-built binaries as part of [GraalVM](http://
77

88
### Prerequisites
99

10-
* Python 3 (required by `mx`), and Python 2.7 for building Node.js
10+
* Python 3.8+ (required by `mx`)
1111
* git (to download, update, and locate repositories)
12-
* Java JDK 8 or newer
12+
* Java JDK 11 or newer
1313

1414
Building the Node.js support is optional, and requires additional tools, see futher below.
1515

@@ -37,14 +37,9 @@ Building the Node.js support is optional, and requires additional tools, see fut
3737
For the further steps you need to be in either of those directories (we assume you cd'ed to the `graal-js` directory).
3838
3939
4. setup your environment:
40-
- if you build with JDK8:
40+
- assuming you build with JDK11 or newer:
4141
```bash
42-
export JAVA_HOME=[path to JDK8]
43-
```
44-
- if you build with JDK9+:
45-
```bash
46-
export JAVA_HOME=[path to JDK9+]
47-
export EXTRA_JAVA_HOMES=[path to JDK8]
42+
export JAVA_HOME=[path to JDK11+]
4843
```
4944
5. (optional) clone or update the dependent repositories:
5045
```bash

docs/user/FAQ.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,30 @@ For a reference of the JavaScript APIs that GraalVM supports, see [GRAAL.JS-API]
2020

2121
### Is GraalVM compatible with the original node implementation?
2222
Node.js based on GraalVM is largely compatible with the original Node.js (based on the V8 engine).
23-
This leads to a high number of npm-based modules being compatible with GraalVM. In fact, out of the 95k modules we test, more than 90% of them pass all tests.
23+
This leads to a high number of npm-based modules being compatible with GraalVM.
24+
In fact, out of the 100k npm modules we test, more than 94% of them pass all tests.
2425
Still, several sources of differences have to be considered:
2526

2627
- **Setup:**
27-
GraalVM mostly mimicks the original setup of Node, including the `node` executable, `npm`, and similar. However, not all command-line options are supported (or behave exactly identically). You need to (re-)compile native modules against the v8.h file, etc.
28+
GraalVM mostly mimicks the original setup of Node, including the `node` executable, `npm`, and similar.
29+
However, not all command-line options are supported (or behave exactly identically).
30+
Modules might require that native modules are (re-)compiled against the v8.h file.
2831

2932
Since GraalVM 21.1, Node.js and all related executables (e.g., `node`, `npm`, etc.) are not included by default in the GraalVM binary.
3033
Node.js support is now packaged in a separate component that can be installed with the _GraalVM Updater_ using `$GRAALVM/bin/gu install nodejs`.
3134

3235
- **Internals:**
33-
GraalVM is implemented on top of a JVM, and thus has a different internal architecture than Node.js based on V8. This implies that some internal mechanisms behave differently and cannot exactly replicate V8 behaviour. This will hardly ever affect user code, but might affect modules implemented natively, depending on V8 internals.
36+
GraalVM is implemented on top of a JVM, and thus has a different internal architecture than Node.js based on V8.
37+
This implies that some internal mechanisms behave differently and cannot exactly replicate V8 behaviour.
38+
This will hardly ever affect user code, but might affect modules implemented natively, depending on V8 internals.
3439

3540
- **Performance:**
36-
Due to GraalVM being implemented on top of a JVM, performance characteristics vary from the original native implementation. While GraalVM's peak performance can match V8 on many benchmarks, it will typically take longer to reach the peak (known as _warmup_). Be sure to give the GraalVM compiler some extra time when measuring (peak) performance.
41+
Due to GraalVM being implemented on top of a JVM, performance characteristics vary from the original native implementation.
42+
While GraalVM's peak performance can match V8 on many benchmarks, it will typically take longer to reach the peak (known as _warmup_).
43+
Be sure to give the GraalVM compiler some extra time when measuring (peak) performance.
3744

38-
In addition, GraalVM uses the following approaches to check and retain compatibility with Node.js code:
45+
- **Compatiblity:**
46+
GraalVM uses the following approaches to check and retain compatibility with Node.js code:
3947

4048
* node-compat-table: GraalVM is compared against other engines using the _node-compat-table_ module, highlighting incompatibilities that might break Node.js code.
4149
* automated mass-testing of modules using _mocha_: in order to test a large set of modules, GraalVM is tested against 95k modules that use the mocha test framework. Using mocha allows automating the process of executing the test and comprehending the test result.
@@ -96,10 +104,11 @@ Here are a few tips you can follow to analyse and improve peak performance:
96104

97105
### What is the difference between running GraalVM's JavaScript in Native Image compared to the JVM?
98106
In essence, the JavaScript engine of GraalVM is a plain Java application.
99-
Running it on any JVM (JDK 8 or higher) is possible, but, for a better result, it should be GraalVM or a compatible JVMCI-enabled JDK using the GraalVM compiler.
107+
Running it on any JVM (JDK 11 or higher) is possible, but, for a better result, it should be GraalVM or a compatible JVMCI-enabled JDK using the GraalVM compiler.
100108
This mode gives the JavaScript engine full access to Java at runtime, but also requires the JVM to first (just-in-time) compile the JavaScript engine when executed, just like any other Java application.
101109

102-
Running in Native Image means that the JavaScript engine, including all its dependencies from, e.g., the JDK, is pre-compiled into a native executable. This will tremendously speed up the startup of any JavaScript application, as GraalVM can immediately start to compile JavaScript code, without itself requiring to be compiled first.
110+
Running in Native Image means that the JavaScript engine, including all its dependencies from, e.g., the JDK, is pre-compiled into a native executable.
111+
This will tremendously speed up the startup of any JavaScript application, as GraalVM can immediately start to compile JavaScript code, without itself requiring to be compiled first.
103112
This mode, however, will only give GraalVM access to Java classes known at the time of image creation.
104113
Most significantly, this means that the JavaScript-to-Java interoperability features are not available in this mode, as they would require dynamic class loading and execution of arbitrary Java code at runtime.
105114

docs/user/JavaInteroperability.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ See the [Embedding Reference](https://www.graalvm.org/reference-manual/embed-lan
1414
The [Polyglot Programming](https://www.graalvm.org/reference-manual/polyglot-programming/) guide can be of additional help in that area.
1515
Specific migration guides for [Rhino](RhinoMigrationGuide.md) and [Nashorn](NashornMigrationGuide.md) are also available.
1616

17-
GraalVM ships with the `js` native launcher.
18-
The Node.js support is packaged separately and can be installed with GraalVM Updater:
19-
```shell
20-
$GRAALVM/bin/gu install nodejs
21-
```
22-
Then the `node` launcher becomes available.
17+
Both JavaScript and Node.js are separately installable components of GraalVM.
18+
See the [README](../../README.md) for details on how to use the _GraalVM Updater_ to install JavaScript and Node.js.
19+
After a successfull installation, the respective native launchers `js` and `node` from the `$GRAALVM/bin` directory can be used.
20+
2321
Although other builds are possible, the following examples assume this setup is used.
2422

2523
## Enabling Java Interoperability

docs/user/NashornMigrationGuide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ When the Java class has both a field and a method of the same name publicly avai
231231
## Additional Aspects to Consider
232232

233233
### Features of GraalVM JavaScript
234-
GraalVM JavaScript supports features of the newest ECMAScript specification and some extensions to it. See [JavaScript Compatibility](JavaScriptCompatibility.md). Note that this example adds objects to the global scope that might interfere with existing source code unaware of those extensions.
234+
GraalVM JavaScript supports features of the newest ECMAScript specification and some extensions to it.
235+
See [JavaScript Compatibility](JavaScriptCompatibility.md).
236+
Note that this example adds objects to the global scope that might interfere with existing source code unaware of those extensions.
235237

236238
### Console Output
237239
GraalVM JavaScript provides a `print` builtin function compatible with Nashorn.

0 commit comments

Comments
 (0)