You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ Changelog may include unreleased versions.
6
6
See [version roadmap](https://www.graalvm.org/release-notes/version-roadmap/) for release dates.
7
7
8
8
## Version 22.2.0
9
+
* GraalVM JavaScript is now an installable component of GraalVM. It can be installed with `gu install js`.
9
10
* Removed experimental option `commonjs-global-properties`. The same functionality can be achieved in user code with a direct call to `require()` after context creation.
Copy file name to clipboardExpand all lines: README.md
+19-8Lines changed: 19 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,18 @@ The goals of GraalVM JavaScript are:
14
14
15
15
16
16
## 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.
18
29
19
30
```
20
31
$ $GRAALVM/bin/js
@@ -23,8 +34,9 @@ Hello JavaScript
23
34
>
24
35
```
25
36
26
-
The preferred way to run GraalVM JavaScript is from a [GraalVM](https://www.graalvm.org/downloads/).
27
37
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.
28
40
29
41
## Documentation
30
42
@@ -36,8 +48,9 @@ For contributors, a guide how to build GraalVM JavaScript from source code can b
36
48
## Current Status
37
49
38
50
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.
40
52
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.
41
54
42
55
In addition, some popular extensions of other engines are supported, see [`JavaScriptCompatibility.md`](https://github.com/graalvm/graaljs/tree/master/docs/user/JavaScriptCompatibility.md).
43
56
@@ -48,7 +61,8 @@ It provides high compatibility with existing npm packages, with high likelyhood
48
61
This includes npm packages with native implementations.
49
62
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.
50
63
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_:
52
66
53
67
```shell
54
68
$ $GRAALVM/bin/gu install nodejs
@@ -58,10 +72,7 @@ $ $GRAALVM/bin/node --version
58
72
### Compatibility on Operating Systems
59
73
60
74
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.
Copy file name to clipboardExpand all lines: docs/user/FAQ.md
+16-7Lines changed: 16 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,22 +20,30 @@ For a reference of the JavaScript APIs that GraalVM supports, see [GRAAL.JS-API]
20
20
21
21
### Is GraalVM compatible with the original node implementation?
22
22
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.
24
25
Still, several sources of differences have to be considered:
25
26
26
27
-**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.
28
31
29
32
Since GraalVM 21.1, Node.js and all related executables (e.g., `node`, `npm`, etc.) are not included by default in the GraalVM binary.
30
33
Node.js support is now packaged in a separate component that can be installed with the _GraalVM Updater_ using `$GRAALVM/bin/gu install nodejs`.
31
34
32
35
-**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.
34
39
35
40
-**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.
37
44
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:
39
47
40
48
* node-compat-table: GraalVM is compared against other engines using the _node-compat-table_ module, highlighting incompatibilities that might break Node.js code.
41
49
* 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:
96
104
97
105
### What is the difference between running GraalVM's JavaScript in Native Image compared to the JVM?
98
106
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.
100
108
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.
101
109
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.
103
112
This mode, however, will only give GraalVM access to Java classes known at the time of image creation.
104
113
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.
Copy file name to clipboardExpand all lines: docs/user/NashornMigrationGuide.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,7 +231,9 @@ When the Java class has both a field and a method of the same name publicly avai
231
231
## Additional Aspects to Consider
232
232
233
233
### 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.
235
237
236
238
### Console Output
237
239
GraalVM JavaScript provides a `print` builtin function compatible with Nashorn.
0 commit comments