Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    sdnetwork
    @sdnetwork
    ok. Thanks
    sdnetwork
    @sdnetwork
    what is the equivalent of npm start -- -i when use es4x-pm to instantiate a project ?
    Paulo Lopes
    @pmlopes
    You can do: npm start -- -inspect=5858 if i'm not mistaken, if you run your app with -help it should tell you all the possible flags
    @sdnetwork I've just upgraded to graal rc13 and confirm that the loading of ES6 isn't broken anymore. The next step is to implement the module loading semantics to use node_modules as the base engine just implements the spec (acts like a browser so to say).
    sdnetwork
    @sdnetwork
    @pmlopes really great news and thx for the debug mode
    Paulo Lopes
    @pmlopes
    :+1:
    sdnetwork
    @sdnetwork
    A little tip to use debugger with vscode and es4x-pm initiator
    { "name": "Launch via npm", "type": "node", "request": "launch", "cwd": "${workspaceFolder}", "runtimeExecutable": "npm", "runtimeArgs": [ "run-script", "start", "--", "-inspect=5858" ], "port": 5858 }
    Paulo Lopes
    @pmlopes
    We can add that to the docs. It's really an area that is missing...
    :+1:
    sdnetwork
    @sdnetwork
    yes for sure
    sdnetwork
    @sdnetwork
    for vscode launch config it's important to add "outputCapture": "std" otherwise no output console
    {
                "name": "Launch via npm",
                "type": "node",
                "request": "launch",
                "cwd": "${workspaceFolder}",
                "runtimeExecutable": "npm",
                "runtimeArgs": [
                    "run-script", "start", "--", "-inspect=5858"
                ],
                "port": 5858,
                "outputCapture": "std"
            }
    `
    Paulo Lopes
    @pmlopes
    Alternatively we can also add a new vertx-pm command to generate this file so users could do for example es4x vscode launcher and this file gets written/appended to the .vscode/launchers.json
    sdnetwork
    @sdnetwork
    yes really good, we can create an environement for several edi like vscode,webstorm ...
    Paulo Lopes
    @pmlopes
    if you're interested in contributing, I can assist you, for example, for this example you can start by adding a new command like the Dockerfile one: https://github.com/reactiverse/es4x/blob/develop/pm/src/main/java/io/reactiverse/es4x/commands/DockerfileCommand.java
    sdnetwork
    @sdnetwork
    ok thanks i will try ;)
    Paulo Lopes
    @pmlopes
    just a heads up release 0.8.0 https://github.com/reactiverse/es4x/releases/tag/0.8.0 is out, now that graaljs is officially stable, it is used as the js engine for the project. This means that work was put on getting it to work even better. Debugging and VScode integration is now a matter of a click or two :wink: On the performance side, we see it quite stable with great results on techempower CI runs.
    sdnetwork
    @sdnetwork
    :+1:
    Frank O'Hara
    @fohara

    @pmlopes amazing project! The combination of graaljs and vertx is powerful and performant. Since graaljs opens up the possibility of using npm packages, is it possible to use something like https://github.com/typeorm/typeorm for data access?

    I really like vertx, but there doesn't seem to be a robust reactive orm that is supported. Since an orm that was designed for node is likely reactive/async by default, does es4x open up the possibility of using an orm like typeorm while still being non-blocking?

    krecco
    @krecco
    @pmlopes es4x is really great. I have two questions. How to integrate custom Shiro realm (i am using key/value store - and have it working in java)? And seconly is there an example for using reactiverse/elasticsearch-client with es4x? Thanks.
    Paulo Lopes
    @pmlopes
    @fohara sorry it's vacation time so replies are slow, in theory it should be possible however note that if the drivers used by typeorm are native node modules it won't work. If the ORM can be decoupled from the driver, then using the vertx reactive drivers (postgres) and soon (mysql and mssql) then it can be a very powerful combo indeed.

    @krecco you can use anything you have in java too, I'm working on a way to include extra jars so they will be available in your code and from code it self you can get any java class as:

    let someJavaClass = Java.type('fully.classified.class.Name')
    let myInstance =  new someJavaClass()
    ...

    then it just behaves like a js object but indeed it the java class. You will not have IDE code completion as that it not infered by IDEs

    WhiteWoodCity
    @WhiteWoodCity_twitter

    Good morning, for docs, is there a syntax typo

    !!! warning "package upload limits"

    Currently the...

    for vuepress syntax extension, should it be

    ::: warning Package Upload Limits
    Currently the ...
    :::

    ?

    Paulo Lopes
    @pmlopes
    Yes it should be 3x colon :::
    WhiteWoodCity
    @WhiteWoodCity_twitter
    Is it possible to use ES4X without install node.js?
    Paulo Lopes
    @pmlopes
    Theoretically yes (with cheating) if you install graalvm it contains both npm and node (running on graal) in this case everything should work. Going 100% without is possible but it requires some work. In the package json declare only mvnDependencies these are installable with es4x install. In this case es4x is a java app that uses the same maven resolution lib and will download just the jars. You can use them in your app but there's no ide support (no .d.ts) plus you need to use the interop import style let x = Java.type('FQCN') instead of js modules
    To run apps without npm or node a script node_modules/.bin/es4x-starter is created that only uses the jdk.
    Paulo Lopes
    @pmlopes
    @WhiteWoodCity_twitter I was thinking that it would be possible to avoid npm/node if we implement a module resolution like https://deno.land/ in this case we would download js on demand
    Jarsks
    @jarsks_twitter
    I generated a Dockerfile using es4x and ran into the error:
    Step 11/18 : RUN curl -sL https://github.com/reactiverse/es4x/releases/download/${ES4X_VERSION}/es4x-pm-${ES4X_VERSION}-bin.tar.gz | tar zx --strip-components=1 -C /usr/local
     ---> Running in 2c2a5dc590be
    Removing intermediate container 2c2a5dc590be
     ---> 52dccc2f9385
    Step 12/18 : RUN es4x install -f
     ---> Running in 2f55c64b395c
    The command 'install' is not a valid command.
    See 'java io.reactiverse.es4x.ES4X --help'
    I was able to get around it by installing es4x-pm using npm.
    I also ran into another error trying out the typescript example in the repo.
    node_modules/@vertx/web/options.d.ts:17:10 - error TS2440: Import declaration conflicts with local declaration of 'PermittedOptions'.
    
    17 import { PermittedOptions } from '@vertx/bridge-common/options';
    Paulo Lopes
    @pmlopes
    Hi @jarsks_twitter the first issue is indeed odd. I'll investigate it asap. The second one is a known issue, the root cause is that there's 2 vertx classes with the same name but different package that the type definition generator doesn't account for. It is purely a type info error and if you ignore it for now you will see that the typescript compiler did generate the correct working code. Anyway with vertx 4 that issue will disappear
    Jarsks
    @jarsks_twitter
    Thanks @pmlopes, here is the output when changed to use --help
    Step 11/18 : RUN curl -sL https://github.com/reactiverse/es4x/releases/download/${ES4X_VERSION}/es4x-pm-${ES4X_VERSION}-bin.tar.gz | tar zx --strip-components=1 -C /usr/local
     ---> Using cache
     ---> 19df3b727e86
    Step 12/18 : RUN es4x --help
     ---> Running in c11e75e3689f
    Usage: java io.reactiverse.es4x.ES4X [COMMAND] [OPTIONS] [arg...]
    
    Commands:
        bare      Creates a bare instance of vert.x.
        list      List vert.x applications
        run       Runs a JS script called <main-verticle> in its own instance of
                  vert.x.
        start     Start a vert.x application in background
        stop      Stop a vert.x application
        version   Displays the version.
    
    Run 'java io.reactiverse.es4x.ES4X COMMAND --help' for more information on a
    command.
    Paulo Lopes
    @pmlopes
    The issue has been fixed on master and I'm starting the release process tomorrow.
    Paulo Lopes
    @pmlopes
    @jarsks_twitter release 0.9.1 is pushed it should fix that issue and a few more 😅
    Jarsks
    @jarsks_twitter
    @pmlopes Thanks for the quick release. I tested it and it's working now!
    Paulo Lopes
    @pmlopes
    :+1:
    Jarsks
    @jarsks_twitter
    Paulo Lopes
    @pmlopes
    Thanks for the heads up!
    chefhoobajoob
    @chefhoobajoob
    @pmlopes : what exactly are the constraints (if any) on using npm packages that are designed to run on node? Do modules actually run on nodejs within GRAAL?
    chefhoobajoob
    @chefhoobajoob
    @pmlopes: hmm - graaljs claims support for node.js modules, including native packages. Is that the level of compatibility supported on ES4X?
    Paulo Lopes
    @pmlopes
    Hi, graaljs is a pure JavaScript runtime, think of it as V8. The runtime has no concept of commonjs modules, packages, etc (this is what es4x uses). Then there's a sub project called graaljs node, where they build nodejs but replace V8 with graaljs and run on the jvm. The build of nodejs uses the other graalvm technologies such as native images, etc and allows full compatibility with node. The big difference is that this mode is not so performance like es4x for the reasons I've presented at several conferences. Vertx event loop is more advanced for full CPU usage, netty seems to do a better job at networking code plus the not will now see the full application not just the script. With enough warm up time you get the results you see in the techempower benchmark (which is run by techempower, not me).
    chefhoobajoob
    @chefhoobajoob
    ok - thank you for the description - I was able to find some of your articles describing the performance benchmarks. So, is it accurate to say that the es4x implementation is in a similar role as graaljs node, but it does not support any variant of native modules, including those targeting node's N-API? To be safe, we should avoid using any npm packages that make use of any kind of native modules?
    Paulo Lopes
    @pmlopes
    Yes and that is why it's not a replacement for node but an alternative for the case when performance is important
    krecco
    @krecco
    @fohara any news on typeorm?
    chefhoobajoob
    @chefhoobajoob
    @pmlopes : maybe this is a dumb question, but I'm updating a few different services to vertx 3.8.3, and thinking about trying to swap out our nashorn js verticles for a first cut version of es4x implementations of those same verticles, at least to get a feel for the dev cycle and technical considerations. es4x is still in development - is it shooting for a 1.0 'production-ready' release as part of the vert.x 4.0 release, or will it have an independent set of release milestones?
    Paulo Lopes
    @pmlopes
    Hi @chefhoobajoob yes the idea is that with vertx 4 (and Graal 19.3) I'll move to 1.0. vertx 4 new apis will allow (optional) async await usage on vertx apis so it will be easier to code/read. Graal 19.3 will be a lts release so no need to worry with breaking changes on the js engine. Currently we keep 2 different versions because it's easier to keep adding small features and not wait for a full vertx release. Maybe in the future we can align both
    chefhoobajoob
    @chefhoobajoob
    Great - thank you!
    krecco
    @krecco
    @pmlopes - great news!
    Paulo Lopes
    @pmlopes
    I was asked today about the possibility of mixing es4x and other Java libs that have no npm bindings. If anyone is interested here's a es4x +Java graphql + grpc example https://github.com/pmlopes/es4x-grpc-graphql