ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 404 forks source link

melange: find out js artifact of a given ml source #7459

Open jchavarri opened 1 year ago

jchavarri commented 1 year ago

Dune and Melange default to placing .js artifacts in _build folder. In comparison, ReScript default behavior is to put .js artifacts next to the sources.

To help Melange users look at the resulting .js files, it would be nice to have the ability to "Inspect JavaScript output" from editors. To do so, Dune could look up all the melange.emit stanzas in the workspace and search for the given module emitted in them. Then editor tooling libraries could consume this functionality through rpc.

Alizter commented 1 year ago

What about promoting all js?

jchavarri commented 1 year ago

That could work. I personally haven't tested promotion mode much (or at all 😅 ) with Melange. But even if I had, it has a couple of downsides:

anmonteiro commented 8 months ago

This is a bit tricky because e.g. a library libA can be included in multiple melange.emits, so there will be several JS targets for it. If we were to implement this, we'd need to find all the targets where it appears and list them under the respective melange.emit stanzas that they belong to.