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

Replace runVMScript() with getInternalVMContext() #2768

Merged
merged 2 commits into from Jan 2, 2020
Merged

Conversation

domenic
Copy link
Member

@domenic domenic commented Jan 1, 2020

This allows more flexibility for vm-using consumers. Closes #2731.

@SimenB please take a look and let me know what you think!

This allows more flexibility for vm-using consumers. Closes #2731.
Copy link
Contributor

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

This is perfect, thanks!

@domenic domenic merged commit 11be37a into master Jan 2, 2020
Comment on lines +332 to +334
script.runInContext(vmContext);
script.runInContext(vmContext);
script.runInContext(vmContext);
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, the variable is named s instead of script.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sigh, thanks. I'll do a force-push.

@SimenB
Copy link
Contributor

SimenB commented Jan 20, 2020

Just to follow up, this was a great call rather than messing with the compileFunction approach I started with. I've looked into running modules in vm and we need access to the context when constructing the module, not just when actually evaluating/running it (at least as the current experimental API is): https://nodejs.org/api/vm.html#vm_constructor_new_vm_sourcetextmodule_code_options

So exposing the context directly was the correct call without jsdom having to add a bunch of extra apis/abstractions 👍

@TimothyGu TimothyGu deleted the vm-context branch January 24, 2020 05:06
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.

None yet

4 participants