{"name":"resolve-pkg","version":"3.0.1","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"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"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/ && del node_modules/aliased-pkg && make-dir node_modules/aliased-pkg && cpy 'fixtures/aliased-pkg/*' node_modules/aliased-pkg/ && del node_modules/esm-only-pkg && make-dir node_modules/esm-only-pkg && cpy 'fixtures/esm-only-pkg/*' node_modules/esm-only-pkg/ && del node_modules/nested-package-json-pkg && make-dir node_modules/nested-package-json-pkg/dist && cpy 'fixtures/nested-package-json-pkg/*' node_modules/nested-package-json-pkg/ && cpy 'fixtures/nested-package-json-pkg/dist/*' node_modules/nested-package-json-pkg/dist/","test":"xo && ava && tsd"},"keywords":["require","resolve","path","module","from","like","path","cwd","current","working","directory","grunt","main","entry","point"],"dependencies":{"find-up-simple":"^1.0.1"},"devDependencies":{"@someprivate/module-test":"file:./fixtures/private-module-test","ava":"^6.4.1","cpy-cli":"^6.0.0","del-cli":"^7.0.0","grunt-svgmin":"^7.0.0","is-safe-filename":"^0.1.1","make-dir-cli":"^4.0.0","tsd":"^0.33.0","xo":"^1.2.3"},"xo":{"ignores":["fixtures/**","temp-investigation/**"]},"gitHead":"6aaa506a06d6407eec38cf06609a09f07ea6a98d","types":"./index.d.ts","_id":"resolve-pkg@3.0.1","bugs":{"url":"https://github.com/sindresorhus/resolve-pkg/issues"},"homepage":"https://github.com/sindresorhus/resolve-pkg#readme","_nodeVersion":"25.6.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-OYIg+p3xVYwh4R0tnEKU+XZA8qiDY4y7iC+XgoC8LFbZuKHjPuuJ9mhWdSX6KYFNKvgar6hOdNj207DDI0nMfg==","shasum":"f9b6b43b85b1f5bd3cb7a7d249c290a6e423192d","tarball":"http://registry-npm.ywwl.com/resolve-pkg/download/resolve-pkg-3.0.1.tgz","fileCount":5,"unpackedSize":7707,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDz7mmBQ7y/ogfwmQiAnor1wDkvTLOpcZThm0fkyoQPzAIhALyHaUOBpOaJBYb6eIBX5PGFMdzUVxBovb9ygM8oSPhp"}],"size":2893,"noattachment":false,"key":"/resolve-pkg/-/resolve-pkg-3.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/resolve-pkg_3.0.1_1770879575287_0.1902462365005655"},"_hasShrinkwrap":false,"readme":"# 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 an entry point defined in package.json, resulting in them not being resolvable by `import.meta.resolve()`. Unlike `import.meta.resolve()`, this package also resolves packages without an entry point and returns `undefined` instead of throwing when the package can't be found.\n\n## Install\n\n```sh\nnpm install resolve-pkg\n```\n\n## Usage\n\n```js\nimport resolvePackage from 'resolve-pkg';\n\n// $ npm install --save-dev grunt-svgmin\n\nresolvePackage('grunt-svgmin/tasks', {cwd: import.meta.dirname});\n//=> '/Users/sindresorhus/unicorn/node_modules/grunt-svgmin/tasks'\n\n// Fails here as Grunt tasks usually don't have a defined entry point\nimport.meta.resolve('grunt-svgmin/tasks');\n//=> Error\n```\n\n## API\n\n### resolvePackage(moduleId, options?)\n\n#### moduleId\n\nType: `string`\n\nWhat you would use in `import`.\n\n#### options\n\n##### cwd\n\nType: `string`<br>\nDefault: `process.cwd()`\n\nDirectory to resolve from.\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","publish_time":1770879575507,"_cnpm_publish_time":1770879575507,"dist-tags":{"latest":"3.0.1"}}