-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved watch onto dynamic file extensions #906
Conversation
I was about to add json to the regex (/.(js|coffee|json)$/). This is a better solution. +1 |
This won't escape extensions such as |
@mal Can you elaborate further? {
'.js': function () { /* Process JS */ },
'.json': function () { /* Process JSON */ },
'.node': function () { /* Process node binary */ }
} so the RegExp will look like However, now that you mention it, I am not escaping the |
...and patched. |
Ahh my mistake, I assumed that |
@visionmedia What is it going to take to get this PR merged? |
escapedExts = exts.map(function (ext) { | ||
return ext.replace(/\./g, '\\.'); | ||
}), | ||
extRegexp = new RegExp('(' + escapedExts.join('|') + ')$'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move these stuff out of exports.files and do var extRegexp = requireExtensionsRegexp()
or similar, not a huge deal even a rebase would be sweet and I'll merge
Alright, cool. Unfortunately, I am swamped this weekend but I will get to it by Wednesday. |
@visionmedia To prevent further delays, I am going with the shortest route. I have rebased and squashed the PR. |
Not sure this implementation is a good idea, since |
Ah, I had no idea. In that case, it might be wise to use a default + feature detection + optional CLI based overrides (the overriding was my purpose for the original PR). Default + feature detection is easy: var exts = require.extensions ? require.extensions : ['.js', '.json', '.node', '.coffee', '.litcoffee'];
// If you want to be nice, you would add in .yml, yaml for js-yaml users. For CLI based overrides, you would probably need to start using an instance level |
@twolfson deprecation in the sense that we probably shouldn't use this due to it being unreliable, rather than the api missing. see these messages (and discussion): https://groups.google.com/d/msg/nodejs/QsOEWvptQpA/LKqTL4hLK_4J and https://groups.google.com/d/msg/nodejs/QsOEWvptQpA/ZVMSu8Sq66AJ i think we should go with default + optional cli overrides only and not use |
What I was suggesting is feature detection, the API is not going to change, it will only be removed. I no longer have time to dedicate to this pull request. Please choose to use it, fork it, or scrap it. Thank you for your consideration. |
This PR is 7 months old. Please let me know what the decision is (for merge, fork, or deletion). |
if it's deprecated then yeah screw that, we'll have to add flags or something, though I just wouldn't use watch personally, just complicates things, |
I am developing a test framework on top of
mocha
which uses.json
and.yaml
files as part of its usage. To make--watch
work with the relevant files, I have expandedutils.files
to watch all file extensions we have registered.Additionally, this patches #804.
If you are interested in the framework, it is called doubleshot.