I’m trying to build my own observable UI for an experimental tool at work. Right now I have the observable runtime working, where I have a module with variables added to it, and they update the DOM etc.
The issue I’m seeing is this: it looks like variables always take either a constant value, or a function, i.e.
myModule.variable(...).define('blah', , () => 'hello world')
myModule.variable(...).define('blah', ['html'], html => "html
Similarly, it’s not clear to me how to calculate the dependencies (in the example above, html) based on the string I get back from a textarea. I see that there’s a parser in the observable codebase here https://github.com/observablehq/parser which returns useful things like whether a chunk of code is a generator or is async etc., but it doesn’t look like it does anything about calculating deps, and anyway it’s not returning me JS that I can use.
For some background, basically I’m trying to build a similar UI to observablehq for a tool at work, and because it would have special access to our API’s etc. it would need to be self-hosted. In other words, I know you provide some “Teams” stuff, but we wouldn’t be allowed to use that here. I also realize that this might be part of your secret sauce for observablehq, so I understand if you don’t want to divulge your secrets…
Thanks again for the awesome tool and I appreciate any help in advance!