diff --git a/scripts/build/config.ts b/scripts/build/config.ts index 62a91376f6e7..3b6e53bf1a11 100644 --- a/scripts/build/config.ts +++ b/scripts/build/config.ts @@ -84,8 +84,6 @@ export interface Config { freebsd: boolean; /** linux || darwin || freebsd */ unix: boolean; - /** darwin || freebsd — kqueue-based event loop */ - kqueue: boolean; x64: boolean; arm64: boolean; @@ -732,7 +730,6 @@ export function resolveConfig(partial: PartialConfig, toolchain: Toolchain): Con const windows = os === "windows"; const freebsd = os === "freebsd"; const unix = linux || darwin || freebsd; - const kqueue = darwin || freebsd; const x64 = arch === "x64"; const arm64 = arch === "aarch64"; // Darwin target on a non-darwin host (Linux CI box building macOS @@ -1175,7 +1172,6 @@ export function resolveConfig(partial: PartialConfig, toolchain: Toolchain): Con windows, freebsd, unix, - kqueue, x64, arm64, host, diff --git a/scripts/build/depVersionsHeader.ts b/scripts/build/depVersionsHeader.ts index 810601198df9..85cb9a17b241 100644 --- a/scripts/build/depVersionsHeader.ts +++ b/scripts/build/depVersionsHeader.ts @@ -103,9 +103,6 @@ export function generateDepVersionsHeader(cfg: Config): string { 'extern "C" {', "#endif", "", - "// Dependency versions", - ...versions.map(([name, val]) => `#define BUN_DEP_${name} "${val}"`), - "", "// C string constants for easy access", ...versions.map(([name, val]) => `static const char* const BUN_VERSION_${name} = "${val}";`), "", diff --git a/scripts/build/source.ts b/scripts/build/source.ts index 9e6a932da208..08f3e88c07ef 100644 --- a/scripts/build/source.ts +++ b/scripts/build/source.ts @@ -452,7 +452,7 @@ export interface Dependency { /** * Macro name suffix for `bun_dependency_versions.h` — becomes - * `BUN_DEP_` / `BUN_VERSION_`. The value is derived from + * `BUN_VERSION_`. The value is derived from * `source(cfg)`: `github-archive.commit`, `prebuilt.identity`, etc. * * Omit for deps that shouldn't appear in `process.versions` (e.g. diff --git a/scripts/glob-sources.ts b/scripts/glob-sources.ts index 9848a8c000f8..aac8548984a7 100644 --- a/scripts/glob-sources.ts +++ b/scripts/glob-sources.ts @@ -116,7 +116,6 @@ const patterns = { "packages/bun-usockets/src/crypto/*.c", "src/jsc/bindings/uv-posix-polyfills.c", "src/jsc/bindings/uv-posix-stubs.c", - "src/*.c", "src/jsc/bindings/node/http/llhttp/*.c", ], }, diff --git a/src/api/lib.rs b/src/api/lib.rs index 14249de1ba5f..afdb17d4cc67 100644 --- a/src/api/lib.rs +++ b/src/api/lib.rs @@ -8,9 +8,7 @@ // Re-exports — canonical definitions live in `bun_options_types::schema::api`. // ────────────────────────────────────────────────────────────────────────── -pub use bun_options_types::schema::api::{ - BunInstall, Ca, NodeLinker, NpmRegistry, NpmRegistryMap, PnpmMatcher, -}; +pub use bun_options_types::schema::api::{BunInstall, Ca, NpmRegistry}; // ────────────────────────────────────────────────────────────────────────── // npm_registry — module path for the nested `NpmRegistry::Parser` diff --git a/src/bundler_jsc/PluginRunner.rs b/src/bundler_jsc/PluginRunner.rs index ed2d4883095a..cc7d627734ca 100644 --- a/src/bundler_jsc/PluginRunner.rs +++ b/src/bundler_jsc/PluginRunner.rs @@ -1,8 +1,6 @@ //! Runtime plugin host (JS-side `Bun.plugin()` resolve hooks). Lives here so //! `bundler/` is free of `JSValue`/`JSGlobalObject`. -pub use bun_resolver::fs::Path as FsPath; - /// Re-export of the concrete struct. /// `extract_namespace` / `could_be_plugin` (pure byte parsing) live in /// `bun_bundler`; the stateful struct + `on_resolve` body live in diff --git a/src/bundler_jsc/lib.rs b/src/bundler_jsc/lib.rs index ad322194fe4b..582e07aa76ef 100644 --- a/src/bundler_jsc/lib.rs +++ b/src/bundler_jsc/lib.rs @@ -5,7 +5,7 @@ // ────────────────────────────────────────────────────────────────────────── // Bridge types — re-exported from `bun_jsc` now that it `cargo check`s. // ────────────────────────────────────────────────────────────────────────── -pub use bun_jsc::{ErrorableString, JSGlobalObject, JSValue, JsError, JsResult, VM}; +pub use bun_jsc::{JSGlobalObject, JSValue, JsResult, VM}; #[path = "source_map_mode_jsc.rs"] pub mod source_map_mode_jsc; diff --git a/src/clap/error.rs b/src/clap/error.rs index 42569187ccae..3bab9a99ffad 100644 --- a/src/clap/error.rs +++ b/src/clap/error.rs @@ -6,8 +6,6 @@ pub enum Error { MissingValue, #[error("InvalidArgument")] InvalidArgument, - #[error("WriteFailed")] - WriteFailed, } impl Error { @@ -17,7 +15,6 @@ impl Error { Self::DoesntTakeValue => "DoesntTakeValue", Self::MissingValue => "MissingValue", Self::InvalidArgument => "InvalidArgument", - Self::WriteFailed => "WriteFailed", } } } @@ -28,12 +25,6 @@ impl bun_core::output::ErrName for Error { } } -impl From for Error { - fn from(_: core::fmt::Error) -> Self { - Self::WriteFailed - } -} - impl From for Error { fn from(e: crate::streaming::ArgError) -> Self { match e { diff --git a/src/clap/lib.rs b/src/clap/lib.rs index ad9651910f29..9e5024ad8787 100644 --- a/src/clap/lib.rs +++ b/src/clap/lib.rs @@ -334,11 +334,6 @@ impl Diagnostic { crate::Error::InvalidArgument => { bun_core::pretty_errorln!("error: Invalid Argument '{}'", name) } - _ => bun_core::pretty_errorln!( - "error: {} while parsing argument '{}'", - err, - name - ), } bun_core::Output::flush(); Ok(()) diff --git a/src/errno/darwin_errno.rs b/src/errno/darwin_errno.rs index 87c532f1d8b3..829ded7151d9 100644 --- a/src/errno/darwin_errno.rs +++ b/src/errno/darwin_errno.rs @@ -1,7 +1,6 @@ // posix types live in `crate::posix` (moved from bun_sys). pub use crate::posix::E; pub use crate::posix::S; -pub use crate::posix::mode_t as Mode; #[repr(u16)] #[derive( diff --git a/src/errno/freebsd_errno.rs b/src/errno/freebsd_errno.rs index 5d94073ed8f0..3eee07519175 100644 --- a/src/errno/freebsd_errno.rs +++ b/src/errno/freebsd_errno.rs @@ -1,7 +1,6 @@ // posix types live in `crate::posix` (moved from bun_sys). pub use crate::posix::E; pub use crate::posix::S; -pub use crate::posix::mode_t as Mode; #[repr(u16)] #[derive( diff --git a/src/errno/linux_errno.rs b/src/errno/linux_errno.rs index ad43842a23ba..df716ca29c02 100644 --- a/src/errno/linux_errno.rs +++ b/src/errno/linux_errno.rs @@ -1,7 +1,6 @@ // posix types live in `crate::posix` (moved from bun_sys). pub use crate::posix::E; pub use crate::posix::S; -pub use crate::posix::mode_t as Mode; #[repr(u16)] #[derive( diff --git a/src/install/PackageManager/PackageManagerEnqueue.rs b/src/install/PackageManager/PackageManagerEnqueue.rs index f0c91da56b53..a2c6a0e66a1b 100644 --- a/src/install/PackageManager/PackageManagerEnqueue.rs +++ b/src/install/PackageManager/PackageManagerEnqueue.rs @@ -15,6 +15,7 @@ use crate::_folder_resolver::{ self as FolderResolution, FolderResolution as FolderResolutionValue, GlobalOrRelative, PackageWorkspaceSearchPathFormatter, }; +use crate::dependency; use crate::dependency::{DependencyExt as _, TagExt as _, VersionExt as _}; use crate::lockfile::PackageIndexEntry; use crate::lockfile::package::Package; @@ -30,7 +31,6 @@ use crate::repository_real::RepositoryExt as _; use crate::resolution::{ NpmVersionInfo as ResolutionNpmValue, Tag as ResolutionTag, TaggedValue as ResolutionTagged, }; -use crate::{ManifestLoad, dependency}; use bun_install::NetworkTask; use bun_install::{ self as install, Behavior, Dependency, DependencyID, ExtractTarball, Features, Integrity, Npm, @@ -1022,7 +1022,6 @@ pub fn enqueue_dependency_with_main_and_success_fn( &*scope, name_hash, Some(&mut expired), - ManifestLoad::LoadFromMemoryFallbackToDisk, needs_extended_manifest, ) } { @@ -2361,7 +2360,6 @@ fn get_or_put_resolved_package( cache_ctx, scope.get(), name_hash, - ManifestLoad::LoadFromMemoryFallbackToDisk, needs_ext, ) else { return Ok(None); // manifest might still be downloading. This feels unreliable. diff --git a/src/install/PackageManager/PopulateManifestCache.rs b/src/install/PackageManager/PopulateManifestCache.rs index 79993c5fa0d0..c4a2ee22b6b3 100644 --- a/src/install/PackageManager/PopulateManifestCache.rs +++ b/src/install/PackageManager/PopulateManifestCache.rs @@ -4,7 +4,6 @@ use bun_core::Output; use crate::Dependency; use crate::DependencyID; -use crate::ManifestLoad; use crate::NetworkTask; use crate::PackageID; use crate::Resolution; @@ -190,7 +189,6 @@ pub fn populate_manifest_cache( cache_ctx, scope.get(), pkg_name_slice, - ManifestLoad::LoadFromMemoryFallbackToDisk, needs_extended_manifest, ); if cached.is_none() { @@ -245,7 +243,6 @@ pub fn populate_manifest_cache( cache_ctx, scope.get(), package_name, - ManifestLoad::LoadFromMemoryFallbackToDisk, needs_extended_manifest, ); if cached.is_none() { diff --git a/src/install/PackageManifestMap.rs b/src/install/PackageManifestMap.rs index 342246927401..21d73cf53644 100644 --- a/src/install/PackageManifestMap.rs +++ b/src/install/PackageManifestMap.rs @@ -26,12 +26,6 @@ impl Value { type ManifestHashMap = HashMap>; -#[derive(Clone, Copy, PartialEq, Eq)] -pub enum CacheBehavior { - LoadFromMemory, - LoadFromMemoryFallbackToDisk, -} - /// By-value snapshot of the `PackageManager` fields the disk-fallback path of /// [`PackageManifestMap::by_name_hash_allow_expired`] reads. /// @@ -61,14 +55,12 @@ impl PackageManifestMap { ctx: DiskCacheCtx, scope: &npm::registry::Scope, name: &[u8], - cache_behavior: CacheBehavior, needs_extended_manifest: bool, ) -> Option<&mut npm::PackageManifest> { self.by_name_hash( ctx, scope, StringBuilder::string_hash(name), - cache_behavior, needs_extended_manifest, ) } @@ -87,24 +79,14 @@ impl PackageManifestMap { ctx: DiskCacheCtx, scope: &npm::registry::Scope, name_hash: PackageNameHash, - cache_behavior: CacheBehavior, needs_extended_manifest: bool, ) -> Option<&mut npm::PackageManifest> { - self.by_name_hash_allow_expired( - ctx, - scope, - name_hash, - None, - cache_behavior, - needs_extended_manifest, - ) + self.by_name_hash_allow_expired(ctx, scope, name_hash, None, needs_extended_manifest) } - /// Memory-only lookup — equivalent to `by_name_hash` with - /// `CacheBehavior::LoadFromMemory`, but without the `ctx`/`scope` - /// parameters: the memory-only arm never reads them. Exposed separately so callers - /// holding `&mut PackageManager` can borrow only the disjoint - /// `pm.manifests` field. + /// Memory-only lookup: no disk fallback, so no `ctx`/`scope`. Exposed + /// separately so callers holding `&mut PackageManager` can borrow only + /// the disjoint `pm.manifests` field. pub(crate) fn by_name_hash_in_memory( &mut self, name_hash: PackageNameHash, @@ -121,7 +103,6 @@ impl PackageManifestMap { scope: &npm::registry::Scope, name: &[u8], is_expired: Option<&mut bool>, - cache_behavior: CacheBehavior, needs_extended_manifest: bool, ) -> Option<&mut npm::PackageManifest> { self.by_name_hash_allow_expired( @@ -129,7 +110,6 @@ impl PackageManifestMap { scope, StringBuilder::string_hash(name), is_expired, - cache_behavior, needs_extended_manifest, ) } @@ -145,25 +125,8 @@ impl PackageManifestMap { scope: &npm::registry::Scope, name_hash: PackageNameHash, is_expired: Option<&mut bool>, - cache_behavior: CacheBehavior, needs_extended_manifest: bool, ) -> Option<&mut npm::PackageManifest> { - if cache_behavior == CacheBehavior::LoadFromMemory { - let entry = self.hash_map.get_mut(&name_hash)?; - return match entry { - Value::Manifest(m) => Some(m), - Value::Expired(m) => { - if let Some(expiry) = is_expired { - *expiry = true; - Some(m) - } else { - None - } - } - Value::NotFound => None, - }; - } - match self.hash_map.entry(name_hash) { Entry::Occupied(occ) => { let value_ptr = occ.into_mut(); diff --git a/src/install/lib.rs b/src/install/lib.rs index 11258ad52a84..bcfa7c503a67 100644 --- a/src/install/lib.rs +++ b/src/install/lib.rs @@ -198,10 +198,6 @@ pub mod package_manager { MapEntry as WorkspacePackageJsonCacheEntry, WorkspacePackageJSONCache, }; - /// `PackageManifestMap.load` `When` enum — re-export the real enum so - /// callers naming either path agree on one type. - pub use crate::package_manifest_map::CacheBehavior as ManifestLoad; - /// `CommandLineArguments.AuditLevel` (subset surfaced for /// `bun_runtime::cli::audit_command`). Re-exported alongside the full /// `command_line_arguments` module from `package_manager_real`. @@ -285,14 +281,13 @@ pub use integrity::Integrity; pub use bin::Bin; pub use lockfile_real::bun_lock as TextLockfile; -pub use patch_install as patch; pub use dependency::Tag as DependencyVersionTag; pub use extract_tarball::ExtractTarball; pub use lockfile::{LoadResult, LoadStep, Lockfile, PatchedDep}; pub use package_manager::Options::LogLevel; pub use package_manager::{ - GetJsonOptions, GetJsonResult, ManifestLoad, WorkspaceFilter, WorkspacePackageJsonCacheEntry, + GetJsonOptions, GetJsonResult, WorkspaceFilter, WorkspacePackageJsonCacheEntry, }; pub use repository::{Repository, RepositoryExt}; pub use resolution::Tag as ResolutionTag; diff --git a/src/install/lockfile.rs b/src/install/lockfile.rs index fdc2d43b1e3f..345d168b322e 100644 --- a/src/install/lockfile.rs +++ b/src/install/lockfile.rs @@ -1502,7 +1502,6 @@ impl Lockfile { cache_ctx, scope, pkg_name_hash, - Install::ManifestLoad::LoadFromMemoryFallbackToDisk, false, ) else { continue; diff --git a/src/jsc/ErrorCode.rs b/src/jsc/ErrorCode.rs index 33c52881348f..a34dd8e031fb 100644 --- a/src/jsc/ErrorCode.rs +++ b/src/jsc/ErrorCode.rs @@ -45,7 +45,7 @@ impl GlobalObjectRef for crate::JSGlobalObject { type ErrorCodeInt = u16; /// `Bun::ErrorCode` in C++. Modelled as a newtype-over-`u16` so the same type -/// can also carry the legacy sentinels (`PARSER_ERROR` / `JS_ERROR_OBJECT`) +/// can also carry the legacy sentinel (`JS_ERROR_OBJECT`) /// without an exhaustive-match obligation. #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] @@ -66,7 +66,6 @@ include!(concat!(env!("BUN_CODEGEN_DIR"), "/ErrorCode.generated.rs")); // Legacy anyerror-wrapper sentinels. // ────────────────────────────────────────────────────────────────────────── impl ErrorCode { - pub(crate) const PARSER_ERROR: ErrorCodeInt = 0xFFFE; pub const JS_ERROR_OBJECT: ErrorCodeInt = 0xFFFD; } @@ -170,13 +169,4 @@ impl<'a, G: GlobalObjectRef + ?Sized> ErrorBuilder<'a, G> { } } -// C++ compares parser-error sentinels against these exported statics -// (`extern "C" ZigErrorCode Zig_ErrorCodeParserError;`, headers-handwritten.h). - -#[unsafe(no_mangle)] -static Zig_ErrorCodeParserError: ErrorCodeInt = ErrorCode::PARSER_ERROR; - -#[unsafe(no_mangle)] -static Zig_ErrorCodeJSErrorObject: ErrorCodeInt = ErrorCode::JS_ERROR_OBJECT; - // ported from: src/jsc/bindings/ErrorCode.ts diff --git a/src/jsc/bindings/headers-handwritten.h b/src/jsc/bindings/headers-handwritten.h index 6cb74be5243e..633dea655e8e 100644 --- a/src/jsc/bindings/headers-handwritten.h +++ b/src/jsc/bindings/headers-handwritten.h @@ -341,8 +341,6 @@ typedef struct { extern "C" const char* Bun__userAgent; -extern "C" ZigErrorCode Zig_ErrorCodeParserError; - extern "C" void ZigString__free(const unsigned char* ptr, size_t len, void* allocator); extern "C" bool Bun__transpileVirtualModule( @@ -384,11 +382,6 @@ extern "C" bool Bun__VM__useIsolationSourceProviderCache(void* bunVM); extern "C" const char* Bun__version; extern "C" const char* Bun__version_with_sha; -// Version exports removed - now handled by CMake-generated header (bun_dependency_versions.h) -// Only keep the ones still exported from native code -extern "C" const char* Bun__versions_uws; -extern "C" const char* Bun__versions_usockets; - extern "C" const char* Bun__version_sha; extern "C" void ZigString__freeGlobal(const unsigned char* ptr, size_t len); diff --git a/src/jsc/generated.rs b/src/jsc/generated.rs index 729e58c9eb60..4f97b65ede60 100644 --- a/src/jsc/generated.rs +++ b/src/jsc/generated.rs @@ -977,7 +977,7 @@ macro_rules! impl_js_class_via_generated { /// Expands to a `pub mod $mod` containing the standard `.classes.ts` codegen /// surface for a JS wrapper class: `from_js` / `from_js_direct` / `from_js_ref` -/// / `to_js` / `to_js_unchecked` / `dangerously_set_ptr` / `get_constructor`, +/// / `to_js` / `to_js_unchecked` / `get_constructor`, /// plus a cached-accessor pair per listed property. /// /// One impl, generated once — see @@ -1039,9 +1039,7 @@ macro_rules! js_class_module { // to a non-null `*mut`). `__from_js*` only type-check the encoded // value and return the stored `m_ctx` pointer (or null) — the C++ // side never dereferences `Payload`, so there is no Rust-side - // precondition. `__dangerously_set_ptr` keeps `unsafe` - // because it installs `ptr` into a GC cell whose finalizer will - // later free it (deferred deref → ownership precondition). + // precondition. $crate::jsc_abi_extern! { #[allow(improper_ctypes)] { @@ -1053,8 +1051,6 @@ macro_rules! js_class_module { safe fn __create(global: *mut JSGlobalObject, ptr: *mut Payload) -> JSValue; #[link_name = concat!($TypeName, "__getConstructor")] safe fn __get_constructor(global: &JSGlobalObject) -> JSValue; - #[link_name = concat!($TypeName, "__dangerouslySetPtr")] - fn __dangerously_set_ptr(value: JSValue, ptr: *mut Payload) -> bool; } } @@ -1107,20 +1103,6 @@ macro_rules! js_class_module { pub fn get_constructor(global: &JSGlobalObject) -> JSValue { __get_constructor(global) } - - /// Detach (`ptr = null`) or replace the wrapped native pointer on - /// an existing JS wrapper. Returns `false` if `value` is not (a - /// subclass of) the wrapper type. - /// - /// # Safety - /// Caller must ensure the previous `m_ctx` is finalized exactly - /// once elsewhere — the C++ side overwrites without freeing. - #[inline] - pub unsafe fn dangerously_set_ptr(value: JSValue, ptr: *mut Payload) -> bool { - // SAFETY: `value` is a valid encoded JSValue; the C++ side - // type-checks before writing `m_ctx`. - unsafe { __dangerously_set_ptr(value, ptr) } - } } }; } diff --git a/src/md/types.rs b/src/md/types.rs index b9e3820b9b5b..1f452ce614bc 100644 --- a/src/md/types.rs +++ b/src/md/types.rs @@ -157,7 +157,6 @@ pub enum LineType { Hr, Atxheader, Setextunderline, - Setextheader, Indentedcode, Fencedcode, Html, diff --git a/src/react_compiler/hir/environment_config.rs b/src/react_compiler/hir/environment_config.rs index ea345bc15758..9982ecdd7cf9 100644 --- a/src/react_compiler/hir/environment_config.rs +++ b/src/react_compiler/hir/environment_config.rs @@ -52,10 +52,6 @@ impl Default for ExhaustiveEffectDepsMode { } } -fn default_true() -> bool { - true -} - /// Compiler environment configuration. Contains feature flags and settings. /// /// Fields that would require passing JS functions across the JS/Rust boundary diff --git a/src/runtime/api/bun/spawn.rs b/src/runtime/api/bun/spawn.rs index 5cc3f756ac12..d3e602518add 100644 --- a/src/runtime/api/bun/spawn.rs +++ b/src/runtime/api/bun/spawn.rs @@ -16,6 +16,6 @@ #[path = "spawn/stdio.rs"] pub mod stdio; -pub use ::bun_spawn::posix_spawn::{BunSpawn, PosixSpawn, bun_spawn, posix_spawn}; +pub use ::bun_spawn::posix_spawn::{bun_spawn, posix_spawn}; // `process` is re-exported from the `bun_spawn` workspace crate. diff --git a/src/runtime/cli/outdated_command.rs b/src/runtime/cli/outdated_command.rs index 0e3c7dfe61c7..0b624af75692 100644 --- a/src/runtime/cli/outdated_command.rs +++ b/src/runtime/cli/outdated_command.rs @@ -10,7 +10,7 @@ use bun_install::dependency::{self, Behavior}; use bun_install::lockfile::package::PackageColumns as _; use bun_install::lockfile::{LoadResult, LoadStep}; use bun_install::package_manager::{ - LogLevel, ManifestLoad, Subcommand, WorkspaceFilter, populate_manifest_cache, + LogLevel, Subcommand, WorkspaceFilter, populate_manifest_cache, }; use bun_install::{CommandLineArguments, DependencyID, PackageID, PackageManager, resolution}; use bun_paths::{self as path, PathBuffer}; @@ -525,7 +525,6 @@ impl OutdatedCommand { &scope, package_name, Some(&mut expired), - ManifestLoad::LoadFromMemoryFallbackToDisk, needs_extended, ) else { continue; @@ -724,7 +723,6 @@ impl OutdatedCommand { &scope, package_name, Some(&mut expired), - ManifestLoad::LoadFromMemoryFallbackToDisk, needs_extended, ) else { continue; diff --git a/src/runtime/cli/update_interactive_command.rs b/src/runtime/cli/update_interactive_command.rs index fbab8741e3a3..b6bb478345b6 100644 --- a/src/runtime/cli/update_interactive_command.rs +++ b/src/runtime/cli/update_interactive_command.rs @@ -13,8 +13,8 @@ use bun_install::dependency::{self, Behavior}; use bun_install::lockfile::package::PackageColumns as _; use bun_install::lockfile::{LoadResult, LoadStep}; use bun_install::package_manager::{ - LogLevel, ManifestLoad, ROOT_PACKAGE_JSON_PATH, Subcommand, WorkspaceFilter, - install_with_manager, populate_manifest_cache, + LogLevel, ROOT_PACKAGE_JSON_PATH, Subcommand, WorkspaceFilter, install_with_manager, + populate_manifest_cache, }; use bun_install::{ CommandLineArguments, GetJsonOptions, GetJsonResult, INVALID_PACKAGE_ID, PackageID, @@ -968,7 +968,6 @@ impl UpdateInteractiveCommand { &scope, package_name, Some(&mut expired), - ManifestLoad::LoadFromMemoryFallbackToDisk, needs_extended, ) else { continue; diff --git a/src/runtime/ffi/abi_type.rs b/src/runtime/ffi/abi_type.rs index 32dc51c65896..36d83fe2b03e 100644 --- a/src/runtime/ffi/abi_type.rs +++ b/src/runtime/ffi/abi_type.rs @@ -213,7 +213,7 @@ impl ABIType { ToCFormatter { tag: self, symbol } } - pub fn to_js(self, symbol: &[u8]) -> ToJSFormatter<'_> { + pub(crate) fn to_js(self, symbol: &[u8]) -> ToJSFormatter<'_> { ToJSFormatter { tag: self, symbol } } @@ -235,7 +235,7 @@ impl ABIType { } } -pub struct ToCFormatter<'a> { +pub(crate) struct ToCFormatter<'a> { pub(crate) symbol: &'a [u8], pub(crate) tag: ABIType, } @@ -257,7 +257,7 @@ impl fmt::Display for ToCFormatter<'_> { } } -pub struct ToJSFormatter<'a> { +pub(crate) struct ToJSFormatter<'a> { pub(crate) symbol: &'a [u8], pub(crate) tag: ABIType, } diff --git a/src/runtime/ffi/mod.rs b/src/runtime/ffi/mod.rs index 3551e861c688..e9e2dee0ca26 100644 --- a/src/runtime/ffi/mod.rs +++ b/src/runtime/ffi/mod.rs @@ -142,4 +142,3 @@ pub use ffi_body::FFI; // ABIType — single source of truth lives in abi_type.rs // ═════════════════════════════════════════════════════════════════════════════ mod abi_type; -pub use abi_type::{ABI_TYPE_LABEL, ABIType, ToCFormatter, ToJSFormatter}; diff --git a/src/runtime/node/node_process.rs b/src/runtime/node/node_process.rs index 61150b0befc1..a62c28df957a 100644 --- a/src/runtime/node/node_process.rs +++ b/src/runtime/node/node_process.rs @@ -101,20 +101,6 @@ static Bun__version_with_sha: CStrPtr = CStrPtr( .as_ptr() .cast::(), ); -// Version exports removed - now handled by build-generated header (bun_dependency_versions.h) -// The C++ code in BunProcess.cpp uses the generated header directly -#[unsafe(no_mangle)] -static Bun__versions_uws: CStrPtr = CStrPtr( - const_format::concatcp!(Environment::GIT_SHA, "\0") - .as_ptr() - .cast::(), -); -#[unsafe(no_mangle)] -static Bun__versions_usockets: CStrPtr = CStrPtr( - const_format::concatcp!(Environment::GIT_SHA, "\0") - .as_ptr() - .cast::(), -); #[unsafe(no_mangle)] static Bun__version_sha: CStrPtr = CStrPtr( const_format::concatcp!(Environment::GIT_SHA, "\0") diff --git a/src/runtime/valkey_jsc/mod.rs b/src/runtime/valkey_jsc/mod.rs index f2f717739ac1..0181c926c953 100644 --- a/src/runtime/valkey_jsc/mod.rs +++ b/src/runtime/valkey_jsc/mod.rs @@ -32,10 +32,9 @@ pub use self::js_valkey as js_valkey_body; // ─── public re-exports ─────────────────────────────────────────────────────── pub use js_valkey::JSValkeyClient; -pub use valkey::{Options, Protocol, Status, ValkeyClient}; pub mod valkey_command { - pub use super::valkey_command_body::{Entry, Meta, Promise, PromisePair, entry, promise_pair}; + pub use super::valkey_command_body::{Entry, PromisePair}; } // ── JsClass wiring (codegen name = "RedisClient", see valkey.classes.ts) ──── diff --git a/src/runtime/webcore/FileReader.rs b/src/runtime/webcore/FileReader.rs index 675393b58b00..d321e94bd335 100644 --- a/src/runtime/webcore/FileReader.rs +++ b/src/runtime/webcore/FileReader.rs @@ -108,7 +108,6 @@ pub enum ReadDuringJSOnPullResult { // TODO(refactor): `&'static mut` forge — sibling `static-widen-mut` pattern; // see note on `FileReader::pending_view`. Js(&'static mut [u8]), - AmountRead(usize), /// Borrows the reader/JS buffer for the duration of one `on_pull` call /// only. Holder-lifetime, not process-lifetime — `RawSlice` per /// `bun_ptr::Interned` Population-B triage. @@ -1066,17 +1065,11 @@ impl FileReader { } return streams::Result::Owned(Vec::::move_from_list(buffered)); } - _ => { - // Falls through to set - // `pending_view = buffer`. The only variants reaching this arm - // are `None` (impossible — we just stored `Js(buffer)` above and - // `on_read_chunk` never sets `None`) and `AmountRead` (never - // produced by `on_read_chunk`). Unreachable in the current state - // machine; if that invariant ever changes, the buffer slice must - // be recovered from a captured raw ptr+len before the move. - unreachable!( - "on_read_chunk never yields None/AmountRead while read_inside_on_pull == Js" - ); + ReadDuringJSOnPullResult::None => { + // `Js(buffer)` was stored above and `on_read_chunk` never + // replaces it with `None`. If that changes, recover the + // buffer slice from a raw ptr+len before this move. + unreachable!("on_read_chunk never yields None while read_inside_on_pull == Js"); } } } diff --git a/src/runtime/webcore/Response.rs b/src/runtime/webcore/Response.rs index c77d927653dc..1b5877c77bfd 100644 --- a/src/runtime/webcore/Response.rs +++ b/src/runtime/webcore/Response.rs @@ -163,12 +163,8 @@ impl Drop for BodyAbortListener { } } -// `jsc.Codegen.JSResponse` — generated by `.classes.ts`. The Rust bindings -// live in `bun_jsc::generated::JSResponse` (emitted by `js_class_module!`): -// `from_js` / `from_js_direct` / `to_js` / `get_constructor` / -// `dangerously_set_ptr` plus the cached-accessor pairs (`body_*_cached`, -// `headers_*_cached`, `url_*_cached`, `statusText_*_cached`, -// `stream_*_cached`). +// `jsc.Codegen.JSResponse` — the real bindings, emitted by +// `js_class_module!` in `bun_jsc::generated`. // // IMPORTANT: do NOT re-introduce `crate::webcore::jsc::codegen::JSResponse` // here — that module is a placeholder stub whose `to_js_unchecked` returns diff --git a/src/runtime/webcore/streams.rs b/src/runtime/webcore/streams.rs index f62a3363fbad..616472fbf5c2 100644 --- a/src/runtime/webcore/streams.rs +++ b/src/runtime/webcore/streams.rs @@ -79,9 +79,6 @@ pub enum Start { #[repr(u8)] #[derive(Copy, Clone, Eq, PartialEq, core::marker::ConstParamTy)] pub enum StartTag { - Empty, - Err, - ChunkSize, ArrayBufferSink, FileSink, HTTPSResponseSink, @@ -90,9 +87,6 @@ pub enum StartTag { NetworkSink, FetchRequestBodySink, HTMLRewriterSink, - Ready, - OwnedAndDone, - Done, } impl Start { @@ -161,8 +155,6 @@ impl Start { StartTag::HTMLRewriterSink => { Self::from_js_with_tag::<{ StartTag::HTMLRewriterSink }>(global_this, value) } - // No `Start` variant carries these tags from JS. - _ => Self::from_js(global_this, value), } } @@ -281,11 +273,6 @@ impl Start { return Ok(Start::ChunkSize(chunk_size)); } } - _ => { - // Dead for every valid TAG; runtime unreachable until - // `generic_const_exprs` lets us hoist to a compile error. - unreachable!("Unsupported StartTag"); - } } Ok(Start::Empty) diff --git a/src/sha_hmac/lib.rs b/src/sha_hmac/lib.rs index a64dd03bf3a1..9aab29fdbb59 100644 --- a/src/sha_hmac/lib.rs +++ b/src/sha_hmac/lib.rs @@ -9,4 +9,4 @@ pub use sha::evp; // Crate-root re-exports // so dependents can write `bun_sha_hmac::SHA256` / `bun_sha_hmac::generate`. pub use hmac::generate; -pub use sha::{Algorithm, MD4, MD5, MD5_SHA1, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512_256}; +pub use sha::{Algorithm, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512_256}; diff --git a/src/sha_hmac/sha.rs b/src/sha_hmac/sha.rs index 0a179500b43b..e10b370eaaaa 100644 --- a/src/sha_hmac/sha.rs +++ b/src/sha_hmac/sha.rs @@ -194,8 +194,6 @@ pub mod evp { new_evp!(SHA384, SHA384_DIGEST_LENGTH, EVP_sha384); new_evp!(SHA256, SHA256_DIGEST_LENGTH, EVP_sha256); new_evp!(SHA512_256, SHA512_256_DIGEST_LENGTH, EVP_sha512_256); - new_evp!(MD5_SHA1, 36, EVP_md5_sha1); // EVP_md5_sha1 writes MD5(16) || SHA1(20) = 36 bytes - new_evp!(Blake2, 256 / 8, EVP_blake2b256); // ────────────────────────────────────────────────────────────────────── // evp::Algorithm — moved from bun_jsc::api::bun::crypto, @@ -274,7 +272,6 @@ pub mod evp { pub use evp::Algorithm; pub use evp::MD4; pub use evp::MD5; -pub use evp::MD5_SHA1; pub use evp::SHA1; pub use evp::SHA224; pub use evp::SHA256; @@ -296,26 +293,6 @@ pub mod hashers { boringssl_sys::SHA1_Final ); - new_hasher!( - SHA512, - SHA512_DIGEST_LENGTH, - boringssl_sys::SHA512_CTX, - boringssl_sys::SHA512, - boringssl_sys::SHA512_Init, - boringssl_sys::SHA512_Update, - boringssl_sys::SHA512_Final - ); - - new_hasher!( - SHA384, - SHA384_DIGEST_LENGTH, - boringssl_sys::SHA512_CTX, - boringssl_sys::SHA384, - boringssl_sys::SHA384_Init, - boringssl_sys::SHA384_Update, - boringssl_sys::SHA384_Final - ); - new_hasher!( SHA256, SHA256_DIGEST_LENGTH, @@ -325,24 +302,4 @@ pub mod hashers { boringssl_sys::SHA256_Update, boringssl_sys::SHA256_Final ); - - new_hasher!( - SHA512_256, - SHA512_256_DIGEST_LENGTH, - boringssl_sys::SHA512_CTX, - boringssl_sys::SHA512_256, - boringssl_sys::SHA512_256_Init, - boringssl_sys::SHA512_256_Update, - boringssl_sys::SHA512_256_Final - ); - - new_hasher!( - RIPEMD160, - boringssl_sys::RIPEMD160_DIGEST_LENGTH as usize, - boringssl_sys::RIPEMD160_CTX, - boringssl_sys::RIPEMD160, - boringssl_sys::RIPEMD160_Init, - boringssl_sys::RIPEMD160_Update, - boringssl_sys::RIPEMD160_Final - ); } diff --git a/src/spawn/lib.rs b/src/spawn/lib.rs index 4725121ebca5..38116bd1c5bf 100644 --- a/src/spawn/lib.rs +++ b/src/spawn/lib.rs @@ -35,8 +35,6 @@ pub mod posix_spawn { pub use crate::process::{WindowsSpawnOptions, WindowsSpawnResult}; pub use bun_spawn_sys::posix_spawn::bun_spawn::*; } - pub use bun_spawn as BunSpawn; - pub use bun_spawn_sys::posix_spawn::posix_spawn as PosixSpawn; } /// `Process` / `Poller` / `WaiterThread` / `spawn_process` / `sync` / diff --git a/src/sql_jsc/jsc.rs b/src/sql_jsc/jsc.rs index 1991c743fa4c..60505c2bd7f3 100644 --- a/src/sql_jsc/jsc.rs +++ b/src/sql_jsc/jsc.rs @@ -27,10 +27,9 @@ use core::ptr::NonNull; // ────────────────────────────────────────────────────────────────────────── pub use bun_jsc::{ - ArrayBuffer, CallFrame, CoerceTo, ErrorBuilder, ErrorCode, ExternColumnIdentifier, - ExternColumnIdentifierValue, GlobalRef, JSArrayIterator, JSCell, JSGlobalObject, JSObject, - JSType, JSValue, JsCell, JsError, JsRef, JsResult, MarkedArgumentBuffer, StringJsc, - StrongOptional, ThrowFmtArgs, ZigStringJsc, bun_string_jsc, host_fn, + ArrayBuffer, CallFrame, ErrorBuilder, ErrorCode, ExternColumnIdentifier, GlobalRef, + JSArrayIterator, JSCell, JSGlobalObject, JSObject, JSType, JSValue, JsCell, JsError, JsRef, + JsResult, MarkedArgumentBuffer, StringJsc, StrongOptional, bun_string_jsc, host_fn, }; /// Re-export — `bun_jsc` now defines `IntegerRange` at its crate root and the @@ -523,7 +522,6 @@ pub mod api { } } } - pub use SSLConfig as SslConfig; } /// PascalCase namespace alias. #[allow(non_snake_case)] diff --git a/src/wyhash/lib.rs b/src/wyhash/lib.rs index ae96362f6ed8..f5a85a21a6fc 100644 --- a/src/wyhash/lib.rs +++ b/src/wyhash/lib.rs @@ -932,8 +932,6 @@ pub const fn hash_const(seed: u64, input: &[u8]) -> u64 { } /// Integer-to-integer hashing (same width in, same width out). -/// We cover the dedicated widths (16/32/64) via a sealed trait. -/// All current callers pass `u32`. #[inline] pub fn hash_int(input: T) -> T { T::hash_int(input) @@ -943,18 +941,6 @@ pub trait HashInt: Copy { fn hash_int(self) -> Self; } -// Source: https://github.com/skeeto/hash-prospector -impl HashInt for u16 { - #[inline] - fn hash_int(self) -> u16 { - let mut x = self; - x = (x ^ (x >> 7)).wrapping_mul(0x2993); - x = (x ^ (x >> 5)).wrapping_mul(0xe877); - x = (x ^ (x >> 9)).wrapping_mul(0x0235); - x ^ (x >> 10) - } -} - // Source: https://github.com/skeeto/hash-prospector impl HashInt for u32 { #[inline] @@ -967,19 +953,6 @@ impl HashInt for u32 { } } -// Source: https://github.com/jonmaiga/mx3 -impl HashInt for u64 { - #[inline] - fn hash_int(self) -> u64 { - const C: u64 = 0xbea2_25f9_eb34_556d; - let mut x = self; - x = (x ^ (x >> 32)).wrapping_mul(C); - x = (x ^ (x >> 29)).wrapping_mul(C); - x = (x ^ (x >> 32)).wrapping_mul(C); - x ^ (x >> 29) - } -} - // ════════════════════════════════════════════════════════════════════════════ // Tests // ════════════════════════════════════════════════════════════════════════════ diff --git a/test/internal/source-lints/dead-symbols-install-webcore-sha.test.ts b/test/internal/source-lints/dead-symbols-install-webcore-sha.test.ts new file mode 100644 index 000000000000..df29302e622c --- /dev/null +++ b/test/internal/source-lints/dead-symbols-install-webcore-sha.test.ts @@ -0,0 +1,125 @@ +// Guards against reintroduction of symbols removed as dead code from +// install, runtime/webcore, jsc, sha_hmac, and several leaf crates. Each +// entry was verified to have zero references across src/, src/codegen/, +// src/js/, and build/debug/codegen/ before deletion, and the full build +// links without the removed no_mangle exports. +// +// This is a source-tree lint: it reads files from src/ and does not touch +// the built binary, so it belongs in test/internal/source-lints/ per the +// README. + +import { expect, test } from "bun:test"; +import { readFileSync } from "node:fs"; +import path from "node:path"; + +const repoRoot = path.resolve(import.meta.dir, "..", "..", ".."); + +function src(p: string): string { + return readFileSync(path.join(repoRoot, p), "utf8"); +} + +function resurrected(checks: Array<[string, RegExp]>): string[] { + return checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); +} + +test("dead Rust symbols (install, webcore, jsc, leaf crates) do not reappear", () => { + const checks: Array<[string, RegExp]> = [ + // install: CacheBehavior's LoadFromMemory variant was never constructed, + // so the enum carried no information and was removed along with its + // parameter. The memory-only path is by_name_hash_in_memory. + ["src/install/PackageManifestMap.rs", /pub enum CacheBehavior\b/], + + // runtime/node: version statics with no readers. C++ reads + // BUN_VERSION_USOCKETS / BUN_VERSION_UWS from the generated + // bun_dependency_versions.h instead (since #22561). + ["src/runtime/node/node_process.rs", /static Bun__versions_uws:/], + ["src/runtime/node/node_process.rs", /static Bun__versions_usockets:/], + + // jsc: sentinel statics never read from C++, and the PARSER_ERROR const + // whose only use they were. + ["src/jsc/ErrorCode.rs", /static Zig_ErrorCodeParserError:/], + ["src/jsc/ErrorCode.rs", /static Zig_ErrorCodeJSErrorObject:/], + ["src/jsc/ErrorCode.rs", /const PARSER_ERROR: ErrorCodeInt/], + + // jsc: js_class_module! emitted a dangerously_set_ptr wrapper plus its + // extern import in every instantiation; no instantiation called it. + ["src/jsc/generated.rs", /__dangerouslySetPtr/], + + // webcore: StartTag variants never constructed; only the 8 sink tags are + // used as START_TAG consts and const-generic args. + ["src/runtime/webcore/streams.rs", /pub enum StartTag \{[^}]*OwnedAndDone/], + // webcore: never produced by on_read_chunk. + ["src/runtime/webcore/FileReader.rs", /AmountRead\(usize\)/], + + // sha_hmac: deprecated-API hashers with no callers (only SHA1 and SHA256 + // have consumers), plus unused evp types. + ["src/sha_hmac/sha.rs", /SHA512_Init,\s*\n\s*boringssl_sys::SHA512_Update/], + ["src/sha_hmac/sha.rs", /RIPEMD160_Init/], + ["src/sha_hmac/sha.rs", /new_evp!\(MD5_SHA1/], + ["src/sha_hmac/sha.rs", /new_evp!\(Blake2,/], + + // wyhash: hash_int's single caller instantiates u32. + ["src/wyhash/lib.rs", /impl HashInt for u16\b/], + ["src/wyhash/lib.rs", /impl HashInt for u64\b/], + + // clap: never-constructed variant and the From impl that was its only + // would-be constructor. + ["src/clap/error.rs", /WriteFailed/], + + // md: never constructed or matched. + ["src/md/types.rs", /Setextheader/], + + // react_compiler: zero references. + ["src/react_compiler/hir/environment_config.rs", /fn default_true\b/], + ]; + expect(resurrected(checks)).toEqual([]); +}); + +test("dead C++ header declarations do not reappear", () => { + const checks: Array<[string, RegExp]> = [ + // Declarations for the removed Rust statics above; nothing on the C++ + // side ever read them. + ["src/jsc/bindings/headers-handwritten.h", /Bun__versions_uws/], + ["src/jsc/bindings/headers-handwritten.h", /Bun__versions_usockets/], + ["src/jsc/bindings/headers-handwritten.h", /Zig_ErrorCodeParserError/], + ]; + expect(resurrected(checks)).toEqual([]); +}); + +test("unused re-export names do not reappear", () => { + const checks: Array<[string, RegExp]> = [ + // Each name was unreferenced under the re-exported path; the underlying + // items (where they still exist) are reached via their own modules. + ["src/install/lib.rs", /pub use patch_install as patch;/], + ["src/install/lib.rs", /CacheBehavior as ManifestLoad/], + ["src/sql_jsc/jsc.rs", /pub use SSLConfig as SslConfig;/], + ["src/sql_jsc/jsc.rs", /ExternColumnIdentifierValue/], + ["src/api/lib.rs", /NpmRegistryMap/], + ["src/bundler_jsc/PluginRunner.rs", /as FsPath/], + ["src/bundler_jsc/lib.rs", /ErrorableString/], + ["src/errno/linux_errno.rs", /mode_t as Mode/], + ["src/errno/darwin_errno.rs", /mode_t as Mode/], + ["src/errno/freebsd_errno.rs", /mode_t as Mode/], + ["src/spawn/lib.rs", /posix_spawn as PosixSpawn/], + ["src/runtime/api/bun/spawn.rs", /\bPosixSpawn\b/], + ["src/runtime/ffi/mod.rs", /pub use abi_type::/], + ["src/runtime/valkey_jsc/mod.rs", /pub use valkey::\{Options/], + ]; + expect(resurrected(checks)).toEqual([]); +}); + +test("stale build-script entries do not reappear", () => { + // Note: the fail-before gate stashes src/ only, so these script checks are + // regression guards rather than part of the fail-before proof. + const checks: Array<[string, RegExp]> = [ + // src/asan-config.c (the glob's last match) was deleted in #29655; the + // pattern silently matched nothing. + ["scripts/glob-sources.ts", /"src\/\*\.c"/], + // Generated #define BUN_DEP_* block was write-only; BunProcess.cpp reads + // only the BUN_VERSION_* constants. + ["scripts/build/depVersionsHeader.ts", /BUN_DEP_/], + // Computed, stored, never read. + ["scripts/build/config.ts", /kqueue/], + ]; + expect(resurrected(checks)).toEqual([]); +});