metadata export compiles, but untested.
bug fixes to previous commits. Emitting sourceMetadata seems to be working