Socket
Socket
Sign inDemoInstall

resolve

Package Overview
Dependencies
1
Maintainers
40
Versions
95
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.8.0 to 1.8.1

.editorconfig

6

lib/async.js

@@ -41,8 +41,8 @@ var core = require('./core');

if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
var res = path.resolve(parent, x);
var res = path.resolve(basedir, x);
if (x === '..' || x.slice(-1) === '/') res += '/';
if (/\/$/.test(x) && res === parent) {
if (/\/$/.test(x) && res === basedir) {
loadAsDirectory(res, opts.package, onfile);
} else loadAsFile(res, opts.package, onfile);
} else loadNodeModules(x, parent, function (err, n, pkg) {
} else loadNodeModules(x, basedir, function (err, n, pkg) {
if (err) cb(err);

@@ -49,0 +49,0 @@ else if (n) cb(null, n, pkg);

@@ -32,3 +32,3 @@ var core = require('./core');

if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
var res = path.resolve(parent, x);
var res = path.resolve(basedir, x);
if (x === '..' || x.slice(-1) === '/') res += '/';

@@ -38,3 +38,3 @@ var m = loadAsFileSync(res) || loadAsDirectorySync(res);

} else {
var n = loadNodeModulesSync(x, parent);
var n = loadNodeModulesSync(x, basedir);
if (n) return n;

@@ -41,0 +41,0 @@ }

{
"name": "resolve",
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
"version": "1.8.0",
"version": "1.8.1",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

@@ -18,2 +18,7 @@ var path = require('path');

t.equal(
resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }),
path.join(dir, 'foo.js')
);
t.throws(function () {

@@ -20,0 +25,0 @@ resolve.sync('foo', { basedir: dir });

@@ -6,3 +6,3 @@ var path = require('path');

test('async foo', function (t) {
t.plan(11);
t.plan(12);
var dir = path.join(__dirname, 'resolver');

@@ -34,2 +34,7 @@

resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) {
if (err) t.fail(err);
t.equal(res, path.join(dir, 'foo.js'));
});
resolve('foo', { basedir: dir }, function (err) {

@@ -36,0 +41,0 @@ t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'");

@@ -44,3 +44,5 @@ var path = require('path');

var start = new Date();
t.equal(resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js'));
t.doesNotThrow(function () {
t.equal(resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js'));
});
t.ok(new Date() - start < 50, 'resolve.sync timedout');

@@ -47,0 +49,0 @@ t.end();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc