Read the contents of node_modules.
var rpt =
That's it. It doesn't figure out if dependencies are met, it doesn't
mutate package.json data objects (beyond what
read-package-json already does), it
doesn't limit its search to include/exclude
Just follows the links in the
node_modules hierarchy and reads the
package.json files it finds therein.
When there are symlinks to packages in the
node_modules hierarchy, a
Link object will be created, with a
target that is a
For the most part, you can treat
Link objects just the same as
Node objects. But if your tree-walking program needs to treat
symlinks differently from normal folders, then make sure to check the
In a given
read-package-tree run, a specific
path will always
correspond to a single object, and a specific
realpath will always
correspond to a single
Node object. This means that you may not be
able to pass the resulting data object to
JSON.stringify, because it
may contain cycles.
Errors parsing or finding a package.json in node_modules will result in a
node with the error property set. We will still find deeper node_modules
if any exist. Prior to
5.0.0 these aborted tree reading with an error
Only a few classes of errors are fatal (result in an error callback):
fs.realpathreturns an error for any path its trying to resolve.