component-require
Advanced tools
Comparing version 0.3.1 to 1.0.0
0.3.1 / 2013-09-12 | ||
1.0.0 / 2013-12-29 | ||
================== | ||
* remove alias support | ||
0.3.1 / 2013-09-12 | ||
================== | ||
* fix circular dependency issue | ||
0.3.0 / 2013-08-04 | ||
0.3.0 / 2013-08-04 | ||
================== | ||
@@ -9,0 +14,0 @@ |
@@ -49,8 +49,2 @@ | ||
/** | ||
* Registered aliases. | ||
*/ | ||
require.aliases = {}; | ||
/** | ||
* Resolve `path`. | ||
@@ -70,3 +64,3 @@ * | ||
require.resolve = function(path) { | ||
if (path.charAt(0) === '/') path = path.slice(1); | ||
if ('/' == path.charAt(0)) path = path.slice(1); | ||
@@ -81,6 +75,7 @@ var paths = [ | ||
for (var i = 0; i < paths.length; i++) { | ||
for (var i = 0, len = paths.length; i < len; i++) { | ||
var path = paths[i]; | ||
if (require.modules.hasOwnProperty(path)) return path; | ||
if (require.aliases.hasOwnProperty(path)) return require.aliases[path]; | ||
if (require.modules.hasOwnProperty(path)) { | ||
return path; | ||
} | ||
} | ||
@@ -106,3 +101,3 @@ }; | ||
for (var i = 0; i < path.length; ++i) { | ||
for (var i = 0, len = path.length; i < len; ++i) { | ||
if ('..' == path[i]) { | ||
@@ -131,17 +126,2 @@ curr.pop(); | ||
/** | ||
* Alias a module definition. | ||
* | ||
* @param {String} from | ||
* @param {String} to | ||
* @api private | ||
*/ | ||
require.alias = function(from, to) { | ||
if (!require.modules.hasOwnProperty(from)) { | ||
throw new Error('Failed to alias "' + from + '", it does not exist'); | ||
} | ||
require.aliases[to] = from; | ||
}; | ||
/** | ||
* Return a require function relative to the `parent` path. | ||
@@ -155,3 +135,3 @@ * | ||
require.relative = function(parent) { | ||
var p = require.normalize(parent, '..'); | ||
var root = require.normalize(parent, '..'); | ||
@@ -186,11 +166,3 @@ /** | ||
if ('/' == c) return path.slice(1); | ||
if ('.' == c) return require.normalize(p, path); | ||
// resolve deps by returning | ||
// the dep in the nearest "deps" | ||
// directory | ||
var segs = parent.split('/'); | ||
var i = lastIndexOf(segs, 'deps') + 1; | ||
if (!i) i = 0; | ||
path = segs.slice(0, i + 1).join('/') + '/deps/' + path; | ||
if ('.' == c) return require.normalize(root, path); | ||
return path; | ||
@@ -197,0 +169,0 @@ }; |
{ | ||
"name": "component-require", | ||
"version": "0.3.1", | ||
"version": "1.0.0", | ||
"description": "require implementation for component(1)", | ||
"keywords": ["require", "component"], | ||
"keywords": [ | ||
"require", | ||
"component" | ||
], | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -12,3 +15,7 @@ "dependencies": {}, | ||
}, | ||
"main": "index" | ||
"main": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/component/require.git" | ||
} | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
6
6228
144