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

feat(core): support compile to wasi target #22870

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Brooooooklyn
Copy link
Contributor

This pull request is trying to add wasm32-wasi target support for the nx/native

To test the build, you can run the following commands:

  • rustup target add wasm32-wasip1-threads
  • pnpm exec napi build --release --platform --package-json-path packages/nx/package.json --manifest-path packages/nx/Cargo.toml --js ./native-bindings.js -o packages/nx/src/native --target wasm32-wasip1-threads

And the wasm file will be built at packages/nx/src/native/nx.wasm32-wasi.wasm

Blocked by:

The pseudo_terminal mod is excluded on the wasm32 targets, which is as expected.

The watch mod is excluded because of the upstream watchexec deps introduced by ignore-files don't support the wasi target at this moment (but we can improve it).

Copy link

vercel bot commented Apr 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Apr 27, 2024 1:28am

@Brooooooklyn Brooooooklyn changed the title Wasm feat(core): support compile to wasi target Apr 18, 2024
@Brooooooklyn
Copy link
Contributor Author

After spending several hours reviewing the source code of watchexec, a dependency of nx watch feature, I believe it might be quite challenging to successfully compile the nx watch module's functionality into wasi. This is because it heavily utilizes tokio::signal::unix::signal and stdio interfaces, which lack corresponding system calls in wasi-preview1 (currently, Node.js only supports wasi-preview1). Future versions like wasi-preview2 might offer support, but it will also require waiting for underlying dependencies such as tokio to incorporate support.

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

Successfully merging this pull request may close these issues.

None yet

2 participants