require-in-the-middle
Advanced tools
Comparing version 5.0.0 to 5.0.1
12
index.js
@@ -11,2 +11,4 @@ 'use strict' | ||
const builtins = Module.builtinModules | ||
// 'foo/bar.js' or 'foo/bar/index.js' => 'foo/bar' | ||
@@ -43,3 +45,3 @@ const normalize = /([/\\]index)?(\.js)?$/ | ||
this._require = Module.prototype.require = function (request) { | ||
this._require = Module.prototype.require = function (id) { | ||
if (self._unhooked === true) { | ||
@@ -53,7 +55,7 @@ // if the patched require function could not be removed because | ||
const filename = Module._resolveFilename(request, this) | ||
const core = filename.includes(path.sep) === false | ||
const filename = Module._resolveFilename(id, this) | ||
const core = builtins.includes(filename) | ||
let moduleName, basedir | ||
debug('processing %s module require(\'%s\'): %s', core === true ? 'core' : 'non-core', request, filename) | ||
debug('processing %s module require(\'%s\'): %s', core === true ? 'core' : 'non-core', id, filename) | ||
@@ -102,3 +104,3 @@ // return known patched modules immediately | ||
debug('resolved filename to module: %s (request: %s, resolved: %s, basedir: %s)', moduleName, request, fullModuleName, basedir) | ||
debug('resolved filename to module: %s (id: %s, resolved: %s, basedir: %s)', moduleName, id, fullModuleName, basedir) | ||
@@ -105,0 +107,0 @@ // Ex: require('foo/lib/../bar.js') |
{ | ||
"name": "require-in-the-middle", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Module to hook into the Node.js require function", | ||
@@ -15,3 +15,4 @@ "main": "index.js", | ||
"roundround": "^0.2.0", | ||
"standard": "^13.1.0", | ||
"semver": "^6.3.0", | ||
"standard": "^14.3.1", | ||
"tape": "^4.11.0" | ||
@@ -45,5 +46,5 @@ }, | ||
"coordinates": [ | ||
55.778265, | ||
12.593155 | ||
55.776587, | ||
12.592619 | ||
] | ||
} |
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
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
10914
135
6