{"name":"package-hash","version":"2.0.0","description":"Generates a hash for an installed npm package, useful for salting caches","main":"index.js","files":["index.js"],"engines":{"node":">=4"},"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.11","lodash.flattendeep":"^4.4.0","md5-hex":"^2.0.0","release-zalgo":"^1.0.0"},"devDependencies":{"@novemberborn/as-i-preach":"^7.0.0","ava":"^0.18.0","coveralls":"^2.11.15","nyc":"^10.0.0","rimraf":"^2.5.2","tar":"^2.2.1"},"nyc":{"cache":true,"exclude":["scripts","test"],"reporter":["html","lcov","text"]},"standard-engine":"@novemberborn/as-i-preach","gitHead":"764189d31b2a659051b7b6b7a784095e8ce22863","_id":"package-hash@2.0.0","_shasum":"78ae326c89e05a4d813b68601977af05c00d2a0d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.4.0","_npmUser":{"name":"novemberborn","email":"mark@novemberborn.net"},"dist":{"shasum":"78ae326c89e05a4d813b68601977af05c00d2a0d","tarball":"http://registry-npm.ywwl.com/package-hash/download/package-hash-2.0.0.tgz","integrity":"sha512-DH4/1cxLWA2wrv2uDwd8G41S0GXOnFG9vRqx4B7iAWeT19mEA9R3EUXZtZ/I87boGH9DNl8fMUV82dvsR3ckeA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHHm5yMtfITE119+L/7SWRK/3tS71puLCXD5bHigGHFzAiEAhnEo7GfoB5O8G0CMibzbWH8+qud1REEhhaUqYWRNGYA="}],"size":3637,"noattachment":false,"key":"/package-hash/-/package-hash-2.0.0.tgz"},"maintainers":[{"name":"novemberborn","email":"mark@novemberborn.net"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/package-hash-2.0.0.tgz_1486138677677_0.8842510140966624"},"directories":{},"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":1486138679390,"_cnpm_publish_time":1486138679390,"dist-tags":{"latest":"4.0.0"}}