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

XS Compartment constructor with module loader hooks #536

Closed
dckc opened this issue Dec 3, 2020 · 10 comments
Closed

XS Compartment constructor with module loader hooks #536

dckc opened this issue Dec 3, 2020 · 10 comments
Assignees
Labels
kriskowal-reviewed-2024-01 Issues that kriskowal is satisfied do not need attention from team bug review as of January, 2024 xsnap

Comments

@dckc
Copy link
Contributor

dckc commented Dec 3, 2020

@kriskowal my current solution in agoric-sdk is endo-load.js, called from start-xs.js

It consumes the output of findmods.js, which runs under node.js and uses filing-cabinet to walk the tree of module dependencies.

As I think I mentioned, in contrast to xsnap, where all .js scripts and modules are loaded / parsed at runtime, start-xs.js and endo-load.js start in a world where all the StaticModuleRecords are in compiled bytecodes. See Makefile for details.

originally raised as: Agoric/agoric-sdk#57

@dckc dckc changed the title using node.js module specifiers in XS via Compartment module map XS Compartment constructor with module loader hooks Jan 25, 2021
@dckc
Copy link
Contributor Author

dckc commented Jan 25, 2021

Now that findmods.js is obsolete in favor of xsnap and rollup, let's use this to represent dynamicModuleLoading and such as discussed in Agoric/agoric-sdk#2107 .

@dckc
Copy link
Contributor Author

dckc commented Mar 4, 2021

@kriskowal here's hoping you can get to this soonish...

@kriskowal
Copy link
Member

This might be ready-to-try. It needs compartment-mapper and ses-shim (full stack, including babel) running in XS.

@dckc
Copy link
Contributor Author

dckc commented Mar 4, 2021

Including babel? I thought the purpose of this was to avoid babel. I wonder where I got confused.

@kriskowal
Copy link
Member

Oh, no. I am confused because you put it on my plate. If it’s on my plate, that implies we’d be doing compartments with the ses-shim. If we’re doing “XS Compartment constructor with module loader hooks”, we’re writing C.

@dckc
Copy link
Contributor Author

dckc commented Mar 4, 2021

yes, I'm kinda muddled in my thinking. Hm.

@erights
Copy link
Contributor

erights commented Mar 4, 2021

My understanding is that the next step is to use the builtin XS Compartment only as an evaluator that can replace the 8 magic lines of code. We still need to build @kriskowal 's Compartment on top of that in order to handle modules the way we need.

@erights
Copy link
Contributor

erights commented Mar 4, 2021

When removing the 8 magic lines of code, we need to carefully examine which if any safety checks we're removing. The builtin XS Compartment will still do something not to our liking with dynamic import(...) expression, so we'll still need to prohibit it. We should also continue to prohibit html comments, but this is arguable. We can almost drop the prohibition on direct eval, because the builtin XS Compartment implements direct eval correctly. However, there's no way to do so while still enforcing these very prohibitions.

@dckc dckc added the xsnap label Jun 28, 2021
@kriskowal kriskowal added the kriskowal-reviewed-2024-01 Issues that kriskowal is satisfied do not need attention from team bug review as of January, 2024 label Jan 10, 2024
@kriskowal
Copy link
Member

I think this issue largely falls under #400, surfacing native XS Compartment when running SES on XSnap. That in turn also covers work Moddable has already done to support dynamic module loading. All that remains is some hypothetical work to make compartment mapper useful for generating XS native manifests, but I don’t intend to track that since it’s not well-motivated. I’m closing this in favor of ongoing tracking in #400. Please reöpen if this represents some other work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kriskowal-reviewed-2024-01 Issues that kriskowal is satisfied do not need attention from team bug review as of January, 2024 xsnap
Projects
None yet
Development

No branches or pull requests

3 participants