Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resolve-pkg

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolve-pkg - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

15

index.js

@@ -8,4 +8,13 @@ 'use strict';

var parts = moduleId.split(path.sep);
var pkg = path.join(parts.shift(), 'package.json');
var parts = moduleId.replace(/\\/g, '/').split('/');
var packageName = '';
// handle scoped package name
if (parts.length > 0 && parts[0][0] === '@') {
packageName += parts.shift() + '/';
}
packageName += parts.shift();
var pkg = path.join(packageName, 'package.json');
var resolved = resolveFrom(opts.cwd || '.', pkg);

@@ -17,3 +26,3 @@

return path.join(path.dirname(resolved), parts.join(path.sep));
return path.join(path.dirname(resolved), parts.join('/'));
};

9

package.json
{
"name": "resolve-pkg",
"version": "0.1.0",
"description": "Resolve the path of a package regardless of it having an entry",
"version": "0.2.0",
"description": "Resolve the path of a package regardless of it having an entry point",
"license": "MIT",

@@ -43,5 +43,6 @@ "repository": "sindresorhus/resolve-pkg",

"ava": "*",
"grunt-svgmin": "3.1.0",
"xo": "*"
"grunt-svgmin": "3.3.0",
"xo": "*",
"@someprivate/module-test": "file:./fixtures/private-module-test"
}
}
# resolve-pkg [![Build Status](https://travis-ci.org/sindresorhus/resolve-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-pkg)
> Resolve the path of a package regardless of it having an entry
> Resolve the path of a package regardless of it having an entry point

@@ -45,3 +45,3 @@ Some 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 `null` instead of throwing when the module can't be found, and resolves from `process.cwd()` instead `__dirname` by default.

Type: `boolean`
Type: `boolean`<br>
Default: `process.cwd()`

@@ -63,2 +63,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc