{"name":"read-package-tree","version":"4.0.0","author":{"url":"http://blog.izs.me/","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"ISC","_id":"read-package-tree@4.0.0","maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"iarna","email":"me@re-becca.org"}],"homepage":"https://github.com/npm/read-package-tree","bugs":{"url":"https://github.com/npm/read-package-tree/issues"},"dist":{"shasum":"e25265071c561e3cb45034996471e7cd7c1ba1c6","tarball":"http://registry-npm.ywwl.com/read-package-tree/download/read-package-tree-4.0.0.tgz","integrity":"sha512-ir+AViA2XdkLLmFllggkk/onTBw3UxTcYLDY7uwXuHq85Rz4XOqvCwzmHKbH3QQUMHJTA3vH8FVKF8ZQrvmHeQ==","signatures":[{"sig":"MEUCIEFVUmTMhpESoPRHO9UjZaVhgcQJz3oFTqMLbGk0miIyAiEA4m0JXIEeAiD0Bw8zlmIwC/0DtahmpZnozEQU+1uGg7Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":4466,"noattachment":false,"key":"/read-package-tree/-/read-package-tree-4.0.0.tgz"},"main":"rpt.js","_from":".","_shasum":"e25265071c561e3cb45034996471e7cd7c1ba1c6","gitHead":"defe8eda3be00788b1f9c504db07495040bb0e73","scripts":{"test":"tap test/*.js"},"_npmUser":{"name":"iarna","email":"me@re-becca.org"},"deprecated":"The functionality that this package provided is now in @npmcli/arborist","repository":{"url":"https://github.com/npm/read-package-tree","type":"git"},"_npmVersion":"2.7.5","description":"Read the contents of node_modules.","directories":{"test":"test"},"_nodeVersion":"1.6.2","dependencies":{"once":"^1.3.0","dezalgo":"^1.0.0","debuglog":"^1.0.1","read-package-json":"^1.2.6","normalize-package-data":"^2.0.0","readdir-scoped-modules":"^1.0.0"},"devDependencies":{"tap":"^0.4.12","archy":"0"},"readme":"# read-package-tree\n\n[![Build Status](https://travis-ci.org/npm/read-package-tree.svg?branch=master)](https://travis-ci.org/npm/read-package-tree)\n\nRead the contents of node_modules.\n\n## USAGE\n\n```javascript\nvar rpt = require ('read-package-tree')\nrpt('/path/to/pkg/root', function (node, kidName) {\n  // optional filter function– if included, each package folder found is passed to\n  // it to see if it should be included in the final tree\n  // node is what we're adding children to\n  // kidName is the directory name of the module we're considering adding\n  // return true -> include, false -> skip\n}, function (er, data) {\n  // er means that something didn't work.\n  // data is a structure like:\n  // {\n  //   package: <package.json data, or an empty object>\n  //   package.name: defaults to `basename(path)`\n  //   children: [ <more things like this> ]\n  //   parent: <thing that has this in its children property, or null>\n  //   path: <path loaded>\n  //   realpath: <the real path on disk>\n  //   isLink: <set if this is a Link>\n  //   target: <if a Link, then this is the actual Node>\n  //   error: <if set, the error we got loading/parsing the package.json>\n  // }\n})\n\n// or promise-style\nrpt('/path/to/pkg/root').then(data => { ... })\n```\n\nThat's it.  It doesn't figure out if dependencies are met, it doesn't\nmutate package.json data objects (beyond what\n[read-package-json](http://npm.im/read-package-json) already does), it\ndoesn't limit its search to include/exclude `devDependencies`, or\nanything else.\n\nJust follows the links in the `node_modules` hierarchy and reads the\npackage.json files it finds therein.\n\n## Symbolic Links\n\nWhen there are symlinks to packages in the `node_modules` hierarchy, a\n`Link` object will be created, with a `target` that is a `Node`\nobject.\n\nFor the most part, you can treat `Link` objects just the same as\n`Node` objects.  But if your tree-walking program needs to treat\nsymlinks differently from normal folders, then make sure to check the\nobject.\n\nIn a given `read-package-tree` run, a specific `path` will always\ncorrespond to a single object, and a specific `realpath` will always\ncorrespond to a single `Node` object.  This means that you may not be\nable to pass the resulting data object to `JSON.stringify`, because it\nmay contain cycles.\n\n## Errors\n\nErrors parsing or finding a package.json in node_modules will result in a\nnode with the error property set.  We will still find deeper node_modules\nif any exist. *Prior to `5.0.0` these aborted tree reading with an error\ncallback.*\n\nOnly a few classes of errors are fatal (result in an error callback):\n\n* If the top level location is entirely missing, that will error.\n* if `fs.realpath` returns an error for any path its trying to resolve.\n","publish_time":1428387616716,"_cnpm_publish_time":1428387616716,"dist-tags":{"latest":"5.3.1"}}