Skip to content

fix: allow for use of both manual & fetchEvent based HTTP #247

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

Conversation

vados-cosmonic
Copy link
Contributor

This commit updates the componentize-js code to support both fetchEvent and manual based HTTP.

To make this possible we needed to re-introduce a few things:

  • A feature that represents fetch-event
  • Allow controlling removal of the the built-in fetch event
  • Allow skipping checks for manual wasi:http/incoming-handler impls
  • Add oxc-parser to detect manual impls and toggle fetch-event feature

The docs are also updated to note the changes to API/usage.

@vados-cosmonic vados-cosmonic force-pushed the refactor=wasi-http-detection branch 2 times, most recently from bf0c88d to 16b39ad Compare July 10, 2025 16:56
@vados-cosmonic vados-cosmonic force-pushed the refactor=wasi-http-detection branch from e86e516 to 95b0742 Compare July 11, 2025 05:17
@vados-cosmonic vados-cosmonic requested a review from andreiltd July 11, 2025 06:25
Copy link
Member

@andreiltd andreiltd 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! I wouldn't mind additional tests, for example for pure components that you mention in the docs, but otherwise LGTM! 🚀

@vados-cosmonic vados-cosmonic force-pushed the refactor=wasi-http-detection branch 3 times, most recently from a6faf1d to 057a7c5 Compare July 11, 2025 08:43
@vados-cosmonic
Copy link
Contributor Author

Also @tschneidereit before you run into this.. I have already split out the PRs so they're a bit easier to review:

#252
#251
#248

I'll do the required PR fixups regardless of which you merge in what order!

vados-cosmonic and others added 6 commits July 14, 2025 22:43
This commit updates the componentize-js code to support both
fetchEvent and manual based HTTP.

To make this possible we needed to re-introduce a few things:

- A feature that represents fetch-event
- Allow controlling removal of the the built-in fetch event
- Allow skipping checks for manual wasi:http/incoming-handler impls
- Add oxc-parser to detect manual impls and toggle fetch-event feature

The docs are also updated to note the changes to API/usage.
@vados-cosmonic vados-cosmonic force-pushed the refactor=wasi-http-detection branch from 5cefd26 to 327dc46 Compare July 14, 2025 13:44
@vados-cosmonic
Copy link
Contributor Author

Hey @tschneidereit -- I've rebased this to main with all the changes that landed, this should be a very minimal changeset + test now.

Copy link
Member

@tschneidereit tschneidereit left a comment

Choose a reason for hiding this comment

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

Let's get this landed. There are a couple of things I'd prefer to have different, but absolutely don't want to block getting this in on them:

It'd be nice if we could, on a best-effort basis, detect usage of FetchEvent when auto-disabling support for it. That'd be possible using oxc, but somewhat gnarly. Basically, it'd require walking the AST, finding all function calls to the identifier addEventListener, and checking if the first argument is the string literal "fetch". Obviously there are ways to create both false positives and negatives, but those are unlikely enough for a warning not to be a problem, I think.

The more important thing is that I thought we had agreed to have the parsing happen in Rust instead of JS. That'd both better support using the splicer as a Rust dependency, and be faster.

Again, we should absolutely land this without addressing either of these!

@vados-cosmonic
Copy link
Contributor Author

Made an issue so that we don't forget to come back to the fetch event detection to improve it!

#253

@vados-cosmonic vados-cosmonic merged commit 24cef8f into bytecodealliance:main Jul 14, 2025
16 checks passed
@vados-cosmonic vados-cosmonic deleted the refactor=wasi-http-detection branch July 14, 2025 15:28
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