autorequire
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -17,4 +17,4 @@ (function() { | ||
autorequire = function() { | ||
var CustomConvention, convention, conventionAndOrOptions, conventionPrototype, key, options, requirePath, rootPath, value, workingDir; | ||
requirePath = arguments[0], conventionAndOrOptions = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
var CustomConvention, convention, conventionAndOrOverrides, conventionPrototype, key, overrides, requirePath, rootPath, value, workingDir; | ||
requirePath = arguments[0], conventionAndOrOverrides = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
if (requirePath[0] !== '.') { | ||
@@ -25,6 +25,6 @@ raise(TypeError, 'autorequire only supports ./relative paths for now.'); | ||
rootPath = path.normalize(workingDir + '/' + requirePath); | ||
if (typeof conventionAndOrOptions[conventionAndOrOptions.length - 1] === 'object') { | ||
options = conventionAndOrOptions.pop(); | ||
if (typeof conventionAndOrOverrides[conventionAndOrOverrides.length - 1] === 'object') { | ||
overrides = conventionAndOrOverrides.pop(); | ||
} | ||
convention = conventionAndOrOptions.shift() || 'Default'; | ||
convention = conventionAndOrOverrides.shift() || 'Default'; | ||
if (typeof convention === 'string') { | ||
@@ -39,3 +39,3 @@ if (!conventions[convention]) { | ||
} | ||
if (options) { | ||
if (overrides) { | ||
CustomConvention = (function() { | ||
@@ -48,5 +48,5 @@ __extends(CustomConvention, conventionPrototype); | ||
})(); | ||
for (key in options) { | ||
if (!__hasProp.call(options, key)) continue; | ||
value = options[key]; | ||
for (key in overrides) { | ||
if (!__hasProp.call(overrides, key)) continue; | ||
value = overrides[key]; | ||
CustomConvention.prototype[key] = value; | ||
@@ -53,0 +53,0 @@ } |
(function() { | ||
var Module, path, vm; | ||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | ||
path = require('path'); | ||
@@ -14,5 +13,5 @@ Module = require('module'); | ||
self = this; | ||
require = __bind(function(path) { | ||
return this.require(path); | ||
}, this); | ||
require = function(path) { | ||
return self.require(path); | ||
}; | ||
require.resolve = function(request) { | ||
@@ -19,0 +18,0 @@ return Module._resolveFilename(request, self)[1]; |
@@ -15,3 +15,3 @@ (function() { | ||
require = __bind(function(path) { | ||
return this.require(path); | ||
return self.require(path); | ||
}, this); | ||
@@ -18,0 +18,0 @@ require.resolve = function(request) { |
@@ -35,3 +35,3 @@ (function() { | ||
ModuleGroupFactory.prototype.appendIntrospectiveProperties = function() { | ||
Object.defineProperty(this.moduleGroup, '__path', { | ||
Object.defineProperty(this.moduleGroup, '__dirname', { | ||
value: this.path, | ||
@@ -38,0 +38,0 @@ enumerable: false |
{ | ||
"name": "autorequire", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Automatically requires source for a module/project, provided you follow a convention.", | ||
@@ -5,0 +5,0 @@ "keywords": ["require", "autorequire", "autoload", "modules", "load", "loader"], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
198149
61
836