{"_id":"resolve-pkg","_rev":"43068","name":"resolve-pkg","description":"Resolve the path of a package regardless of it having an entry point","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-06-03T10:13:05.000Z","created":"2015-12-19T17:23:21.170Z","2.0.0":"2019-04-16T12:23:57.260Z","1.0.0":"2017-01-13T09:37:31.164Z","0.2.0":"2016-08-05T20:27:21.518Z","0.1.0":"2015-12-19T17:23:21.170Z"},"users":{"danielbayley":true,"sbruchmann":true,"mrahmadawais":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/resolve-pkg.git"},"versions":{"2.0.0":{"name":"resolve-pkg","version":"2.0.0","description":"Resolve the path of a package regardless of it having an entry point","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/resolve-pkg.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"pretest":"del node_modules/@someprivate/module-test && make-dir node_modules/@someprivate/module-test && cpy 'fixtures/private-module-test/*' node_modules/@someprivate/module-test/","test":"xo && ava && tsd"},"keywords":["require","resolve","path","module","from","like","path","cwd","current","working","directory","grunt","main","entry","point"],"dependencies":{"resolve-from":"^5.0.0"},"devDependencies":{"@someprivate/module-test":"file:./fixtures/private-module-test","ava":"^1.4.1","cpy-cli":"^2.0.0","del-cli":"^1.1.0","grunt-svgmin":"^6.0.0","make-dir-cli":"^2.0.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"602fb3f95c0c0725471a8fb403c41a2e752c51ba","bugs":{"url":"https://github.com/sindresorhus/resolve-pkg/issues"},"homepage":"https://github.com/sindresorhus/resolve-pkg#readme","_id":"resolve-pkg@2.0.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"ac06991418a7623edc119084edc98b0e6bf05a41","size":2445,"noattachment":false,"key":"/resolve-pkg/-/resolve-pkg-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-pkg/download/resolve-pkg-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-pkg_2.0.0_1555417437158_0.004611785738547258"},"_hasShrinkwrap":false,"publish_time":1555417437260,"_cnpm_publish_time":1555417437260},"1.0.0":{"name":"resolve-pkg","version":"1.0.0","description":"Resolve the path of a package regardless of it having an entry point","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/resolve-pkg.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["require","resolve","path","module","from","like","path","cwd","current","working","directory","grunt","main","entry","point"],"dependencies":{"resolve-from":"^2.0.0"},"devDependencies":{"@someprivate/module-test":"file:./fixtures/private-module-test","ava":"*","grunt-svgmin":"^4.0.0","xo":"*"},"gitHead":"96cae747f7a5a00fe0a5e1f6f026b14aeb63f1f6","bugs":{"url":"https://github.com/sindresorhus/resolve-pkg/issues"},"homepage":"https://github.com/sindresorhus/resolve-pkg#readme","_id":"resolve-pkg@1.0.0","_shasum":"e19a15e78aca2e124461dc92b2e3943ef93494d9","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"e19a15e78aca2e124461dc92b2e3943ef93494d9","size":2192,"noattachment":false,"key":"/resolve-pkg/-/resolve-pkg-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-pkg/download/resolve-pkg-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resolve-pkg-1.0.0.tgz_1484300250922_0.788734458386898"},"directories":{},"publish_time":1484300251164,"_cnpm_publish_time":1484300251164,"_hasShrinkwrap":false},"0.2.0":{"name":"resolve-pkg","version":"0.2.0","description":"Resolve the path of a package regardless of it having an entry point","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/resolve-pkg.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["require","resolve","path","module","from","like","path","cwd","current","working","directory","grunt","main","entry","point"],"dependencies":{"resolve-from":"^2.0.0"},"devDependencies":{"ava":"*","grunt-svgmin":"3.3.0","xo":"*","@someprivate/module-test":"file:./fixtures/private-module-test"},"gitHead":"b3fbd48c0c59696a71b420ce41779e59e5872b6b","bugs":{"url":"https://github.com/sindresorhus/resolve-pkg/issues"},"homepage":"https://github.com/sindresorhus/resolve-pkg#readme","_id":"resolve-pkg@0.2.0","_shasum":"515ff7a6091dcc157e50e0ba8ca428dbb88540d6","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"515ff7a6091dcc157e50e0ba8ca428dbb88540d6","size":2207,"noattachment":false,"key":"/resolve-pkg/-/resolve-pkg-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-pkg/download/resolve-pkg-0.2.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resolve-pkg-0.2.0.tgz_1470428839804_0.34364057146012783"},"directories":{},"publish_time":1470428841518,"_cnpm_publish_time":1470428841518,"_hasShrinkwrap":false},"0.1.0":{"name":"resolve-pkg","version":"0.1.0","description":"Resolve the path of a package regardless of it having an entry","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/resolve-pkg"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["require","resolve","path","module","from","like","path","cwd","current","working","directory","grunt","main","entry","point"],"dependencies":{"resolve-from":"^2.0.0"},"devDependencies":{"ava":"*","grunt-svgmin":"3.1.0","xo":"*"},"gitHead":"b23eb5e6f61eb684345edd4c33f00dcde9f10bc8","bugs":{"url":"https://github.com/sindresorhus/resolve-pkg/issues"},"homepage":"https://github.com/sindresorhus/resolve-pkg","_id":"resolve-pkg@0.1.0","_shasum":"02cc993410e2936962bd97166a1b077da9725531","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"02cc993410e2936962bd97166a1b077da9725531","size":2073,"noattachment":false,"key":"/resolve-pkg/-/resolve-pkg-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/resolve-pkg/download/resolve-pkg-0.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1450545801170,"_cnpm_publish_time":1450545801170,"_hasShrinkwrap":false}},"readme":"# resolve-pkg [![Build Status](https://travis-ci.org/sindresorhus/resolve-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-pkg)\n\n> Resolve the path of a package regardless of it having an entry point\n\nSome packages like CLI tools and grunt tasks don't have a entry point, like `\"main\": \"foo.js\"` in package.json, resulting in them not being resolvable by `require.resolve()`. Unlike `require.resolve()`, this module also resolves packages without an entry point, returns `undefined` instead of throwing when the module can't be found, and resolves from `process.cwd()` instead `__dirname` by default.\n\n\n## Install\n\n```\n$ npm install resolve-pkg\n```\n\n\n## Usage\n\n```js\nconst resolvePkg = require('resolve-pkg');\n\n// $ npm install --save-dev grunt-svgmin\n\nresolvePkg('grunt-svgmin/tasks', {cwd: __dirname});\n//=> '/Users/sindresorhus/unicorn/node_modules/grunt-svgmin/tasks'\n\n// Fails here as Grunt tasks usually don't have a defined main entry point\nrequire.resolve('grunt-svgmin/tasks');\n//=> Error: Cannot find module 'grunt-svgmin'\n```\n\n\n## API\n\n### resolvePkg(moduleId, [options])\n\n#### moduleId\n\nType: `string`\n\nWhat you would use in `require()`.\n\n#### options\n\n##### cwd\n\nType: `string`<br>\nDefault: `process.cwd()`\n\nDirectory to resolve from.\n\n\n## Related\n\n- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory\n- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path\n- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module\n- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path\n- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory\n- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n","_attachments":{},"homepage":"https://github.com/sindresorhus/resolve-pkg#readme","bugs":{"url":"https://github.com/sindresorhus/resolve-pkg/issues"},"license":"MIT"}