Switch codegen data source from caniuse-db to caniuse-lite#687
Merged
Conversation
The cron-driven `Update browserslist` workflow has been failing because
the Rust codegen read from `caniuse-db` while the parser tests shell out
to `node_modules/.bin/browserslist`, which reads from `caniuse-lite`.
The two packages share a `1.0.30001NNN` version number but their data
snapshots drift, so after a `pnpm update --prod` the parser tests diff
against a different Firefox/Chrome version set than the one baked into
the generated Rust data.
This commit aligns both sides on `caniuse-lite`: a new in-Rust port of
caniuse-lite's `agents`/`feature`/`region` unpackers (added under
`xtask/src/data/caniuse_lite.rs`) reads the packed `module.exports = {...}`
data files via JSON5, expands the single-letter browser/version codes
into full strings, and produces the same `Caniuse` shape the existing
generators consume. Regions are now passed through `Caniuse` instead of
being read per-file from disk, so the regions generator drops its
`fs::read_dir` over `caniuse-db/region-usage-json/`.
`package.json` swaps `caniuse-db` for `caniuse-lite` as a peer dep;
`pnpm update --prod` continues to keep the lockfile fresh.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #687 +/- ##
=======================================
Coverage 99.03% 99.03%
=======================================
Files 47 47
Lines 2374 2374
=======================================
Hits 2351 2351
Misses 23 23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merged
Boshen
pushed a commit
that referenced
this pull request
May 29, 2026
## 🤖 New release * `oxc-browserslist`: 3.0.3 -> 3.0.4 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [3.0.4](oxc-browserslist-v3.0.3...oxc-browserslist-v3.0.4) - 2026-05-29 ### Other - DRY up feature/region codegen with shared table + lookup helpers ([#694](#694)) - Consolidate bundled-data loading behind compression helpers ([#693](#693)) - Reduce binary size: run-length encode feature support versions ([#692](#692)) - Reduce binary size: Zopfli codegen compression + percentage byte-plane ([#691](#691)) - Reduce binary size: byte-plane (stream-split) compression for region pair indices ([#690](#690)) - Update README binary size to 621K ([#689](#689)) - Reduce binary size of bundled caniuse/electron data ([#688](#688)) - Switch codegen data source from caniuse-db to caniuse-lite ([#687](#687)) - Update browserslist ([#685](#685)) - Update rust crates ([#682](#682)) - Update browserslist ([#679](#679)) - Update browserslist ([#678](#678)) - Update browserslist ([#677](#677)) - Update browserslist ([#673](#673)) - Update browserslist ([#671](#671)) </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>
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.
Summary
Update browserslistcron has been failing (example) because the Rust codegen reads fromcaniuse-dbwhile the parser tests shell out to the JSbrowserslistCLI, which reads fromcaniuse-lite. Both packages share a1.0.30001NNNversion number but their data snapshots drift, so apnpm update --prodleaves the two data sources misaligned and the parser tests diff against a different Firefox/Chrome version set than the one baked into the generated Rust data.caniuse-liteby porting caniuse-lite's three JS unpackers (agents,feature,region) to Rust underxtask/src/data/caniuse_lite.rs. The new loader reads the packedmodule.exports = {...}data files via JSON5, expands the single-letter browser/version codes, and produces the sameCaniuseshape the existing generators consume — no Node spawning at codegen time.Caniuseinstead of being read per-file from disk; the regions generator drops itsfs::read_dirovercaniuse-db/region-usage-json/.package.jsonswapscaniuse-dbforcaniuse-liteas a peer dep; the cron'spnpm update --prodcontinues to keep the lockfile fresh.Notes
F(release_date) map hasnullfor some versions, sorelease_dateis typedIndexMap<String, Option<i64>>.D:undefined, which isn't JSON5, so the parser doesbody.replace("undefined", "null")before deserializing.