fix(cloudflare): strip return statements from frontmatter in esbuild scan plugin#15588
Conversation
🦋 Changeset detectedLatest commit: 64e4b5f The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Princesseuh
left a comment
There was a problem hiding this comment.
Looks great, awesome work!
|
Thank you so much! 🥳 |
|
Would this also present with |
|
No, that's unrelated to this. |
|
@Princesseuh I understand that the esbuild plugin in the cloudflare adapter throwing an error doesn't cause the warnings in astro-check, but it does seem like it's the same problem presenting in different areas of the Astro ecosystem. Doing this in frontmatter that is handled in middleware seems to be a workaround for the astro-check warnings on top level return statement: |
fixes: #15518
Changes
In the previous implementation of the Cloudflare Workers integration, the following error occurred when esbuild attempted to scan dependencies by loading the code:
This pull request addresses this issue with the following changes:
returnstatements are now replaced withthrow. This logic is based on the implementation found invite-plugin-astro/compile.ts. To ensure source maps remain accurate, the replacement includes padding to maintain the original character count.Testing
Top-level return cannot be ...error no longer occurs.Failed to run dependency scan ...error).Docs
N/A