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: wasm-bindgen and stdweb compatbility #263

Closed
wants to merge 1 commit into from
Closed

feat: wasm-bindgen and stdweb compatbility #263

wants to merge 1 commit into from

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Aug 18, 2020

Uses wasm compatible instant instead of std::instant. Fall backs to std::instant when feature not specified.

Use cases for wasm compatibility - playground 😄

@caspervonb
Copy link
Contributor

Worth noting that std::time::Instant is supported with wasm32-wasi.

@littledivy
Copy link
Member Author

littledivy commented Aug 18, 2020

Right, but not in wasm32-unknown-unknown

@littledivy littledivy marked this pull request as ready for review August 18, 2020 07:24
@lucacasonato
Copy link
Member

Worth noting that std::time::Instant is supported with wasm32-wasi

Does deno_lint compile with wasm32-wasi? If so I think this patch is not necessary. You can polyfill the wasi_time_get syscall on the web using Date (or performance.now()).

@littledivy
Copy link
Member Author

Got it.

@littledivy littledivy closed this Aug 18, 2020
@littledivy littledivy deleted the wasm-compatible branch August 18, 2020 08:33
@eliassjogreen
Copy link
Contributor

This would be nice for wasm32-unknown-unknown support for a project the denosaurs are working on, I don't really see a reason why not to support it? wasm-pack (nor wasm-bindgen I think) doesn't seem to support wasi which makes the build process way more complicated and just a mess. If wasm32 support is not planned could you provide an example of how I would polyfill it?

@bartlomieju
Copy link
Member

@eliassjogreen I'm not sure, CC @caspervonb

@caspervonb
Copy link
Contributor

I don't really see a reason why not to support it

I do, we should not be supporting ABIs that don't exist. Some of the cargo ecosystem have abused the target with feature flags but it is still a bare metal target with no system calls.

wasm-pack (nor wasm-bindgen I think) doesn't seem to support wasi which makes the build process way more complicated and just a mess.

They do, just compile with cargo build --target wasm32-wasi then run wasm-bindgen after without wasm-pack (wasm-pack is not a great tool IMO as it hides all the compilation steps from you).

@caspervonb
Copy link
Contributor

Kom inn på Deno Discord om du sitter fast og trenger hjelp @eliassjogreen 🙃

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