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
Update cloudflare adapter docs for new import types #8211
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉 Here’s what will happen next:
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @adrianlyjak ! This looks pretty good and will be a welcome addition to the docs! Just one line I think is worth clarifying before I sign off on it, and I fixed some tiny nits in another sentence. But, soon you'll get your official welcome to Team Docs! 🥳
</p> | ||
|
||
Whether or not to import `.wasm` files [directly as ES modules](https://github.com/WebAssembly/esm-integration/tree/main/proposals/esm-integration) using the `.wasm?module` import syntax. | ||
Enables [imports of `.wasm`, `.bin`, and `.txt` modules](#cloudflare-module-imports). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll ask @alexanderniebuhr to also review this line because admittedly I'm not familiar with this, so I can only go on language!
Just checking: is this meant to be essentially the same as the option it replaces, only adding extra kinds of files that can imported? If so, is it intentional that this no longer says "directly as ES modules"? Is that an important nuance/detail that should still be included here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct that this effectively just adds a couple of new exported file types. I removed the sentence and link because it's a proposal that's only for Wasm ES modules. (It contains info about the the specific nuances of how Wasm is exported). Yes, all three types are ES module (that's somewhat inherent to import
ing them).
I think the breakdown of each exported type in the subsequent section is sufficient and more to the point, but it might make sense to link to this proposal within the Wasm bullet? However, looking closer, I think we should leave the link out for now, reading through the Wasm ES Module proposal, I think the semantics are starting to diverge from cloudflare's implementation. Effectively in the proposal, a vanilla import looks like it will pre-instantiate the wasm module (which is kind of nice, but not what cloudflare does)
proposal
import wasmInstance from "./myModule.wasm";
wasmInstance.add(1, 2)
// or, if you want to get the "source" module in order to instantiate it, there's some sort of special "source" keyword
import source addModule from "./myModule.wasm");
const instantiated = new WebAssembly.Instance(myModule);
instantiated.add(1, 2)
As opposed to cloudflare, which always exports the source module. Note that there's no source
keyword
import addModule from "./myModule.wasm");
const instantiated = new WebAssembly.Instance(myModule);
instantiated.add(1, 2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha! Thanks for the explanation. I'm not sure an external link is necessary here, I just wanted to make sure that the deletion of the extra detail was intentional. I'll wait for Alex to confirm that this expresses what he wants conveyed, and if he's happy, I'm happy! 🙌
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Description (required)
Updates cloudflare adapter docs for features to-be-added in withastro/adapters#251. This change enhances
wasmModuleImports
to support more extensions. The change is non-breaking, since the existingwasmModuleImports
option will be respected if defined. The change also changes the default to enabled. I chose to exclude mention of the deprecatedwasmModuleImports
to keep it simpleFirst-time contributor to Astro Docs
I contributed here once before to add the
wasmModuleImports
docs, I think this was before this repo was separate. Discord user is "lyjackal"