{"name":"resolve-package-path","description":"a special purpose fast memoizing way to resolve a node modules package.json","version":"2.0.0","main":"index.js","types":"index.d.ts","license":"MIT","dependencies":{"path-root":"^0.1.1","resolve":"^1.13.1"},"devDependencies":{"@types/chai":"^4.2.6","@types/fs-extra":"^8.0.1","@types/mocha":"^5.2.7","@types/node":"^12.12.14","@types/semver":"^6.2.0","chai":"^4.2.0","execa":"^3.4.0","fixturify-project":"^1.9.1","fs-extra":"^8.1.0","mocha":"^6.2.2","semver":"^6.3.0","typescript":"^3.7.3"},"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"},"engines":{"node":"8.* || 10.* || >= 12"},"gitHead":"3e9b74512521c69609e84736e64d8e21c52a0c55","_id":"resolve-package-path@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.16.2","_npmUser":{"name":"stefanpenner","email":"stefan.penner@gmail.com"},"dist":{"integrity":"sha512-/CLuzodHO2wyyHTzls5Qr+EFeG6RcW4u6//gjYvUfcfyuplIX1SSccU+A5A9A78Gmezkl3NBkFAMxLbzTY9TJA==","shasum":"7f258ab86ff074fff4ff8027a28f94d17d6fb1df","tarball":"http://registry-npm.ywwl.com/resolve-package-path/download/resolve-package-path-2.0.0.tgz","fileCount":31,"unpackedSize":108560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd7pPgCRA9TVsSAnZWagAAtYIP/0qo+1zTp6TbzsYD+EHG\nD86zCFZ5mnwHbPnfLbQxCNnqg5kG8cvjBbNgD1OfVXlXGGU/NSrBNd8cO1eP\nFTA66B8wwzDw2/gZaFalU5K9lLX9h2a6pZ8qbBU59zsKJRR7kZYLac0KFhBN\noTFtxcciWcFa5si5RSMtDHDMZw0Gl+mMSyawLfatnSscLfKKxSZgkEi+acFq\nwyGfV/qaidlVe8H8DEvhCIkgvvmJKrgM/tmxiDsi5R9p1xFyE5t2F8CNt3+M\nc9nDcAd/WkRKuTQMPO5op5/2QipfPhi+9gkE9YJqc1fCyT35wFw3KnpFGu52\nKqiCgIhID7GuVtbl0uYjtSMI6s+MNX3U4aQsFkAG0ECp/3TA0i+KzmusnJWX\na5NHlMtrXvO6ic36hr570gCPndcnSL2syDlsGzhocMGOdECHTfm3JTdW3aOL\nJJEf90aCyUyrH4vCz+ifGhxdD3IxggnqFwnx1lSqYzJ0V5GT0QOLbbTyLOAk\nFwienCTguJ1zsXohi4xMU8Yumt3P/KAlnUtOIfT5RNM9Kw1ii1GztjqQJ6EY\nU8pZVj1PnduwJkXD+9DpZxXjwFvmSdSpU9KmI2wKtAT+TcgkLKhD0/7j1EIv\nA/jfOih/vEBo8t2fXPjBIHJKWCmn9Wjh5ee7dpijgEayFg1Pywx5HN8srmbm\nHRHm\r\n=P2QT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIArNfpFHsCfeO5A5vTI0zKaOCsZ9Wriaf1PTD+BZUkrBAiAZp2yItkjlb6vxRclTRQDsZ2Yq3xWaw+oRZ9peang0hw=="}],"size":31079,"noattachment":false,"key":"/resolve-package-path/-/resolve-package-path-2.0.0.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_2.0.0_1575916512263_0.9790614605764822"},"_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":1575916512427,"_cnpm_publish_time":1575916512427,"dist-tags":{"latest":"4.0.3"}}