Permalink
Browse files

Added monitorModules option

Fixed path references when already in file url form
  • Loading branch information...
1 parent 6460bde commit 0f6287d146655c1b5fc49055a9ae5e8f143c486b @kriszyp committed Oct 14, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/nodules.js
View
@@ -25,6 +25,7 @@ var modules = {},
overlays = {},
callbacks = [],
useSetInterval = false,
+ monitorModules = true,
packages = {},
filePathMappings = [],
defaultPath = "",
@@ -169,6 +170,7 @@ try{
if(filePathMappingsJson){
var filePathMappingsObject = JSON.parse(filePathMappingsJson);
useSetInterval = filePathMappingsObject.useSetInterval;
+ monitorModules = filePathMappingsObject.monitorModules !== false;
for(var i in filePathMappingsObject){
filePathMappings.push({
from: RegExp(i),
@@ -752,7 +754,7 @@ var watchedFiles;
function readModuleFile(path, uri){
try{
var source = fs.read(path);
- if(!watching[path] && !dontWatch[uri]){
+ if(monitorModules && !watching[path] && !dontWatch[uri]){
watching[path] = true;
if(fs.watchFile && !useSetInterval){
fs.watchFile(path, {persistent: false, interval: process.platform == "darwin" ? 300 : 0}, possibleChange);
@@ -817,7 +819,7 @@ function cachePath(uri){
filePathMappings.forEach(function(pathMapping){
path = path.replace(pathMapping.from, pathMapping.to);
});
- return ((path.charAt(0) == '/' || path.charAt(1) == ':') ? '' : exports.baseFilePath + '/') + path.replace(/^\w*:(\w*:)?\/\//,'').replace(/!\/?/g,'/'); // remove protocol and replace colons and add base file path
+ return ((path.charAt(0) == '/' || path.charAt(1) == ':' || path.substring(0,5) == "file:") ? '' : exports.baseFilePath + '/') + path.replace(/^\w*:(\w*:)?\/\//,'').replace(/!\/?/g,'/'); // remove protocol and replace colons and add base file path
}
function cache(handler, writeBack){
return function(uri){

0 comments on commit 0f6287d

Please sign in to comment.