Any way to customize default nomask used in file_scan_directory() to allow Node.js modules? I would like to use Node.js modules (such as grunt-contrib-imagemin) in my Drupal theme, but that adds *.info files which confuses Drupal.  If there were some way to change the default value of nomask used in file_scan_directory() to include 'node_modules' or some way to tell Node.js to use a local folder other than node_modules then the problem would be solved. 

There is a post here that suggests patching Drupal core, but I'm hoping there's a more elegant solution.
As far as Drupal/PHP are concerned, no, there's no option other than either changing the default arguments to the function, or finding all calls to that function that don't include the 2nd arg, and updating things there. Either way you're likely to have to patch a core method or two.

NPM's convention is to use a folder called node_modules. They don't want to change that (https://github.com/npm/npm/issues/2734, https://github.com/npm/npm/issues/775), but there is a prefix config option which may be suitable for your needs.