{"name":"resolve-package-path","description":"a special purpose fast memoizing way to resolve a node modules package.json","version":"4.0.1","repository":{"type":"git","url":"git+ssh://git@github.com/stefanpenner/resolve-package-path.git"},"main":"lib/index.js","types":"lib/index.d.ts","license":"MIT","dependencies":{"path-root":"^0.1.1"},"devDependencies":{"@types/chai":"^4.2.18","@types/fs-extra":"^9.0.11","@types/mocha":"^8.2.2","@types/node":"^15.12.0","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0","chai":"^4.3.4","eslint":"^7.27.0","eslint-config-prettier":"^8.3.0","eslint-plugin-mocha":"^9.0.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^3.4.0","execa":"^5.1.0","fixturify-project":"^3.0.2","fs-extra":"^10.0.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","prettier":"^2.3.0","ts-mocha":"^8.0.0","typescript":"^4.3.2"},"scripts":{"build":"tsc -b .","watch":"tsc --watch .","clean":"tsc -b --clean .","test":"npm-run-all build lint test:ts","test:ts":"ts-mocha tests/*-test.ts","test:inspect":"ts-mocha inspect tests/*-test.ts","test:ts:debug":"ts-mocha debug tests/*-test.ts","lint":"eslint ."},"engines":{"node":">= 12"},"volta":{"node":"12.19.0","yarn":"1.22.10"},"gitHead":"b9fe587bb127f1a6f2422d37c70365c41fb0b42c","bugs":{"url":"https://github.com/stefanpenner/resolve-package-path/issues"},"homepage":"https://github.com/stefanpenner/resolve-package-path#readme","_id":"resolve-package-path@4.0.1","_nodeVersion":"12.19.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-2gb/yU2fSfX22pjDYyevzyOKK9q72XKUFqlAsrfPzZArM4JkIH/Qcme4n3EbaZttObWm/fIFLbPxrXIyiL8wdQ==","shasum":"0e77271e06c8cc41740d28ef974806a77fdc8880","tarball":"http://registry-npm.ywwl.com/resolve-package-path/download/resolve-package-path-4.0.1.tgz","fileCount":18,"unpackedSize":53578,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgumxtCRA9TVsSAnZWagAAqKYQAIs649BoJOz019BCVdYA\nVMnHbnmTb59h3y0v3IDeO4p0Q+27SnbVj0lOvT/VRt3xkjygeCE5fsj7xuUS\nGhBDLal/bHAyiZ5pv114ID27MGTrQxT5t5/fnxTR/NjoVmnCKaxcfF2sYL+X\n260Zvj1EMoFYJ8feJpR8TwDEvIVeea7q78X2b1pqheZv9Um0WHZ6aGFeRK1Y\nWce2UbBavqS3iV1gyx4y9t8aG7XcCJdWtspdZRFgvef6NQqd5Lj8ZNHaS9+e\nmIkQbTvmZlzI8aYcNuO7PMkQjBVWY32vOstl3x3CvTt9BKtCHpMj/ZvPd/MH\n/ORiKlwhC4CtTTQMzZiFX2PrYj6gVcZ1G1VuyO4REwtG3o6Z+Uvg04b6+Icc\n/AKCLT1OOWncX9SFIhlfiAXFUNDFM72mOLpeRbtLXyms3eQJYfqwxxJybQDZ\nyGXhjy+i3H3LFUK3vMbyW+ZayCNqlmMD4XrBZvduhnV7TgToaSoCIuY+2kSw\n02LNOgdNKNUUDE48/cMFHX8oWv57rW2jvSAvaJVpWAXzTsXbxxsEYSxkqS3s\njM+ewWpViovGbp54a8lmIS49Rp9YVRLbLActyzRvsHH0eX0XkjUfIuc2cLjq\nl9tityfeDDyBKSIfYtL78u4Y3aHDWAWIlSjoT9Q/0nFsMGwmK+RoW8SvrrKd\nFbvI\r\n=hpvo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDi3lihxlGUqDtWZSIYZts2WOGikJMEG0zhuom0H3cVhwIhAL15OngaaXDWnLfIMLJ5pCsCv5iBu18tG0kYbt/Ny6wP"}],"size":15008,"noattachment":false,"key":"/resolve-package-path/-/resolve-package-path-4.0.1.tgz"},"_npmUser":{"name":"stefanpenner","email":"stefan.penner@gmail.com"},"directories":{},"maintainers":[{"name":"rwjblue","email":"me@rwjblue.com"},{"name":"stefanpenner","email":"stefan.penner@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-package-path_4.0.1_1622830188843_0.002689106783023254"},"_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":1622830189079,"_cnpm_publish_time":1622830189079,"dist-tags":{"latest":"4.0.3"}}