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`.

This is part of the patch to fix `npm ls` with a `--depth=x` option.
See https://github.com/isaacs/npm/pull/4179