{
"_from": "read-package-tree@latest",
"_id": "read-package-tree@5.3.1",
"_inBundle": false,
"_integrity": "sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw==",
"_location": "/npm/read-package-tree",
"_phantomChildren": {},
"_requested": {
"escapedName": "read-package-tree",
"fetchSpec": "latest",
"name": "read-package-tree",
"raw": "read-package-tree@latest",
"rawSpec": "latest",
"registry": true,
"saveSpec": null,
"type": "tag"
},
"_requiredBy": [
"#USER",
"/npm"
],
"_resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.3.1.tgz",
"_shasum": "a32cb64c7f31eb8a6f31ef06f9cedf74068fe636",
"_shrinkwrap": null,
"_spec": "read-package-tree@latest",
"_where": "/Users/isaacs/dev/npm/cli",
"author": {
"email": "i@izs.me",
"name": "Isaac Z. Schlueter",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/npm/read-package-tree/issues"
},
"bundleDependencies": false,
"dependencies": {
"read-package-json": "^2.0.0",
"readdir-scoped-modules": "^1.0.0",
"util-promisify": "^2.1.0"
},
"deprecated": false,
"description": "Read the contents of node_modules.",
"devDependencies": {
"archy": "^1.0.0",
"mkdirp": "^0.5.1",
"tacks": "^1.2.1",
"tap": "^12.7.0"
},
"directories": {
"test": "test"
},
"files": [
"realpath.js",
"rpt.js"
],
"homepage": "https://github.com/npm/read-package-tree",
"license": "ISC",
"main": "rpt.js",
"name": "read-package-tree",
"optionalDependencies": {},
"readme": "# read-package-tree\n\n[](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",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/read-package-tree.git"
},
"scripts": {
"postpublish": "git push origin --follow-tags",
"postversion": "npm publish",
"preversion": "npm test",
"snap": "TAP_SNAPSHOT=1 tap test/*.js --100",
"test": "tap test/*.js --100"
},
"tap": {
"100": true
},
"version": "5.3.1"
}