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

feat: improve rolldown compatibility #13519

Merged
merged 6 commits into from
Apr 3, 2025

Conversation

florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Mar 30, 2025

Changes

Testing

Should pass

Docs

N/A. No changeset since it's a refactor

@florian-lefebvre florian-lefebvre self-assigned this Mar 30, 2025
Copy link

changeset-bot bot commented Mar 30, 2025

🦋 Changeset detected

Latest commit: 5bf450a

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 30, 2025
Copy link

codspeed-hq bot commented Mar 30, 2025

CodSpeed Performance Report

Merging #13519 will not alter performance

Comparing feat/rolldown-led-improvements (a9faa4e) with main (d777420)

Summary

✅ 6 untouched benchmarks

@ematipico
Copy link
Member

Can you please breakdown the changes for us reviewers? I don't know what the changes are for, and what I'm reviewing

@@ -151,7 +154,7 @@ export default function assets({ settings }: { settings: AstroSettings }): vite.
},
// In build, rewrite paths to ESM imported images in code to their final location
async renderChunk(code) {
const assetUrlRE = /__ASTRO_ASSET_IMAGE__([\w$]{8})__(?:_(.*?)__)?/g;
const assetUrlRE = /__ASTRO_ASSET_IMAGE__([\w$]+)__(?:_(.*?)__)?/g;
Copy link
Member Author

Choose a reason for hiding this comment

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

In rolldown hashes are not exactly 8 long

Copy link
Member Author

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

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

I recommend you read the patch file linked in the PR desc. I ported the changes that seemed non breaking to Astro directly. The fact that tests still pass is reassuring imo

@@ -57,6 +57,9 @@ function getNonPrerenderOnlyChunks(bundle: Rollup.OutputBundle, internals: Build

nonPrerenderOnlyEntryChunks.add(chunk);
}
if (chunk.type === 'chunk' && chunk.isDynamicEntry) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This would be a bug in Astro according to the patch file

Copy link
Member

@ematipico ematipico 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 @florian-lefebvre. I would add a changelog so we can track the changes, in case there's some unexpected regression to our users.

Also, I would appreciate if we left comments in the places where we now return objects. We return strings on most of our plugins, however only the asset ones require an object. We should keep track of the change with a comment, so maintainers aren't going to refactor it.

@florian-lefebvre florian-lefebvre marked this pull request as draft March 31, 2025 12:24
@florian-lefebvre florian-lefebvre marked this pull request as ready for review March 31, 2025 12:38
@florian-lefebvre florian-lefebvre merged commit 3323f5c into main Apr 3, 2025
16 checks passed
@florian-lefebvre florian-lefebvre deleted the feat/rolldown-led-improvements branch April 3, 2025 16:15
@astrobot-houston astrobot-houston mentioned this pull request Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants