Comparing version
@@ -90,3 +90,3 @@ var fs = require('fs'); | ||
res = path.resolve(basedir, x); | ||
if (x === '..' || x.slice(-1) === '/') res += '/'; | ||
if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; | ||
if ((/\/$/).test(x) && res === basedir) { | ||
@@ -93,0 +93,0 @@ loadAsDirectory(res, opts.package, onfile); |
@@ -71,3 +71,3 @@ var isCore = require('./is-core'); | ||
var res = path.resolve(absoluteStart, x); | ||
if (x === '..' || x.slice(-1) === '/') res += '/'; | ||
if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; | ||
var m = loadAsFileSync(res) || loadAsDirectorySync(res); | ||
@@ -74,0 +74,0 @@ if (m) return maybeUnwrapSymlink(m, opts); |
{ | ||
"name": "resolve", | ||
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", | ||
"version": "1.15.0", | ||
"version": "1.15.1", | ||
"repository": { | ||
@@ -27,3 +27,3 @@ "type": "git", | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^15.1.0", | ||
"@ljharb/eslint-config": "^16.0.0", | ||
"array.prototype.map": "^1.0.2", | ||
@@ -30,0 +30,0 @@ "eslint": "^6.8.0", |
@@ -241,2 +241,16 @@ var path = require('path'); | ||
test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { | ||
var dir = path.join(__dirname, 'resolver'); | ||
t.equal( | ||
resolve.sync('./', { basedir: path.join(dir, 'same_names/foo') }), | ||
path.join(dir, 'same_names/foo/index.js') | ||
); | ||
t.equal( | ||
resolve.sync('.', { basedir: path.join(dir, 'same_names/foo') }), | ||
path.join(dir, 'same_names/foo/index.js') | ||
); | ||
t.end(); | ||
}); | ||
test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { | ||
@@ -243,0 +257,0 @@ var testFile = path.basename(__filename); |
@@ -318,2 +318,18 @@ var path = require('path'); | ||
test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { | ||
t.plan(2); | ||
var dir = path.join(__dirname, 'resolver'); | ||
resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { | ||
if (err) t.fail(err); | ||
t.equal(res, path.join(dir, 'same_names/foo/index.js')); | ||
}); | ||
resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { | ||
if (err) t.fail(err); | ||
t.equal(res, path.join(dir, 'same_names/foo/index.js')); | ||
}); | ||
}); | ||
test('async: #121 - treating an existing file as a dir when no basedir', function (t) { | ||
@@ -320,0 +336,0 @@ var testFile = path.basename(__filename); |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
99301
1.2%2260
1.07%