Skip to content

Commit fa59a9f

Browse files
committed
Update Options.md
1 parent e9764e5 commit fa59a9f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

docs/user/Options.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ js -e 'print(1+2);'
1919
```shell
2020
js -f myfile.js
2121
```
22+
* `--module FILE`: load and execute the provided module file. Note that `.mjs` files are treated as modules by default.
23+
```shell
24+
js --module myfile.mjs
25+
```
2226
* `--version`: print the version information of GraalVM JavaScript, then exit.
2327
* `--strict`: execute the engine in JavaScript's _strict mode_.
2428

@@ -27,21 +31,21 @@ js -f myfile.js
2731
There are several options to configure the behavior of the GraalVM JavaScript engine.
2832
Depending on how the engine is started, the options can be passed either to the launcher or programmatically.
2933

30-
For a full list of options of the JavaScript engine, pass the `--help:js` flag to the `js` launcher (available from GraalVM 22.1., for older releases use `--help:languages`).
34+
For a full list of options of the JavaScript engine, pass the `--help:js` flag to the `js` launcher (available from GraalVM 22.1, for older releases use `--help:languages`).
3135
To include internal options, use `--help:js:internal`.
3236
Note that those lists both include stable, supported options and experimental options.
3337

3438
### Provide Options to the Launcher
3539
To the launcher, the options are passed with `--js.<option-name>=<value>`:
3640
```shell
37-
js --js.ecmascript-version=6
41+
js --js.ecmascript-version=2015
3842
```
3943

4044
### Provide Options Programmatically Using the Context API
4145
When started from Java using GraalVM's Polyglot API, the options are passed programmatically to the `Context` object:
4246
```java
4347
Context context = Context.newBuilder("js")
44-
.option("js.ecmascript-version", "6")
48+
.option("js.ecmascript-version", "2015")
4549
.build();
4650
context.eval("js", "42");
4751
```
@@ -65,6 +69,10 @@ The following stable options are frequently relevant:
6569
* `--js.intl-402`: enable ECMAScript Internationalization API. Boolean value, default is `true`.
6670
* `--js.regexp-static-result`: provide static `RegExp` properties containing the results of the last successful match, e.g., `RegExp.$1` (legacy). Boolean value, default is `true`.
6771
* `--js.strict`: enable strict mode for all scripts. Boolean value, default is `false`.
72+
* `--js.console`: enable the `console` global property. Boolean value, default is `true`.
73+
* `--js.allow-eval`: allow the code generation from strings, e.g. using `eval()` or the `Function` constructor. Boolean value, default is `true`.
74+
* `--js.timer-resolution`: sets the resolution of timing functions, like `Date.now()` and `performance.now()`, in nanoseconds. Default: `1000000` (i.e. 1 ms).
75+
* `--js.unhandled-rejections`: configure unhandled promise rejection tracking. Accepted values are `none` (default, no tracking), `warn` (print a warning to stderr), `throw` (throw an exception), and `handler` (invoke a custom handler).
6876

6977
For a complete list, use `js --help:js:internal`
7078

@@ -108,3 +116,6 @@ To use them, the `--experimental-options` flag is required or the experimental o
108116
* `--js.nashorn-compat`: provide compatibility mode with the Nashorn engine. Sets ECMAScript version to 5 by default. Might conflict with newer ECMAScript versions. Boolean value, default is `false`.
109117
* `--js.timezone`: set the local time zone. String value, default is the system default.
110118
* `--js.v8-compat`: provide better compatibility with Google's V8 engine. Boolean value, default is `false`.
119+
* `--js.esm-eval-returns-exports`: `context.eval` of an ES module `Source` returns its exported symbols.
120+
* `--js.temporal`: enable  [`Temporal` API](https://github.com/tc39/proposal-temporal).
121+
* `--js.webassembly`: enable `WebAssembly` API.

0 commit comments

Comments
 (0)