Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e0b8268
Restrict crate-internal items to pub(crate)
Jarred-Sumner May 23, 2026
00d95e7
Remove dead AST JSON-serialization facility and empty bun_unicode crate
Jarred-Sumner May 23, 2026
e1d285c
Remove unconsumed crates: bun_meta, bun_url_jsc, bun_libarchive_sys, …
Jarred-Sumner May 23, 2026
d8ee30d
Address review feedback
Jarred-Sumner May 23, 2026
01fc54b
Deny unreachable_pub workspace-wide
Jarred-Sumner May 23, 2026
c6bbc02
Merge remote-tracking branch 'origin/main' into claude/pub-crate-demote
Jarred-Sumner May 23, 2026
06f7be6
Fix unreachable_pub in the standalone shim build and post-merge code
Jarred-Sumner May 23, 2026
3f63077
Audit cross-crate exports: demote, delete dead code, mark the remainder
Jarred-Sumner May 23, 2026
ee5ad86
Remove empty module shells left by the ES5 table removal
Jarred-Sumner May 23, 2026
7915136
Clean up residue from the dead-code deletion pass
Jarred-Sumner May 23, 2026
e61530e
Merge remote-tracking branch 'origin/main' into claude/pub-crate-demote
Jarred-Sumner May 23, 2026
4457dd3
Keep HOST_EXPORT-marked functions pub fn
Jarred-Sumner May 23, 2026
b995321
Allow debug-only helpers that are dead in release builds
Jarred-Sumner May 23, 2026
9abf984
Address review feedback on the audit commit
Jarred-Sumner May 23, 2026
81291dd
Keep JS-class payload structs pub for the class codegen
Jarred-Sumner May 23, 2026
31497fc
Fix clippy and miri: allow the documented raw-pointer deref, clean up…
Jarred-Sumner May 23, 2026
866b54b
Emit pub(crate) from the string-map codegen
Jarred-Sumner May 24, 2026
60ef844
Merge remote-tracking branch 'origin/main' into claude/pub-crate-demote
Jarred-Sumner May 24, 2026
fcf5a20
Merge remote-tracking branch 'origin/main' into claude/pub-crate-demote
Jarred-Sumner May 24, 2026
909bc4b
Widen types that appear in pub signatures; address review feedback
Jarred-Sumner May 24, 2026
f8b2ca0
Deny all warnings workspace-wide and fix every diagnostic
Jarred-Sumner May 24, 2026
7b7737e
Fix Windows release build: cfg the core_intrinsics feature, allow lin…
Jarred-Sumner May 24, 2026
00d7859
Restore HeapLabel/named_allocator docs; handle wrapped impl headers i…
Jarred-Sumner May 24, 2026
72556c0
Fix the JSXElement doc comment's code fences so doctest collection su…
Jarred-Sumner May 24, 2026
2d94380
Merge remote-tracking branch 'origin/main' into claude/pub-crate-demote
Jarred-Sumner May 24, 2026
4ece90d
Address review: delete dead HeapLabel/named_allocator, fix macro visi…
Jarred-Sumner May 24, 2026
672ec73
Remove unused fileToCrate map from find-dead-exports
Jarred-Sumner May 24, 2026
a9b0374
Reword to_source doc to reference source_from_file_at
Jarred-Sumner May 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 6 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ members = [
"src/js",
"src/libarchive",
"src/md",
"src/meta",
"src/node-fallbacks",
"src/paths",
"src/resolver",
"src/safety",
Expand All @@ -29,7 +27,6 @@ members = [
"src/sql",
"src/sys",
"src/threading",
Comment thread
claude[bot] marked this conversation as resolved.
"src/unicode",
"src/valkey",
"src/watcher",
"src/cares_sys",
Expand All @@ -51,7 +48,6 @@ members = [
"src/js_parser",
"src/js_parser_jsc",
"src/js_printer",
"src/libarchive_sys",
"src/libdeflate_sys",
"src/libuv_sys",
"src/ast",
Expand All @@ -65,7 +61,6 @@ members = [
"src/platform",
"src/sha_hmac",
"src/sys_jsc",
"src/url_jsc",
"src/zlib_sys",
"src/dispatch",
"src/brotli",
Expand All @@ -82,7 +77,6 @@ members = [
"src/brotli_sys",
"src/bun_alloc",
"src/mimalloc_sys",
"src/picohttp_sys",
"src/semver_jsc",
"src/standalone_graph",
"src/uws",
Expand Down Expand Up @@ -193,6 +187,12 @@ strip = "symbols"
# `cargo build` / `cargo check` (without those flags) doesn't warn.
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bun_asan)'] }
dead_code = "deny"
# Every crate in this workspace is an internal implementation detail of one
# binary, so `pub` is a claim that *another crate* imports the item. If it
# doesn't, write `pub(crate)` — that keeps the item under `dead_code` analysis
# instead of being exempted as an external API root. Macro-generated items that
# must stay `pub` carry `#[allow(unreachable_pub)]` at the expansion site.
unreachable_pub = "deny"
unused_imports = "deny"
unused_variables = "deny"
unused_mut = "deny"
Expand Down Expand Up @@ -339,7 +339,6 @@ memchr = "2"
rustix = { version = "0.38", default-features = false, features = ["std", "fs", "event", "process", "net"] }
bitflags = "2"
thiserror = "2"
crossbeam = "0.8"
smallvec = "1"
bumpalo = { version = "3", features = ["collections", "boxed"] }
typed-arena = "2"
Expand All @@ -361,8 +360,6 @@ bun_io = { path = "src/io" }
bun_js = { path = "src/js" }
bun_libarchive = { path = "src/libarchive" }
bun_md = { path = "src/md" }
bun_meta = { path = "src/meta" }
bun_node-fallbacks = { path = "src/node-fallbacks" }
bun_paths = { path = "src/paths" }
bun_resolver = { path = "src/resolver" }
bun_safety = { path = "src/safety" }
Expand All @@ -371,7 +368,6 @@ bun_sourcemap = { path = "src/sourcemap" }
bun_sql = { path = "src/sql" }
bun_sys = { path = "src/sys" }
bun_threading = { path = "src/threading" }
bun_unicode = { path = "src/unicode" }
bun_valkey = { path = "src/valkey" }
bun_watcher = { path = "src/watcher" }
bun_cares_sys = { path = "src/cares_sys" }
Expand All @@ -393,7 +389,6 @@ bun_install_types = { path = "src/install_types" }
bun_js_parser = { path = "src/js_parser" }
bun_js_parser_jsc = { path = "src/js_parser_jsc" }
bun_js_printer = { path = "src/js_printer" }
bun_libarchive_sys = { path = "src/libarchive_sys" }
bun_libdeflate_sys = { path = "src/libdeflate_sys" }
bun_libuv_sys = { path = "src/libuv_sys" }
bun_ast = { path = "src/ast" }
Expand All @@ -407,7 +402,6 @@ bun_patch = { path = "src/patch" }
bun_platform = { path = "src/platform" }
bun_sha_hmac = { path = "src/sha_hmac" }
bun_sys_jsc = { path = "src/sys_jsc" }
bun_url_jsc = { path = "src/url_jsc" }
bun_zlib_sys = { path = "src/zlib_sys" }
bun_dispatch = { path = "src/dispatch" }
bun_brotli = { path = "src/brotli" }
Expand All @@ -424,7 +418,6 @@ bun_boringssl = { path = "src/boringssl" }
bun_brotli_sys = { path = "src/brotli_sys" }
bun_alloc = { path = "src/bun_alloc" }
bun_mimalloc_sys = { path = "src/mimalloc_sys" }
bun_picohttp_sys = { path = "src/picohttp_sys" }
bun_semver_jsc = { path = "src/semver_jsc" }
bun_standalone_graph = { path = "src/standalone_graph" }
bun_uws = { path = "src/uws" }
Expand Down
1 change: 0 additions & 1 deletion src/analytics/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![warn(unreachable_pub)]
use core::fmt;
use core::sync::atomic::{AtomicU8, AtomicUsize, Ordering};
use std::sync::OnceLock;
Expand Down
1 change: 0 additions & 1 deletion src/api/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
// Re-exports — canonical definitions live in `bun_options_types::schema::api`.
// ──────────────────────────────────────────────────────────────────────────

#![warn(unreachable_pub)]
pub use bun_options_types::schema::api::{
BunInstall, Ca, NodeLinker, NpmRegistry, NpmRegistryMap, PnpmMatcher,
};
Expand Down
14 changes: 0 additions & 14 deletions src/ast/ast_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,6 @@ impl<'a> Ast<'a> {
}
}

// Zig: `std.json.stringify(self.parts, opts, stream)` where
// `opts = .{ .whitespace = .{ .separator = true } }`. In the Rust port the
// `crate::JsonWriter` trait stands in for the configured
// `std.json.WriteStream` (separator/whitespace are properties of the
// writer impl, not passed per-call), so the body collapses to a single
// `write` of the parts slice — the writer emits the JSON array,
// dispatching to `Part::json_stringify` per element (same shape as
// `Part::json_stringify` writing `self.stmts`). No live callers.
pub fn to_json<W: crate::JsonWriter>(&self, stream: &mut W) -> Result<(), bun_core::Error> {
// PORT NOTE: `whitespace.separator = true` is the caller's
// responsibility when constructing the `JsonWriter` impl.
stream.write(self.parts.as_slice())
}

// Zig `deinit` only freed `parts`, `symbols`, `import_records` via `bun.default_allocator`,
// and was guarded by "Do not call this if it wasn't globally allocated!".
// In Rust those fields own their storage and free on Drop; no explicit body needed.
Expand Down
6 changes: 0 additions & 6 deletions src/ast/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ impl Ref {
symbol: symbol_table.get_symbol(self),
}
}
pub fn json_stringify<W: crate::JsonWriter>(
self,
writer: &mut W,
) -> Result<(), bun_core::Error> {
writer.write(&[self.source_index(), self.inner_index()])
}
}

// Zig: `DumpImplData` + `dumpImpl` — formatter wrapper returned by `Ref.dump`.
Expand Down
50 changes: 0 additions & 50 deletions src/ast/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ pub enum Tag {
BMissing,
}

impl Tag {
pub fn json_stringify<W: crate::JsonWriter>(
self,
writer: &mut W,
) -> Result<(), bun_core::Error> {
writer.write(<&'static str>::from(self))
}
}

// Zig: `pub var icount: usize = 0;` — mutable global counter, never read.
// Debug-only so release doesn't pay a contended `lock xadd` per Binding.
#[cfg(debug_assertions)]
Expand Down Expand Up @@ -300,45 +291,4 @@ impl Binding {
}
}

// ──────────────────────────────────────────────────────────────────────────
// jsonStringify — Zig wrote a `Serializable` aggregate via the std.json
// protocol. The Rust JSON-writer trait is still shape-agnostic (`write<T>`),
// so we mirror the Zig body 1:1 and let the writer impl decide how to emit
// the aggregate. `Serializable` is a private layout-only carrier.
// ──────────────────────────────────────────────────────────────────────────

// Fields are the JSON-serialization payload (Zig std.json wrote each via
// `@typeInfo` reflection). No `BindingJsonWriter` implementor exists yet, so
// rustc correctly proves they are never *read*; they are the data contract for
// when the writer lands, not dead code.
#[expect(dead_code)]
pub struct Serializable {
r#type: Tag,
object: &'static [u8],
value: B,
loc: crate::Loc,
}

impl Binding {
pub fn json_stringify<W>(&self, writer: &mut W) -> Result<(), bun_core::Error>
where
W: BindingJsonWriter,
{
writer.write(Serializable {
r#type: self.data.tag(),
object: b"binding",
value: self.data,
loc: self.loc,
})
}
}

/// Stand-in for Zig's `anytype` json writer used by `Binding::json_stringify`.
/// Kept local (not `crate::JsonWriter`) because the crate-level trait is
/// currently `&str`-only; this preserves the Zig call-shape until the JSON
/// layer settles.
pub trait BindingJsonWriter {
fn write(&mut self, value: Serializable) -> Result<(), bun_core::Error>;
}

// ported from: src/js_parser/ast/Binding.zig
Loading