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

How does the module map deal with relative paths? #38

Open
littledan opened this issue Feb 10, 2020 · 3 comments
Open

How does the module map deal with relative paths? #38

littledan opened this issue Feb 10, 2020 · 3 comments

Comments

@littledan
Copy link
Member

Lots of JS environments use module specifiers which could be either relative or absolute paths. In this case, the module specifier is usually converted into an absolute form, and then that absolute path is used as the key in the module map. However, the conversion/normalization is often done in a host-specific way (since different systems have different specifier syntaxes).

How does the moduleMap of Compartments enable paths to be made absolute, so they can serve as cache keys? What even is the type of the moduleMap exactly?

@dckc
Copy link
Contributor

dckc commented Feb 10, 2020

In at least one experiment (https://gist.github.com/jfparadis/cfd2e965047131fcfac1cb81fdb9b863), the moduleMap is an object map from referrer to specifier to target, where target is a key in a parent Compartment map.

@littledan
Copy link
Member Author

@dckc Thanks for the background. Oh wow, so it's fully denormalized, and you have to pre-calculate all of these referrers to fill in the map? I wonder how practical that is.

@dckc
Copy link
Contributor

dckc commented Feb 10, 2020

Yes, the stuff I've seen kicked around so far is fully denormalized. We'll see how it turns out...

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

No branches or pull requests

2 participants