Rewriting lib compiler. Adding require/provide api. Fixes #1.