Closed EndangeredMassa closed 11 years ago
This sounds good. We can rip off mocha here. They use an option with extension:module, where the module adds require.extensions
support for that extension. Then, since it's a global mutation, we can just pull that function out of our environment. Like #28, this will rely on michaelficarra/jedediah#1.
Unfortunately, we can't just use require.extensions
here, since the function you put on require.extensions
just calls the .compile
method of its first argument, and doesn't have a guaranteed return value. Since we have a sync interface, there's nothing we can do with this. Going with your original suggestion.
It looks like the file watcher is only available on the CLI. The problem is that I need custom extension handler for my project.
Is there a way to add this to the CLI? I can't think of a great interface for it, but something like
-h extension:path-to-file
might be useful enough. That file would be a module that exports a function that acts just like the handlers object callbacks.Then, if you allow lists in some way, I could use the same transform method for multiple extensions.
It seems like a complex option to pass on a command line, but it would be very useful to me.