Closed bryangingechen closed 5 years ago
I now have some commits addressing #1 which sit on top of this branch. If you'd prefer to review everything at once, I can open a new PR with that branch instead.
Sorry for the delay - was reading up on acorn to understand this more.
This looks good to me! You can send a PR of the other branch and I'll approve that one.
I think ideally, we wouldnt need acorn-walk
as a direct dependency, since @observablehq/parser
already uses it. Maybe we could send a PR to that parser to re-export simple
so we could save some space, but for now it looks good!
Thanks again for working on this, btw - It looks and feels much more cleaner now, and proper viewof/mutable support is just awesome!
Despite the name of the branch, this PR addresses #2: the compiler should now properly treat regular cells that reference
viewof
andmutable
cells. The tricky part is replacing all the references to "viewof X
" and "mutable Y
" with placeholders. For that I used the ObservableHQ'sparser.walk
function withacorn-walk
, following some old code.I've added some examples to
test.html
; in the future we probably want to have more systematic tests. I also assigned the module object to the window scope in that HTML file to make future debugging a little more convenient.