Comparing version 0.4.2 to 0.4.3
var core = require('./core'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var caller = require('./caller.js'); | ||
@@ -24,5 +25,3 @@ module.exports = function resolve (x, opts, cb) { | ||
var extensions = opts.extensions || [ '.js' ]; | ||
var y = opts.basedir | ||
|| path.dirname(require.cache[__filename].parent.filename) | ||
; | ||
var y = opts.basedir || path.dirname(caller()); | ||
@@ -29,0 +28,0 @@ opts.paths = opts.paths || []; |
var core = require('./core'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var caller = require('./caller.js'); | ||
@@ -17,5 +18,3 @@ module.exports = function (x, opts) { | ||
var extensions = opts.extensions || [ '.js' ]; | ||
var y = opts.basedir | ||
|| path.dirname(require.cache[__filename].parent.filename) | ||
; | ||
var y = opts.basedir || path.dirname(caller()); | ||
@@ -22,0 +21,0 @@ opts.paths = opts.paths || []; |
{ | ||
"name" : "resolve", | ||
"description" : "resolve like require.resolve() on behalf of files asynchronously and synchronously", | ||
"version" : "0.4.2", | ||
"version" : "0.4.3", | ||
"repository" : { | ||
@@ -6,0 +6,0 @@ "type" : "git", |
@@ -255,1 +255,17 @@ var test = require('tap').test; | ||
}); | ||
test('without basedir', function (t) { | ||
t.plan(1); | ||
var dir = __dirname + '/resolver/without_basedir'; | ||
var tester = require(dir + '/main.js'); | ||
tester(t, function (err, res, pkg){ | ||
if (err) { | ||
t.fail(err); | ||
} else { | ||
t.equal(res, dir + '/node_modules/mymodule.js'); | ||
} | ||
}); | ||
}); | ||
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
32956
38
859
3