Restrict crate-internal items to pub(crate) and remove dead code it exposes (#31254)
## What Three commits, one sweep: 1. **`pub` → `pub(crate)` for 1,298 items across 105 files.** Applied mechanically via `cargo fix` driven by the `unreachable_pub` lint, which only fires on items that are provably unreachable from outside their defining crate — so the demotion cannot change what compiles. Two items (`addrinfo`/`freeaddrinfo` re-exports in `bun_dns`) were reverted by hand because a chained `pub use` re-exports them. 2. **Remove the dead AST JSON-serialization facility.** The `js_ast` `jsonStringify` port — `JsonWriter`/`BindingJsonWriter` traits, `Serializable` carrier structs, 26 `json_stringify` methods, `Ast::to_json` — has zero trait implementors and zero callers. The only `.json_stringify()` call sites in the tree are `JSValue`'s native `JSON.stringify`, which is unrelated. 3. **Remove six crates nothing depends on**, plus the data files vendored under them: - `bun_unicode` — empty `lib.rs`, no consumers, but carried the entire vendored Unicode Character Database (~70k lines of `.txt`) - `bun_libarchive_sys` / `bun_picohttp_sys` — superseded duplicates; `bun_libarchive` / `bun_picohttp` carry their own bindings and are what everything actually uses - `bun_meta`, `bun_url_jsc` — zero callers - the `bun_node-fallbacks` crate wrapper (the `.js` fallback modules stay; codegen bundles those directly) - `crossbeam` from `[workspace.dependencies]` (no member declares it) After this, every workspace crate except the two standalone build roots (`bun_codegen`, `bun_shim_impl`) has at least one in-workspace dependent. ## Why `dead_code = "deny"` is already enforced workspace-wide, but it treats every `pub` item as an external API root and never analyzes it. In a workspace where every crate is an internal implementation detail of one binary, that exemption swallows real dead code. Demoting crate-internal items to `pub(crate)` puts them back under the lint — that is what surfaced the dead serialization facility. ## Verification - `cargo check --workspace --lib --bins` clean under the workspace's normal lint set - Full debug build links and runs - `bundler_edgecase` 103 pass / 0 fail, `bundler_browser` 12 pass / 0 fail (node-fallbacks path), `bun-add` failures are pre-existing on main (registry config leak in the test environment, identical signature with an unmodified build) ``` 179 files changed, 1,522 insertions(+), 84,970 deletions(-) ```
J
Jarred Sumner committed
49c97de6b38192db015d26619e5acd26332c80b6
Parent: f271ddc
Committed by GitHub <noreply@github.com>
on 5/24/2026, 5:53:14 AM