npm --depth option edge case fix

When a dependency has depth === maxDepth, it should be set with its
package info instead of a plain version string (treated as a problem
by npm). It should also have its own dependencies/peerDependencies
set to an empty object to prevent them being output in `npm ls`.

Also see https://github.com/isaacs/npm/pull/4179