Dynamic import and import.meta in Compartment

3 views
Skip to first unread message

Kris Kowal

unread,
Apr 20, 2022, 6:26:12 PM4/20/22
to SES-strategy
I’ve just updated an issue in SES that pertains to the design and the shim implementation of dynamic import and import metadata that opens a few questions for the champions group.

https://github.com/endojs/endo/issues/291

1. At what time should an importMetaHook be called. I propose immediately preceding the initialization of any module that utters import.meta.

2. If the loadHook of a compartment returns a “module record envelope” with a “meta” property, should the properties of moduleRecordEnvelope.meta be transferred to import.meta by the semantics of Object.assign or Object.defineProperties and Object.getOwnPropertyDescriptors? The former has the virtue of simplicity but the latter would allow lazy initialization. However, the current design of importMetaHook affords an alternative, cheaper mechanism for lazilly producing `import.meta.resolve` closures.

Please reply on the issue if you’ve got an opinion. I would of course like to capture the resolution on the compartments proposal as well, and would be greatly obliged if someone volunteers to do that paperwork.

Kris
Reply all
Reply to author
Forward
0 new messages