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

docs(wasm): add sections about Node.js and module access #13978

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

tommie
Copy link
Contributor

@tommie tommie commented Jul 28, 2023

Description

This also renames the example import from imports to someModule. It's easy to think imports is a magic key.

Closes #13965.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

This also renames the example import from `imports` to
`someModule`. It's easy to think `imports` is a magic key.

Closes vitejs#13965.
@stackblitz
Copy link

stackblitz bot commented Jul 28, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

docs/guide/features.md Outdated Show resolved Hide resolved

```js
init({
imports: {
someModule: {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it is better to align with MDN here, they are using imports so I would suggest we stick with the current naming: https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/instantiate#first_overload_example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll note that the spec uses "js" as the sample module name: https://webassembly.github.io/spec/js-api/#sample

(MDN also tripped me up in trying to understand the parameter, so I'd love to not just do what they do. :)

That case having been made, if you want "imports", sure.

Copy link
Member

Choose a reason for hiding this comment

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

I let @sapphi-red weight on this one. Thanks for the changes!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SG. Thanks for the review and providing Vite!

Copy link
Member

Choose a reason for hiding this comment

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

I'll select imports as I assume more people would read MDN than the spec.

patak-dev
patak-dev previously approved these changes Jul 29, 2023
docs/guide/features.md Outdated Show resolved Hide resolved

```js
init({
imports: {
someModule: {
Copy link
Member

Choose a reason for hiding this comment

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

I'll select imports as I assume more people would read MDN than the spec.

sapphi-red
sapphi-red previously approved these changes Jul 31, 2023
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

Thanks! I have one nitpick.

@tommie tommie dismissed stale reviews from sapphi-red and patak-dev via 9a41743 July 31, 2023 10:49
Co-authored-by: 翠 / green <[email protected]>
@patak-dev patak-dev merged commit 2c73d10 into vitejs:main Jul 31, 2023
@tommie tommie deleted the wasm-helper-13965-doc branch July 31, 2023 12:45
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.

wasm-helper should return Module in addition to Instance
3 participants