From 35a713d76a8a107c037cc6ce134c05b728f312d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 18 Jun 2020 21:46:27 +0200 Subject: [PATCH] Revert #92, use resolve's `preserveSymlinks` option --- index.js | 20 +------------------- test/modules.js | 2 +- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/index.js b/index.js index 53334b2..8a1908a 100644 --- a/index.js +++ b/index.js @@ -206,7 +206,7 @@ function build_resolve_opts(opts, base) { return opts; } -function resolve(id, opts, callback) { +function resolve(id, opts, cb) { // opts.filename // opts.paths @@ -216,24 +216,6 @@ function resolve(id, opts, callback) { opts = opts || {}; opts.filename = opts.filename || ''; - var cb = function(err, path, pkg) { - fs.stat(path, function(notPath) { - if (notPath) { - callback(err, path, pkg); - } - else { - fs.realpath(path, function(notReal, real) { - if (notReal) { - callback(err, path, pkg); - } - else { - callback(err, real, pkg); - } - }); - } - }); - } - var base = path.dirname(opts.filename); if (opts.basedir) { diff --git a/test/modules.js b/test/modules.js index a1ced3c..ddf26d2 100644 --- a/test/modules.js +++ b/test/modules.js @@ -332,7 +332,7 @@ test('respect symlinks', function (done) { // - node_modules // - symlink to x // - resolve('linked', { paths: [ fixtures_dir + '/linker/node_modules' ] }, function(err, path, pkg) { + resolve('linked', { paths: [ fixtures_dir + '/linker/node_modules' ], preserveSymlinks: false }, function(err, path, pkg) { assert.ifError(err); assert.equal(path, require.resolve('./fixtures/linked/index')); done();