Fix default basedir calculation

Using the `require.cache` to identify which module is calling us is not reliable. It will always tell you what the *first* module to require us was, not the module that's currently calling.

This change uses the V8 stack trace API to identify the real current caller.