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.
-
Summary
swc_core
for lightweight Rust-side users, like plugin authors.Motivation
swc_core
is 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_core
because you need a bugfix ofswc_css_parser
, your crates depending onswc_ecma_ast
should be built again becauseswc_core
is 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-metadata
internally 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.-w
can 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_ast
maps to one version ofswc_common
, so a user can upgradeswc_ecma_ast
without upgradingswc_common
.--upgrade
-u
flag can be used to update all resolved versions.--json v1
This tool should allow the dumping of everything with
--json v1
, so it can be extended easily withjq
and terminal pipe.Drawbacks
More work, again.
Alternatives
Unresolved questions
Beta Was this translation helpful? Give feedback.
All reactions