{"name":"resolve-package-path","description":"a special purpose fast memoizing way to resolve a node modules package.json","version":"1.2.4","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":"4eb8bad0460eac3ffcbd7d18aed7a372b6236305","_id":"resolve-package-path@1.2.4","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"stefanpenner","email":"stefan.penner@gmail.com"},"dist":{"integrity":"sha512-AOIfR/AauBM1w1Oq9swqGxUjL4PW7bMztN7UCQ4KWg9AR2t03bGb9faegZbE0meAOHlntAni/4kXkcsQ7dWLPQ==","shasum":"814c5fcfb5f6e4151d95ec6e5653707c43706670","tarball":"http://registry-npm.ywwl.com/resolve-package-path/download/resolve-package-path-1.2.4.tgz","fileCount":31,"unpackedSize":134177,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcgKXXCRA9TVsSAnZWagAAjXYP/A1jLTplHlm1emt4h//X\ngqyBhw0zNTS2+Gto/8MTPYtLDwKowTG6fTVbzY+xxJsVUorN/oD+srFJH/AX\n+7il4Eq49l8v9ETgxM4Nhz2rF/H4rSlxOd5kStjxqehEtd8v/aW9YFGFeLbc\n8Q5M3vx8qOLO4iev3T8n+9O9/tGe8cR2kUnrqkuAhF1EeHtd4T9DQiRlHUbE\nIpdWyGzQkutBcpQf6vdX22gZXlIsbyUafqUAp+ApU60wM1skAcmUYr8Ogch2\nxopkBulumtwnbY7RKsNM7df63h2L5CGPBXq5X11T3sQyA1g7Lsta28piLBFk\nz/Qa3KMVss2sHEWpiLnGj7NriRIgvOjzqPEIACzga9bsh6ktGnwZHrqYgwoC\nTnOzP7R1mBkxEcD9OrqAONC2SpZbo0gcDxXCzdmDZeN5Dr/9bci4MDCRehSh\nEDtk+WZCObOPi9lq7hnWExJyf/ifJjjY0kdVn7glB1JJC2uEUTdTAFHz6KRx\nF2UELusTXHJb/jEaZCgLYfiWoNUnq0oLmhN4tKeyoYIsYgq+c/bs7Mmkv/Ng\n0Jw5e9A5gzOYxBdF7YyoKd7Ne1iGbeeufpCpq3hohnWKwOa/2j2aeOe0Nc7Y\nrK7NacvO/tMwRO2S2pp2XfmnpuR6EoMfKGeIUHzP1tCiICBSyEV/XrSh/8oz\nDF4c\r\n=4XRf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHdoDZZtgmiXcbi4lMAiKbeiSUlxVth5F5AStU1vTGH5AiAXRVhrtR9p7gz6iTuwbYcuYn3xyOP+saMx8SNlA9VfsA=="}],"size":40417,"noattachment":false,"key":"/resolve-package-path/-/resolve-package-path-1.2.4.tgz"},"maintainers":[{"email":"me@rwjblue.com","name":"rwjblue"},{"email":"stefan.penner@gmail.com","name":"stefanpenner"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-package-path_1.2.4_1551934934797_0.7824263472903423"},"_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":1551934935080,"_cnpm_publish_time":1551934935080,"dist-tags":{"latest":"4.0.3"}}