Comparing version 1.0.2-rc to 1.0.2-rc3
@@ -98,3 +98,3 @@ 'use strict'; | ||
return '.' + item.replace(/^[\*\.]+/, ''); // remove "*." | ||
}).join('$|'); // return regexp string like: .js$|.jade$ | ||
}).join(','); // return regexp string like: .js$|.jade$ | ||
} | ||
@@ -104,3 +104,3 @@ | ||
// single extensions work | ||
extension += '$'; | ||
// extension += '$'; | ||
@@ -107,0 +107,0 @@ options.ext = extension; |
@@ -9,7 +9,5 @@ 'use strict'; | ||
var load = require('./load'), | ||
bus = require('../utils/bus'), | ||
rules = require('../rules'), | ||
fs = require('fs'), | ||
path = require('path'), | ||
existsSync = fs.existsSync || path.existsSync, | ||
utils = require('../utils'), | ||
bus = utils.bus, | ||
checkWatchSupport = require('./checkWatchSupport'); | ||
@@ -55,13 +53,27 @@ | ||
if (!options.monitor) { | ||
options.monitor = utils.clone(options.watch || ['*.*']); | ||
options.monitor.push.apply((options.ignore || []).map(function (rule) { | ||
return '!' + rule; | ||
})); | ||
} | ||
if (options.execOptions.ext) { | ||
rules.watch.add(new RegExp(options.execOptions.ext)); | ||
// rules.watch.add(new RegExp(options.execOptions.ext)); | ||
options.execOptions.ext.split(',').forEach(function (ext) { | ||
options.monitor.push('*' + ext); | ||
}); | ||
} | ||
delete options.watch; | ||
delete options.ignore; | ||
// read directories to monitor | ||
options.watch.forEach(function (dir) { | ||
dir = path.resolve(dir); | ||
if (existsSync(config.dir)) { | ||
config.dirs.push(path.resolve(config.dir)); | ||
} | ||
}); | ||
// options.watch.forEach(function (dir) { | ||
// dir = path.resolve(dir); | ||
// if (existsSync(dir)) { | ||
// config.dirs.push(path.resolve(dir)); | ||
// } | ||
// }); | ||
@@ -68,0 +80,0 @@ if (config.dirs.length === 0) { |
@@ -9,2 +9,3 @@ 'use strict'; | ||
childProcess = require('child_process'), | ||
minimatch = require('minimatch'), | ||
exec = childProcess.exec, | ||
@@ -126,25 +127,46 @@ restartTimer = null, | ||
function filterAndRestart(files) { | ||
var data = {}; | ||
if (files.length) { | ||
data.all = files.length; | ||
utils.log.detail('files triggering change check: ' + files.join('\n')); | ||
var cwd = process.cwd(); | ||
utils.log.detail('files triggering change check: ' + files.map(function (file) { | ||
return path.relative(cwd, file); | ||
}).join(', ')); | ||
files = files.filter(ignoredFilter); | ||
var rules = config.options.monitor.sort(function (a, b) { | ||
return b.split('/').length - a.split('/').length; | ||
}).map(function (s) { | ||
var prefix = s.slice(0, 1); | ||
if (prefix === '!') { | ||
return '!**/' + s.slice(1); | ||
} | ||
return '**/' + s; | ||
}); | ||
data.ignore = files.length; | ||
var good = [], | ||
ignored = 0, | ||
watched = 0; | ||
if (config.options.watch.length) { | ||
files = files.filter(function (file) { | ||
return config.options.watch.re && config.options.watch.re.test(file); | ||
}); | ||
} | ||
files.forEach(function (file) { | ||
for (var i = 0; i < rules.length; i++) { | ||
if (rules[i].slice(0, 1) === '!') { | ||
if (!minimatch(file, rules[i])) { | ||
ignored++; | ||
break; | ||
} | ||
} else { | ||
if (minimatch(file, rules[i])) { | ||
watched++; | ||
utils.log.detail('matched rule: ' + rules[i]); | ||
good.push(file); | ||
break; | ||
} | ||
} | ||
} | ||
}); | ||
data.watch = files.length; | ||
utils.log.detail('changes after filters (all/ignored/watched): ' + [files.length, ignored, watched].join('/')); | ||
utils.log.detail('changes after filters (pre/ignored/valid): ' + [data.all, data.ignore, data.watch].join('/')); | ||
// reset the last check so we're only looking at recently modified files | ||
config.lastStarted = Date.now(); | ||
if (files.length) { | ||
if (good.length) { | ||
if (restartTimer !== null) { | ||
@@ -155,3 +177,3 @@ clearTimeout(restartTimer); | ||
utils.log.status('restarting due to changes...'); | ||
files.forEach(function (file) { | ||
good.forEach(function (file) { | ||
utils.log.detail(path.relative(process.cwd(), file)); | ||
@@ -158,0 +180,0 @@ }); |
@@ -90,11 +90,16 @@ 'use strict'; | ||
config.dirs.forEach(function (dir) { | ||
utils.log.info('watching: ' + dir); | ||
}); | ||
var none = function (v) { | ||
return v; | ||
}; | ||
utils.log.detail('ignoring: ' + config.options.monitor.map(function (rule) { | ||
return rule.slice(0, 1) === '!' ? rule.slice(1) : false; | ||
}).filter(none).join(' ')); | ||
utils.log.info('watching: ' + config.options.monitor.map(function (rule) { | ||
return rule.slice(0, 1) !== '!' ? rule : false; | ||
}).join(' ')); | ||
utils.log.detail('watching extensions: ' + config.options.ext); | ||
config.options.ignore.forEach(function (pattern) { | ||
utils.log.detail('ignoring: ' + pattern); | ||
}); | ||
@@ -175,14 +180,15 @@ if (config.options.dump) { | ||
// on exception *inside* nodemon, shutdown wrapped node app | ||
if (!config.required) process.on('uncaughtException', function (err) { | ||
console.error('exception in nodemon killing node'); | ||
console.error(err.stack); | ||
console.error(); | ||
console.error('If appropriate, please file an error: http://github.com/remy/nodemon/issues/new\n'); | ||
if (!config.required) { | ||
process.exit(1); | ||
} | ||
}); | ||
if (!config.required) { | ||
process.on('uncaughtException', function (err) { | ||
console.error('exception in nodemon killing node'); | ||
console.error(err.stack); | ||
console.error(); | ||
console.error('If appropriate, please file an error: http://github.com/remy/nodemon/issues/new\n'); | ||
if (!config.required) { | ||
process.exit(1); | ||
} | ||
}); | ||
} | ||
module.exports = nodemon; | ||
@@ -0,1 +1,5 @@ | ||
'use strict'; | ||
var utils = require('../utils'); | ||
// internal | ||
@@ -42,3 +46,7 @@ var reEscComments = /\\#/g, | ||
if (rule instanceof RegExp) { | ||
rule = ':' + rule.toString().replace(/^\/(.*?)\/$/g, '$1'); | ||
// rule = ':' + rule.toString().replace(/^\/(.*?)\/$/g, '$1'); | ||
utils.log.error('RegExp format no longer supported, but globs are.'); | ||
console.log(rule); | ||
return; | ||
} | ||
@@ -58,2 +66,3 @@ | ||
rule = rule.substring(1); | ||
utils.log.error('RegExp no longer supported: ' + rule); | ||
regexp = true; | ||
@@ -66,6 +75,6 @@ } else if (rule.length === 0) { | ||
if (regexp) { | ||
rules[which].push(rule); | ||
// rules[which].push(rule); | ||
} else { | ||
rule = rule.replace(reEscapeChars, '\\$&') | ||
.replace(reAsterisk, '.*'); | ||
// rule = rule.replace(reEscapeChars, '\\$&') | ||
// .replace(reAsterisk, '.*'); | ||
@@ -76,3 +85,3 @@ rules[which].push(rule); | ||
// compile a regexp of all the rules for this ignore or watch | ||
rules[which].re = new RegExp(rules[which].join('|')); | ||
// rules[which].re = new RegExp(rules[which].join('|')); | ||
} |
@@ -25,3 +25,3 @@ 'use strict'; | ||
Object.keys(this.log).forEach(function (method) { | ||
// this.log[method] = noop; | ||
this.log[method] = noop; | ||
}.bind(this)); | ||
@@ -33,6 +33,9 @@ } | ||
Object.keys(this.log).forEach(function (method) { | ||
// delete this.log[method]; | ||
delete this.log[method]; | ||
}.bind(this)); | ||
} | ||
this.debug = false; | ||
}, | ||
regexpToText: function (t) { | ||
return t.replace(/\.\*\\./g, '*.').replace(/\\{2}/g, '^^').replace(/\\/g, '').replace(/\^\^/g, '\\'); | ||
} | ||
@@ -39,0 +42,0 @@ }; |
@@ -24,3 +24,3 @@ { | ||
], | ||
"version": "1.0.2rc", | ||
"version": "1.0.2-rc3", | ||
"preferGlobal": "true", | ||
@@ -47,4 +47,5 @@ "licenses": [ | ||
"dependencies": { | ||
"update-notifier": "~0.1.7" | ||
"update-notifier": "~0.1.7", | ||
"minimatch": "~0.2.14" | ||
} | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
119062
87
1713
15
4
2
+ Addedminimatch@~0.2.14
+ Addedlru-cache@2.7.3(transitive)
+ Addedminimatch@0.2.14(transitive)
+ Addedsigmund@1.0.1(transitive)