Migrate to swc_core#9131
Merged
alshdavid merged 3 commits intoJul 16, 2023
Merged
Conversation
Using `swc_ecmascript` etc directly is deprecated and the recommendation is to migrate to swc_core instead as a meta-pacakge. This change makes that migration - it's mostly a case of updating a lot of imports, but also as a side-effect of bumping a few versions of SWC to pick up bugfixes there were some deprecated fields where code changes were needed. One major change with the latest SWC is that it currently requires Rust nightly to build. I've updated the `rust-toolchain` to reflect this, but I'm not sure if there are any broader implications.
8f2005a to
467e9b2
Compare
This ensures correct tools are available in GH actions.
467e9b2 to
d009ad6
Compare
marcins
commented
Jul 13, 2023
| with: | ||
| cache: yarn | ||
| - uses: actions-rs/toolchain@v1 | ||
| with: |
Contributor
Author
There was a problem hiding this comment.
I tried using the rust-toolchain file support in this action for handling this, but couldn't get it working (in particular, this action doesn't support the modern TOML format - it hasn't been updated for years).
mischnic
reviewed
Jul 14, 2023
| @@ -1,4 +1,5 @@ | |||
| [workspace] | |||
| resolver = "2" | |||
Member
There was a problem hiding this comment.
What was the reason for adding this?
Contributor
Author
There was a problem hiding this comment.
Without this, you get this warning when building the JS Transformer:
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
From reading the docs, if everything is building with the 2021 resolver then it's all good.
mischnic
approved these changes
Jul 16, 2023
alshdavid
approved these changes
Jul 16, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
↪️ Pull Request
I wanted to pull in the fix for swc-project/swc#7582, but it didn't appear to be published in the
swc_ecmascriptminor version we were using. Bumping the minor version to latest caused some other compilation issues, so I decided to yakshave..Using
swc_ecmascriptetc directly is deprecated and the recommendation is to migrate toswc_coreinstead as a meta-pacakge that's semver stable.This change makes that migration - it's mostly a case of updating a lot of imports, but also as a side-effect of bumping a few versions of SWC to pick up bugfixes there were some deprecated fields where code changes were needed.
One major change with the latest SWC is that it currently requires Rust nightly to build. I've updated the
rust-toolchainto reflect this, but I'm not sure if there are any broader implications.