Fixed package file resolution. Fixes #718, #720.

The loadPackageFile method can now handle folders (e.g. `require("./foo")` => `require("./foo/index.js")` and filenames (e.g. `require("./foo.js")`) in addition to the normal paths it could handle before.