{"name":"package-hash","version":"3.0.0","description":"Generates a hash for an installed npm package, useful for salting caches","main":"index.js","engines":{"node":">=6"},"scripts":{"lint":"as-i-preach","unpack-fixtures":"node scripts/unpack-fixtures.js","pregenerate-fixture-index":"npm run unpack-fixtures","generate-fixture-index":"node scripts/generate-fixture-index.js","pretest":"npm run unpack-fixtures","test":"ava","posttest":"npm run lint","coverage":"nyc npm test","watch:test":"npm run test -- --watch"},"repository":{"type":"git","url":"git+https://github.com/novemberborn/package-hash.git"},"author":{"name":"Mark Wubben","url":"https://novemberborn.net/"},"license":"ISC","bugs":{"url":"https://github.com/novemberborn/package-hash/issues"},"homepage":"https://github.com/novemberborn/package-hash#readme","dependencies":{"graceful-fs":"^4.1.15","hasha":"^3.0.0","lodash.flattendeep":"^4.4.0","release-zalgo":"^1.0.0"},"devDependencies":{"@novemberborn/as-i-preach":"^11.0.0","ava":"^1.1.0","codecov":"^3.1.0","nyc":"^13.1.0","rimraf":"^2.6.3","tar":"^4.4.8"},"nyc":{"cache":true,"exclude":["scripts","test"],"reporter":["html","lcov","text"]},"standard-engine":"@novemberborn/as-i-preach","gitHead":"d2682c959cb26013b31eb30595449f057b28904e","_id":"package-hash@3.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.14.0","_npmUser":{"name":"novemberborn","email":"mark@novemberborn.net"},"dist":{"integrity":"sha512-lOtmukMDVvtkL84rJHI7dpTYq+0rli8N2wlnqUcBuDWCfVhRUfOmnR9SsoHFMLpACvEV60dX7rd0rFaYDZI+FA==","shasum":"50183f2d36c9e3e528ea0a8605dff57ce976f88e","tarball":"http://registry-npm.ywwl.com/package-hash/download/package-hash-3.0.0.tgz","fileCount":4,"unpackedSize":9351,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPwnqCRA9TVsSAnZWagAA3z4QAJqtPina3HyREjZ/2ZvR\nU1c5ULs3Cf2UFAKEvNuj6CgFhF7pf+5RYGl6Xi0SjL8UU6I9NdhJhgKfZkl+\npPHQOWJZrI3DgSP/4HI9O9x69GGMj1TWtOWdQw342sN+9+gukp5BNB1bhJ/P\nguZ4gAbeJ3iATXevDQ8bFy9Xyzhn6UmwTr0UmluIhoIw7eI/r8Tk4QvjkSJ9\nmWoD8fnQexfgDawdM7FX6VPd1QGMA+TYGACy5vOJ8ze0FgNr6ZmbLeXPxg2R\nqwj49j14v3ir5XV/vsDfJHfSkDbKunxO7FcQwicirJYmnoZJNb0NMm9KBnhf\n1P6KSLVleJU3bJgIqMX9zpGiDWc/yc3GyeGdzrjJB4zhVlUN0wisqG7NN2IR\nekK5DKmSplxdt9Xg/D7Qe0U1v7eD6PXo33MoRc8vNHgvEBZvn4X/3HH0vdum\nmV0xsjxZ6kpy+UBGFWfvfpqoifU5Fx3lAZbcD2KYM6xjSUssIGLf811WWif8\nLlj1egiRT4LzfAT9YaDt/GEZfgpbTPTYGZP3RsVHglj1NqPubh//+lgPzKsu\nfahsQ2NSWgoqhmNRO/SJH+5zyD46QZjfX+MWgQ2rwTsXmt38z+jvbQ1LgnnA\ntB5LQkZ1/IlpzTd3MZr4SIeZmS1UMGWGMC1+6hrqSwt+3EkfByaEOvMpJDxi\nR/HP\r\n=ERA3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDq201uaTRMemg3dEzxkK+/2rpJxiv9DebGmyAE71xFIAiA8717t0GJcEBewi7gkntgyN83+4b7TRGlcifn+CZcD/g=="}],"size":3691,"noattachment":false,"key":"/package-hash/-/package-hash-3.0.0.tgz"},"maintainers":[{"name":"novemberborn","email":"mark@novemberborn.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/package-hash_3.0.0_1547635177860_0.037036260692207223"},"_hasShrinkwrap":false,"readme":"# package-hash\n\nGenerates a hash for an installed npm package, useful for salting caches.\n[AVA](https://github.com/sindresorhus/ava) for example caches precompiled test\nfiles. It generates a salt for its cache based on the various packages that are\nused when compiling the test files.\n\n`package-hash` can generate an appropriate hash based on the package location\n(on disk) and the `package.json` file. This hash is salted with a hash\nfor the `package-hash` itself.\n\n`package-hash` can detect when the package-to-be-hashed is a Git repository. In\nthe AVA example this is useful when you're debugging one of the packages used to\ncompile the test files. You can clone it locally and use `npm link` so AVA can\nfind the clone. The hash will include the HEAD (`.git/HEAD`) and its\ncorresponding ref (e.g. `.git/refs/heads/master`), any packed refs\n(`.git/packed-refs`), as well as the diff (`git diff`) for any non-committed\nchanges. This makes it really easy to test your changes without having to\nexplicitly clear the cache in the parent project.\n\n## Installation\n\n```console\n$ npm install --save package-hash\n```\n\n## Usage\n\n```js\nconst packageHash = require('package-hash')\n\n// Asynchronously:\nconst hash = await packageHash(require.resolve('babel-core/package.json'))\n\n// Synchronously:\nconst hash = packageHash.sync(require.resolve('babel-core/package.json'))\n```\n\n`packageHash()` / `packageHash.sync()` must be called with a file path for an\nexisting `package.json` file. To get the path to an npm package it's easiest to\nuse `require.resolve('the-name/package.json')`.\n\nYou can provide multiple paths:\n\n```js\nconst hash = await packageHash([\n  require.resolve('babel-core/package.json'),\n  require.resolve('babel-preset-es2015/package.json')\n])\n```\n\nAn optional salt value can also be provided:\n\n```js\nconst hash = await packageHash(require.resolve('babel-core/package.json'), 'salt value')\n```\n\n## API\n\n### `packageHash(paths, salt?)`\n\n`paths: string | string[]` ➜ can be a single file path, or an array of paths.\n\n`salt: Array | Buffer | Object | string` ➜ optional. If an `Array` or `Object` (not `null`) it is first converted to a JSON string.\n\nReturns a promise for the hex-encoded hash string.\n\n### `packageHash.sync(paths, salt?)`\n\n`paths: string | string[]` ➜ can be a single file path, or an array of paths.\n\n`salt: Array | Buffer | Object | string` ➜ optional. If an `Array` or `Object` (not `null`) it is first converted to a JSON string.\n\nReturns a hex-encoded hash string.\n\n## Compatibility\n\n`package-hash` has been tested with Node.js 8 and above, including Windows\nsupport.\n","publish_time":1547635177952,"_cnpm_publish_time":1547635177952,"dist-tags":{"latest":"4.0.0"}}