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

realize-package-specifier

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

realize-package-specifier - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

10

index.js

@@ -19,3 +19,3 @@ "use strict"

? path.resolve(where, dep.spec)
: path.resolve(spec)
: path.resolve(dep.rawSpec? dep.rawSpec: dep.name)
fs.stat(specpath, function (er, s) {

@@ -29,3 +29,9 @@ if (er) return finalize()

function finalize(type) {
if (type != null) dep.type = type
if (type != null && type != dep.type) {
dep.type = type
if (! dep.rawSpec) {
dep.rawSpec = dep.name
dep.name = null
}
}
if (dep.type == "local" || dep.type == "directory") dep.spec = specpath

@@ -32,0 +38,0 @@ cb(null, dep)

2

package.json
{
"name": "realize-package-specifier",
"version": "1.1.0",
"version": "1.2.0",
"description": "Like npm-package-arg, but more so, producing full file paths and differentiating local tar and directory sources.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -88,1 +88,35 @@ "use strict"

})
test("named realize-package-specifier", function (t) {
t.plan(10)
rps("a@a.tar.gz", function (err, result) {
t.is(result.type, "local", "named local tarball")
})
rps("b@b", function (err, result) {
t.is(result.type, "directory", "named local package directory")
})
rps("c@c", function (err, result) {
t.is(result.type, "tag", "remote package, non-package local directory")
})
rps("d@d", function (err, result) {
t.is(result.type, "tag", "remote package, no local directory")
})
rps("a@file:./a.tar.gz", function (err, result) {
t.is(result.type, "local", "local tarball")
})
rps("b@file:./b", function (err, result) {
t.is(result.type, "directory", "local package directory")
})
rps("c@file:./c", function (err, result) {
t.is(result.type, "local", "non-package local directory, specified with a file URL")
})
rps("d@file:./d", function (err, result) {
t.is(result.type, "local", "no local directory, specified with a file URL")
})
rps("e@e/1", function (err, result) {
t.is(result.type, "directory", "local package directory")
})
rps("e@e/2", function (err, result) {
t.is(result.type, "github", "github package dependency")
})
})
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