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

Roadmap for stabilization of vm modules #37648

Open
1 of 5 tasks
targos opened this issue Mar 7, 2021 · 25 comments
Open
1 of 5 tasks

Roadmap for stabilization of vm modules #37648

targos opened this issue Mar 7, 2021 · 25 comments
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. experimental Issues and PRs related to experimental features. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. loaders Issues and PRs related to ES module loaders never-stale Mark issue so that it is never considered stale vm Issues and PRs related to the vm subsystem.

Comments

@targos
Copy link
Member

targos commented Mar 7, 2021

According to @SimenB, here are the issues that should probably be taken care of before we unflag and mark vm modules as stable:

/cc @devsnek

@targos targos added esm Issues and PRs related to the ECMAScript Modules implementation. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. vm Issues and PRs related to the vm subsystem. labels Mar 7, 2021
@SimenB
Copy link
Member

SimenB commented Mar 7, 2021

That last one might be a bug/race condition in Jest's implementation still. I haven't found the time to dig into it properly since opening up the issue, unfortunately. It feels like it's related to some module caching or context GC thing, but that's pure speculation. I have some hope it's related to whatever needs fixing for #36351 (again, speculating)

@devsnek
Copy link
Member

devsnek commented Mar 7, 2021

definitely blocked on v8:9968

@SimenB
Copy link
Member

SimenB commented Aug 25, 2021

The above linked v8 issue has been closed as fixed now (:tada:) - any idea of when we'll know if it's enough for Node's use cases?

@targos
Copy link
Member Author

targos commented Aug 25, 2021

The commit fixing the above V8 issue is in V8 9.4. I'll probably open a PR upgrading to that version next week.

@devsnek
Copy link
Member

devsnek commented Aug 25, 2021

it is not fixed quite yet, check v8:10284

@SimenB
Copy link
Member

SimenB commented Aug 25, 2021

Ah ok, thanks for the link! Seems there's quite a bit of activity recently, so hopefully it's not too far away 🙂

@vjeux
Copy link

vjeux commented Feb 2, 2022

Just wanted to say that Jest is blocked on those tasks being completed in order to properly support ESM. It would be amazing if this could be prioritized!

@jasonwilliams
Copy link

jasonwilliams commented Feb 28, 2022

Vitest is also blocked on those tasks too by the looks of vitest-dev/vitest#795 (comment). It seems to segfault on vm.runInThisContext when ran in debug mode on VSCode

@benmccann
Copy link
Contributor

I got another segfault in Vitest: vitest-dev/vitest#317

@piranna
Copy link
Contributor

piranna commented Jun 7, 2022

bytenode is also blocked by this.

@devsnek devsnek added the experimental Issues and PRs related to experimental features. label Jul 19, 2022
@devsnek devsnek added never-stale Mark issue so that it is never considered stale loaders Issues and PRs related to ES module loaders labels Jul 19, 2022
@targos
Copy link
Member Author

targos commented Jul 19, 2022

I think the root V8 bug is now chromium:1238312. There was recent activity on this CL: https://chromium-review.googlesource.com/c/v8/v8/+/3172764

@devsnek
Copy link
Member

devsnek commented Jul 19, 2022

expansion doesn't work for chromium bugs, correct url is: https://bugs.chromium.org/p/chromium/issues/detail?id=1238312

v8 is working on overhauling host_defined_options to be a single Data instead of a FixedArray, as well as moving it to a common place that behaves better with caching for both modules and scripts (this includes the deprecation of v8::ScriptOrModule!!). i don't know what their planned timelines are but there's also some info here: https://bugs.chromium.org/p/chromium/issues/detail?id=1244145

@targos
Copy link
Member Author

targos commented Jul 19, 2022

I added support for chromium: expansion.

@SimenB
Copy link
Member

SimenB commented Sep 23, 2022

Should #44211 be added to the OP?

@silverwind
Copy link
Contributor

vite also would have a use case for VM modules, if they were made stable.

@HarikrishnanBalagopal
Copy link

HarikrishnanBalagopal commented May 3, 2023

Any update on this? As mentioned earlier, using imports in jest test files needs the experimental flag

NODE_OPTIONS=--experimental-vm-modules jest

jestjs/jest#12990 (comment)

@GeoffreyBooth
Copy link
Member

Any update on this?

Pull requests are welcome!

@AlbertMarashi
Copy link

cmon.. it's been years. This feature would help w/ so much in the JS ecosystem

@targos
Copy link
Member Author

targos commented May 9, 2023

Pull requests are still welcome.

@SimenB
Copy link
Member

SimenB commented Sep 14, 2023

After 2.5 years, one of the issues in the OP can finally be checked off 😀

@thernstig
Copy link
Contributor

@joyeecheung can the first item be ticked off since #33439 is closed?

@SimenB
Copy link
Member

SimenB commented Oct 26, 2023

Not sure if there's an issue for it, but the cache misses in vm.Script that was mitigated in #50137 (released in 21.1.0) will resurface when vm modules are unflagged - so fixing the cache in those cases should probably also be a blocker before unflagging/stabilizing.

rekmarks added a commit to MetaMask/create-release-branch that referenced this issue Dec 8, 2023
This PR updates `execa` to `^8.0.1`. Since `execa@>=6.0.0` is ESM-only and `jest` only has experimental ESM support (jestjs/jest#10976), this required switching from `ts-jest` to `babel-jest`. To minimize dependency transpilation, the ESM packages that are necessary to transpile are enumerated in `jest.config.js`.

This version of `execa` includes [automatic escaping of shell arguments](https://github.com/sindresorhus/execa/tree/v8.0.1#execafile-arguments-options), which was the entire point of #112, #113, and this PR.

The state of ESM support in the Node.js ecosystem is absolutely horrible, and I would not recommend further migrations for the time being. We should continue to dual-release our packages and avoid ESM-only dependencies until the ecosystem has matured. For details see the above `jest` issue and nodejs/node#37648.
@metawrap-dev
Copy link

Just to be clear, is this what is blocking VSCode extensions from using ES modules?

@woss
Copy link

woss commented Apr 5, 2024

@metawrap-dev no

@RedYetiDev
Copy link
Member

@nodejs/vm
I believe that #36351 may be fixed (See #36351 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. experimental Issues and PRs related to experimental features. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. loaders Issues and PRs related to ES module loaders never-stale Mark issue so that it is never considered stale vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

No branches or pull requests