realize-package-specifier
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -17,2 +17,3 @@ "use strict" | ||
} | ||
if ((dep.type == "range" || dep.type == "version") && dep.name != dep.raw) return cb(null, dep) | ||
var specpath = dep.type == "local" | ||
@@ -19,0 +20,0 @@ ? path.resolve(where, dep.spec) |
{ | ||
"name": "realize-package-specifier", | ||
"version": "1.2.0", | ||
"version": "1.3.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", |
@@ -7,11 +7,13 @@ "use strict" | ||
var re = { | ||
tarball: /[\/\\]a.tar.gz$/, | ||
packagedir: /[\/\\]b$/, | ||
packagejson: /[\/\\]b[\/\\]package.json$/, | ||
nonpackagedir: /[\/\\]c$/, | ||
nopackagejson: /[\/\\]c[\/\\]package.json$/, | ||
remotename: /[\/\\]d$/, | ||
packagedirlikegithub: /[\/\\]e[\/\\]1$/, | ||
packagejsonlikegithub: /[\/\\]e[\/\\]1[\/\\]package.json$/, | ||
github: /[\/\\]e[\/\\]2$/ | ||
tarball: /[/\\]a.tar.gz$/, | ||
packagedir: /[/\\]b$/, | ||
packagejson: /[/\\]b[/\\]package.json$/, | ||
nonpackagedir: /[/\\]c$/, | ||
nopackagejson: /[/\\]c[/\\]package.json$/, | ||
remotename: /[/\\]d$/, | ||
packagedirlikegithub: /[/\\]e[/\\]1$/, | ||
packagejsonlikegithub: /[/\\]e[/\\]1[/\\]package.json$/, | ||
github: /[/\\]e[/\\]2$/, | ||
localrangefile: /[/\\]1[.]0[.]0$/, | ||
localverfile: /[/\\]1$/ | ||
} | ||
@@ -49,2 +51,8 @@ | ||
} | ||
else if (re.localverfile.test(path)) { | ||
callback(null,{isDirectory:function(){ return false }}) | ||
} | ||
else if (re.localrangefile.test(path)) { | ||
callback(null,{isDirectory:function(){ return false }}) | ||
} | ||
else { | ||
@@ -58,3 +66,3 @@ throw new Error("Unknown stat fixture path: "+path) | ||
test("realize-package-specifier", function (t) { | ||
t.plan(10) | ||
t.plan(12) | ||
rps("a.tar.gz", function (err, result) { | ||
@@ -90,5 +98,11 @@ t.is(result.type, "local", "local tarball") | ||
}) | ||
rps("1", function (err, result) { | ||
t.is(result.type, "local", "range like local file is still a local file") | ||
}) | ||
rps("1.0.0", function (err, result) { | ||
t.is(result.type, "local", "version like local file is still a local file") | ||
}) | ||
}) | ||
test("named realize-package-specifier", function (t) { | ||
t.plan(10) | ||
t.plan(12) | ||
@@ -125,2 +139,8 @@ rps("a@a.tar.gz", function (err, result) { | ||
}) | ||
rps("e@1", function (err, result) { | ||
t.is(result.type, "range", "range like specifier is never a local file") | ||
}) | ||
rps("e@1.0.0", function (err, result) { | ||
t.is(result.type, "version", "version like specifier is never a local file") | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17288
8
391