-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement compile.cell
#3
Comments
@bryangingechen @davertron I just merged in #12 that implements I'm afraid the |
@asg017 Awesome! I'll try and take a look at this in the next couple of days and see if I can work it in. Just to give you some info about what the use case I have for compile.cell: I've built my own observablehq clone. I did this for a couple of reasons: 1) For fun, to learn more about how it works, and 2) Because I wanted a self-hosted version of this at my company that we could use and have access to our data (there's no way my company would be comfortable having a public tool like the real observablehq having access to our data). I also wanted to be able to modify the stdlib to be able to add helper methods for fetching data from our data sources etc. Anyway, so I've basically used the runtime and your compiler to make my own version of observablehq, which means that I have an editor where people can create their own notebooks etc., which means I need to be able to define cells and redefine them on the fly as the user edits their notebook. FWIW, this means I'm also very interested in your work to be able to compile notebooks into a module similar to how observablehq's api does it, because I'll want to allow people to import cells from my own notebooks etc. I was planning on trying to implement that myself at some point, so maybe that's something I could contribute back here instead (or use if someone else is already working on it). But again, thanks for your awesome work on this, it's super cool and has been a fun learning experience! |
this is nice! for those who want to try https://observablehq.com/@randomfractals/an-unofficial-observablehq-compiler |
compile.module
takes in a "program" as string, parses withparseModule
, and outputs adefine
function to create a runtime module.compile.cell
should take in a "cell" as a string, parse withparseCell
, but I'm not sure what it should output.The output should work for:
module.define
module.redefine
import
variables -module.import
import {...} with {...}
? But this probably goes withimport
above -module.derive
variable.delete
A very rough guess could be:
But idk how import cells could work like this :/
compile.cell
could also take in a module as a parameter - for example:But I don't like this too much, since 1) how do you distinguish from define/redefine/imports, and 2) I want it to have a similar signature as
compile.module
(take in a string, return a function you can use to define).The text was updated successfully, but these errors were encountered: