gulpjs / rechoir

Prepare a node environment to require files with different extensions.
MIT License
48 stars 12 forks source link

Possible fix for #10 #13

Closed silkentrance closed 9 years ago

silkentrance commented 9 years ago

Have a look. I know that this will break the existing API. It will, however, make the behavior of load() similar to require() so that load() can be used as a drop-in replacement.

This might even go so far as to register the load function as the new require function in the user module, e.g.

var rechoir = require('rechoir')(module);
require = rechoir.load;

var sumfing = require('latest-stats.csv');
...

What do you think?

silkentrance commented 9 years ago

And maybe we can get rid of resolve-sync altogether now that we have the module's require() function?

I do not know, however, if require and module.require are essentially the same function, as require has a few more properties assigned to it.

According to http://nodejs.org/api/modules.html#modules_module_require_id they behave exactly the same.

silkentrance commented 9 years ago

@tkellen merged master, all seems to be well

tkellen commented 9 years ago

Can you rebase to a single commit and then we'll merge this?

silkentrance commented 9 years ago

Uh oh, never done this before. Will try. Also need to add parameter checking.

silkentrance commented 9 years ago

Hope that the latest commit does the trick...

silkentrance commented 9 years ago

Erm, rebasing with published commits seems to be a no-no... Well, cherry pick then? Otherwise I will tear down the branch and recreate it and then we can merge the single commit in the new branch.

tkellen commented 9 years ago

if you rebase/squash you can force push over your old commits and this will automatically update the PR

silkentrance commented 9 years ago

Seems to be ok, when trying to push I get 'everything is up to date'... and I already did the merge, so... you can simply merge 19110c2 as it already contains the changes merged from master...

silkentrance commented 9 years ago

Okay, forced push, forgot to rebase --continue...

silkentrance commented 9 years ago

Thanks for pointing me towards rebase!

silkentrance commented 9 years ago

With load() going to be removed this is now obsolete.