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

Adds support for multiple concurrent runtimes #630

Merged
merged 6 commits into from
Dec 13, 2019
Merged

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Dec 11, 2019

What's the problem this PR addresses?

Some packages need to be able to require files from other dependency trees. This isn't possible at the moment, because the PnP runtime covers all require calls.

How did you fix it?

Basically module instances are now "namespaced" based on their PnP API path. When a require call is made to a file that doesn't belong to the original runtime, we find out whether a new runtime could cover it by tracking the closest .pnp.js file in the hierarchy. We then load it and use it.

Some extra subtleties:

  • The PnP artifacts now include eslint-disable in their headers to prevent accidental linting
  • The VirtualFS won't transform anymore paths if the depth component is an invalid number.
  • Virtual folders are now always called $$virtual, and will always be transformed no matter their location. This change was required because the PnP hook didn't know what were the virtual paths for the other runtimes than the initial one.
  • The PnP APIs will be reloaded if their files change (at the moment the check is done between every call; I'll very likely change that to gate this behaviour behind a flag, unless performances aren't noticeable)

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.

1 participant