Open cdata opened 2 months ago
Currently, CommonModule's environment produces a SyntaxError
upon accessing import.meta
, whereas CommonScript has an (empty) Object. These aren't ES modules in the sense that they can import modules (outside of authoring/bundling), so the SyntaxError approach seems more appropriate, though possibly more difficult to recreate within boa.
Yah, I agree. By default I would seek to emulate whatever the behavior happens to be in the Common Module case.
Eventually we should probably support reading import.meta
without throwing, but that can be covered by a different issue.
As of #32 , we have a Common Module invocation path that utilizes a JS VM running inside of a Wasm VM to interpret JS on-demand. There will be several mitigations required to reduce the chance of user code detecting that it is running as a compiled module vs. interpreted. One such mitigation is to ensure that
import.meta
presents the same state to user code in compiled and interpreted modes.