Getting jsdom to execute in the GraalJS engine

144 views
Skip to first unread message

Hugo Ferreira

unread,
Oct 17, 2019, 11:35:56 AM10/17/19
to jsdom
Hello,

I am trying to execute jsdom in the GraalVM JavaScript engine.

Unfortunately its seems like the first few `require` in https://github.com/jsdom/jsdom/blob/master/lib/api.js
are intrinsic to the Node.js script engine. My question is: is it possible to run jsdom in a Javascript engine
other than Node.js? Is it just a question of loading the required script. For example, were can I find the "path"
script?

TIA

Sebastian Mayr

unread,
Oct 17, 2019, 11:39:16 AM10/17/19
to js...@googlegroups.com
Possibly. While we don't support Graal, we do support webworkers in browsers via browserify. You may be able to feed that version into Graal, although I'm not sure if it supports all the necessary APIs of the shim scripts.

-Sebastian

--
You received this message because you are subscribed to the Google Groups "jsdom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsdom+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsdom/de063e66-4aac-421f-93e8-f9f4607b9070%40googlegroups.com.

Hugo Ferreira

unread,
Oct 17, 2019, 12:10:29 PM10/17/19
to jsdom
Sebastian,

Appreciate the information. My JavaScript is poor so this may be a less than intelligent question:
I have to feed GraalJS either a file with JS or a string with JS.
You said I " may be able to feed that version into Graal". I take it it is a script that has been "packed" by browserify?
If so, were can I get this. My Google foo failed me.

In regards to the "shim scripts", were can I get information on these? I can always try and implement them as JS
directly in a script or as Java interop objects.

TIA



On Thursday, 17 October 2019 16:39:16 UTC+1, Sebastian Mayr wrote:
Possibly. While we don't support Graal, we do support webworkers in browsers via browserify. You may be able to feed that version into Graal, although I'm not sure if it supports all the necessary APIs of the shim scripts.

-Sebastian

On Thu, Oct 17, 2019, 11:36 Hugo Ferreira <hugo6f...@gmail.com> wrote:
Hello,

I am trying to execute jsdom in the GraalVM JavaScript engine.

Unfortunately its seems like the first few `require` in https://github.com/jsdom/jsdom/blob/master/lib/api.js
are intrinsic to the Node.js script engine. My question is: is it possible to run jsdom in a Javascript engine
other than Node.js? Is it just a question of loading the required script. For example, were can I find the "path"
script?

TIA

--
You received this message because you are subscribed to the Google Groups "jsdom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to js...@googlegroups.com.

Sebastian Mayr

unread,
Oct 17, 2019, 12:24:44 PM10/17/19
to js...@googlegroups.com
We don't provide a browserified script by default since you usually pack an entry script with it as well that exports the functionality you need into the window/executes it during init.

Our tests build that version with browserifys API, do so you might be able to glean some info there.

The shims are provided by browserify and basically implement node's native modules (that are required) so you can reuse exactly that same code in the browser. If a shim doesn't work for you, browserify has a way to specify overrides for all required modules. However at this point this is getting more into browserify usage.

-Sebastian

To unsubscribe from this group and stop receiving emails from it, send an email to jsdom+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsdom/c2994699-c018-4cce-8563-5acbaeaa7a35%40googlegroups.com.

Hugo Ferreira

unread,
Oct 17, 2019, 4:32:22 PM10/17/19
to js...@googlegroups.com
Thanks Sebastian. I will try browserify and see how far i get.



Reply all
Reply to author
Forward
0 new messages