Elixirscript: dependencies and source maps


Two of the more challenging issues left for elixirscript are dependency resolution and source maps and I am looking for any advice, opinions, idea, or help that could lead to resolving them.

For dependencies, I’ve been playing around with the idea of using some of the functionality in mix to find dependencies in the deps folder for use. I saw the Mix.Dep module and it looked like it could be useful. Would that be safe to use? Does it make sense to explicitly state elixirscript dependencies? Does it make more sense to crawl the ast and find exactly what modules and dependencies are in use? A goal is hopefully to only end up with output that only includes what is used.

Source maps I think are more complicated. As far as I can tell, Elixir doesn’t output column information with the ast. I’ve seen the discussions and issues on why that is. On top of that, there is creating the algorithm for the source map encoding and then mapping the elixir code. I’m still trying to wrap my head around source maps. It may not be something that is currently doable without column information (I’m not sure), but I would like to do whatever is possible to get steps further towards the goal. I know that Luvviescript took the approach of calculating the column information for Erlang. I was hoping to avoid that, but maybe something like that is the best option?


Hi Bryan, Adam Beynon (creator of Opal - the Ruby to JS transpilier) might be worth pinging? They have source maps in Opal and although he’s no longer part of the project he might be able to give you some pointers? He’s a great guy and I’m sure would be happy to chat :slight_smile:

Makes sense to use to me, although I might go a different route by having Elixirscript dependencies be set elsewhere (can still be done in the mix.exs file, via, say, your compiler and plugins for mix).

As for source maps… no clue… :frowning:

I’ve definitely been keeping an eye on Elixirscript. I’m curious how javascript generators have been insufficient for emulating processes though?

1 Like

@AstonJ thanks I will see if I can have a chat with him.

@OvermindDL1 yes, I think having elixirscript dependencies defined in the mix.exs file, but separate is a good idea. It might make knowing what to compile easier. The one issue I see there is with possibly downloading dependencies. Maybe there is a hybrid approach? One idea could be to still define them in the same place, but set an option to say they are only used in elixirscript? Maybe something as simple as setting them to be available in a different environment the same way we currently do with dev, test, prod, etc.

On generators/processes, I do think it is possible and I was mainly able to achieve it. I think I underestimated how much things from OTP would also be needed and that’s when I backtracked. If I had a bit more help it might be something to tackle, but it’s not something I would want to tackle myself.

Somewhat related, I’ve been thinking about simplifying some of the javascript specific things in elixirscript to make sharing code between elixir and elixirscript easier.