refactor: replace cfg-if dependency with std cfg_select! macro#1290
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1290 +/- ##
=======================================
Coverage 94.07% 94.07%
=======================================
Files 21 21
Lines 4285 4288 +3
=======================================
+ Hits 4031 4034 +3
Misses 254 254 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 3.37%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | pm/yarn-flat |
748.9 µs | 850 µs | -11.89% |
| ❌ | pm/pnpm-hoisted |
902.1 µs | 961.6 µs | -6.19% |
| ❌ | complex_real |
21.3 µs | 22.4 µs | -4.75% |
| ❌ | resolver_memory[multi-thread] |
244.8 µs | 255.2 µs | -4.07% |
| ❌ | pm/yarn-isolated |
945.7 µs | 975.7 µs | -3.07% |
| ⚡ | pm/pnpm-isolated |
962 µs | 927.3 µs | +3.74% |
| ⚡ | resolver_real[multi-thread] |
253.7 µs | 245 µs | +3.58% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing cfg-select (4fcb62c) with main (bf4a499)
Footnotes
-
5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
## 🤖 New release * `oxc_resolver`: 11.23.0 -> 11.24.0 * `oxc_resolver_napi`: 11.23.0 -> 11.24.0 <details><summary><i><b>Changelog</b></i></summary><p> ## `oxc_resolver` <blockquote> ## [11.24.0](v11.23.0...v11.24.0) - 2026-07-12 ### <!-- 0 -->🚀 Features - expose tsconfig paths resolve method without file existence check ([#1282](#1282)) (by @sapphi-red) - add `ResolveError::TsconfigLoadFailed` for tsconfig read and parse failures ([#1287](#1287)) (by @shulaoda) ### <!-- 2 -->🚜 Refactor - replace cfg-if dependency with std cfg_select! macro ([#1290](#1290)) (by @Boshen) ### <!-- 3 -->📚 Documentation - normalize README sponsor section ([#1273](#1273)) (by @Boshen) ### <!-- 4 -->⚡ Performance - *(cache)* reuse the child path when its parent canonicalizes to itself ([#1288](#1288)) (by @Boshen) - *(napi)* shrink release binaries (path remap + build-std without backtrace) ([#1283](#1283)) (by @Boshen) ### Contributors * @sapphi-red * @Boshen * @renovate[bot] * @shulaoda </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: oxc-guard[bot] <276638029+oxc-guard[bot]@users.noreply.github.com>
## 🤖 New release * `oxc_resolver`: 11.24.0 -> 11.24.1 * `oxc_resolver_napi`: 11.24.0 -> 11.24.1 <details><summary><i><b>Changelog</b></i></summary><p> ## `oxc_resolver` <blockquote> ## [11.24.0](v11.23.0...v11.24.0) - 2026-07-12 ### <!-- 0 -->🚀 Features - expose tsconfig paths resolve method without file existence check ([#1282](#1282)) (by @sapphi-red) - add `ResolveError::TsconfigLoadFailed` for tsconfig read and parse failures ([#1287](#1287)) (by @shulaoda) ### <!-- 2 -->🚜 Refactor - replace cfg-if dependency with std cfg_select! macro ([#1290](#1290)) (by @Boshen) ### <!-- 3 -->📚 Documentation - normalize README sponsor section ([#1273](#1273)) (by @Boshen) ### <!-- 4 -->⚡ Performance - *(cache)* reuse the child path when its parent canonicalizes to itself ([#1288](#1288)) (by @Boshen) - *(napi)* shrink release binaries (path remap + build-std without backtrace) ([#1283](#1283)) (by @Boshen) ### Contributors * @sapphi-red * @Boshen * @renovate[bot] * @shulaoda </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: oxc-guard[bot] <276638029+oxc-guard[bot]@users.noreply.github.com>
Replaces the
cfg-ifcrate withstd::cfg_select!, which was stabilized in Rust 1.95 (its rustdoc even carriesdoc(alias = "cfg-if")as the intended replacement). This drops one dependency.metadata,symlink_metadata,read_link,Cache::canonicalize,normalize_withwasm handling,ResolverGeneric::new/clone_with_options) becomecfg_select!arms; the twoletsites use it in expression position, whichcfg_if!could not do.FileSystemOsand the non-wasm specifier shadowing inrequire_implhad no else branch, so they become plain#[cfg]attributes instead of a macro with an empty fallback arm.Verified with
just ready(fmt, typos, check incl. s390x target, tests for default and--all-features, napi build + node tests, pnp tests, clippy--deny warnings, doc). Windows and wasm arms are token-identical to before and are covered by CI.Stacked on #1289 (MSRV 1.95.0 bump); retargets to
mainonce that merges.