This probably undesirable behaviour stems from normalize-package-data:
> The values in optionalDependencies get added to dependencies. The
optionalDependencies array is left untouched.
Solution Caveat: regular dependencies that are also optional (does that
even make sense?) will not be updated with --save because there's no
way to detect which optional dependencies aren't also regular
dependencies – we just avoid updating anything optional during --save.
While the request to foo/latest will be less data over the wire,
it's also much less likely to be cached by the registry CDN.
This, it's more likely to be a trip to the origin server, which is
much slower than serving out of the CDN.
Additionally, we can then use that data object to check the
versions hash here in outdated.js, rather than doing a full tgz
download and unpack for 'cache.add'.
Do directly an update if a git url is specified in the package.json
For outdated, print wanted=git and latest=git
Additionally, fixing a small, still unknown bug in update,
regarding the positions of where, latest and req, introduced
by 2f7fd625a0Fixes#1727
Add versions that are not matching the version specified in the
package.json as 'latest', at cost of one request more per package.
Show versions that are specified by the package.json as 'wanted'
Fixes#1428
If the 'from' value is not a url, then the fact that it changes is not
relevant. For example 'foo@*' and 'foo@1' and 'foo@' might all point to
the same package. However, a changed url IS relevant, because it
indicates that it is now a different thing.
Fixes#3798, a regression caused by #3578.
This feels so good. lib/utils/log.js is the worst kind of
glue code that keeps the npm project from being properly
abstracted into independent pieces.
In the process, also cleaned up a lot of unproductive logging,
and made the npm-debug.log generated on errors be a bit more
easy to read.