{"name":"resolve-package-path","description":"a special purpose fast memoizing way to resolve a node modules package.json","version":"1.2.7","main":"index.js","types":"index.d.ts","license":"MIT","dependencies":{"path-root":"^0.1.1","resolve":"^1.10.0"},"devDependencies":{"@types/chai":"^4.1.7","@types/fs-extra":"^5.0.5","@types/mocha":"^5.2.6","@types/node":"^11.10.4","@types/semver":"^5.5.0","chai":"^4.2.0","execa":"^1.0.0","fixturify-project":"^1.7.0","fs-extra":"^7.0.1","mocha":"^6.0.2","semver":"^5.6.0","typescript":"^3.3.3333"},"scripts":{"build":"tsc -b .","watch":"tsc --watch .","clean":"tsc -b --clean .","test":"yarn build && yarn test:js","test:js":"mocha tests/*-test.js","test:js:debug":"mocha debug tests/*-test.js"},"gitHead":"f0892c90052c83f499dae96ac4dd6a9e4fad187f","_id":"resolve-package-path@1.2.7","_nodeVersion":"11.12.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-fVEKHGeK85bGbVFuwO9o1aU0n3vqQGrezPc51JGu9UTXpFQfWq5qCeKxyaRUSvephs+06c5j5rPq/dzHGEo8+Q==","shasum":"2a7bc37ad96865e239330e3102c31322847e652e","tarball":"http://registry-npm.ywwl.com/resolve-package-path/download/resolve-package-path-1.2.7.tgz","fileCount":31,"unpackedSize":135124,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJctRxrCRA9TVsSAnZWagAAmX8P/2etO+5nZrjr8TpbQSuf\nL7d55wuOUg9E8eHeFpJ4rFlTCbH/0oK3p51B6ZuiCmrlVPCn4EaLklu2suoU\nXzW1R5wcMu46WTZ9/p1K/a1stxcYXITXHIvuB+S6ZE3srzv+mUcoQ78tHQZS\nOMyawQQu1Pumq7r2hNxSDPyCCMqtAVZNTe2NGpWnKpb6quJbf3XaMmr/oJ5Y\nINF00dXwiqzZu4J0mG6/v9rFdUet+zgRjj7d2ZFfapLPEy/DLGJnfpkijK1D\nDAMv9GOs4MIqpHABmkD18HBzcN9plMOivV2XAkhWJY0feCnDRFnJY6lxf4Ne\nlPdtmo/UfLeZQ+QKuLr5p+AFGLLs5+tYa7tuNFEwaGJkFoiAGma46OTS1nLB\nlF9NMMnTDcs9CYftS7m6wLWrNSW17snsQnrKRgR7g459zsDKRW/4nJqZEMZR\nW+f6fbsH7X9VXMWmvBgqodXFIyN3UHZBygi84tbEErFb0wjdUKW97X3SwrvK\ng393SWfuOis2+cJuevhI8ZymWo9mroEvQkAdIbe9Qpw3FBQgVdf4YojSSrxu\nJW3HSNrt1hxIRLg3SF1vlx+pJVOo6O8HjNIQyE3XY9+ILlGCmwrn45S+RzoJ\nlMahTx8rbVVD4LbjmjWn9wmPA0jXoeTF8xf4A+kMToGz/MacLjsZaTV3DCUR\nL+RW\r\n=fZV3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCIiVfPO9cS1dmOpfbYLI92de2szsRdf5fu4cs33RTOsQIgQ5DXFVVAwvDhTQPZ7rNL0T26OjY06bPGOi/w7ZyY6qo="}],"size":40546,"noattachment":false,"key":"/resolve-package-path/-/resolve-package-path-1.2.7.tgz"},"maintainers":[{"email":"me@rwjblue.com","name":"rwjblue"},{"email":"stefan.penner@gmail.com","name":"stefanpenner"}],"_npmUser":{"name":"stefanpenner","email":"stefan.penner@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-package-path_1.2.7_1555373162547_0.55079272785636"},"_hasShrinkwrap":false,"readme":"# resolve-package-path [![CI](https://github.com/stefanpenner/resolve-package-path/workflows/CI/badge.svg)](https://github.com/stefanpenner/resolve-package-path/actions/workflows/ci.yml)\n\nThis project is special-purpose, made to resolve `package.json` files for:\n\n  - a given module name and basedir or\n  - a given basedir\n\nIt cannot and does not resolve anything else.\n\nTo achieve its file-resolution performance, it does two specific things:\n\n- It memoizes results identically to node's `require`. Specifically,\n  for a given moduleName and baseDir it will, for the duration of the process,\n  always return the exact same response.\n\n- It re-implements the parts of `require.resolve` needed to resolve package.json\n  files ONLY. This removes unneeded I/O. (based on @davecombs approach)\n\n## Usage\n\n```sh\nyarn add resolve-package-path\n```\n\n```js\nconst resolvePackagePath = require('resolve-package-path');\n\nresolvePackagePath('rsvp', 'base-dir/to/start/the/node_resolution-algorithm-from') // => /path/to/rsvp.json or null\n\nconst { findUpPackagePath } = resolvePackagePath;\nfindUpPackagePath('base-dir/to/start') // => path/to/package.json or null\n```\n\n## Advanced usage\n\n### Preserve Symlinks\n\nNode supports `--preserve-symlinks` and `NODE_PRESERVE_SYMLINKS=1` for compatibility this library respects these.\n\n### Disable default caching\n\nAlthough by default `resolve-package-path` caches or memoizes results, this feature can be disabled:\n\n```js\nconst resolvePackagePath = require('resolve-package-path');\n\nresolvePackagePath('rsvp', 'base-dir/to/start/the/node_resolution-algorithm-from', false) // => uncached result /path/to/rsvp.json or null\n\nconst { findUpPackagePath } = resolvePackagePath;\nfindUpPackagePath('base-dir/to/start', false) // => path/to/package.json or null\n```\n\n### Purge the cache\n\n```js\nconst resolvePackagePath = require('resolve-package-path');\nresolvePackagePath._resetCache();\n```\n\n### Provide an alternative cache\n\nIn some advanced circumtances, you may want to gain access to the cache to share between more systems.\nIn that case, a cache instance of the following form can be provided as a third argument:\n\n```js\ncache = {\n  RESOLVED_PACKAGE_PATH: new Map(),\n  REAL_FILE_PATH: new Map(),\n  REAL_DIRECTORY_PATH: new Map(),\n};\nfindUpCache = new Map();\n\nconst resolvePackagePath = require('resolve-package-path');\nresolvePackagePath('rsvp', 'path/to/start/from', cache);\n\nconst { findUpPackagePath } = resolvePackagePath;\nfindUpPackagePath('base-dir/to/start', findUpCache) // => path/to/package.json or null\n```\n\n### Use internal helper functions\n\nFor consumers who also do `getRealFilePath` or\n`getRealDirectoryPath` calls on relevant paths, we expose them as utilities.\nThese utilties ensure identical functionality to resolve-package-path, and a\nshared cache, which may help reduce IO.\n","publish_time":1555373162820,"_cnpm_publish_time":1555373162820,"dist-tags":{"latest":"4.0.3"}}