Don't disable the cache when inside proxyquire() and other improvements#9
Merged
thlorenz merged 8 commits intothlorenz:masterfrom May 21, 2014
Merged
Don't disable the cache when inside proxyquire() and other improvements#9thlorenz merged 8 commits intothlorenz:masterfrom
proxyquire() and other improvements#9thlorenz merged 8 commits intothlorenz:masterfrom
Conversation
Contributor
|
👍 👍 👍 |
Owner
|
Thanks, will have a look when I get a breather. |
|
👍 Works for me. Fixes #6 |
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.
Contributor
|
@thlorenz any chance you could take a look at this? i know you're super busy, but it's an awesome PR :) |
Owner
|
I'll dedicate some time tomorrow to have a look. |
Owner
|
Went out as Thank you both for contributing this. Awesome work @jhiesey! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.