Skip to content

Don't disable the cache when inside proxyquire() and other improvements#9

Merged
thlorenz merged 8 commits intothlorenz:masterfrom
jhiesey:master
May 21, 2014
Merged

Don't disable the cache when inside proxyquire() and other improvements#9
thlorenz merged 8 commits intothlorenz:masterfrom
jhiesey:master

Conversation

@jhiesey
Copy link
Contributor

@jhiesey jhiesey commented May 6, 2014

This is the pull request I promised a week ago in IRC together with @feross.

This change allows using proxyquireify with tape, which has both circular dependencies and keeps global state. Previously it would fail due to the lack of caching.

Proxyquireify can now be used as a browserify plugin (as opposed to a browserify replacement) as well.

I realize this is a rather big pull request. I'm open to feedback, so let me know what you think.

@feross
Copy link
Contributor

feross commented May 6, 2014

👍 👍 👍

@thlorenz thlorenz self-assigned this May 6, 2014
@thlorenz
Copy link
Owner

thlorenz commented May 6, 2014

Thanks, will have a look when I get a breather.

@weilu
Copy link

weilu commented May 16, 2014

👍 Works for me. Fixes #6

jhiesey and others added 8 commits May 17, 2014 12:13
Instead of entirely disabling the browserify cache, just switch to
a different cache each time `proxyquire` is called. This allows
modules like `tape`, which have global state and/or circular
dependencies, to work correctly.

Also, move the require monkeypatching from the transform to the
prelude, wich makes it possible to build code with proxyquireify
even if proxyquireify is not used and is not built into the
bundle. This allows test code to be always built with proxyquireify
even if the module is not included as a dependency.
@feross
Copy link
Contributor

feross commented May 19, 2014

@thlorenz any chance you could take a look at this? i know you're super busy, but it's an awesome PR :)

@thlorenz
Copy link
Owner

I'll dedicate some time tomorrow to have a look.

@thlorenz thlorenz merged commit b7807ea into thlorenz:master May 21, 2014
@thlorenz
Copy link
Owner

Went out as 0.5.

Thank you both for contributing this. Awesome work @jhiesey!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants