asg017 / unofficial-observablehq-compiler

An unofficial compiler for Observable notebook syntax
https://www.npmjs.com/package/@alex.garcia/unofficial-observablehq-compiler
115 stars 22 forks source link

feat(compiler): viewof & mutable references / imports #7

Closed bryangingechen closed 5 years ago

bryangingechen commented 5 years ago

The first commit 2ef363f is the same as in #6. To reply to your comment from that PR, I would support a request for the parser package to export acorn's simple (though maybe since parser is an acorn plugin they could use peerDependencies instead? not sure...). Also, I guess I could've set the version for acorn-walk to the same version that the parser uses, but it slipped my mind...

The second commit 618a215 implements imports for viewof & mutable cells:

The third and fourth commits are other tweaks. I noticed that the define function is currently using creating its own Library for Generators (and Mutable in my addition). In the third commit 5eb6098, I changed this to just rely on the runtime's builtin module, as in the ES modules served by the Observable API (example. This is a little more efficient at runtime (as is, the user will have an extra Library object from the compiler) and also allows us to move the runtime package to the dev dependencies since it's now only used in the tests.

The fourth commit b5482fc is just a style thing, I noticed that the markdown cells labeling the imports had a level of indentation which didn't seem intentional so I removed it. Let me know if I guessed wrong and you want the indentation back.

Feel free to add comments to the code if you have questions!

asg017 commented 5 years ago

Thanks a ton for all of your work! And thanks for organizing/labeling your commits as you did 😄