|
1 | 1 | [](https://www.graalvm.org/slack-invitation/)
|
2 | 2 |
|
3 |
| -A high performance implementation of the JavaScript programming language. |
4 |
| -Built on the GraalVM by Oracle Labs. |
| 3 | +# GraalJS |
5 | 4 |
|
6 |
| -The goals of GraalVM JavaScript are: |
| 5 | +GraalJS is a JavaScript engine implemented in Java on top of GraalVM. |
| 6 | +It is an ECMAScript-compliant runtime to execute JavaScript and Node.js applications, and includes all the benefits from the GraalVM stack including interoperability with Java. |
| 7 | +GraalJS is an open-source project. |
7 | 8 |
|
8 |
| -* Execute JavaScript code with best possible performance |
| 9 | +The goals of GraalJS are: |
9 | 10 | * [Full compatibility with the latest ECMAScript specification](docs/user/JavaScriptCompatibility.md)
|
10 |
| -* Support Node.js applications, including native packages ([check](https://www.graalvm.org/compatibility/)) |
11 |
| -* Allow simple upgrading from [Nashorn](docs/user/NashornMigrationGuide.md) or [Rhino](docs/user/RhinoMigrationGuide.md) based applications |
12 |
| -* [Fast interoperability](https://www.graalvm.org/reference-manual/polyglot-programming/) with Java, Scala, or Kotlin, or with other GraalVM languages like Ruby, Python, or R |
13 |
| -* Be embeddable in systems like [Oracle RDBMS](https://labs.oracle.com/pls/apex/f?p=LABS:project_details:0:15) or MySQL |
14 |
| - |
| 11 | +* [Interoperability with Java](docs/user/JavaInteroperability.md) |
| 12 | +* Interoperability with WebAssembly using the JavaScript WebAssembly API |
| 13 | +* Running JavaScript with the best possible performance |
| 14 | +* Support for Node.js applications, including native packages |
| 15 | +* Simple upgrading from applications based on [Nashorn](docs/user/NashornMigrationGuide.md) or [Rhino](docs/user/RhinoMigrationGuide.md) |
| 16 | +* Embeddability in systems like [Oracle RDBMS](https://labs.oracle.com/pls/apex/f?p=LABS:project_details:0:15) or MySQL |
15 | 17 |
|
16 | 18 | ## Getting Started
|
17 |
| -The preferred way to run GraalVM JavaScript (a.k.a. GraalJS) is from a [GraalVM](https://www.graalvm.org/downloads/). |
18 |
| -As of GraalVM for JDK 21, (23.1), GraalVM JavaScript and Node.js runtimes are available as [standalone distributions](https://github.com/oracle/graaljs/releases) and [Maven artifacts](https://central.sonatype.com/artifact/org.graalvm.polyglot/js) (but no longer as GraalVM components). |
19 |
| -See the documentation on the [GraalVM website](https://www.graalvm.org/latest/reference-manual/js/) for more information on how to set up GraalVM JavaScript. |
20 | 19 |
|
21 |
| -### Standalone Distribution |
22 |
| -To install GraalVM JavaScript using the [standalone distribution], simply download and extract the desired archive from the [GitHub Releases](https://github.com/oracle/graaljs/releases) page. |
23 |
| -The standalone archives for the JavaScript and Node.js distributions are named `graaljs[-community][-jvm]-<version>-<os>-<arch>.tar.gz` and `graalnodejs[-community][-jvm]-<version>-<os>-<arch>.tar.gz`, respectively. |
24 |
| -Four different available configurations are available for each component and platform combination: |
| 20 | +As of version 23.1.0, GraalJS is available as [Maven artifacts](https://central.sonatype.com/artifact/org.graalvm.polyglot/js). |
| 21 | +We also provide [standalone distributions](https://github.com/oracle/graaljs/releases) of the JavaScript and Node.js runtimes. |
25 | 22 |
|
26 |
| -| Runtime | License | Archive Infix | |
27 |
| -| -------------| ------- | ---------------- | |
28 |
| -| Native | GFTC | _none_ | |
29 |
| -| JVM | GFTC | `-jvm` | |
30 |
| -| Native | UPL | `-community` | |
31 |
| -| JVM | UPL | `-community-jvm` | |
| 23 | +### Maven Artifacts |
32 | 24 |
|
33 |
| -After installation, the `js` or `node` executable in the `bin` subdirectory can be used to run JavaScript files or Node modules, respectively. |
34 |
| -If no file is provided on the command line, an interactive shell (REPL) will be spawned. |
| 25 | +Thanks to GraalJS, you can easily embed JavaScript into a Java application. |
| 26 | +All necessary artifacts can be downloaded directly from Maven Central. |
35 | 27 |
|
36 |
| -### Maven Artifact |
37 |
| -All required artifacts for embedding GraalVM JavaScript can be found in the Maven dependency group [`org.graalvm.polyglot`](https://central.sonatype.com/namespace/org.graalvm.polyglot). |
| 28 | +All artifacts relevant to embedders can be found in the Maven dependency group [org.graalvm.polyglot](https://central.sonatype.com/namespace/org.graalvm.polyglot). |
38 | 29 |
|
39 |
| -Here is a minimal Maven dependency setup that you can copy into your `pom.xml`: |
| 30 | +Below is a minimal Maven dependency setup that you can copy into your _pom.xml_: |
40 | 31 | ```xml
|
41 | 32 | <dependency>
|
42 |
| - <groupId>org.graalvm.polyglot</groupId> |
43 |
| - <artifactId>polyglot</artifactId> |
44 |
| - <version>23.1.0</version> |
| 33 | + <groupId>org.graalvm.polyglot</groupId> |
| 34 | + <artifactId>polyglot</artifactId> |
| 35 | + <version>${graaljs.version}</version> |
45 | 36 | </dependency>
|
46 | 37 | <dependency>
|
47 |
| - <groupId>org.graalvm.polyglot</groupId> |
48 |
| - <artifactId>js</artifactId> |
49 |
| - <version>23.1.0</version> |
50 |
| - <type>pom</type> |
| 38 | + <groupId>org.graalvm.polyglot</groupId> |
| 39 | + <artifactId>js</artifactId> |
| 40 | + <version>${graaljs.version}</version> |
| 41 | + <type>pom</type> |
51 | 42 | </dependency>
|
52 |
| -<!-- add additional languages and tools, if needed --> |
53 | 43 | ```
|
| 44 | +This enables GraalJS which is built on top of Oracle GraalVM and licensed under the [GraalVM Free Terms and Conditions (GFTC)](https://www.oracle.com/downloads/licenses/graal-free-license.html). |
| 45 | +Use `js-community` if you want to use GraalJS built on GraalVM Community Edition. |
54 | 46 |
|
55 |
| -See the [polyglot embedding demonstration](https://github.com/graalvm/polyglot-embedding-demo) on GitHub for a complete runnable example. |
56 | 47 |
|
57 |
| -Language and tool dependencies use the [GraalVM Free Terms and Conditions (GFTC)](https://www.oracle.com/downloads/licenses/graal-free-license.html) license by default. |
58 |
| -To use community-licensed versions instead, add the `-community` suffix to each language and tool dependency, e.g.: |
59 |
| -```xml |
60 |
| -<dependency> |
61 |
| - <groupId>org.graalvm.polyglot</groupId> |
62 |
| - <artifactId>js-community</artifactId> |
63 |
| - <version>23.1.0</version> |
64 |
| - <type>pom</type> |
65 |
| -</dependency> |
66 |
| -``` |
67 |
| -To access [polyglot isolate](https://www.graalvm.org/latest/reference-manual/embed-languages/#polyglot-isolates) artifacts (GFTC only), use the `-isolate` suffix instead (e.g. `js-isolate`). |
| 48 | +To access [polyglot isolate](https://www.graalvm.org/reference-manual/embed-languages/#polyglot-isolates) artifacts (GFTC only), use the `-isolate` suffix instead (e.g. `js-isolate`). |
| 49 | + |
| 50 | +See the [polyglot embedding demonstration](https://github.com/graalvm/polyglot-embedding-demo) on GitHub for a complete runnable example. |
68 | 51 |
|
69 |
| -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). |
| 52 | +You can use GraalJS with GraalVM JDK, Oracle JDK, or OpenJDK. |
| 53 | +If you prefer running on a stock JVM, have a look at [Run GraalJS on a Stock JDK](docs/user/RunOnJDK.md). |
70 | 54 | Note that in this mode many features and optimizations of GraalVM are not available.
|
71 | 55 | Due to those limitations, running on a stock JVM is not a supported feature - please use a GraalVM instead.
|
72 | 56 |
|
73 |
| -## Documentation |
| 57 | +### Standalone Distributions |
| 58 | + |
| 59 | +Standalone distributions are published on [GitHub](https://github.com/oracle/graaljs/releases). |
| 60 | +There are two language runtime options to choose from: |
| 61 | +- Native launcher compiled ahead of time with GraalVM Native Image; |
| 62 | +- JVM-based runtime. |
| 63 | + |
| 64 | +To distinguish between them, a standalone that comes with a JVM has a `-jvm` infix in the name. |
| 65 | +Also, the GraalVM Community Edition version has `-community` in the name, for example, `graaljs-community-<version>-<os>-<arch>.tar.gz`. |
74 | 66 |
|
75 |
| -Extensive documentation is available on [graalvm.org](https://www.graalvm.org/): see [Getting Started](https://www.graalvm.org/docs/getting-started/) and the more extensive [JavaScript and Node.js Reference Manual](https://www.graalvm.org/reference-manual/js/). |
76 |
| -In addition, there is documentation in the source code repository in the [`docs`](https://github.com/graalvm/graaljs/tree/master/docs) directory, for [users](https://github.com/graalvm/graaljs/tree/master/docs/user) and [contributors](https://github.com/graalvm/graaljs/tree/master/docs/contributor). |
| 67 | +Four different configurations are available for each component and platform combination: |
77 | 68 |
|
78 |
| -For contributors, a guide how to build GraalVM JavaScript from source code can be found in [`Building.md`](https://github.com/graalvm/graaljs/tree/master/docs/Building.md). |
| 69 | +| Runtime | License | Archive Infix | |
| 70 | +| -------------| ------- | ---------------- | |
| 71 | +| Native | GFTC | _none_ | |
| 72 | +| JVM | GFTC | `-jvm` | |
| 73 | +| Native | UPL | `-community` | |
| 74 | +| JVM | UPL | `-community-jvm` | |
79 | 75 |
|
80 |
| -## Current Status |
| 76 | +To install GraalJS from a standalone, download and extract the archive from the [GitHub Releases](https://github.com/oracle/graaljs/releases) page. |
| 77 | +After the installation, the `js` or `node` executable in the `bin` subdirectory can be used to run JavaScript files or Node modules, respectively. |
| 78 | +If no file is provided on the command line, an interactive shell (REPL) will be spawned. |
81 | 79 |
|
82 |
| -GraalVM JavaScript is compatible with the [ECMAScript 2023 specification](https://262.ecma-international.org/14.0/). |
83 |
| -New features, e.g. `ECMAScript proposals` scheduled to land in future editions, are added frequently and are accessible behind a flag. |
84 |
| -See the [CHANGELOG.md](https://github.com/graalvm/graaljs/tree/master/CHANGELOG.md) for the proposals already adopted. |
| 80 | +## Node.js Runtime |
85 | 81 |
|
86 |
| -In addition, some popular extensions of other engines are supported, see [`JavaScriptCompatibility.md`](https://github.com/graalvm/graaljs/tree/master/docs/user/JavaScriptCompatibility.md). |
| 82 | +GraalJS can run unmodified Node.js applications. |
| 83 | +GraalVM's Node.js runtime is based on a recent version of Node.js, and runs the GraalJS engine instead of Google V8. |
| 84 | +It provides high compatibility with the existing NPM packages. |
| 85 | +This includes NPM packages with native implementations. |
| 86 | +Note that some NPM modules may require to be recompiled from source with GraalJS (if they ship with binaries that have been compiled for Node.js based on V8). |
87 | 87 |
|
88 |
| -### Node.js support |
| 88 | +Node.js is available as a separate [standalone distribution](#standalone-distributions). |
| 89 | +See [how to get started with Node.js](NodeJS.md). |
89 | 90 |
|
90 |
| -GraalVM JavaScript can execute Node.js applications. |
91 |
| -It provides high compatibility with existing npm packages, with high likelihood that your application will run out of the box. |
92 |
| -This includes npm packages with native implementations. |
93 |
| -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. |
94 |
| -Node.js is a separate [standalone distribution](#standalone-distribution). |
| 91 | +## Documentation |
95 | 92 |
|
96 |
| -### Compatibility on Operating Systems |
| 93 | +Extensive user documentation is available on the [website](https://www.graalvm.org/reference-manual/js/). |
| 94 | +In addition, there is documentation in this repository under [docs](https://github.com/oracle/graaljs/tree/master/docs), for [users](https://github.com/oracle/graaljs/tree/master/docs/user) and [contributors](https://github.com/oracle/graaljs/tree/master/docs/contributor). |
| 95 | +For contributing, see also a [guide on how to build GraalJS from source code](docs/Building.md). |
97 | 96 |
|
98 |
| -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). |
99 |
| -We provide binary distributions and fully support GraalVM JavaScript on Linux (AMD64, AArch64), MacOS (AMD64, AArch64), and Windows (AMD64), currently. |
| 97 | +## Compatibility |
100 | 98 |
|
101 |
| -## GraalVM JavaScript Reference Manual |
| 99 | +GraalJS is compatible with the [ECMAScript 2024 specification](https://262.ecma-international.org/). |
| 100 | +New features, new ECMAScript proposals, scheduled to land in future editions, are added frequently and are accessible behind an option. |
| 101 | +See the [CHANGELOG.md](CHANGELOG.md) for the proposals already adopted. |
102 | 102 |
|
103 |
| -A reference manual for GraalVM JavaScript is available on the [GraalVM website](https://www.graalvm.org/reference-manual/js/). |
| 103 | +In addition, some popular extensions of other engines are supported. See [GraalJS Compatibility](docs/user/JavaScriptCompatibility.md). |
104 | 104 |
|
105 |
| -## Stay connected with the community |
| 105 | +## Operating Systems Compatibility |
106 | 106 |
|
107 |
| -See [graalvm.org/community](https://www.graalvm.org/community/) on how to stay connected with the development community. |
108 |
| -The channel _graaljs_ on [graalvm.slack.com](https://www.graalvm.org/slack-invitation) is a good way to get in touch with us. |
109 |
| -Please report JavaScript-specific issues on the [`oracle/graaljs`](https://github.com/oracle/graaljs/) GitHub repository. |
| 107 | +The core JavaScript engine is a Java application and is thus compatible with every operating system that provides a compatible JVM. See [Run GraalJS on a Stock JDK](docs/user/RunOnJDK.md). |
| 108 | +We provide binary distributions and fully support GraalJS on Linux (x64, AArch64), macOS (x64, AArch64), and Windows (x64), currently. |
110 | 109 |
|
111 |
| -## License |
| 110 | +## Stay Connected with the Community |
112 | 111 |
|
113 |
| -GraalVM JavaScript source code and community distributions are available under the following license: |
| 112 | +See [graalvm.org/community](https://www.graalvm.org/community/) for how to stay connected with the development community. |
| 113 | +The channel _graaljs_ on [graalvm.slack.com](https://www.graalvm.org/slack-invitation) is a good way to get in touch with the team behind GraalJS. |
| 114 | +Report any GraalJS-specific issues at the [oracle/graaljs](https://github.com/oracle/graaljs/) GitHub repository. |
114 | 115 |
|
115 |
| -* [The Universal Permissive License (UPL), Version 1.0](https://opensource.org/licenses/UPL) |
| 116 | +## License |
116 | 117 |
|
117 |
| -Non-community artifacts are provided under the following license: |
| 118 | +GraalJS source code and community distributions are available under the [Universal Permissive License (UPL), Version 1.0](https://opensource.org/licenses/UPL). |
118 | 119 |
|
119 |
| -* [GraalVM Free Terms and Conditions (GFTC) including License for Early Adopter Versions](https://www.oracle.com/downloads/licenses/graal-free-license.html) |
| 120 | +Non-community artifacts are provided under the [GraalVM Free Terms and Conditions (GFTC) including License for Early Adopter Versions](https://www.oracle.com/downloads/licenses/graal-free-license.html). |
0 commit comments