[jsscripting] Upgrade to ECMAScript 2022 & Dependency improvements (#14093)
* [jsscripting] Remove asm from dependencies in pom
GraalJS >= 20.3.0 doesn't require org.ow2.asm as compile dependency anymore, see https://mvnrepository.com/artifact/org.graalvm.js/js/20.3.0.
* [jsscripting] Remove dependency org.graalvm.js/js-launcher as it is not required
js-launcher is GraalVM's JavaScript command line interpreter and not required in the addon.
See https://www.graalvm.org/22.1/reference-manual/js/RunOnJDK/.
* [jsscripting] Add missing com.ibm.icu dependency
GraalJS changelog says that it is not required for GraalJS >= 22.0.0 (see 685e5873af/CHANGELOG.md (version-2200)).
But GraalJS 22.3.0 attempts to load classes from it during runtime.
* [jsscripting] Update GraalJS engine options
Compat, as its additional functionality is not used by openhab-js and user code is not expected to use it.
* [jsscripting] Remove com.ibm.icu/icu4j dependency
* [jsscripting] Don't disable Nashorn compat mode as openhab-js requires it for accessors
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This commit is contained in:
@@ -113,10 +113,12 @@ public class OpenhabGraalJSScriptEngine
|
||||
.build(),
|
||||
Context.newBuilder("js").allowExperimentalOptions(true).allowAllAccess(true)
|
||||
.allowHostAccess(HOST_ACCESS).option("js.commonjs-require-cwd", JSDependencyTracker.LIB_PATH)
|
||||
.option("js.nashorn-compat", "true") // to ease migration
|
||||
.option("js.ecmascript-version", "2021") // nashorn compat will enforce es5 compatibility, we
|
||||
// want ecma2021
|
||||
.option("js.commonjs-require", "true") // enable CommonJS module support
|
||||
.option("js.nashorn-compat", "true") // Enable Nashorn compat mode as openhab-js relies on
|
||||
// accessors, see
|
||||
// https://github.com/oracle/graaljs/blob/master/docs/user/NashornMigrationGuide.md#accessors
|
||||
.option("js.ecmascript-version", "2022") // If Nashorn compat is enabled, it will enforce ES5
|
||||
// compatibility, we want ECMA2022
|
||||
.option("js.commonjs-require", "true") // Enable CommonJS module support
|
||||
.hostClassLoader(getClass().getClassLoader())
|
||||
.fileSystem(new DelegatingFileSystem(FileSystems.getDefault().provider()) {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user