{"name":"resolve-package-path","description":"a special purpose fast memoizing way to resolve a node modules package.json","version":"1.1.0","main":"index.js","license":"MIT","dependencies":{"path-root":"^0.1.1","resolve":"^1.10.0"},"devDependencies":{"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"},"scripts":{"test":"mocha tests","test:debug":"mocha debug tests"},"gitHead":"d2d73d76125b34e7ee21e7bd7f5568b754a34323","_id":"resolve-package-path@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.10.0","_npmUser":{"name":"stefanpenner","email":"stefan.penner@gmail.com"},"dist":{"integrity":"sha512-AF4AqOJJcJGgui67vcmnGAYX6btFYGyIsNfoB3J6h3ZLKuNHoAQlqqgsw2QBb4oDUWgXQa99EckqAQxJBpHxnA==","shasum":"924c7f0e47539c08248bc2ba81f567e2e6ac1963","tarball":"http://registry-npm.ywwl.com/resolve-package-path/download/resolve-package-path-1.1.0.tgz","fileCount":14,"unpackedSize":98604,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcexq6CRA9TVsSAnZWagAAGjgP/A8tF89NUk1sggNMsGm1\ncIayD3A1CN2uEd+k6s+AB+b4e01OvUFqq6Jh/XKCrcl53mm2NuQuySHQI0qS\nB+vQlmWhuDCfhmrOVz2vmtkSQSfFBHtscneFJ/kIoyjfsH2rr26KZj4uHR6E\nVvrVEm4oOfCUctnL8cl2UafNkUvazhBOX0FP2ko50xR2Y9L8ImrdcD8UCWTa\n3fJ95+ILXtrY0TcLgCNRXs8YtOYJgu+NE9YLUBlLJynKexAN8Wk4tgePcGKs\npQT5N3Z3Y5nuQV3v0V0DQGqVr+eiHV1/HnkvzRIb1Frn4v+LnBmufR87MBWR\nvDXuQ/Ox5dz/oiWPCENfX6jJUcLLhKlevYOxiU+2Rtvj1+armIPMj3NjDIJT\n9safZk+6SzpkBGQp6Lj96nUiA3EDCP2gQQTpicfZJWkX1qL09DrwrRwtG+Co\nL/4a7WSoBSfGU1U9DxRMAnsFMb19KuAn/ELg1L3nnLTevuiXluLcv5/jSdDd\nlsQXHM07QMnQJMRqybVJU4dXA7dx7lPaYhk/jRaZTfb5R+/Bf/RW1/ZQ2Qbk\nWavJmIVbT1WSX8BFuNTgaryLGvMe8x4nxDLSL4c8bh7mmKU+pdK7PRFAiyWt\nNR10eezcpHy0WAtyBJRu45yCJSuNlGBNku+2SdXqaE2nvOcGQj6MlGF8T7fI\n3aud\r\n=5sxK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHoK1fFIk6VGeGhfG0FtiOgm30HeTqI33r/gXi3wnGX5AiAOUWZFigw16eXzg4BUj3u1Z1hUqHF5vgHzn0S31W03VA=="}],"size":35791,"noattachment":false,"key":"/resolve-package-path/-/resolve-package-path-1.1.0.tgz"},"maintainers":[{"name":"stefanpenner","email":"stefan.penner@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-package-path_1.1.0_1551571641265_0.09633323867359067"},"_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":1551571641493,"_cnpm_publish_time":1551571641493,"dist-tags":{"latest":"4.0.3"}}