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

Update cloudflare adapter docs for new import types #8211

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

adrianlyjak
Copy link

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 existing wasmModuleImports option will be respected if defined. The change also changes the default to enabled. I chose to exclude mention of the deprecated wasmModuleImports to keep it simple

First-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"

Copy link

vercel bot commented May 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview May 8, 2024 4:09pm

@astrobot-houston
Copy link
Contributor

Hello! Thank you for opening your first PR to Astro’s Docs! 🎉

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any broken links you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel 🥳

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented May 7, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/integrations-guide/cloudflare.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link
Member

@sarah11918 sarah11918 left a 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).
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 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?

Copy link
Author

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 importing 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)

Copy link
Member

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! 🙌

@sarah11918 sarah11918 added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) labels May 8, 2024
@alexanderniebuhr alexanderniebuhr self-requested a review May 8, 2024 08:45
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants