jsweet icon indicating copy to clipboard operation
jsweet copied to clipboard

New annotation for transpiler entry point

Open WhiteTrashLord opened this issue 5 years ago • 2 comments

I used the annotaion Erased and it works quite well. What you think about about making a new annotation which sets the Entry point for the transpiler and it will use only classes which are connected to the Entry point class?

This would be easier for someone who wants to exclude many classes.

WhiteTrashLord avatar Oct 27 '18 19:10 WhiteTrashLord

What you suggest sounds very much like JS modules + Tree Shaking JSweet can generate ES6 modules, and you can then use a separate bundler to perform tree shaking.

That being said, I am not sure that this is exactly what you need. If you want to exclude Java class from transpilation

  1. you may try to exclude files from the transpilation using the maven plugin: https://github.com/lgrignon/jsweet-node-example/blob/master/pom.xml#L43
  2. apply Erased annotation to classes using a specific matcher: https://github.com/cincheo/jsweet/blob/master/doc/jsweet-language-specifications.md#introducing-the-extension-api

lgrignon avatar Nov 05 '18 21:11 lgrignon

I don't really need anything. The Erased annotation is good enough for me. It's also good to know that I can also exclude classes in Maven, I only suggested it because there are EntryPoints in GWT:

http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsClient.html

WhiteTrashLord avatar Nov 06 '18 19:11 WhiteTrashLord