Created by: natefaubion
This is a change to the sjs
binary that lets it load macros from installed modules, in addition to relative files, by piggybacking off of node's internal API for resolving module locations.
This is a bit hacky as node doesn't expose this API directly, but seeing as how node's module system is locked, I doubt it will be changing significantly any time soon.
If you provide a --module
that starts with a ./
or ../
it will resolve it based on the cwd. If you provide it with a package name like somelib/macros
it will walk up the node_modules
tree.
Overall, a lot could be done to improve macro loading from packages, but I think this is a decent first step that doesn't require users to copy files around.