realize-package-specifier
Advanced tools
Comparing version 2.0.0 to 2.1.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": "2.0.0", | ||
"version": "2.1.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(11) | ||
t.plan(13) | ||
rps("a.tar.gz", function (err, result) { | ||
@@ -91,5 +99,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(11) | ||
t.plan(13) | ||
@@ -127,2 +141,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") | ||
}) | ||
}) |
@@ -102,24 +102,14 @@ var test = require("tap").test; | ||
}, | ||
"file:path/to/foo": { | ||
name: null, | ||
type: "local", | ||
spec: path.resolve("path/to/foo"), | ||
spec: path.resolve(__dirname,"..","path/to/foo"), | ||
raw: "file:path/to/foo" | ||
}, | ||
"file:~/path/to/foo": { | ||
name: null, | ||
type: "local", | ||
spec: path.resolve("~/path/to/foo"), | ||
raw: "file:~/path/to/foo" | ||
}, | ||
"file:../path/to/foo": { | ||
name: null, | ||
type: "local", | ||
spec: path.resolve("../path/to/foo"), | ||
spec: path.resolve(__dirname,"..","../path/to/foo"), | ||
raw: "file:../path/to/foo" | ||
}, | ||
"file:///path/to/foo": { | ||
@@ -126,0 +116,0 @@ name: null, |
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
24852
600