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

BREAKING: Remove support for .wasm imports #5135

Merged
merged 4 commits into from
May 7, 2020

Conversation

bartlomieju
Copy link
Member

Importing .wasm files is non-standardized therefore deciding to
support current functionality past 1.0 release is risky.

Besides that .wasm import posed many challenges in our codebase
due to complex interactions with TS compiler which spawned
thread for each encountered .wasm import.

This commit removes:

  • cli/compilers/wasm.rs
  • cli/compilers/wasm_wrap.js
  • two integration tests related to .wasm imports

Importing .wasm files is non-standardized therefore deciding to
support current functionality past 1.0 release is risky.

Besides that .wasm import posed many challenges in our codebase
due to complex interactions with TS compiler which spawned
thread for each encountered .wasm import.

This commit removes:
- cli/compilers/wasm.rs
- cli/compilers/wasm_wrap.js
- two integration tests related to .wasm imports
@bartlomieju bartlomieju requested a review from ry May 7, 2020 15:20
@hayd
Copy link
Contributor

hayd commented May 7, 2020

Couldn't it be --unstable, wasm support is a huge win.

@bartlomieju
Copy link
Member Author

@hayd WASM is still supported, this PR only removes import "./foo.wasm"; support.

You can still use WebAssembly API:

const bytes = new Uint8Array([
  0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x60,
  0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01,
  0x03, 0x61, 0x64, 0x64, 0x00, 0x00, 0x0a, 0x09, 0x01, 0x07, 0x00, 0x20,
  0x00, 0x20, 0x01, 0x6a, 0x0b
]);

async function main() {
  const wasm = await WebAssembly.instantiate(bytes);
  const result = wasm.instance.exports.add(1, 3);
  console.log("1 + 3 =", result);
  if (result != 4) {
    throw Error("bad");
  }
}

main();

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

There is a reference to wasm imports in docs/getting_started/wasm.md

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

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

LGTM

@bartlomieju bartlomieju merged commit 2b66b8a into denoland:master May 7, 2020
@bartlomieju bartlomieju deleted the remove_wasm_compiler branch May 7, 2020 18:43
@kevinkassimo
Copy link
Contributor

Sad to see it go, but I guess we can bring it back some time in the future once we figure out what could be the best solution.

@ry
Copy link
Member

ry commented May 7, 2020

@kevinkassimo that's the idea. I'm also sad to see this go, but it's hindering refactors in the compiler and a case can be made that wasm imports are not standard. I think we'll have this feature back relatively soon.

@annymosse
Copy link

😢 Really so sad to see this super wanted feature get out from 🦕 travels stories.

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.

5 participants