Open
Description
I am trying to use an ECMA Module and I find I am forces to use the Import
.
import {Asciidoctor} from 'graalvm/asciidoctor.mjs`;
var asciidoctor = Asciidoctor();
That works on a normal FS, but fails when the script (let's call it app.mjs
) and graalvm/asciidoctor.mjs
are bundled inside a Jar.
I am trying to make it work with a custom FS, but given the module can be preloaded like the example below, I'd be nice to reference the preloaded module instead of having to process it again. That could benefit from cached modules right? I understand that the use of a custom FS invalidates it, I can preload the module content in memory, but it will be parsed on every call.
String ASCIIDOCTOR_JS="graalvm/asciidoctor.mjs"
String APP_JS="app.mjs"
Source asciidoctorSource = Source.newBuilder("js", Utils.fromClasspathUrl(ASCIIDOCTOR_JS)).build();
Value result = context.eval(asciidoctorSource);
Source appSource = Source.newBuilder("js", Utils.fromClasspathUrl(APP_JS)).build();
Value result2 = context.eval(appSource);