encode exported modules for #339
properly decode optional/exported modules for #339
fix package search for #339
encode empty packages for #339
parse each JSON model only once
fix getPackage() for #339
unknown type, for #339