Check for package name validity only when there's a package declaration

This makes it possible for users to provide a package name when the
proto file doesn't declare one. It is especially useful to put the
generated module shim in a JS module when running in the browser.
Interim release, while waiting upstream to merge changes