Skip to content

Commit

Permalink
module: remove require('.') with NODE_PATH compatibilty
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Apr 17, 2015
1 parent cd60ff0 commit 7220214
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ function tryExtensions(p, exts) {
}


const noopDeprecateRequireDot = util.deprecate(function() {},
"warning: require('.') resolved outside the package directory. " +
"This functionality is deprecated and will be removed soon.");


Module._findPath = function(request, paths) {
var exts = Object.keys(Module._extensions);

Expand Down Expand Up @@ -174,8 +169,6 @@ Module._findPath = function(request, paths) {
}

if (filename) {
// Warn once if '.' resolved outside the module dir
if (request === '.' && i > 0) noopDeprecateRequireDot();
Module._pathCache[cacheKey] = filename;
return filename;
}
Expand Down Expand Up @@ -212,23 +205,13 @@ Module._resolveLookupPaths = function(request, parent) {
}

var start = request.substring(0, 2);
if (start !== './' && start !== '..') {
if (start !== '.' && start !== './' && start !== '..') {
var paths = modulePaths;
if (parent) {
if (!parent.paths) parent.paths = [];
paths = parent.paths.concat(paths);
}

// Maintain backwards compat with certain broken uses of require('.')
// by putting the module's directory in front of the lookup paths.
if (request === '.') {
if (parent && parent.filename) {
paths.splice(0, 0, path.dirname(parent.filename));
} else {
paths.splice(0, 0, path.resolve(request));
}
}

return [request, paths];
}

Expand Down

0 comments on commit 7220214

Please sign in to comment.