Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions scripts/build/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1175,7 +1172,6 @@ export function resolveConfig(partial: PartialConfig, toolchain: Toolchain): Con
windows,
freebsd,
unix,
kqueue,
x64,
arm64,
host,
Expand Down
3 changes: 0 additions & 3 deletions scripts/build/depVersionsHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}";`),
"",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export interface Dependency {

/**
* Macro name suffix for `bun_dependency_versions.h` — becomes
* `BUN_DEP_<macro>` / `BUN_VERSION_<macro>`. The value is derived from
* `BUN_VERSION_<macro>`. 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.
Expand Down
1 change: 0 additions & 1 deletion scripts/glob-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
},
Expand Down
4 changes: 1 addition & 3 deletions src/api/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 0 additions & 2 deletions src/bundler_jsc/PluginRunner.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bundler_jsc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions src/clap/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ pub enum Error {
MissingValue,
#[error("InvalidArgument")]
InvalidArgument,
#[error("WriteFailed")]
WriteFailed,
}

impl Error {
Expand All @@ -17,7 +15,6 @@ impl Error {
Self::DoesntTakeValue => "DoesntTakeValue",
Self::MissingValue => "MissingValue",
Self::InvalidArgument => "InvalidArgument",
Self::WriteFailed => "WriteFailed",
}
}
}
Expand All @@ -28,12 +25,6 @@ impl bun_core::output::ErrName for Error {
}
}

impl From<core::fmt::Error> for Error {
fn from(_: core::fmt::Error) -> Self {
Self::WriteFailed
}
}

impl From<crate::streaming::ArgError> for Error {
fn from(e: crate::streaming::ArgError) -> Self {
match e {
Expand Down
5 changes: 0 additions & 5 deletions src/clap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ impl Diagnostic {
crate::Error::InvalidArgument => {
bun_core::pretty_errorln!("<red>error<r><d>:<r> Invalid Argument '{}'", name)
}
_ => bun_core::pretty_errorln!(
"<red>error<r><d>:<r> {} while parsing argument '{}'",
err,
name
),
}
bun_core::Output::flush();
Ok(())
Expand Down
1 change: 0 additions & 1 deletion src/errno/darwin_errno.rs
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/errno/freebsd_errno.rs
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/errno/linux_errno.rs
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 1 addition & 3 deletions src/install/PackageManager/PackageManagerEnqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -1022,7 +1022,6 @@ pub fn enqueue_dependency_with_main_and_success_fn(
&*scope,
name_hash,
Some(&mut expired),
ManifestLoad::LoadFromMemoryFallbackToDisk,
needs_extended_manifest,
)
} {
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions src/install/PackageManager/PopulateManifestCache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -245,7 +243,6 @@ pub fn populate_manifest_cache(
cache_ctx,
scope.get(),
package_name,
ManifestLoad::LoadFromMemoryFallbackToDisk,
needs_extended_manifest,
);
if cached.is_none() {
Expand Down
45 changes: 4 additions & 41 deletions src/install/PackageManifestMap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ impl Value {
type ManifestHashMap =
HashMap<PackageNameHash, Value, bun_collections::IdentityContext<PackageNameHash>>;

#[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.
///
Expand Down Expand Up @@ -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,
)
}
Expand All @@ -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.
Comment thread
robobun marked this conversation as resolved.
pub(crate) fn by_name_hash_in_memory(
&mut self,
name_hash: PackageNameHash,
Expand All @@ -121,15 +103,13 @@ 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(
ctx,
scope,
StringBuilder::string_hash(name),
is_expired,
cache_behavior,
needs_extended_manifest,
)
}
Expand All @@ -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();
Expand Down
7 changes: 1 addition & 6 deletions src/install/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/install/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,6 @@ impl Lockfile {
cache_ctx,
scope,
pkg_name_hash,
Install::ManifestLoad::LoadFromMemoryFallbackToDisk,
false,
) else {
continue;
Expand Down
12 changes: 1 addition & 11 deletions src/jsc/ErrorCode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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;
}

Expand Down Expand Up @@ -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
7 changes: 0 additions & 7 deletions src/jsc/bindings/headers-handwritten.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
Loading