diff --git a/Cargo.lock b/Cargo.lock index 5c8ed1083cc9..4784e9b3d6ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -344,7 +344,6 @@ dependencies = [ "bun_ptr", "bun_resolve_builtins", "bun_resolver", - "bun_router", "bun_sourcemap", "bun_sys", "bun_threading", @@ -746,18 +745,12 @@ dependencies = [ name = "bun_glob" version = "0.0.0" dependencies = [ - "bitflags", "bstr", "bun_alloc", "bun_collections", "bun_core", "bun_paths", "bun_sys", - "const_format", - "enum-map", - "enumset", - "libc", - "scopeguard", "strum", ] @@ -1561,7 +1554,6 @@ dependencies = [ name = "bun_router" version = "0.0.0" dependencies = [ - "bitflags", "bstr", "bun_alloc", "bun_ast", @@ -1576,10 +1568,6 @@ dependencies = [ "bun_sys", "bun_url", "bun_wyhash", - "const_format", - "enum-map", - "enumset", - "libc", "scopeguard", "strum", "thiserror", diff --git a/src/bundler/Cargo.toml b/src/bundler/Cargo.toml index 3ab8acc5b1a0..965e35703359 100644 --- a/src/bundler/Cargo.toml +++ b/src/bundler/Cargo.toml @@ -54,7 +54,6 @@ bun_md.workspace = true bun_options_types.workspace = true bun_paths.workspace = true bun_perf.workspace = true -bun_router.workspace = true bun_sourcemap.workspace = true bun_sys.workspace = true bun_threading.workspace = true diff --git a/src/css/crate_error.rs b/src/css/crate_error.rs index ee82b2fd3eed..9d8c5e04ff3b 100644 --- a/src/css/crate_error.rs +++ b/src/css/crate_error.rs @@ -6,8 +6,6 @@ pub enum Error { InvalidCharacter, #[error("UnsupportedCSSTarget")] UnsupportedCSSTarget, - #[error("CSSPrintError")] - CSSPrintError, } impl Error { @@ -17,7 +15,6 @@ impl Error { Self::Overflow => "Overflow", Self::InvalidCharacter => "InvalidCharacter", Self::UnsupportedCSSTarget => "UnsupportedCSSTarget", - Self::CSSPrintError => "CSSPrintError", } } } diff --git a/src/css/selectors/parser.rs b/src/css/selectors/parser.rs index 7f839acf5a0e..163683cd3bee 100644 --- a/src/css/selectors/parser.rs +++ b/src/css/selectors/parser.rs @@ -1620,19 +1620,6 @@ impl GenericSelectorList { unreachable!("use serializer::serialize_selector_list()"); } - pub fn parse_with_options(input: &mut CssParser, options: &ParserOptions) -> CResult { - let mut parser = SelectorParser { - options, - is_nesting_allowed: true, - }; - Self::parse( - &mut parser, - input, - ParseErrorRecovery::DiscardList, - NestingRequirement::None, - ) - } - pub fn parse( parser: &mut SelectorParser, input: &mut CssParser, @@ -1927,14 +1914,6 @@ impl GenericSelector { self.specificity_and_flags.specificity } - pub fn parse_with_options(input: &mut CssParser, options: &ParserOptions) -> CResult { - let mut selector_parser = SelectorParser { - is_nesting_allowed: true, - options, - }; - Self::parse(&mut selector_parser, input) - } - pub(crate) fn iter_raw_match_order(&self) -> RawMatchOrderIterator<'_, Impl> { RawMatchOrderIterator { slice: &self.components, diff --git a/src/glob/Cargo.toml b/src/glob/Cargo.toml index 450b9d2abd62..0cb1bd25ef49 100644 --- a/src/glob/Cargo.toml +++ b/src/glob/Cargo.toml @@ -12,12 +12,6 @@ workspace = true [dependencies] strum.workspace = true bstr.workspace = true -scopeguard.workspace = true -const_format.workspace = true -enum-map.workspace = true -enumset.workspace = true -libc.workspace = true -bitflags.workspace = true bun_alloc.workspace = true bun_core.workspace = true bun_collections.workspace = true diff --git a/src/http_jsc/websocket_client.rs b/src/http_jsc/websocket_client.rs index 2f6bad144c5d..11e08e93961c 100644 --- a/src/http_jsc/websocket_client.rs +++ b/src/http_jsc/websocket_client.rs @@ -2045,26 +2045,21 @@ pub enum ErrorCode { Closed = 14, FailedToWrite = 15, FailedToConnect = 16, - HeadersTooLarge = 17, Ended = 18, FailedToAllocateMemory = 19, ControlFrameIsFragmented = 20, InvalidControlFrame = 21, CompressionUnsupported = 22, InvalidCompressedData = 23, - CompressionFailed = 24, UnexpectedMaskFromServer = 25, - ExpectedControlFrame = 26, UnsupportedControlFrame = 27, UnexpectedOpcode = 28, InvalidUtf8 = 29, TlsHandshakeFailed = 30, MessageTooBig = 31, - ProtocolError = 32, // Proxy error codes ProxyConnectFailed = 33, ProxyAuthenticationRequired = 34, - ProxyConnectionRefused = 35, ProxyTunnelFailed = 36, UnexpectedRsv1 = 37, } diff --git a/src/install/PackageInstall.rs b/src/install/PackageInstall.rs index 00ab60a992c3..43521627fdef 100644 --- a/src/install/PackageInstall.rs +++ b/src/install/PackageInstall.rs @@ -40,8 +40,6 @@ pub struct PackageInstall<'a> { pub(crate) package_version: &'a [u8], pub(crate) patch: Option, - // TODO: this is never read - pub(crate) file_count: u32, pub(crate) node_modules: &'a NodeModulesFolder, pub lockfile: &'a Lockfile, } @@ -226,25 +224,20 @@ impl InstallResult { #[repr(u8)] #[derive(Copy, Clone, PartialEq, Eq)] pub enum Step { - Copyfile, OpeningCacheDir, OpeningDestDir, CopyingFiles, - Linking, LinkingDependency, - Patching, } impl Step { /// "error: failed {s} for package" pub(crate) fn name(self) -> &'static [u8] { match self { - Step::Copyfile | Step::CopyingFiles => b"copying files from cache to destination", + Step::CopyingFiles => b"copying files from cache to destination", Step::OpeningCacheDir => b"opening cache/package/version dir", Step::OpeningDestDir => b"opening node_modules/package dir", - Step::Linking => b"linking bins", Step::LinkingDependency => b"linking dependency/workspace to node_modules", - Step::Patching => b"patching dependency", } } } @@ -1046,8 +1039,7 @@ impl<'a> PackageInstall<'a> { }; walker_.resolve_unknown_entry_types = true; - fn copy(destination_dir_: &Dir, walker: &mut Walker) -> crate::Result { - let mut real_file_count: u32 = 0; + fn copy(destination_dir_: &Dir, walker: &mut Walker) -> crate::Result<()> { let mut stackpath = [0u8; path::MAX_PATH_BYTES]; while let Some(entry) = walker.next()? { match entry.kind { @@ -1086,14 +1078,12 @@ impl<'a> PackageInstall<'a> { _ => return Err(crate::Error::Unexpected), }, } - - real_file_count += 1; } _ => {} } } - Ok(real_file_count) + Ok(()) } let subdir = match destination_dir.make_open_path( @@ -1103,10 +1093,9 @@ impl<'a> PackageInstall<'a> { Ok(d) => d, Err(err) => return Ok(InstallResult::fail(err.into(), Step::OpeningDestDir, None)), }; - self.file_count = match copy(&subdir, &mut walker_) { - Ok(n) => n, - Err(err) => return Ok(InstallResult::fail(err, Step::CopyingFiles, None)), - }; + if let Err(err) = copy(&subdir, &mut walker_) { + return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); + } Ok(InstallResult::Success) } @@ -1340,11 +1329,7 @@ impl<'a> PackageInstall<'a> { head1: WinSlice<'_>, to_copy_into2_offset: WinOffset, head2: WinSlice<'_>, - ) -> crate::Result { - #[cfg(not(windows))] - let mut real_file_count: u32 = 0; - #[cfg(windows)] - let real_file_count: u32 = 0; + ) -> crate::Result<()> { #[cfg(not(windows))] let mut copy_file_state = bun_sys::copy_file::CopyFileState::default(); #[cfg(not(windows))] @@ -1446,7 +1431,6 @@ impl<'a> PackageInstall<'a> { if entry.kind != EntryKind::File { continue; } - real_file_count += 1; let in_file = sys::openat(entry.dir, entry.basename, sys::O::RDONLY, 0)?; let _close_in = sys::CloseOnDrop::new(in_file); @@ -1532,7 +1516,7 @@ impl<'a> PackageInstall<'a> { } } - Ok(real_file_count) + Ok(()) } #[cfg(windows)] @@ -1558,10 +1542,9 @@ impl<'a> PackageInstall<'a> { (), ); - self.file_count = match result { - Ok(n) => n, - Err(err) => return InstallResult::fail(err, Step::CopyingFiles, None), - }; + if let Err(err) = result { + return InstallResult::fail(err, Step::CopyingFiles, None); + } InstallResult::Success } @@ -1593,8 +1576,7 @@ impl<'a> PackageInstall<'a> { head1: WinSlice<'_>, to_copy_into2_offset: WinOffset, head2: WinSlice<'_>, - ) -> crate::Result { - let mut real_file_count: u32 = 0; + ) -> crate::Result<()> { #[cfg(not(windows))] let _ = (to_copy_into1_offset, head1, to_copy_into2_offset, head2); #[cfg(windows)] @@ -1663,8 +1645,6 @@ impl<'a> PackageInstall<'a> { return Err(map_linkat_err(err)); } } - - real_file_count += 1; } _ => {} } @@ -1702,7 +1682,6 @@ impl<'a> PackageInstall<'a> { entry.basename.as_slice(), )); } - real_file_count += 1; } } @@ -1722,7 +1701,7 @@ impl<'a> PackageInstall<'a> { } } - Ok(real_file_count) + Ok(()) } #[cfg(windows)] @@ -1744,27 +1723,24 @@ impl<'a> PackageInstall<'a> { (), ); - self.file_count = match result { - Ok(n) => n, - Err(err) => { - #[cfg(windows)] - { - if err == crate::Error::FailedToCopyFile { - return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); - } + if let Err(err) = result { + #[cfg(windows)] + { + if err == crate::Error::FailedToCopyFile { + return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); } - #[cfg(not(windows))] + } + #[cfg(not(windows))] + { + if err == crate::Error::NotSameFileSystem + || err == crate::Error::Sys(bun_errno::SystemErrno::ENXIO) { - if err == crate::Error::NotSameFileSystem - || err == crate::Error::Sys(bun_errno::SystemErrno::ENXIO) - { - return Err(err); - } + return Err(err); } - - return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); } - }; + + return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); + } Ok(InstallResult::Success) } @@ -1816,11 +1792,7 @@ impl<'a> PackageInstall<'a> { head1: WinSlice<'_>, to_copy_into2_offset: usize, head2: &mut [Head2Char], - ) -> crate::Result { - #[cfg(not(windows))] - let mut real_file_count: u32 = 0; - #[cfg(windows)] - let real_file_count: u32 = 0; + ) -> crate::Result<()> { #[cfg(not(windows))] let _ = (to_copy_into1_offset, head1); while let Some(entry) = walker.next()? { @@ -1851,8 +1823,6 @@ impl<'a> PackageInstall<'a> { let _ = sys::unlinkat(destination_dir, entry.path); sys::symlinkat(entry.basename, destination_dir.fd(), entry.path)?; } - - real_file_count += 1; } _ => {} } @@ -1932,7 +1902,7 @@ impl<'a> PackageInstall<'a> { } } - Ok(real_file_count) + Ok(()) } #[cfg(windows)] @@ -1954,26 +1924,23 @@ impl<'a> PackageInstall<'a> { &mut buf2[..], ); - self.file_count = match result { - Ok(n) => n, - Err(err) => { - #[cfg(windows)] - { - if err == crate::Error::FailedToCopyFile { - return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); - } + if let Err(err) = result { + #[cfg(windows)] + { + if err == crate::Error::FailedToCopyFile { + return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); } - #[cfg(not(windows))] + } + #[cfg(not(windows))] + { + if err == crate::Error::NotSameFileSystem + || err == crate::Error::Sys(bun_errno::SystemErrno::ENXIO) { - if err == crate::Error::NotSameFileSystem - || err == crate::Error::Sys(bun_errno::SystemErrno::ENXIO) - { - return Err(err); - } + return Err(err); } - return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); } - }; + return Ok(InstallResult::fail(err, Step::CopyingFiles, None)); + } Ok(InstallResult::Success) } diff --git a/src/install/PackageInstaller.rs b/src/install/PackageInstaller.rs index a74f458d2cbc..abec252030a0 100644 --- a/src/install/PackageInstaller.rs +++ b/src/install/PackageInstaller.rs @@ -1414,7 +1414,6 @@ impl<'a> PackageInstaller<'a> { // site stays safe. lockfile: self.lockfile(), cache_dir_subpath: ZStr::EMPTY, - file_count: 0, }; bun_output::scoped_log!( PackageInstaller, diff --git a/src/install/PackageManager.rs b/src/install/PackageManager.rs index ee11c66510a1..35eba66217dd 100644 --- a/src/install/PackageManager.rs +++ b/src/install/PackageManager.rs @@ -208,10 +208,7 @@ pub use enqueue::{ }; use self::package_manager_lifecycle as lifecycle; -pub use lifecycle::{ - LifecycleScriptTimeLog, LifecycleScriptTimeLogEntry, determine_preinstall_state, - get_preinstall_state, set_preinstall_state, -}; +pub use lifecycle::{determine_preinstall_state, get_preinstall_state, set_preinstall_state}; use self::package_manager_resolution as resolution; pub use resolution::{assign_root_resolution, resolve_from_disk_cache}; @@ -349,9 +346,6 @@ pub struct PackageManager { pub(crate) preallocated_network_tasks: PreallocatedNetworkTasks, pub(crate) preallocated_resolve_tasks: PreallocatedTaskStore, - /// items are only inserted into this if they took more than 500ms - pub(crate) lifecycle_script_time_log: LifecycleScriptTimeLog, - pub pending_lifecycle_script_tasks: AtomicU32, pub(crate) finished_installing: AtomicBool, pub(crate) total_scripts: usize, @@ -455,7 +449,6 @@ pub enum Subcommand { Audit, Info, Why, - Scan, // bin, // hash, // @"hash-print", @@ -1924,7 +1917,6 @@ pub fn init( wr!(pending_pre_calc_hashes, AtomicU32::new(0)); wr!(pending_tasks, AtomicU32::new(0)); wr!(total_tasks, 0); - wr!(lifecycle_script_time_log, LifecycleScriptTimeLog::default()); wr!(pending_lifecycle_script_tasks, AtomicU32::new(0)); wr!(finished_installing, AtomicBool::new(false)); wr!(total_scripts, 0); @@ -2357,7 +2349,6 @@ fn init_with_runtime_once( wr!(pending_pre_calc_hashes, AtomicU32::new(0)); wr!(pending_tasks, AtomicU32::new(0)); wr!(total_tasks, 0); - wr!(lifecycle_script_time_log, LifecycleScriptTimeLog::default()); wr!(pending_lifecycle_script_tasks, AtomicU32::new(0)); wr!(finished_installing, AtomicBool::new(false)); wr!(total_scripts, 0); diff --git a/src/install/PackageManager/CommandLineArguments.rs b/src/install/PackageManager/CommandLineArguments.rs index 5b94b3c465c5..f3619aa2396c 100644 --- a/src/install/PackageManager/CommandLineArguments.rs +++ b/src/install/PackageManager/CommandLineArguments.rs @@ -936,31 +936,6 @@ Full documentation is available at https://bun.com/docs/cli/why. pretty_help(outro_text); Output::flush(); } - Subcommand::Scan => { - let intro_text = r" -Usage: bun pm scan [flags] - - Scan all packages in lockfile for security vulnerabilities. - -Flags:"; - - let outro_text = r" - -Examples: - Scan all packages for vulnerabilities - bun pm scan - - Output results as JSON - bun pm scan --json - -Full documentation is available at https://bun.com/docs/cli/pm#scan. -"; - - pretty_help(intro_text); - clap::simple_help(PM_PARAMS); - pretty_help(outro_text); - Output::flush(); - } } } @@ -986,7 +961,6 @@ Full documentation is available at https://bun.com/docs/cli/pm#scan. // are not included in the help text Subcommand::Audit => AUDIT_PARAMS_FULL, Subcommand::Info => INFO_PARAMS, - Subcommand::Scan => PM_PARAMS, // scan uses the same params as pm command }; let mut diag = clap::Diagnostic::default(); diff --git a/src/install/PackageManager/PackageManagerLifecycle.rs b/src/install/PackageManager/PackageManagerLifecycle.rs index 730d18f94fa4..c2d142bca87f 100644 --- a/src/install/PackageManager/PackageManagerLifecycle.rs +++ b/src/install/PackageManager/PackageManagerLifecycle.rs @@ -12,7 +12,6 @@ use bun_paths::resolve_path::{join_abs_string_z, platform}; use bun_paths::{AutoAbsPath, EnvPath}; use bun_semver::string::Builder as SemverStringBuilder; use bun_sys as Syscall; -use bun_threading::Mutex; use crate::bun_fs::FileSystem; @@ -28,22 +27,6 @@ use bun_install::{ PackageID, PackageManager, PreinstallState, TruncatedPackageNameHash, invalid_package_id, }; -#[derive(Default)] -pub struct LifecycleScriptTimeLog { - mutex: Mutex, - list: Vec, -} - -pub struct LifecycleScriptTimeLogEntry {} - -impl LifecycleScriptTimeLog { - pub(crate) fn append_concurrent(&mut self, entry: LifecycleScriptTimeLogEntry) { - self.mutex.lock(); - self.list.push(entry); - self.mutex.unlock(); - } -} - impl PackageManager { pub(crate) fn ensure_preinstall_state_list_capacity(&mut self, count: usize) { if self.preinstall_state.len() >= count { diff --git a/src/install/lifecycle_script_runner.rs b/src/install/lifecycle_script_runner.rs index 5762cb3ffea6..fea6db697e89 100644 --- a/src/install/lifecycle_script_runner.rs +++ b/src/install/lifecycle_script_runner.rs @@ -7,7 +7,6 @@ use crate::isolated_install::store::{EntryColumns, entry}; use crate::lockfile_real::Scripts as LockfileScripts; use crate::lockfile_real::package::scripts::List as ScriptsList; use crate::package_manager_real::ProgressStrings; -use crate::package_manager_real::package_manager_lifecycle::LifecycleScriptTimeLogEntry; use bun_core::{Global, Output}; use bun_io::BufferedReader; use bun_io::heap as io_heap; @@ -273,8 +272,6 @@ pub struct LifecycleScriptSubprocess<'a> { pub(crate) envp: bun_dotenv::NullDelimitedEnvMap, pub(crate) shell_bin: Option<&'a ZStr>, - pub(crate) timer: Option, - pub(crate) has_incremented_alive_count: bool, pub(crate) foreground: bool, @@ -337,8 +334,6 @@ impl<'a> io_heap::HeapContext> for StartedAtCtx { } } -const MIN_MILLISECONDS_TO_LOG: u64 = 500; - static ALIVE_COUNT: AtomicUsize = AtomicUsize::new(0); impl<'a> LifecycleScriptSubprocess<'a> { @@ -356,8 +351,6 @@ use bun_sys::windows::libuv as uv; pub type OutputReader = BufferedReader; -pub(crate) type Timer = bun_core::time::Timer; - impl<'a> LifecycleScriptSubprocess<'a> { /// Heap-allocate and return a raw pointer; this type is intrusive (heap field, /// OutputReader parent backrefs), so it lives behind `*mut Self`. @@ -372,16 +365,6 @@ impl<'a> LifecycleScriptSubprocess<'a> { self.manager.get() } - /// # Safety - /// See [`Self::manager`]. Mutable access is sound because callers run on - /// the single install thread and no `&PackageManager` - /// outlives the brief field accesses below. - #[inline] - unsafe fn manager_mut(&mut self) -> &mut PackageManager { - // SAFETY: see fn doc. - unsafe { self.manager.get_mut() } - } - pub(crate) fn script_name(&self) -> &'static [u8] { debug_assert!((self.current_script_index as usize) < LockfileScripts::NAMES.len()); LockfileScripts::NAMES[self.current_script_index as usize].as_bytes() @@ -866,8 +849,6 @@ impl<'a> LifecycleScriptSubprocess<'a> { match status { Status::Exited(exit) => { - let maybe_duration = self.timer.as_mut().map(|t| t.read()); - if exit.code > 0 { if self.optional { if let Some(ctx) = &self.ctx { @@ -909,16 +890,6 @@ impl<'a> LifecycleScriptSubprocess<'a> { } } - if let Some(nanos) = maybe_duration { - if nanos > MIN_MILLISECONDS_TO_LOG * bun_core::time::NS_PER_MS { - let entry = LifecycleScriptTimeLogEntry {}; - // SAFETY: see [`Self::manager_mut`]. - unsafe { self.manager_mut() } - .lifecycle_script_time_log - .append_concurrent(entry); - } - } - if let Some(ctx) = &self.ctx { match self.current_script_index { // preinstall @@ -1145,7 +1116,6 @@ impl<'a> LifecycleScriptSubprocess<'a> { stdout: OutputReader::init::(), stderr: OutputReader::init::(), has_called_process_exit: false, - timer: None, has_incremented_alive_count: false, started_at: 0, heap: io_heap::IntrusiveField::default(), diff --git a/src/install/patch_install.rs b/src/install/patch_install.rs index 03b09ccdd32f..4b41e75de78c 100644 --- a/src/install/patch_install.rs +++ b/src/install/patch_install.rs @@ -506,7 +506,6 @@ impl PatchTask { progress: None, package_name: pkg_name, package_version: &resolution_label, - file_count: 0, // dummy value node_modules: &dummy_node_modules, lockfile, diff --git a/src/js/internal/fs/glob.ts b/src/js/internal/fs/glob.ts index c1fade7b8846..bec1c1aeecd6 100644 --- a/src/js/internal/fs/glob.ts +++ b/src/js/internal/fs/glob.ts @@ -1831,7 +1831,6 @@ function lazyMinimatch() { const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : ""); return Object.assign(new RegExp(`^${re}$`, flags), { _src: re, - _glob: glob, }); } get options() { diff --git a/src/js/internal/repl/node-shims.js b/src/js/internal/repl/node-shims.js index 37c57a5937c8..2744fee8d3e2 100644 --- a/src/js/internal/repl/node-shims.js +++ b/src/js/internal/repl/node-shims.js @@ -308,9 +308,7 @@ function stopSigintWatchdog() { // ---- internalBinding('util') ---------------------------------------------- const ALL_PROPERTIES = 0; -const ONLY_WRITABLE = 1; const ONLY_ENUMERABLE = 2; -const ONLY_CONFIGURABLE = 4; const SKIP_STRINGS = 8; const SKIP_SYMBOLS = 16; @@ -390,9 +388,7 @@ export default { // internalBinding('util') constants: { ALL_PROPERTIES, - ONLY_WRITABLE, ONLY_ENUMERABLE, - ONLY_CONFIGURABLE, SKIP_STRINGS, SKIP_SYMBOLS, }, diff --git a/src/jsc/bindings/node/crypto/KeyObject.cpp b/src/jsc/bindings/node/crypto/KeyObject.cpp index 397ba3ab9a30..0b5fe3586079 100644 --- a/src/jsc/bindings/node/crypto/KeyObject.cpp +++ b/src/jsc/bindings/node/crypto/KeyObject.cpp @@ -1119,25 +1119,6 @@ KeyObject KeyObject::create(CryptoKeyType type, ncrypto::EVPKeyPointer&& asymmet return KeyObject(type, WTF::move(data)); } -void KeyObject::getKeyObjectFromHandle(JSGlobalObject* globalObject, ThrowScope& scope, JSValue keyValue, const KeyObject& handle, PrepareAsymmetricKeyMode mode) -{ - if (mode == PrepareAsymmetricKeyMode::CreatePrivate) { - ERR::INVALID_ARG_TYPE(scope, globalObject, "key"_s, "string, ArrayBuffer, Buffer, TypedArray, or DataView"_s, keyValue); - return; - } - - if (handle.type() != CryptoKeyType::Private) { - if (mode == PrepareAsymmetricKeyMode::ConsumePrivate || mode == PrepareAsymmetricKeyMode::CreatePublic) { - ERR::CRYPTO_INVALID_KEY_OBJECT_TYPE(scope, globalObject, handle.type(), "private"_s); - return; - } - if (handle.type() != CryptoKeyType::Public) { - ERR::CRYPTO_INVALID_KEY_OBJECT_TYPE(scope, globalObject, handle.type(), "private or public"_s); - return; - } - } -} - JSArrayBufferView* decodeJwkString(JSGlobalObject* globalObject, ThrowScope& scope, GCOwnedDataScope strView, ASCIILiteral keyName) { JSValue decoded = JSValue::decode(constructFromEncoding(globalObject, strView, BufferEncodingType::base64)); diff --git a/src/jsc/bindings/node/crypto/KeyObject.h b/src/jsc/bindings/node/crypto/KeyObject.h index 132249f3569a..70a830511b2f 100644 --- a/src/jsc/bindings/node/crypto/KeyObject.h +++ b/src/jsc/bindings/node/crypto/KeyObject.h @@ -48,7 +48,6 @@ class KeyObject { // Helpers for `prepareAsymmetricKey` static KeyObject getKeyObjectHandleFromJwk(JSC::JSGlobalObject*, JSC::ThrowScope&, JSC::JSObject* jwk, PrepareAsymmetricKeyMode mode); static KeyObject getKeyObjectHandleFromRaw(JSC::JSGlobalObject*, JSC::ThrowScope&, std::span keyData, ncrypto::EVPKeyPointer::PKFormatType format, const WTF::String& asymmetricKeyType, JSC::JSValue namedCurveValue); - static void getKeyObjectFromHandle(JSC::JSGlobalObject*, JSC::ThrowScope&, JSC::JSValue keyValue, const KeyObject& handle, PrepareAsymmetricKeyMode mode); public: static ncrypto::EVPKeyPointer::PrivateKeyEncodingConfig getPrivateKeyEncoding( diff --git a/src/jsc/bindings/webcore/WebSocket.cpp b/src/jsc/bindings/webcore/WebSocket.cpp index 0105d7fce609..4a56e345ec31 100644 --- a/src/jsc/bindings/webcore/WebSocket.cpp +++ b/src/jsc/bindings/webcore/WebSocket.cpp @@ -1584,10 +1584,6 @@ void WebSocket::didFailWithErrorCode(Bun::WebSocketErrorCode code) didReceiveClose(CleanStatus::NotClean, 1006, "Failed to connect"_s, true); break; } - case Bun::WebSocketErrorCode::headers_too_large: { - didReceiveClose(CleanStatus::NotClean, 1007, "Headers too large"_s, true); - break; - } case Bun::WebSocketErrorCode::ended: { didReceiveClose(CleanStatus::NotClean, 1006, "Connection ended"_s, true); break; @@ -1613,10 +1609,6 @@ void WebSocket::didFailWithErrorCode(Bun::WebSocketErrorCode code) didReceiveClose(CleanStatus::NotClean, 1002, "Protocol error - unexpected mask from server"_s); break; } - case Bun::WebSocketErrorCode::expected_control_frame: { - didReceiveClose(CleanStatus::NotClean, 1002, "Protocol error - expected control frame"_s); - break; - } case Bun::WebSocketErrorCode::unsupported_control_frame: { didReceiveClose(CleanStatus::NotClean, 1002, "Protocol error - unsupported control frame"_s); break; @@ -1643,14 +1635,6 @@ void WebSocket::didFailWithErrorCode(Bun::WebSocketErrorCode code) didReceiveClose(CleanStatus::NotClean, 1009, "Message too big"_s); break; } - case Bun::WebSocketErrorCode::protocol_error: { - didReceiveClose(CleanStatus::NotClean, 1002, "Protocol error"_s); - break; - } - case Bun::WebSocketErrorCode::compression_failed: { - didReceiveClose(CleanStatus::NotClean, 1002, "Compression failed"_s); - break; - } case Bun::WebSocketErrorCode::invalid_compressed_data: { didReceiveClose(CleanStatus::NotClean, 1002, "Invalid compressed data"_s); break; @@ -1663,10 +1647,6 @@ void WebSocket::didFailWithErrorCode(Bun::WebSocketErrorCode code) didReceiveClose(CleanStatus::NotClean, 1006, "Proxy authentication required"_s, true); break; } - case Bun::WebSocketErrorCode::proxy_connection_refused: { - didReceiveClose(CleanStatus::NotClean, 1006, "Proxy connection refused"_s, true); - break; - } case Bun::WebSocketErrorCode::proxy_tunnel_failed: { didReceiveClose(CleanStatus::NotClean, 1006, "Proxy tunnel failed"_s, true); break; diff --git a/src/jsc/bindings/webcore/WebSocketErrorCode.h b/src/jsc/bindings/webcore/WebSocketErrorCode.h index 02f478186a1e..652770e2a161 100644 --- a/src/jsc/bindings/webcore/WebSocketErrorCode.h +++ b/src/jsc/bindings/webcore/WebSocketErrorCode.h @@ -21,26 +21,21 @@ enum class WebSocketErrorCode : int32_t { closed = 14, failed_to_write = 15, failed_to_connect = 16, - headers_too_large = 17, ended = 18, failed_to_allocate_memory = 19, control_frame_is_fragmented = 20, invalid_control_frame = 21, compression_unsupported = 22, invalid_compressed_data = 23, - compression_failed = 24, unexpected_mask_from_server = 25, - expected_control_frame = 26, unsupported_control_frame = 27, unexpected_opcode = 28, invalid_utf8 = 29, tls_handshake_failed = 30, message_too_big = 31, - protocol_error = 32, // Proxy error codes proxy_connect_failed = 33, proxy_authentication_required = 34, - proxy_connection_refused = 35, proxy_tunnel_failed = 36, unexpected_rsv1 = 37, }; diff --git a/src/router/Cargo.toml b/src/router/Cargo.toml index 8166120c2ce2..63ad0766ab8d 100644 --- a/src/router/Cargo.toml +++ b/src/router/Cargo.toml @@ -16,11 +16,6 @@ bun_alloc.workspace = true strum.workspace = true bstr.workspace = true scopeguard.workspace = true -const_format.workspace = true -enum-map.workspace = true -enumset.workspace = true -libc.workspace = true -bitflags.workspace = true bun_core.workspace = true bun_collections.workspace = true bun_ast.workspace = true diff --git a/src/runtime/api/bun/subprocess/Readable.rs b/src/runtime/api/bun/subprocess/Readable.rs index 947a18da9f06..d59aa218de65 100644 --- a/src/runtime/api/bun/subprocess/Readable.rs +++ b/src/runtime/api/bun/subprocess/Readable.rs @@ -8,7 +8,6 @@ use crate::node::types::FdJsc as _; use crate::api::bun_spawn::stdio::Stdio; use crate::webcore::ReadableStream; -use crate::webcore::blob::SizeType as BlobSizeType; use bun_io::max_buf::MaxBuf; use bun_ptr::IntrusiveRc; use bun_ptr::cow_slice::CowSlice; @@ -177,12 +176,6 @@ impl Readable { } } - pub fn on_close(&mut self, _: Option) { - *self = Readable::Closed; - } - - pub fn on_ready(&mut self, _: Option, _: Option) {} - pub fn close(&mut self) { match self { Readable::Memfd(fd) => { diff --git a/src/runtime/api/bun/subprocess/Writable.rs b/src/runtime/api/bun/subprocess/Writable.rs index 23c6205e6a79..4d34112c196e 100644 --- a/src/runtime/api/bun/subprocess/Writable.rs +++ b/src/runtime/api/bun/subprocess/Writable.rs @@ -7,7 +7,6 @@ use bun_sys::{self, Fd, FdExt}; use crate::api::bun_spawn::stdio::Stdio; use crate::node::types::FdJsc; -use crate::webcore::blob::SizeType as BlobSizeType; use crate::webcore::file_sink::{self, FileSink}; use crate::webcore::sink; use crate::webcore::streams::SourceHandle; @@ -166,7 +165,6 @@ impl<'a> Writable<'a> { // act, so this must be the final access. process.on_stdin_destroyed(); } - pub fn on_ready(&mut self, _: Option, _: Option) {} pub(crate) fn init( stdio: &mut Stdio, diff --git a/src/runtime/bake/DevServer.rs b/src/runtime/bake/DevServer.rs index 3ca367b6f914..3abce98aa619 100644 --- a/src/runtime/bake/DevServer.rs +++ b/src/runtime/bake/DevServer.rs @@ -1925,32 +1925,6 @@ impl RequestEnsureRouteBundledCtx { } } - fn on_failure(&mut self) -> JsResult<()> { - // Reborrow via raw - // pointer so the failure slice and the `&mut DevServer` don't alias. - let route_bundle_index = self.route_bundle_index; - let failure = std::ptr::from_ref::( - self.dev_mut() - .route_bundle_ptr(route_bundle_index) - .data - .framework() - .evaluate_failure - .as_ref() - .unwrap(), - ); - // SAFETY: `failure` points into `route_bundles[i].data` which is not - // mutated by `send_serialized_failures`. - let failures = ::core::slice::from_ref(unsafe { &*failure }); - let resp = self.resp; - self.dev_mut().send_serialized_failures( - DevResponse::Http(resp), - failures, - ErrorPageKind::Evaluation, - None, - )?; - Ok(()) - } - fn on_plugin_error(&mut self) -> JsResult<()> { self.resp.end(b"Plugin Error", false); Ok(()) @@ -1968,9 +1942,6 @@ impl EnsureRouteCtx for RequestEnsureRouteBundledCtx { fn on_loaded(&mut self) -> JsResult<()> { Self::on_loaded(self) } - fn on_failure(&mut self) -> JsResult<()> { - Self::on_failure(self) - } fn on_plugin_error(&mut self) -> JsResult<()> { Self::on_plugin_error(self) } @@ -1988,7 +1959,6 @@ enum BundleQueueType { trait EnsureRouteCtx { fn on_defer(&mut self, bundle_field: BundleQueueType) -> JsResult<()>; fn on_loaded(&mut self) -> JsResult<()>; - fn on_failure(&mut self) -> JsResult<()>; fn on_plugin_error(&mut self) -> JsResult<()>; fn to_dev_response(&mut self) -> DevResponse<'_>; } @@ -2145,10 +2115,6 @@ fn ensure_route_is_bundled( state = route_bundle::State::Loaded; continue 'sw; } - route_bundle::State::EvaluationFailure => { - ctx.on_failure()?; - return Ok(()); - } route_bundle::State::Loaded => { ctx.on_loaded()?; return Ok(()); @@ -2345,7 +2311,7 @@ fn check_route_failures( // `incremental_result.failures_added`; reborrow through raw ptr to // satisfy borrowck. let failures = unsafe { &(*dev_ptr).incremental_result.failures_added }; - dev.send_serialized_failures(resp, failures, ErrorPageKind::Bundler, None)?; + dev.send_serialized_failures(resp, failures, None)?; Ok(CheckResult::Stop) } else { // Failures are unreachable by this route, so it is OK to load. @@ -4678,7 +4644,6 @@ pub(super) fn finalize_bundle( global, }), failures, - ErrorPageKind::Bundler, // SAFETY: agent ptr is from `dev.inspector()` just above; live for this scope. // `take()` so the queued-request loop and the fallback below // do not notify the inspector a second time for this bundle. @@ -4713,7 +4678,6 @@ pub(super) fn finalize_bundle( dev.send_serialized_failures( resp, failures, - ErrorPageKind::Bundler, // SAFETY: agent ptr is from `dev.inspector()` above; live for this scope. inspector_agent_ptr.take().map(|p| unsafe { &*p }), )?; @@ -5282,7 +5246,6 @@ impl DevServer { route_bundle::UnresolvedIndex::Framework(route_index) => { route_bundle::Data::Framework(route_bundle::Framework { route_index, - evaluate_failure: None, cached_module_list: jsc::StrongOptional::empty(), cached_client_bundle_url: jsc::StrongOptional::empty(), cached_css_file_array: jsc::StrongOptional::empty(), @@ -5327,14 +5290,6 @@ impl DevServer { } } -#[derive(Copy, Clone)] -enum ErrorPageKind { - /// Modules failed to bundle - Bundler, - /// Modules failed to evaluate - Evaluation, -} - impl DevServer { fn encode_serialized_failures( &self, @@ -5376,15 +5331,11 @@ impl DevServer { &mut self, resp: DevResponse, failures: &[SerializedFailure], - kind: ErrorPageKind, inspector_agent: Option<&BunFrontendDevServerAgent>, ) -> crate::Result<()> { let mut buf: Vec = Vec::with_capacity(2048); - let page_title = match kind { - ErrorPageKind::Bundler => "Build Failed", - ErrorPageKind::Evaluation => "Runtime Error", - }; + let page_title = "Build Failed"; write!( buf, concat!( @@ -6473,36 +6424,6 @@ impl<'a> PromiseEnsureRouteBundledCtx<'a> { Ok(()) } - fn on_failure(&mut self) -> JsResult<()> { - let promise_response = PromiseResponse { - promise: self.ensure_promise(), - global: self.global, - }; - - // Note: split the route-bundle borrow off via raw pointer so the - // failure slice doesn't conflict with the `&mut DevServer` below. - let route_bundle_index = self.route_bundle_index; - let failure = std::ptr::from_ref::( - self.dev_mut() - .route_bundle_ptr(route_bundle_index) - .data - .framework() - .evaluate_failure - .as_ref() - .unwrap(), - ); - // SAFETY: `failure` points into `route_bundles[i].data` which is not - // mutated by `send_serialized_failures`. - let failures = ::core::slice::from_ref(unsafe { &*failure }); - self.dev_mut().send_serialized_failures( - DevResponse::Promise(promise_response), - failures, - ErrorPageKind::Evaluation, - None, - )?; - Ok(()) - } - fn on_plugin_error(&mut self) -> JsResult<()> { let _ = self.ensure_promise(); let global = self.global; @@ -6528,9 +6449,6 @@ impl<'a> EnsureRouteCtx for PromiseEnsureRouteBundledCtx<'a> { fn on_loaded(&mut self) -> JsResult<()> { PromiseEnsureRouteBundledCtx::on_loaded(self) } - fn on_failure(&mut self) -> JsResult<()> { - PromiseEnsureRouteBundledCtx::on_failure(self) - } fn on_plugin_error(&mut self) -> JsResult<()> { PromiseEnsureRouteBundledCtx::on_plugin_error(self) } diff --git a/src/runtime/bake/dev_server/mod.rs b/src/runtime/bake/dev_server/mod.rs index 211753667525..ceb7e11e527f 100644 --- a/src/runtime/bake/dev_server/mod.rs +++ b/src/runtime/bake/dev_server/mod.rs @@ -88,9 +88,6 @@ pub enum MessageId { Version = b'V', HotUpdate = b'u', Errors = b'e', - BrowserMessage = b'b', - BrowserMessageClear = b'B', - RequestHandlerError = b'h', Visualizer = b'v', MemoryVisualizer = b'M', SetUrlResponse = b'n', diff --git a/src/runtime/bake/dev_server/route_bundle.rs b/src/runtime/bake/dev_server/route_bundle.rs index 2e7fe013e2dd..da583284051b 100644 --- a/src/runtime/bake/dev_server/route_bundle.rs +++ b/src/runtime/bake/dev_server/route_bundle.rs @@ -2,7 +2,6 @@ use super::incremental_graph; use super::jsc; -use super::serialized_failure::SerializedFailure; use super::source_map_store; use crate::bake::framework_router; use crate::server::{StaticRoute, html_bundle::HTMLBundleRoute}; @@ -21,7 +20,6 @@ pub enum State { Bundling, DeferredToNextBundle, PossibleBundlingFailures, - EvaluationFailure, Loaded, } @@ -30,7 +28,6 @@ pub struct Framework { pub(crate) cached_module_list: jsc::StrongOptional, pub(crate) cached_client_bundle_url: jsc::StrongOptional, pub(crate) cached_css_file_array: jsc::StrongOptional, - pub(crate) evaluate_failure: Option, } pub struct Html { @@ -151,7 +148,6 @@ impl RouteBundle { match &self.data { Data::Framework(_) => { // jsc.Strong.Optional children do not support memoryCost; not needed. - // .evaluate_failure is not owned. } Data::Html(html) => { if let Some(text) = &html.bundled_html_text { diff --git a/src/runtime/cli/create_command.rs b/src/runtime/cli/create_command.rs index b0ec6e3ab5b4..62f438717a75 100644 --- a/src/runtime/cli/create_command.rs +++ b/src/runtime/cli/create_command.rs @@ -736,7 +736,6 @@ impl CreateCommand { } } } - _ => unreachable!(), } node.end(); @@ -1708,7 +1707,6 @@ impl Default for Example { #[repr(u8)] #[derive(Copy, Clone, Eq, PartialEq, strum::IntoStaticStr)] pub enum ExampleTag { - Unknown, GithubRepository, Official, LocalFolder, diff --git a/src/runtime/cli/pack_command.rs b/src/runtime/cli/pack_command.rs index 855960f9d37e..749980616d6b 100644 --- a/src/runtime/cli/pack_command.rs +++ b/src/runtime/cli/pack_command.rs @@ -295,13 +295,6 @@ impl PackCommand { ); Global::crash(); } - PackError::MissingPackageJSON => { - Output::err_generic( - "failed to find a package.json in: \"{}\"", - format_args!("{}", bstr::BStr::new(abs_pkg_json.as_bytes())), - ); - Global::crash(); - } // for_publish-only variants — unreachable when FOR_PUBLISH=false. PackError::RestrictedUnscopedPackage | PackError::PrivatePackage => unreachable!(), } @@ -326,8 +319,6 @@ pub enum PackError { MissingPackageVersion, #[error("InvalidPackageVersion")] InvalidPackageVersion, - #[error("MissingPackageJSON")] - MissingPackageJSON, // The following two are only valid when FOR_PUBLISH == true (const-generic // enums cannot conditionally include variants, so both instantiations // share one enum). diff --git a/src/runtime/cli/publish_command.rs b/src/runtime/cli/publish_command.rs index ac54ef762f7f..404940433415 100644 --- a/src/runtime/cli/publish_command.rs +++ b/src/runtime/cli/publish_command.rs @@ -648,12 +648,6 @@ impl PublishCommand { (), ); } - PackError::MissingPackageJSON => { - Output::err_generic( - "failed to find package.json from: '{}'", - (bstr::BStr::new(FileSystem::instance().top_level_dir),), - ); - } PackError::RestrictedUnscopedPackage => { Output::err_generic("unable to restrict access to unscoped package", ()); } diff --git a/src/runtime/node/node_fs_watcher.rs b/src/runtime/node/node_fs_watcher.rs index 51fdf3acf30c..2130b424d2c6 100644 --- a/src/runtime/node/node_fs_watcher.rs +++ b/src/runtime/node/node_fs_watcher.rs @@ -340,7 +340,6 @@ pub enum EventType { Rename = 0, Change = 1, Error = 2, - Abort = 3, Close = 4, } diff --git a/src/runtime/shell/IOWriter.rs b/src/runtime/shell/IOWriter.rs index 19787dc7e695..4f8d012cab07 100644 --- a/src/runtime/shell/IOWriter.rs +++ b/src/runtime/shell/IOWriter.rs @@ -85,10 +85,7 @@ pub enum WriterTag { /// Builtin running inside a Cmd — dispatch via `Builtin::on_io_writer_chunk`. Builtin, Cmd, - Pipeline, - Subshell, CondExpr, - If, /// `subproc::PipeReader::CapturedWriter` — heap-allocated, addressed via /// `ChildPtr::raw` rather than `node`. Subproc, @@ -1228,23 +1225,13 @@ pub(crate) fn on_io_writer_chunk( err: Option, ) -> Yield { use crate::shell::builtin::Builtin; - use crate::shell::states::{cmd, cond_expr, pipeline, subshell}; + use crate::shell::states::{cmd, cond_expr}; match child.tag { WriterTag::Builtin => Builtin::on_io_writer_chunk(interp, child.node, written, err), WriterTag::Cmd => cmd::Cmd::on_io_writer_chunk(interp, child.node, written, err), - WriterTag::Pipeline => { - pipeline::Pipeline::on_io_writer_chunk(interp, child.node, written, err) - } - WriterTag::Subshell => { - subshell::Subshell::on_io_writer_chunk(interp, child.node, written, err) - } WriterTag::CondExpr => { cond_expr::CondExpr::on_io_writer_chunk(interp, child.node, written, err) } - // `Interpreter.If` never enqueues to an IOWriter. - WriterTag::If => { - crate::shell::interpreter::unreachable_state("IOWriter.onIOWriterChunk", "If") - } // The target is the subprocess PipeReader's `CapturedWriter`; it // lives outside the NodeId arena (heap-allocated PipeReader), so it // is carried in `child.raw` instead of `child.node`. diff --git a/src/runtime/shell/Yield.rs b/src/runtime/shell/Yield.rs index 71a13dedb537..351032832410 100644 --- a/src/runtime/shell/Yield.rs +++ b/src/runtime/shell/Yield.rs @@ -24,9 +24,6 @@ use crate::shell::states::pipeline::Pipeline; pub enum Yield { /// Step the node at this id (`Interpreter::next_node`). Next(NodeId), - /// Start the node at this id (`Interpreter::start_node`). Used when a - /// freshly-created child needs starting at top-of-stack. - Start(NodeId), /// IOWriter completed a chunk synchronously; fire `on_io_writer_chunk` on /// the registered child at top-of-stack. OnIoWriterChunk { @@ -129,7 +126,6 @@ impl Yield { } interp.next_node(id) } - Yield::Start(id) => interp.start_node(id), Yield::OnIoWriterChunk { child, written, diff --git a/src/runtime/shell/builtin/cat.rs b/src/runtime/shell/builtin/cat.rs index 5bb5539e38b6..bd510becc71d 100644 --- a/src/runtime/shell/builtin/cat.rs +++ b/src/runtime/shell/builtin/cat.rs @@ -37,7 +37,6 @@ pub enum CatState { in_done: bool, }, WaitingWriteErr, - Done, } /// Internal: what to do after dropping the &mut state borrow. @@ -111,7 +110,6 @@ impl Cat { Stdin, FileArg { args_start: usize, idx: usize }, WaitingErr, - Done, } let branch = match &Self::state_mut(interp, cmd).state { CatState::Idle => panic!("Invalid state"), @@ -123,7 +121,6 @@ impl Cat { idx: *idx, }, CatState::WaitingWriteErr => Branch::WaitingErr, - CatState::Done => Branch::Done, }; match branch { Branch::Stdin => { @@ -226,7 +223,6 @@ impl Cat { reader.start() } Branch::WaitingErr => Yield::failed(), - Branch::Done => Builtin::done(interp, cmd, 0), } } @@ -390,7 +386,7 @@ impl Cat { Step::Suspend } } - CatState::Done | CatState::WaitingWriteErr | CatState::Idle => Step::Suspend, + CatState::WaitingWriteErr | CatState::Idle => Step::Suspend, }; if cancel { let wchild = ChildPtr::new(cmd, WriterTag::Builtin); diff --git a/src/runtime/shell/builtin/rm.rs b/src/runtime/shell/builtin/rm.rs index dadc7ee3dbb7..2ee4ffa53f93 100644 --- a/src/runtime/shell/builtin/rm.rs +++ b/src/runtime/shell/builtin/rm.rs @@ -580,7 +580,6 @@ impl JoinStyle { pub enum EntryKindHint { Idk, Dir, - File, } /// One per filepath argument; owns the root @@ -918,7 +917,7 @@ impl ShellRmTask { // `path` are read-only after construction. let (kind_hint, path) = unsafe { ((*dir_task).kind_hint, (*dir_task).path.as_zstr()) }; match kind_hint { - EntryKindHint::Idk | EntryKindHint::File => { + EntryKindHint::Idk => { let mut vtable = RemoveFileVTable { task: self, child_of_dir: false, diff --git a/src/runtime/shell/interpreter.rs b/src/runtime/shell/interpreter.rs index 2379323e78cb..9ee2ebb91e77 100644 --- a/src/runtime/shell/interpreter.rs +++ b/src/runtime/shell/interpreter.rs @@ -2317,7 +2317,6 @@ pub enum ParseFlagResult { Done, IllegalOption(*const [u8]), Unsupported(*const [u8]), - ShowUsage, } /// Returns just `name` and lets the caller's `fmt_error_arena` add the @@ -2352,7 +2351,6 @@ pub(crate) fn parse_flags<'a, O: FlagParser>( ParseFlagResult::ContinueParsing => {} ParseFlagResult::IllegalOption(s) => return Err(ParseError::IllegalOption(s)), ParseFlagResult::Unsupported(s) => return Err(ParseError::Unsupported(s)), - ParseFlagResult::ShowUsage => return Err(ParseError::ShowUsage), } idx += 1; } diff --git a/src/runtime/shell/states/CondExpr.rs b/src/runtime/shell/states/CondExpr.rs index 1850bf77f83f..0336c4fb58c1 100644 --- a/src/runtime/shell/states/CondExpr.rs +++ b/src/runtime/shell/states/CondExpr.rs @@ -25,7 +25,6 @@ pub enum CondExprState { }, WaitingStat, WaitingWriteErr, - Done, } impl CondExpr { @@ -72,10 +71,6 @@ impl CondExpr { } CondExprState::WaitingStat => return Yield::suspended(), CondExprState::WaitingWriteErr => return Yield::suspended(), - CondExprState::Done => { - let parent = interp.as_condexpr(this).base.parent; - return interp.child_done(parent, this, 0); - } } } } diff --git a/src/runtime/shell/states/If.rs b/src/runtime/shell/states/If.rs index 1378602b2ad4..eaa8b40fdbdf 100644 --- a/src/runtime/shell/states/If.rs +++ b/src/runtime/shell/states/If.rs @@ -18,8 +18,6 @@ pub enum IfState { #[default] Idle, Exec(Exec), - WaitingWriteErr, - Done, } pub struct Exec { @@ -164,8 +162,6 @@ impl If { Action::SpawnStmt(stmt_node) } } - IfState::WaitingWriteErr => return Yield::suspended(), - IfState::Done => panic!("This code should not be reachable"), } }; return match action { diff --git a/src/runtime/shell/states/Pipeline.rs b/src/runtime/shell/states/Pipeline.rs index ab5be9be3aec..2179a5c10613 100644 --- a/src/runtime/shell/states/Pipeline.rs +++ b/src/runtime/shell/states/Pipeline.rs @@ -268,27 +268,6 @@ impl Pipeline { interp.start_node(child) } - /// IOWriter completion callback for the error message written in - /// `WaitingWriteErr`: throw on write failure, otherwise finish the - /// pipeline with exit code 1. - pub(crate) fn on_io_writer_chunk( - interp: &Interpreter, - this: NodeId, - _written: usize, - err: Option, - ) -> Yield { - debug_assert!(matches!( - interp.as_pipeline(this).state, - PipelineState::WaitingWriteErr - )); - if let Some(e) = err { - interp.throw(ShellErr::from_system(e)); - return Yield::failed(); - } - let parent = interp.as_pipeline(this).base.parent; - interp.child_done(parent, this, 1) - } - pub(crate) fn child_done( interp: &Interpreter, this: NodeId, diff --git a/src/runtime/shell/states/Subshell.rs b/src/runtime/shell/states/Subshell.rs index bcc67f264fdf..d649729feefa 100644 --- a/src/runtime/shell/states/Subshell.rs +++ b/src/runtime/shell/states/Subshell.rs @@ -18,9 +18,7 @@ pub struct Subshell { pub enum SubshellState { #[default] Idle, - Expanding, Exec, - WaitWriteErr, Done, } @@ -96,8 +94,7 @@ impl Subshell { let script = Script::init(interp, shell, script_node, this, io); Script::start(interp, script) } - SubshellState::Expanding | SubshellState::Exec => Yield::suspended(), - SubshellState::WaitWriteErr => Yield::suspended(), + SubshellState::Exec => Yield::suspended(), SubshellState::Done => { let exit = interp.as_subshell(this).exit_code; interp.child_done(parent, this, exit) @@ -105,24 +102,6 @@ impl Subshell { } } - pub(crate) fn on_io_writer_chunk( - interp: &Interpreter, - this: NodeId, - _written: usize, - _err: Option, - ) -> Yield { - debug_assert!(matches!( - interp.as_subshell(this).state, - SubshellState::WaitWriteErr - )); - let (parent, exit) = { - let me = interp.as_subshell_mut(this); - me.state = SubshellState::Done; - (me.base.parent, me.exit_code) - }; - interp.child_done(parent, this, exit) - } - pub(crate) fn child_done( interp: &Interpreter, this: NodeId, diff --git a/src/runtime/timer/WTFTimer.rs b/src/runtime/timer/WTFTimer.rs index 668a64787ef9..8a130fb0fc79 100644 --- a/src/runtime/timer/WTFTimer.rs +++ b/src/runtime/timer/WTFTimer.rs @@ -57,16 +57,6 @@ pub(crate) struct WTFTimer { bun_event_loop::impl_timer_owner!(WTFTimer; from_timer_ptr => event_loop_timer); -/// # Safety -/// `vm` must be the live `VirtualMachine` for the current thread. -#[unsafe(no_mangle)] -unsafe extern "C" fn WTFTimer__runIfImminent(vm: *mut VirtualMachine) { - // SAFETY: per fn contract. - let el = unsafe { (*vm).event_loop() }; - // SAFETY: `event_loop()` returns the VM's owned EventLoop pointer. - unsafe { (*el).run_imminent_gc_timer() }; -} - impl WTFTimer { /// Fire the underlying `RunLoop::TimerBase`, /// removing `self` from the timer heap first if it's currently scheduled. diff --git a/src/s3_signing/lib.rs b/src/s3_signing/lib.rs index e4ed4874ba2b..41dbe7b939c7 100644 --- a/src/s3_signing/lib.rs +++ b/src/s3_signing/lib.rs @@ -11,5 +11,4 @@ pub mod credentials; pub use acl::ACL; pub use credentials::*; -pub use error::{ErrorCodeAndMessage, S3Error}; pub use storage_class::StorageClass; diff --git a/src/sql/mysql/StatusFlags.rs b/src/sql/mysql/StatusFlags.rs index e9729f77f076..3a39fa42865c 100644 --- a/src/sql/mysql/StatusFlags.rs +++ b/src/sql/mysql/StatusFlags.rs @@ -4,33 +4,8 @@ use core::fmt; #[repr(u16)] #[derive(Copy, Clone, Eq, PartialEq)] pub enum StatusFlag { - SERVER_STATUS_IN_TRANS = 1, - /// Indicates if autocommit mode is enabled - SERVER_STATUS_AUTOCOMMIT = 2, /// Indicates there are more result sets from this query SERVER_MORE_RESULTS_EXISTS = 8, - /// Query used a suboptimal index - SERVER_STATUS_NO_GOOD_INDEX_USED = 16, - /// Query performed a full table scan with no index - SERVER_STATUS_NO_INDEX_USED = 32, - /// Indicates an open cursor exists - SERVER_STATUS_CURSOR_EXISTS = 64, - /// Last row in result set has been sent - SERVER_STATUS_LAST_ROW_SENT = 128, - /// Database was dropped - SERVER_STATUS_DB_DROPPED = 1 << 8, - /// Backslash escaping is disabled - SERVER_STATUS_NO_BACKSLASH_ESCAPES = 1 << 9, - /// Server's metadata has changed - SERVER_STATUS_METADATA_CHANGED = 1 << 10, - /// Query execution was considered slow - SERVER_QUERY_WAS_SLOW = 1 << 11, - /// Statement has output parameters - SERVER_PS_OUT_PARAMS = 1 << 12, - /// Transaction is in read-only mode - SERVER_STATUS_IN_TRANS_READONLY = 1 << 13, - /// Session state has changed - SERVER_SESSION_STATE_CHANGED = 1 << 14, } #[derive(Copy, Clone, Default)] diff --git a/src/sql/mysql/protocol/AnyMySQLError.rs b/src/sql/mysql/protocol/AnyMySQLError.rs index 0dc341ec5e32..5cb311f326d9 100644 --- a/src/sql/mysql/protocol/AnyMySQLError.rs +++ b/src/sql/mysql/protocol/AnyMySQLError.rs @@ -44,7 +44,6 @@ pub enum Error { UnexpectedPacket, ShortRead, UnknownError, - InvalidState, } bun_core::impl_tag_error!(Error); diff --git a/src/sql/mysql/protocol/CommandType.rs b/src/sql/mysql/protocol/CommandType.rs index efb6b1d429b0..bd1c92570b06 100644 --- a/src/sql/mysql/protocol/CommandType.rs +++ b/src/sql/mysql/protocol/CommandType.rs @@ -2,35 +2,7 @@ #[repr(u8)] #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum CommandType { - COM_QUIT = 0x01, - COM_INIT_DB = 0x02, COM_QUERY = 0x03, - COM_FIELD_LIST = 0x04, - COM_CREATE_DB = 0x05, - COM_DROP_DB = 0x06, - COM_REFRESH = 0x07, - COM_SHUTDOWN = 0x08, - COM_STATISTICS = 0x09, - COM_PROCESS_INFO = 0x0a, - COM_CONNECT = 0x0b, - COM_PROCESS_KILL = 0x0c, - COM_DEBUG = 0x0d, - COM_PING = 0x0e, - COM_TIME = 0x0f, - COM_DELAYED_INSERT = 0x10, - COM_CHANGE_USER = 0x11, - COM_BINLOG_DUMP = 0x12, - COM_TABLE_DUMP = 0x13, - COM_CONNECT_OUT = 0x14, - COM_REGISTER_SLAVE = 0x15, COM_STMT_PREPARE = 0x16, COM_STMT_EXECUTE = 0x17, - COM_STMT_SEND_LONG_DATA = 0x18, - COM_STMT_CLOSE = 0x19, - COM_STMT_RESET = 0x1a, - COM_SET_OPTION = 0x1b, - COM_STMT_FETCH = 0x1c, - COM_DAEMON = 0x1d, - COM_BINLOG_DUMP_GTID = 0x1e, - COM_RESET_CONNECTION = 0x1f, } diff --git a/src/sql/postgres/AnyPostgresError.rs b/src/sql/postgres/AnyPostgresError.rs index 735a7ea808f0..6fc1b6072876 100644 --- a/src/sql/postgres/AnyPostgresError.rs +++ b/src/sql/postgres/AnyPostgresError.rs @@ -16,14 +16,12 @@ pub enum AnyPostgresError { InvalidBackendKeyData, InvalidBinaryData, InvalidByteSequence, - InvalidByteSequenceForEncoding, InvalidCharacter, InvalidMessage, InvalidMessageLength, InvalidQueryBinding, InvalidServerKey, InvalidServerSignature, - InvalidTimeFormat, JSError, JSTerminated, MultidimensionalArrayNotSupportedYet, diff --git a/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.rs b/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.rs index c8e975d8a2d1..2df83083621a 100644 --- a/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.rs +++ b/src/sql_jsc/mysql/protocol/any_mysql_error_jsc.rs @@ -115,7 +115,6 @@ pub(crate) fn mysql_error_to_js( "FailedToEncryptPassword" => b"ERR_MYSQL_FAILED_TO_ENCRYPT_PASSWORD", "InvalidPublicKey" => b"ERR_MYSQL_INVALID_PUBLIC_KEY", "PublicKeyRetrievalNotAllowed" => b"ERR_MYSQL_PUBLIC_KEY_RETRIEVAL_NOT_ALLOWED", - "InvalidState" => b"ERR_MYSQL_INVALID_STATE", "JSError" => { return global_object.take_exception(JsError::Thrown); } diff --git a/src/sql_jsc/postgres/error_jsc.rs b/src/sql_jsc/postgres/error_jsc.rs index 84c687de1d06..d8f79c61a95e 100644 --- a/src/sql_jsc/postgres/error_jsc.rs +++ b/src/sql_jsc/postgres/error_jsc.rs @@ -63,14 +63,12 @@ pub(crate) fn postgres_error_to_js( InvalidBackendKeyData => b"ERR_POSTGRES_INVALID_BACKEND_KEY_DATA", InvalidBinaryData => b"ERR_POSTGRES_INVALID_BINARY_DATA", InvalidByteSequence => b"ERR_POSTGRES_INVALID_BYTE_SEQUENCE", - InvalidByteSequenceForEncoding => b"ERR_POSTGRES_INVALID_BYTE_SEQUENCE_FOR_ENCODING", InvalidCharacter => b"ERR_POSTGRES_INVALID_CHARACTER", InvalidMessage => b"ERR_POSTGRES_INVALID_MESSAGE", InvalidMessageLength => b"ERR_POSTGRES_INVALID_MESSAGE_LENGTH", InvalidQueryBinding => b"ERR_POSTGRES_INVALID_QUERY_BINDING", InvalidServerKey => b"ERR_POSTGRES_INVALID_SERVER_KEY", InvalidServerSignature => b"ERR_POSTGRES_INVALID_SERVER_SIGNATURE", - InvalidTimeFormat => b"ERR_POSTGRES_INVALID_TIME_FORMAT", MultidimensionalArrayNotSupportedYet => { b"ERR_POSTGRES_MULTIDIMENSIONAL_ARRAY_NOT_SUPPORTED_YET" }