[
https://issues.apache.org/jira/browse/CAMEL-18718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17636311#comment-17636311
]
Mrinal commented on CAMEL-18718:
--------------------------------
I know this work is already completed but thought of documenting a good
open-source solution that can be used in the future to evaluate JS if needed.
It supports NodeJs also.
https://github.com/caoccao/Javet
> camel-javascript - Language based on graalvm sdk
> ------------------------------------------------
>
> Key: CAMEL-18718
> URL: https://issues.apache.org/jira/browse/CAMEL-18718
> Project: Camel
> Issue Type: New Feature
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 3.20.0
>
>
> Lets see if we can use graalvm-sdk or graalvm-js that can compile and execute
> javascript code (with npm modules imported)
> A dirty prototype
> {code}
> public static void main(String[] args) throws IOException {
> String src = "import {faker} from
> '../js/node_modules/@faker-js/faker/dist/esm/index.mjs';" +
> "const randomName = faker.name.fullName();" +
> "console.log(randomName);";
>
> Context cx = Context.newBuilder("js")
> .allowIO(true)
> .build();
>
> cx.eval(Source.newBuilder("js", src, "test.mjs").build());
> }
> {code}
> If we can then make this as a language in Camel then end users can more
> easily use this together with Camel.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)