Skip to content
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

Allow intercept of transitive require calls files. #3

Closed
wants to merge 4 commits into from

Conversation

jamestalmage
Copy link

This paves the way for avajs/ava#156

This provides a really barebones API for intercepting require calls inside the module. It is up to the implementor to provide caching, resolve file names, load from disk, etc. (which we want to handle ourselves inside ava anyways).

// @sindresorhus @vdemedes

var paths = Module._nodeModulePaths(path.dirname(filename));

var m = new Module(filename, module.parent);

var requireHook = opts.require;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require option should be described in readme.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, for sure.

Still a work in progress. (which I now realize I did not mention).

@jamestalmage
Copy link
Author

@floatdrop
Hold off merging for now.
I still need to address documentation, and we may want to improve this a little.

I will have an ava PR up shortly that uses these modifications.

@floatdrop
Copy link
Owner

@jamestalmage sure, no rush at all :)

@sindresorhus
Copy link

👍 Good idea! Lgtm when it has some docs.

@jimbuck
Copy link

jimbuck commented Sep 29, 2016

Has this feature been abandoned? Is there a better way to handle it? I'm just curious, for experimental purposes.

@jamestalmage
Copy link
Author

I would say it is abandoned. We went a different route in AVA, and I'm probably not going to get around to fixing this.

If someone else wants to take up the torch, be my guest.

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