{"name":"resolve-package-path","description":"a special purpose fast memoizing way to resolve a node modules package.json","version":"1.2.1","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/mocha":"^5.2.6","@types/node":"^11.10.4","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":"9fce31693f68b2e6a4df16169392f373514dd4ac","_id":"resolve-package-path@1.2.1","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"stefanpenner","email":"stefan.penner@gmail.com"},"dist":{"integrity":"sha512-iYx3HMQEArEI+sMfmYogJHKqsc2UZIW10tgKx/93PpI5Y+pru++GnnL4kpSMT8F3/myTCBTnb2btQXRaSnNRZg==","shasum":"21103e04e317f4fd1d010e2b9dfa90991d6ca337","tarball":"http://registry-npm.ywwl.com/resolve-package-path/download/resolve-package-path-1.2.1.tgz","fileCount":22,"unpackedSize":105323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfuETCRA9TVsSAnZWagAAVoYP/2ZID8kI71DIBIUacvrE\nnHaAPhFGAJagAjXI4kf+SwnJHUoCaWBHqHZcLyKMo2v52Ap/rj3UTmhIPvOB\nlX5BpZf3FVL9xDhvXTxRhy9+SghR9tnlc5syIJXDPeLFzBgX2AWgUsxGopDK\ny1i6rtscf8rxHaMhbn+ETrBaFzXAfvHz4blyi7i8hL6sa3DEzZEiRpHzSkrQ\ncKuOlSMn7HjdD5jo54dlmvC8Wc6ndf2IhdQGSZV15Jcvcip8utI3DJVX52oG\nhU83VwvfMXNXUBZosqDmnnb20hwQkbj2yaPEEcdgzN5eG/RtPleyd8tgegiM\nSbuwvyY4TOBo+6BxzSnbqBo5x0YdG06n7dNI2VsocK02I06Lb5kIMNoExra2\nek9UYNz4hDARMGUL7jirVdzly0sHUjQt+Tfji3A8rmPlFLQgUirMIHoOgBef\nRXPkq2NFOg6zgbdaAeRHdjIlXryB4/AAVJrpd6pO9di9oUrCtT5vudeTsijW\nPgkxFImtzuzJ+GT5r2DchbDFU4th4u0IM1KQDQtQzaiCqzyVFfLDHiLFGB7f\n60kXV5/HCFKxxocxdRPAWvxJdPH1SnzNwBU0IsaamIPEqnOKq8LSzOZNITG6\n2FU9uT0/rHaTfzvcOTyNftXtbKaM29zWzO4gUY+ZU1yeJBB5mudOwM4W0czz\nw/Qi\r\n=nsKd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBE9ZPeg1DGu0TxMObC4SfT2BrKqEMLF/mHWeFsqedS6AiEAt5NmPTJeF6dapbX7em0IYZ00s7AUXuDI7xLHn7c1XZI="}],"size":37613,"noattachment":false,"key":"/resolve-package-path/-/resolve-package-path-1.2.1.tgz"},"maintainers":[{"name":"stefanpenner","email":"stefan.penner@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-package-path_1.2.1_1551819026726_0.986095719338153"},"_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":1551819026859,"_cnpm_publish_time":1551819026859,"dist-tags":{"latest":"4.0.3"}}