Comparing version 0.1.5 to 0.1.6
@@ -26,2 +26,19 @@ "use strict"; | ||
/** | ||
********************************** | ||
PUBLIC METHODS | ||
********************************** | ||
**/ | ||
scan.setIgnoreAndRescan = function(foldersToIgnore_){ | ||
foldersToIgnore = foldersToIgnore_.concat(['node_modules']); | ||
return rescan(); | ||
} | ||
/** | ||
********************************** | ||
PRIVATE METHODS | ||
********************************** | ||
**/ | ||
function rescan(){ | ||
@@ -35,9 +52,3 @@ filesInProject = {}; | ||
scan.setIgnoreAndRescan = function(foldersToIgnore_){ | ||
foldersToIgnore = foldersToIgnore_.concat(['node_modules']); | ||
return rescan(); | ||
} | ||
function _scan (dir, extensions){ | ||
@@ -88,3 +99,6 @@ var file, files, filePath, _i, _len; | ||
if (filesInProject[alias] !== undefined){ | ||
ambiguousFileNames[alias] = alias; | ||
if (!ambiguousFileNames[alias]) { | ||
ambiguousFileNames[alias] = [filesInProject[alias]]; | ||
} | ||
ambiguousFileNames[alias].push(realpath); | ||
}else{ | ||
@@ -91,0 +105,0 @@ filesInProject[alias] = realpath; |
@@ -27,3 +27,7 @@ "use strict"; | ||
} | ||
/** | ||
********************************** | ||
PUBLIC METHODS | ||
********************************** | ||
**/ | ||
rekuire.path = function(requirement){ | ||
@@ -40,2 +44,8 @@ return getPath(requirement); | ||
/** | ||
********************************** | ||
PRIVATE METHODS | ||
********************************** | ||
**/ | ||
function getPath(requirement){ | ||
@@ -58,3 +68,5 @@ var location = getModule(requirement).path; | ||
if (ambiguousFileNames[requirement] !== undefined){ | ||
throw new Error('Ambiguity Error: There are more then one files that is named '+requirement); | ||
throw new Error('Ambiguity Error: There are more then one files that is named '+requirement+ | ||
'. \n\t' + ambiguousFileNames[requirement].join('\n\t') + | ||
'\nYou can use require("rekuire").ignore("folder_to_ignore") to prevent Rekuire from scanning unwanted folders.'); | ||
} | ||
@@ -61,0 +73,0 @@ |
{ | ||
"name": "rekuire", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "'rekuire' is basically node's 'require' without the relative paths", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -18,14 +18,17 @@ Rekuire [![NPM version](https://badge.fury.io/js/rekuire.png)](http://badge.fury.io/js/rekuire) | ||
---------- | ||
####0.1.6 | ||
> * Added colliding files paths to Ambiguity Error | ||
####0.1.5 | ||
> * fixed a bug that causes failures when scanning a package with higher os privileges (thanks [Danny][danny]!) | ||
> * Fixed a bug that causes failures when scanning a package with higher os privileges (thanks [Dany][dany]!) | ||
####0.1.4 | ||
> * added a method to ignore folders while searching the right files (for example, the js files in the server's static folder) | ||
> * Added a method to ignore folders while searching the right files (for example, the js files in the server's static folder) | ||
####0.1.3 | ||
> * you can now rekuire file according to the relative path of the file | ||
> * added support for *index.js* files inside a folder - can be retrieved by the folder path | ||
> * Added support for *index.js* files inside a folder - can be retrieved by the folder path | ||
####0.1.2 | ||
> * added support for **.coffee** files and **.json** | ||
> * Added support for **.coffee** files and **.json** | ||
@@ -109,2 +112,2 @@ - - - | ||
[issue]:https://github.com/nadav-dav/rekuire/issues | ||
[danny]:https://github.com/danyshaanan | ||
[dany]:https://github.com/danyshaanan |
@@ -115,3 +115,15 @@ "use strict"; | ||
expect(error).not.toBeNull(); | ||
}) | ||
}); | ||
it("should specify the conflictions", function(){ | ||
var rek = require('rekuire'); | ||
var error = null; | ||
try{ | ||
rek('SameNamedModule'); | ||
}catch(e){ | ||
error = e; | ||
} | ||
expect(error.message).toContain("test/testResources/nestedPackage/folder1/SameNamedModule.js"); | ||
expect(error.message).toContain("test/testResources/nestedPackage/folder2/SameNamedModule.js"); | ||
}); | ||
}); | ||
@@ -118,0 +130,0 @@ |
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
22117
455
112