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

migrate to swc 3.0.0 for next upgrade #196

Merged
merged 16 commits into from
Nov 8, 2024
Merged

Conversation

jantimon
Copy link
Owner

@jantimon jantimon commented Nov 1, 2024

Update the SWC plugin and related dependencies for compatibility with Next.js 15

  • ✅ All existing tests have been updated and pass
  • ✅ Verified compatibility with Next.js 15 features

Version Updates

  • 🔄 Upgraded Next.js from 14.2.4 to 15.0.2 (for our test pipeline and examples)
  • ⚡ Updated @swc/core from 1.6.0 to 1.7.42 (only for our test pipeline)
  • 🛠️ Updated swc_core from 0.279.0 to 3.0.2 and also the related SWC dev packages to their v3.0.x versions

Implementation Changes

  • 🔨 Migrated from Fold to Pass API as per SWC's new visitor pattern
  • 🔄 Replaced as_folder with visit_mut_pass
  • 🔧 Updated function signatures to implement Pass trait
  • 🚫 Temporarily removed cookie-based theming support due to Next.js 15's async cookies API

Breaking Changes Handled

  • Switched to the new visitor pattern using Program.apply() and Fold
  • Updated Ident to IdentName to match the new SWC APIs

Next 15 async

  • The cookie usage in the example was temporary removed and will be addressed in a future update once we implement a solution compatible with Next.js 15's async cookies API

async

Closes #181

Special thanks to @kdy1 for:

@jantimon jantimon changed the title migrate to yak 3 migrate to swc 3.0.0 Nov 1, 2024
Copy link

codspeed-hq bot commented Nov 1, 2024

CodSpeed Performance Report

Merging #196 will not alter performance

Comparing feature/migrate-to-swc-3 (b8df2df) with main (297b434)

Summary

✅ 2 untouched benchmarks

@jantimon jantimon changed the title migrate to swc 3.0.0 migrate to swc 3.0.0 for next upgrade Nov 1, 2024
@jantimon jantimon marked this pull request as ready for review November 1, 2024 10:09
@jantimon jantimon requested a review from Mad-Kat November 1, 2024 10:09
Mad-Kat
Mad-Kat previously approved these changes Nov 1, 2024
@kdy1
Copy link
Collaborator

kdy1 commented Nov 1, 2024

As a side note, I’m going to upgrade swc_core of next to v4 and it will be incompatible with v3 of swc_core.

There was important perf improvement, and it was a Wasm-breaking change

@jantimon
Copy link
Owner Author

jantimon commented Nov 1, 2024

good to know - we will upgrade once SWC 4 lands in next.js

@kdy1
Copy link
Collaborator

kdy1 commented Nov 6, 2024

vercel/next.js#71683 is merged.
There were two breaking changes due to swc-project/swc#9717 (Revert PR) so the version is [email protected]

@jantimon
Copy link
Owner Author

jantimon commented Nov 7, 2024

thanks @kdy1 for all these insights - is this already part of nextjs 15.0.3-canary.8?

@jantimon jantimon mentioned this pull request Nov 7, 2024
Copy link

changeset-bot bot commented Nov 8, 2024

🦋 Changeset detected

Latest commit: b8df2df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
next-yak Major
yak-swc Major

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

# Conflicts:
#	packages/yak-swc/yak_swc/src/utils/css_prop.rs
#	pnpm-lock.yaml
@jantimon jantimon requested a review from Mad-Kat November 8, 2024 13:26
@jantimon jantimon merged commit 94f083f into main Nov 8, 2024
7 checks passed
@jantimon jantimon deleted the feature/migrate-to-swc-3 branch November 8, 2024 13:27
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.

Nextjs 15
3 participants