Replies: 4 comments 1 reply
-
|
cc @kwonoj Thoughts? |
Beta Was this translation helpful? Give feedback.
-
I'm generally not great in favor of introducing another tool to manage version conflict, swc_core was supposed to do serve as resolver for the versions as well as single sdk to build swc. If we want to go back to the direct dependency model, have we ever considered different version modeling entirely? Lot of version conflict coming from individual pkg have individual versions. Instead, a single change bumps up all of swc_* pkg at once to same version and each dependency relies on strict pinned version potentially removes conflict. I think some of large rust codebase actually uses similar approach. |
Beta Was this translation helpful? Give feedback.
-
|
Actual compile time difference of turbopack:
Thoughts? |
Beta Was this translation helpful? Give feedback.
-
|
Timing difference for |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
swc_corefor lightweight Rust-side users, like plugin authors.Motivation
swc_coreis very good for plugin authors, but clearly, it's very bad for heavy users from the Rust side. It's convenient, but it's a known bottleneck for compile time. All used SWC crates must be compiled beforeswc_core, and all dependant crates, should be built afterswc_core.This imposes one more compile time issue for development. If you update
swc_corebecause you need a bugfix ofswc_css_parser, your crates depending onswc_ecma_astshould be built again becauseswc_coreis built again.Detailed design
Version solver
We can create a CLI tool for version solving.
cargo ddt solve-version -w [email protected]This will run
cargo-metadatainternally to get a list of crates to check compatibility. Note that the current versions of crates are ignored by default. This can be respected in e.g. minimal-upgrade mode, but not now.-wcan be specified multiple times. If specified, the versions of crates in the printed answer will be compatible with all packages.If there's a conflict, the command fails.
This can be also used for partial upgrade of SWC, like
cargo ddt solve-version -w [email protected].This will print crates compatible with
[email protected]. In many cases, multiple versions ofswc_ecma_astmaps to one version ofswc_common, so a user can upgradeswc_ecma_astwithout upgradingswc_common.--upgrade-uflag can be used to update all resolved versions.--json v1This tool should allow the dumping of everything with
--json v1, so it can be extended easily withjqand terminal pipe.Drawbacks
More work, again.
Alternatives
Unresolved questions
Beta Was this translation helpful? Give feedback.
All reactions