summaryrefslogtreecommitdiff
path: root/lib/module.js
diff options
context:
space:
mode:
authorRoman Reiss <me@silverwind.io>2017-01-18 00:55:34 +0100
committersilverwind <me@silverwind.io>2017-08-31 21:11:49 +0200
commita517466aa7dcb7afe4864ab12d0f97e10a8d4ee0 (patch)
tree0a09eabb894689372e307fd6faf311edc9f599f6 /lib/module.js
parent365c24591cb0268b13818fe077c63f55de5c8404 (diff)
downloadandroid-node-v8-a517466aa7dcb7afe4864ab12d0f97e10a8d4ee0.tar.gz
android-node-v8-a517466aa7dcb7afe4864ab12d0f97e10a8d4ee0.tar.bz2
android-node-v8-a517466aa7dcb7afe4864ab12d0f97e10a8d4ee0.zip
module: mark DEP0019 as EOL and remove compat code
This removes the compatibilty code that was in place to allow an unintended interaction between `require('.')` and `NODE_PATH`. The compatibility code and the accompanying deprecation warning has been in place since 2015-04-17. PR-URL: https://github.com/nodejs/node/pull/3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/module.js')
-rw-r--r--lib/module.js26
1 files changed, 1 insertions, 25 deletions
diff --git a/lib/module.js b/lib/module.js
index 339a228da9..7bb8288f54 100644
--- a/lib/module.js
+++ b/lib/module.js
@@ -159,7 +159,6 @@ function tryExtensions(p, exts, isMain) {
return false;
}
-var warned = false;
Module._findPath = function(request, paths, isMain) {
if (path.isAbsolute(request)) {
paths = [''];
@@ -221,18 +220,6 @@ Module._findPath = function(request, paths, isMain) {
}
if (filename) {
- // Warn once if '.' resolved outside the module dir
- if (request === '.' && i > 0) {
- if (!warned) {
- warned = true;
- process.emitWarning(
- 'warning: require(\'.\') resolved outside the package ' +
- 'directory. This functionality is deprecated and will be removed ' +
- 'soon.',
- 'DeprecationWarning', 'DEP0019');
- }
- }
-
Module._pathCache[cacheKey] = filename;
return filename;
}
@@ -335,8 +322,7 @@ Module._resolveLookupPaths = function(request, parent, newReturn) {
}
// Check for relative path
- if (request.length < 2 ||
- request.charCodeAt(0) !== 46/*.*/ ||
+ if (request.charCodeAt(0) !== 46/*.*/ &&
(request.charCodeAt(1) !== 46/*.*/ &&
request.charCodeAt(1) !== 47/*/*/)) {
var paths = modulePaths;
@@ -347,16 +333,6 @@ Module._resolveLookupPaths = function(request, parent, newReturn) {
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.unshift(path.dirname(parent.filename));
- } else {
- paths.unshift(path.resolve(request));
- }
- }
-
debug('looking for %j in %j', request, paths);
return (newReturn ? (paths.length > 0 ? paths : null) : [request, paths]);
}