diff --git a/src/ast/import_record.rs b/src/ast/import_record.rs index b4cf2e8bd347..5d7561474a1f 100644 --- a/src/ast/import_record.rs +++ b/src/ast/import_record.rs @@ -2,8 +2,6 @@ //! //! Lives in `bun_ast` so `Ast` (which holds `Vec`) is //! self-contained and `bun_js_printer` can drop its `bun_js_parser` dep. -//! `ImportKind::to_api()` lives in `bun_ast::ImportKindExt` (would -//! back-edge into the schema crate). use crate::Range; use bun_paths::fs::Path; diff --git a/src/ast/lib.rs b/src/ast/lib.rs index 8d36dc3b03f9..7bbde77972c9 100644 --- a/src/ast/lib.rs +++ b/src/ast/lib.rs @@ -131,9 +131,6 @@ impl ImportKind { || self == Self::Url || self == Self::Composes } - - // `to_api()` lives in `bun_ast::ImportKindExt` — depends on - // `schema::api::ImportKind` which sits in a higher-tier crate. } // ─────────────────────────────────────────────────────────────────────────── @@ -2987,7 +2984,7 @@ pub use ast_result::{ TopLevelSymbolToParts, TsEnumsMap, }; pub use import_record::{Flags as ImportRecordFlags, ImportRecord, Tag as ImportRecordTag}; -pub use loader::{Loader, LoaderHashTable, LoaderOptional, SideEffects}; +pub use loader::{Loader, LoaderHashTable, SideEffects}; pub use target::Target; pub mod transpiler_cache; // Glob re-export: `link_interface!` emits `#[doc(hidden)]` type aliases that diff --git a/src/ast/loader.rs b/src/ast/loader.rs index 9a22d6f96070..da6e64e0265c 100644 --- a/src/ast/loader.rs +++ b/src/ast/loader.rs @@ -1,9 +1,9 @@ //! `Loader` + `SideEffects`. //! -//! Data-only enum + pure predicates. `to_api()` / `from_api()` / `API_NAMES` / -//! `LoaderOptional::from_api` live in `bun_options_types::LoaderExt` (would -//! back-edge into the schema crate). `to_mime_type` / `from_mime_type` live in -//! `bun_http_types` (would back-edge into `bun_http::MimeType`). +//! Data-only enum + pure predicates. `to_api()` / `from_api()` / `API_NAMES` +//! live in `bun_options_types::LoaderExt` (would back-edge into the schema +//! crate). `to_mime_type` / `from_mime_type` live in `bun_http_types` (would +//! back-edge into `bun_http::MimeType`). use enum_map::Enum; @@ -64,20 +64,6 @@ bun_core::assert_ffi_discr!( Text = 13, Bunsh = 14, Sqlite = 15, SqliteEmbedded = 16, Html = 17, ); -/// `Loader.Optional` — `enum(u8) { none = 254, _ }` niche-packed optional. -#[repr(transparent)] -#[derive(Copy, Clone, Eq, PartialEq, Debug)] -pub struct LoaderOptional(pub(crate) u8); - -impl LoaderOptional { - pub const NONE: LoaderOptional = LoaderOptional(254); - - #[inline] - pub const fn from_loader(l: Loader) -> LoaderOptional { - LoaderOptional(l as u8) - } -} - // E0658: inherent assoc types are nightly-only; lifted to module scope. pub type LoaderHashTable = bun_collections::StringArrayHashMap; diff --git a/src/http_types/Method.rs b/src/http_types/Method.rs index b1e2b6ecf69a..671c8183677c 100644 --- a/src/http_types/Method.rs +++ b/src/http_types/Method.rs @@ -230,23 +230,6 @@ pub enum Optional { } impl Optional { - pub fn contains(&self, other: &Optional) -> bool { - if matches!(self, Optional::Any) { - return true; - } - if matches!(other, Optional::Any) { - return true; - } - - let Optional::Method(this_set) = self else { - unreachable!() - }; - let Optional::Method(other_set) = other else { - unreachable!() - }; - this_set.intersection(*other_set).len() > 0 - } - pub fn insert(&mut self, method: Method) { match self { Optional::Any => {} diff --git a/src/http_types/mime_type_list_enum.rs b/src/http_types/mime_type_list_enum.rs index ee6a6a841950..36f86706de62 100644 --- a/src/http_types/mime_type_list_enum.rs +++ b/src/http_types/mime_type_list_enum.rs @@ -34,8 +34,6 @@ impl MimeTypeList { self.0.len() } - pub const COUNT: usize = 2310; - pub const ALL: &'static [MimeTypeList] = ALL; } diff --git a/src/options_types/bundle_enums.rs b/src/options_types/bundle_enums.rs index 52e6258b01ea..bc006a092c8d 100644 --- a/src/options_types/bundle_enums.rs +++ b/src/options_types/bundle_enums.rs @@ -7,7 +7,7 @@ //! `from_api`, `API_NAMES`) remain here as sealed extension traits. use crate::schema::api; -use bun_ast::{Loader, LoaderOptional, Target}; +use bun_ast::{Loader, Target}; #[repr(u8)] #[derive(Copy, Clone, Eq, PartialEq, Debug)] @@ -128,8 +128,6 @@ mod sealed { pub trait Sealed {} impl Sealed for bun_ast::Target {} impl Sealed for bun_ast::Loader {} - impl Sealed for bun_ast::LoaderOptional {} - impl Sealed for bun_ast::ImportKind {} } /// `schema::api`-coupled methods on [`bun_ast::Target`]. Import alongside @@ -252,44 +250,6 @@ impl LoaderExt for Loader { } } -/// `schema::api`-coupled methods on [`bun_ast::LoaderOptional`]. -pub trait LoaderOptionalExt: sealed::Sealed { - fn from_api(loader: api::Loader) -> LoaderOptional; -} - -impl LoaderOptionalExt for LoaderOptional { - fn from_api(loader: api::Loader) -> LoaderOptional { - if loader == api::Loader::_none { - LoaderOptional::NONE - } else { - LoaderOptional::from_loader(Loader::from_api(loader)) - } - } -} - -// ─── ImportKind: schema-coupled extension methods ───────────────────────── - -/// `schema::api`-coupled methods on [`bun_ast::ImportKind`]. -pub trait ImportKindExt: sealed::Sealed { - fn to_api(self) -> api::ImportKind; -} - -impl ImportKindExt for bun_ast::ImportKind { - fn to_api(self) -> api::ImportKind { - use bun_ast::ImportKind; - match self { - ImportKind::EntryPointRun | ImportKind::EntryPointBuild => api::ImportKind::entry_point, - ImportKind::Stmt => api::ImportKind::stmt, - ImportKind::Require => api::ImportKind::require, - ImportKind::Dynamic => api::ImportKind::dynamic, - ImportKind::RequireResolve => api::ImportKind::require_resolve, - ImportKind::At => api::ImportKind::at, - ImportKind::Url => api::ImportKind::url, - _ => api::ImportKind::internal, - } - } -} - // ─── move-in: TYPE_ONLY from bun_runtime::bake::framework ────────────────────────── /// Virtual module backing for a diff --git a/src/options_types/jsx.rs b/src/options_types/jsx.rs index 2abce22fdd82..a0ce3963e587 100644 --- a/src/options_types/jsx.rs +++ b/src/options_types/jsx.rs @@ -232,29 +232,6 @@ impl Pragma { } } - pub fn parse_package_name(str: &[u8]) -> &[u8] { - if str.is_empty() { - return str; - } - if str[0] == b'@' { - if let Some(first_slash) = strings::index_of_char(&str[1..], b'/') { - let first_slash = first_slash as usize; - let remainder = &str[1 + first_slash + 1..]; - - if let Some(last_slash) = strings::index_of_char(remainder, b'/') { - let last_slash = last_slash as usize; - return &str[0..first_slash + 1 + last_slash + 1]; - } - } - } - - if let Some(first_slash) = strings::index_of_char(str, b'/') { - return &str[0..first_slash as usize]; - } - - str - } - /// When `package_name` is the default `"react"`, this borrows the /// interned `defaults::IMPORT_SOURCE*` with zero allocations. pub fn set_import_source(&mut self) { diff --git a/src/options_types/lib.rs b/src/options_types/lib.rs index 19cafaba90ee..b1f55e7ca2a3 100644 --- a/src/options_types/lib.rs +++ b/src/options_types/lib.rs @@ -22,8 +22,8 @@ pub use jsx as JSX; // Only the `schema::api`-coupled extension traits and option-only types // (`Format`, `ModuleType`, …) are surfaced from this crate. pub use bundle_enums::{ - BuiltInModule, BundlePackage, ForceNodeEnv, Format, ImportKindExt, LOADER_API_NAMES, LoaderExt, - LoaderOptionalExt, ModuleType, TargetExt, WindowsOptions, + BuiltInModule, BundlePackage, ForceNodeEnv, Format, LOADER_API_NAMES, LoaderExt, ModuleType, + TargetExt, WindowsOptions, }; /// Compiled-standalone-binary virtual filesystem path prefix + predicate. @@ -46,10 +46,6 @@ pub mod standalone_path { #[cfg(windows)] pub const BASE_PUBLIC_PATH: &str = "B:/~BUN/"; - #[cfg(windows)] - pub const BASE_PUBLIC_PATH_WITH_DEFAULT_SUFFIX: &str = - const_format::concatcp!(BASE_PUBLIC_PATH, "root/"); - #[inline] pub(crate) fn is_bun_standalone_file_path_canonicalized(str_: &[u8]) -> bool { str_.starts_with(BASE_PATH.as_bytes()) diff --git a/src/options_types/schema.rs b/src/options_types/schema.rs index e80f2cad3f7a..f8b48ffab67f 100644 --- a/src/options_types/schema.rs +++ b/src/options_types/schema.rs @@ -430,22 +430,6 @@ pub mod api { } } - /// Open `enum(u8)` in the wire schema. Kept closed. - #[repr(u8)] - #[derive(Copy, Clone, Eq, PartialEq, Debug, Default)] - pub enum ImportKind { - #[default] - _none = 0, - entry_point = 1, - stmt = 2, - require = 3, - dynamic = 4, - require_resolve = 5, - at = 6, - url = 7, - internal = 8, - } - // ─── peechy batch 2: hand-expanded for downstream wfs ──────────────── // Jsx / JsxRuntime / StringMap / EnvConfig / LoadedEnvConfig / // LoadedRouteConfig / RouteConfig / FrameworkEntryPoint{,Type,Map,Message} /