That's really cool Jaroslav. Do you have a github link to Bck2Brwsr? I am also interested in Java->JS transpilation (I made that post on the Graal forums).
Recently I've been using Google's J2CL transpiler [1], which is the successor to GWT and wraps the optimizing Closure Compiler. The library has some unfortunate problems however. It doesn't run on Windows, tests don't work, it only runs on their Bazel build system, docs are poor, huge pain interfacing with ES6 and CommonJS modules, etc. Thankfully, there is a community maven plugin [2] which resolves some of these problems and even adds support for sourcemaps during (fast) incremental compilation. I am contributing some things via PRs, for example a 0-dep live-reloading dev server [3]. Here is an example I made with J2CL-m-p: https://august.nagro.us/passgen/ It's a PWA so you can 'install' it by hitting the plus in the right of the addr bar and it works offline. I used web components by extending HTMLElement, as you can see the fragments with inspector. It uses an english dictionary for words. Pretty cool what the web is capable of these days. The HTML netbeans bugs I filed recently were encountered developing this sample. However at the end of the day Google never meant J2CL to be a tool for writing extensive frontend code. I think they probably use it just to let JS devs consume the dtos/validations/algorithms written in Java. And they do the same for the guys writing iOS apps with j2objc [3]. And to be fair, the Java language doesn't always map great to JS, especially things like default function arguments. Scala however, really does fit JS well, and Scala.js [4] is a great software project. They have their own IR that maps to Closure Compiler, just like J2CL. And the community has invested in some great JS framework bindings. Interop & bundling with both ES6 and CommonJS is a breeze. The only problem is that we both wish to write as much Java as possible. So until Graal supports JS output (or we build Graalium ;) ) I think I will start contributing to their effort to implement a Java frontend [5]. Then I can write a Java backend, and idiomatic Scala frontend with full reuse of DTOs, validations, etc. Cheers, August [1]: https://github.com/google/j2cl [2]: https://github.com/Vertispan/j2clmavenplugin/pulls [3]: https://github.com/Vertispan/j2clmavenplugin/issues/62 [4]: https://github.com/google/j2objc [5]: https://www.scala-js.org/doc/sjs-for-js/es6-to-scala-part1.html [6]: https://github.com/arthanzel/scalajs-jfe/blob/master/Hanzel-project-report-sjs-jfe.pdf On Mon, Jan 25, 2021 at 6:05 PM Jaroslav Tulach <[email protected]> wrote: > > > Is there any hope of getting better react support and > > A month or two ago I had announced my project "React for Java" in this > discussion forum. My post received no replies. Probably not that many active > NetBeans IDE developers develop webapps. Anyway, if you find the topic of > using > Java and web and React interesting, here is a link to the tutorial I have > created: > > http://xelfi.cz/react4jdemo/ttt1.html > > In spite of the silence on this mailing listl, there seems to be a growing > interest in running Java in modern browsers (e.g. without Java plugin) and I > am dedicated to make the Apache NetBeans `@JavaScriptBody` annotation[1] > central piece of such effort. > > Best regards, > Jaroslav Tulach > > NetBeans Platform Architect > Bck2Brwsr Java bytecode to JavaScript transpiler creator > Apache HTML/Java API[1] inventor > OracleLabs - the home of JVMs/compilers/transpilers - member > Apache NetBeans - dedicated contributor > > [1] > https://bits.netbeans.org/html+java/1.7/net/java/html/js/package-summary.html > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > For further information about the NetBeans mailing lists, visit: > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
