{"name":"read-package-json-fast","version":"5.0.0","author":{"name":"GitHub Inc."},"license":"ISC","_id":"read-package-json-fast@5.0.0","maintainers":[{"name":"gar","email":"gar+npm@danger.computer"},{"name":"saquibkhan","email":"saquibkhan@github.com"},{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},{"name":"reggi","email":"reggi@github.com"},{"name":"hashtagchris","email":"hashtagchris@github.com"},{"name":"owlstronaut","email":"owlstronaut@github.com"}],"homepage":"https://github.com/npm/read-package-json-fast#readme","bugs":{"url":"https://github.com/npm/read-package-json-fast/issues"},"tap":{"nyc-arg":["--exclude","tap-snapshots/**"]},"dist":{"shasum":"f88dbd3bbcab428c4558a56fd53a3169df0ff7ef","tarball":"http://registry-npm.ywwl.com/read-package-json-fast/download/read-package-json-fast-5.0.0.tgz","fileCount":4,"integrity":"sha512-S16VePJnQcfmk6HIZAiP8TXW/VDlDtZfzVndRDE8lhZNA4YvAiwAjgvhoyf6+soofEH/vrZnOUctSt+jYE2tkg==","signatures":[{"sig":"MEYCIQDBfECfAkyuflz3kvdyfv3xwfSkQeHuos3RAxuTB6tA0wIhAONSneMR2GCNr96bLXlswM7aqCazvcsy7OqNqwNYH3ru","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/read-package-json-fast@5.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":8685,"size":3839,"noattachment":false,"key":"/read-package-json-fast/-/read-package-json-fast-5.0.0.tgz"},"main":"lib/index.js","engines":{"node":"^20.17.0 || >=22.9.0"},"gitHead":"972de8d2d873517f1dcde46b12472fa10b1e9daa","scripts":{"lint":"npm run eslint","snap":"tap","test":"tap","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"","lintfix":"npm run eslint -- --fix","postlint":"template-oss-check","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:32a3e122-f184-432d-9dc2-4566edb69f77"}},"repository":{"url":"git+https://github.com/npm/read-package-json-fast.git","type":"git"},"_npmVersion":"11.6.2","description":"Like read-package-json, but faster","directories":{},"templateOSS":{"publish":true,"version":"4.27.1","//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten."},"_nodeVersion":"22.20.0","dependencies":{"npm-normalize-package-bin":"^5.0.0","json-parse-even-better-errors":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^16.3.0","@npmcli/template-oss":"4.27.1","@npmcli/eslint-config":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/read-package-json-fast_5.0.0_1761240302537_0.7856173513983393","host":"s3://npm-registry-packages-npm-production"},"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":1761240302746,"_cnpm_publish_time":1761240302746,"dist-tags":{"latest":"6.0.0"}}