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: isomorphic wasi #1571

Merged
merged 15 commits into from
Feb 17, 2023
Merged

feat: isomorphic wasi #1571

merged 15 commits into from
Feb 17, 2023

Conversation

MarkMcCulloh
Copy link
Contributor

@MarkMcCulloh MarkMcCulloh commented Feb 17, 2023

Current State

wingc is currently consumed in two ways:

This is ok, but there are several downsides:

  • Some code duplication with initialization and invocation of wingc
  • wasmer-js is frankly not well maintained
  • node's wasi only works in node
  • node wasi required node18 or newer and more importantly requires the use of an experimental flag

New Change

I noticed that bun recently started using wasi-js for wasi. This library is a better-maintained fork of wasmer-js. It's part of https://cowasm.org/ which is a super cool project.

So I switched the CLI to use this library to load wingc, and made the playground consume the cli as a library.

TODO

  • Windows?
  • Node16?
  • Docs

By submitting this pull request, I confirm that my contribution is made under the terms of the Monada Contribution License.

package.json Show resolved Hide resolved
apps/wing/src/wingc.ts Outdated Show resolved Hide resolved
apps/wing/src/wingc.ts Show resolved Hide resolved
@MarkMcCulloh MarkMcCulloh marked this pull request as ready for review February 17, 2023 21:30
@MarkMcCulloh MarkMcCulloh requested a review from a team as a code owner February 17, 2023 21:30
apps/wing/src/wingc.ts Outdated Show resolved Hide resolved
@mergify
Copy link
Contributor

mergify bot commented Feb 17, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit b0e799f into main Feb 17, 2023
@mergify mergify bot deleted the mark/isomorphic-wasi branch February 17, 2023 22:37
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.5.52.

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goodness!

MarkMcCulloh added a commit that referenced this pull request Feb 19, 2023
mergify bot pushed a commit that referenced this pull request Feb 19, 2023
The changes in #1571 introduced wasi-js, which has a troublesome preinstall script. Until a fix is found to either get rid of it or make it work for everyone, this reverts all the wasi changes


*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
mergify bot pushed a commit that referenced this pull request Feb 20, 2023
This PR reintroduces #1571 with 3 additional changes to avoid [the last regression](#1578):
- `patch-package` is used to mess with wasi-js, to remove the preinstall script from their package.json. The patching is performed during packaging, where it's actually effective (for downstream consumers).
- wasi-js is included as a bundled dep for winglang to ensure that the patched `package.json` is appropriately patched in time to avoid any hooks. Normally this isn't needed with patch package, but due to the particular mutation I'm not sure this is avoidable
- Added checks to hangar to ensure we avoid introducing script hooks. I verified that these tests pass with the latest version of the repo but fail the version noted in the regression.

The changes from the original PR are untouched.

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
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

4 participants