Open tangert opened 4 years ago
Apologies if I'm misunderstanding what you want, but the current version of the compiler doesn't actually output JS code when given the source code of a cell or notebook. It's a bit more like an "interpreter", in that it takes the input and returns a "define" function (in memory) that is suitable for passing to the Observable runtime's runtime.module
method.
Issue #5 tracks an addition which would actually be more like a source-to-source compiler.
@bryangingechen no you’re right, I think I was just misunderstanding the docs. Have to dig a bit more, but thanks for linking the other issue.
@tangert source-to-source compiler functions have been added as of v0.5.0. See the compile.moduleToESModule
and compile.notebookToESModule
methods.
Hey Alex, I'm interested in using the compiler server side but I'm having trouble getting a result compiling cell content and seeing the outputted JS without using the inspector. Wondering if you have any examples you've played with already. I'll keep hacking away and provide updates.