Comparing version 2.0.1 to 2.1.0
@@ -29,5 +29,3 @@ // Copyright (c) 2013 Daniel Ennis <aikar@aikar.co> | ||
indexMap.push(obj); | ||
obj.__proto__ = proxy(obj.__proto__, loadModule); | ||
dirMap[index] = []; | ||
@@ -48,9 +46,9 @@ } | ||
} else { | ||
var mod = path.join(dir, file); | ||
try { | ||
return require(path.join(dir, file)); | ||
} catch (ignored) { } | ||
return require(require.resolve(mod)); | ||
} catch (ignored) {} | ||
} | ||
} | ||
} | ||
} | ||
@@ -60,3 +58,4 @@ module.exports = registerAutoloader; | ||
function proxy(target, cb){ | ||
var traps = { | ||
return Proxy.create({ | ||
getPropertyDescriptor: Object.getOwnPropertyDescriptor.bind(null, target), | ||
getOwnPropertyDescriptor: Object.getOwnPropertyDescriptor.bind(null, target), | ||
@@ -67,3 +66,2 @@ getOwnPropertyNames: Object.getOwnPropertyNames.bind(null, target), | ||
defineProperty: Object.defineProperty.bind(null, target), | ||
get: function(r,k){ return target[k] }, | ||
set: function(r,k,v){ target[k] = v; return true }, | ||
@@ -73,19 +71,7 @@ has: function(k){ return k in target }, | ||
delete: function(k){ delete target[k]; return true }, | ||
enumerate: function(){ var i=0,k=[]; for (k[i++] in target); return k } | ||
}; | ||
return Proxy.create({ | ||
enumerate: function(){ var i=0,k=[]; for (k[i++] in target); return k }, | ||
get: function(r, key){ | ||
if (key != 'v8debug' && target[key] == undefined) { | ||
var result = cb(key); | ||
if (typeof result == 'undefined') { | ||
throw new ReferenceError(key + ' is not defined'); | ||
} else { | ||
return result; | ||
} | ||
return cb(key); | ||
} | ||
if (key in traps) { | ||
return traps[key].apply(target, arguments); | ||
} | ||
} | ||
@@ -92,0 +78,0 @@ }, Object.getPrototypeOf(target)); |
@@ -5,3 +5,3 @@ { | ||
"description": "Autoloads JS Files", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"homepage": "http://aikar.co", | ||
@@ -12,2 +12,6 @@ "main": "autoloader.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/aikar/autoloader.git" | ||
}, | ||
"scripts": { | ||
@@ -14,0 +18,0 @@ "start":"node autoloader.js" |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
7661
82