Skip to content

Commit

Permalink
perf: filter by ext on chokidar side
Browse files Browse the repository at this point in the history
  • Loading branch information
pahan35 committed Mar 28, 2023
1 parent b11ddd1 commit 3485034
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 0 additions & 14 deletions lib/monitor/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,6 @@ function match(files, monitor, ext) {

debug('good', good)

// finally check the good files against the extensions that we're monitoring
if (ext) {
if (ext.indexOf(',') === -1) {
ext = '**/*.' + ext;
} else {
ext = '**/*.{' + ext + '}';
}

good = good.filter(function (file) {
// only compare the filename to the extension test
return minimatch(path.basename(file), ext, minimatchOpts);
});
} // else assume *.*

var result = good.concat(whitelist);

if (utils.isWindows) {
Expand Down
2 changes: 2 additions & 0 deletions lib/monitor/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ function watch() {
ignored.push(dotFilePattern);
}

const ext = undefsafe(config, 'options.execOptions.ext') || '';
var watchOptions = {
ignorePermissionErrors: true,
ignored: ignored,
persistent: true,
usePolling: config.options.legacyWatch || false,
interval: config.options.pollingInterval,
ext: ext.length > 0 ? ext.split(',') : undefined,
// note to future developer: I've gone back and forth on adding `cwd`
// to the props and in some cases it fixes bugs but typically it causes
// bugs elsewhere (since nodemon is used is so many ways). the final
Expand Down

0 comments on commit 3485034

Please sign in to comment.