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

fix(wasi): ContextOptions is an optional argument #2138

Merged
merged 2 commits into from
Apr 22, 2022
Merged

Conversation

tani
Copy link
Contributor

@tani tani commented Apr 22, 2022

According to the node.js docs,
we can use WASI class without arguments. I mean that the ContextOptions should be optional.
This is a problematic to load https://github.com/ruby/ruby.wasm .

See also: https://nodejs.org/api/wasi.html

@tani tani requested review from bartlomieju and kt3k as code owners April 22, 2022 01:27
@CLAassistant
Copy link

CLAassistant commented Apr 22, 2022

CLA assistant check
All committers have signed the CLA.

@tani tani changed the title ContextOptions is an optional argument fix(wasi): ContextOptions is an optional argument Apr 22, 2022
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

Looks like a good idea. Context is directly used as wasi.Wasi class in std/node, so this is also a fix for node/wasi. Left one comment

@@ -346,7 +346,7 @@ export default class Context {

exports: Record<string, WebAssembly.ImportValue>;

constructor(options: ContextOptions) {
constructor(options?: ContextOptions = {}) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems throwing an type error

error: TS1015 [ERROR]: Parameter cannot have question mark and initializer.
  constructor(options?: ContextOptions = {}) {
              ~~~~~~~
    at file:///Users/runner/work/deno_std/deno_std/wasi/snapshot_preview1.ts:349:15

@tani
Copy link
Contributor Author

tani commented Apr 22, 2022

@kt3k Thank you for giving the review. I fixed it. Cheers,

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

LGTM

@kt3k kt3k merged commit b1c90a0 into denoland:main Apr 22, 2022
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.

3 participants