{"name":"read-package-json-fast","version":"2.0.3","author":{"url":"https://izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"ISC","_id":"read-package-json-fast@2.0.3","maintainers":[{"name":"isaacs","email":"i@izs.me"},{"name":"darcyclarke","email":"darcy@darcyclarke.me"},{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},{"name":"nlf","email":"quitlahok@gmail.com"},{"name":"gar","email":"gar+npm@danger.computer"},{"name":"gimli01","email":"gimli01@github.com"},{"name":"lukekarrys","email":"luke@lukekarrys.com"}],"homepage":"https://github.com/npm/read-package-json-fast#readme","bugs":{"url":"https://github.com/npm/read-package-json-fast/issues"},"tap":{"check-coverage":true},"dist":{"shasum":"323ca529630da82cb34b36cc0b996693c98c2b83","tarball":"http://registry-npm.ywwl.com/read-package-json-fast/download/read-package-json-fast-2.0.3.tgz","fileCount":4,"integrity":"sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ==","signatures":[{"sig":"MEMCH1lqgIXB4OjARXJVXIYlfCgOEmiDdH2VBzHyrUE9bOoCIHeaNxSXMtHuTDxQBrlqp0uRJzaIh2wyzppBEhHVECXx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8253,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg+NRkCRA9TVsSAnZWagAAsOEP/juRiVP0EzYL9Tfx6UgV\n7rz/sPEg8ucC954I2N92ydaBQWuMZDg1C2YhGcXVBwvWKjBmojHu0+8Z7VWq\nlngO2p7v1mKwi5JRJtSvgr006zB10nbA5AGuYTCGEM204yG34MwPiWYU6w5f\n8cPmmYvFofQ8d/vgeUIHXS6yddu2rjT3HYQgWQwzcDbxHQvTOCy+7vds6xkW\nc7og0f7+W3rO+RUrodastten5Fo8BDbdeXKgaHp+1nDAwLPhquuNE+sjrC/5\nG5RZdnb9PukwUYpi8/fq0n8cqU9rEyPDehA+SBwaCMtI431b/cUXgqmTVqRe\njcXci7r3dEfTUSsSmBWwbaTw7/GYn3w8KQgi/P55JVmyEUqJT5sbuzQCv8FC\nAPIBxG34HdFOIWRvdRHzPCI45sOUcPdCO2pBDnPURo8Us4LemjNjO5jBb28s\nETQEEnFK2gEnAd1KqehOwoLjAufIuskFopRTpvrbwwnumctEbX4oF74VwoOa\nwjMsMc/ueY7b2uIxCJXK7SylDd5zjpzSTpXkDbDP4KaIDcaxHFHskucBSuIx\nznzFMT4l3PS6nWreKJeS+QCFXG0tA4W7UZanm2L7EFAOTshxe1pfgdfGFQfF\nTA9egyR864eX0RCUfklfNS+RbAdRBsqzAjd8bgXX9KhPj3gML/z5kCBcnHNn\ncmPH\r\n=E/4y\r\n-----END PGP SIGNATURE-----\r\n","size":3656,"noattachment":false,"key":"/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz"},"engines":{"node":">=10"},"gitHead":"8308c0f10d6bf420b447b2032245343de1202806","scripts":{"snap":"tap","test":"tap","preversion":"npm test","postpublish":"git push origin --follow-tags","postversion":"npm publish"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"repository":{"url":"git+https://github.com/npm/read-package-json-fast.git","type":"git"},"_npmVersion":"7.19.0","description":"Like read-package-json, but faster","directories":{},"_nodeVersion":"16.0.0","dependencies":{"npm-normalize-package-bin":"^1.0.1","json-parse-even-better-errors":"^2.3.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^15.0.9"},"_npmOperationalInternal":{"tmp":"tmp/read-package-json-fast_2.0.3_1626920035873_0.3380888948035814","host":"s3://npm-registry-packages"},"readme":"# read-package-json-fast\n\nLike [`read-package-json`](http://npm.im/read-package-json), but faster and\nmore accepting of \"missing\" data.\n\nThis is only suitable for reading package.json files in a node_modules\ntree, since it doesn't do the various cleanups, normalization, and warnings\nthat are beneficial at the root level in a package being published.\n\n## USAGE\n\n```js\nconst rpj = require('read-package-json-fast')\n\n// typical promisey type API\nrpj('/path/to/package.json')\n  .then(data => ...)\n  .catch(er => ...)\n\n// or just normalize a package manifest\nconst normalized = rpj.normalize(packageJsonObject)\n```\n\nErrors raised from parsing will use\n[`json-parse-even-better-errors`](http://npm.im/json-parse-even-better-errors),\nso they'll be of type `JSONParseError` and have a `code: 'EJSONPARSE'`\nproperty.  Errors will also always have a `path` member referring to the\npath originally passed into the function.\n\n## Indentation\n\nTo preserve indentation when the file is saved back to disk, use\n`data[Symbol.for('indent')]` as the third argument to `JSON.stringify`, and\nif you want to preserve windows `\\r\\n` newlines, replace the `\\n` chars in\nthe string with `data[Symbol.for('newline')]`.\n\nFor example:\n\n```js\nconst data = await readPackageJsonFast('./package.json')\nconst indent = Symbol.for('indent')\nconst newline = Symbol.for('newline')\n// .. do some stuff to the data ..\nconst string = JSON.stringify(data, null, data[indent]) + '\\n'\nconst eolFixed = data[newline] === '\\n' ? string\n  : string.replace(/\\n/g, data[newline])\nawait writeFile('./package.json', eolFixed)\n```\n\nIndentation is determined by looking at the whitespace between the initial\n`{` and the first `\"` that follows it.  If you have lots of weird\ninconsistent indentation, then it won't track that or give you any way to\npreserve it.  Whether this is a bug or a feature is debatable ;)\n\n## WHAT THIS MODULE DOES\n\n- Parse JSON\n- Normalize `bundledDependencies`/`bundleDependencies` naming to just\n  `bundleDependencies` (without the extra `d`)\n- Handle `true`, `false`, or object values passed to `bundleDependencies`\n- Normalize `funding: <string>` to `funding: { url: <string> }`\n- Remove any `scripts` members that are not a string value.\n- Normalize a string `bin` member to `{ [name]: bin }`.\n- Fold `optionalDependencies` into `dependencies`.\n- Set the `_id` property if name and version are set.  (This is\n  load-bearing in a few places within the npm CLI.)\n\n## WHAT THIS MODULE DOES NOT DO\n\n- Warn about invalid/missing name, version, repository, etc.\n- Extract a description from the `README.md` file, or attach the readme to\n  the parsed data object.\n- Read the `HEAD` value out of the `.git` folder.\n- Warn about potentially typo'ed scripts (eg, `tset` instead of `test`)\n- Check to make sure that all the files in the `files` field exist and are\n  valid files.\n- Fix bundleDependencies that are not listed in `dependencies`.\n- Fix `dependencies` fields that are not strictly objects of string values.\n- Anything involving the `directories` field (ie, bins, mans, and so on).\n","publish_time":1626920036044,"_cnpm_publish_time":1626920036044,"dist-tags":{"latest":"6.0.0"}}