From 7c9a61db1de1bd19df7da202060e377547bb01da Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 08:18:29 +0000 Subject: [PATCH 01/10] Remove dead code from C++ bindings, src/js builtins, CSS, and Rust util crates C++ (src/jsc/bindings/): - Delete objects.h (254 lines, entirely commented-out) and ZigLazyStaticFunctions-inlines.h (never #included) - Remove extern "C" functions with zero callers across src/, vendor/, packages/, codegen: JSC__JSValue__fastGetOwn, JSC__JSValue__createRopeString, JSC__VM__externalMemorySize, JSC__JSValue__dateInstanceFromNullTerminatedString, JSC__JSValue__DateNowISOString, DOMFormData__toQueryString, Bun__REPL__formatValue, bun_ignore_sigpipe, Bun__disableSOLinger, getJSCBytecodeCacheVersion, Zig__GlobalObject__{get,reset}ModuleRegistryMap, JSGlobalObject__requestTermination, functionFulfillModuleSync, JSC__createEmptyObjectWithStructure, JSC__putDirectOffset, highway_json_index, Bake__getSSRResponseConstructor, StringBuilder__appendUtf16, StringBuilder__appendQuotedJsonString, Bun__JS{BigInt,}StatFSObjectConstructor, ScriptExecutionContextIdentifier__forGlobalObject, Yarr__RegularExpression__{matchedLength,searchRev}, Cookie__fromJS, jsFetchHeaders_getRawKeys src/js/: - builtins/CommonJS.ts: remove 131-line commented-out loadEsmIntoCjs__dead block - builtins/JSBufferPrototype.ts: remove setBigUint64 (no codegen consumer) - internal/http.ts: remove 27 unused Symbol consts, emitCloseNTAndComplete, ClientRequestEmitState, getRawKeys - builtins.d.ts, BunBuiltinNames.h: drop $fulfillModuleSync CSS (src/css/): remove unreachable option chains (every PrinterOptions construction uses ..Default::default() with only minify/targets set): - PrinterOptions.analyze_dependencies and downstream: DependencyOptions, Dependency, ImportDependency, UrlDependency, Printer.{dependencies,remove_imports}, dep-collection branches in rules/import.rs, rules/mod.rs, properties/custom.rs, values/url.rs, values/image.rs; Url::is_absolute - PrinterOptions.pseudo_classes: struct PseudoClasses, pseudo! macro branch in selectors/selector.rs - PrinterErrorKind::{ambiguous_url_in_custom_property, invalid_css_modules_pattern_in_grid} Rust: - bun_core/util.rs: FdOptional (unused; only re-exported) - bun_core/env_var.rs: BUN_NEEDS_PROC_SELF_WORKAROUND, MI_VERBOSE, TODIUM Cargo.toml: drop unused deps from collections, paths, io, glob, css (21 entries) Verified: bun bd builds clean, rust:check-all passes on all 10 targets, css.test.ts / css-modules.test.ts / node:http smoke test pass. --- Cargo.lock | 21 -- src/bun_core/env_var.rs | 5 - src/bun_core/util.rs | 17 -- src/collections/Cargo.toml | 2 - src/css/Cargo.toml | 5 - src/css/css_modules.rs | 3 +- src/css/css_parser.rs | 2 +- src/css/dependencies.rs | 71 +---- src/css/error.rs | 15 -- src/css/lib.rs | 4 +- src/css/printer.rs | 56 +--- src/css/properties/custom.rs | 44 --- src/css/rules/import.rs | 24 +- src/css/rules/mod.rs | 24 -- src/css/selectors/selector.rs | 26 +- src/css/values/image.rs | 35 +-- src/css/values/url.rs | 73 ----- src/glob/Cargo.toml | 5 - src/io/Cargo.toml | 4 - src/js/builtins.d.ts | 1 - src/js/builtins/BunBuiltinNames.h | 1 - src/js/builtins/CommonJS.ts | 132 --------- src/js/builtins/JSBufferPrototype.ts | 8 - src/js/internal/http.ts | 75 ------ src/jsc/DOMFormData.rs | 3 +- src/jsc/FetchHeaders.rs | 3 +- .../bindings/BakeAdditionsToGlobalObject.cpp | 6 - src/jsc/bindings/Cookie.cpp | 5 - src/jsc/bindings/JSBundlerPlugin.cpp | 1 - src/jsc/bindings/NodeFSStatFSBinding.cpp | 10 - src/jsc/bindings/RegularExpression.cpp | 8 - src/jsc/bindings/SQLClient.cpp | 15 -- src/jsc/bindings/ScriptExecutionContext.cpp | 6 - src/jsc/bindings/StringBuilderBinding.cpp | 11 - src/jsc/bindings/ZigGlobalObject.cpp | 69 ----- .../bindings/ZigLazyStaticFunctions-inlines.h | 33 --- src/jsc/bindings/bindings.cpp | 120 --------- src/jsc/bindings/c-bindings.cpp | 27 -- src/jsc/bindings/headers.h | 5 - src/jsc/bindings/highway_json.cpp | 12 - src/jsc/bindings/objects.h | 254 ------------------ src/jsc/bindings/webcore/JSFetchHeaders.cpp | 30 --- src/jsc/bindings/webcore/JSFetchHeaders.h | 2 - src/paths/Cargo.toml | 5 - src/sys/lib.rs | 2 +- .../source-lints/dead-symbols-35437.test.ts | 68 +++++ 46 files changed, 87 insertions(+), 1261 deletions(-) delete mode 100644 src/jsc/bindings/ZigLazyStaticFunctions-inlines.h delete mode 100644 src/jsc/bindings/objects.h create mode 100644 test/internal/source-lints/dead-symbols-35437.test.ts diff --git a/Cargo.lock b/Cargo.lock index eeec9e5dc3d5..708b11bef6ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -484,8 +484,6 @@ dependencies = [ "paste", "rustc-hash", "smallvec", - "strum", - "thiserror", ] [[package]] @@ -584,14 +582,9 @@ dependencies = [ "bun_paths", "bun_ptr", "bun_wyhash", - "const_format", - "enum-map", - "enumset", - "libc", "scopeguard", "strum", "thiserror", - "typed-arena", ] [[package]] @@ -746,17 +739,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", ] @@ -1020,15 +1008,11 @@ dependencies = [ "bun_core", "bun_dispatch", "bun_errno", - "bun_opaque", - "bun_paths", "bun_ptr", "bun_spawn_sys", "bun_sys", "bun_threading", "bun_uws_sys", - "const_format", - "enum-map", "enumset", "libc", "scopeguard", @@ -1405,18 +1389,13 @@ dependencies = [ name = "bun_paths" version = "0.0.0" dependencies = [ - "bitflags", "bstr", "bun_alloc", "bun_core", "bun_errno", "bun_simdutf_sys", - "bytemuck", "const_format", - "enum-map", - "enumset", "libc", - "scopeguard", "strum", "thiserror", ] diff --git a/src/bun_core/env_var.rs b/src/bun_core/env_var.rs index 6d1d0f45ef20..66a0bc371f9d 100644 --- a/src/bun_core/env_var.rs +++ b/src/bun_core/env_var.rs @@ -103,7 +103,6 @@ new!(pub BUN_INSTALL_STREAMING_MIN_SIZE: unsigned, "BUN_INSTALL_STREAMING_MIN_SI // thread schedules a drain; collapses the per-chunk thread-pool futex wake // into roughly one per `threshold` bytes. new!(pub BUN_INSTALL_STREAMING_DRAIN_THRESHOLD: unsigned, "BUN_INSTALL_STREAMING_DRAIN_THRESHOLD", { default: 256 * 1024 }); -new!(pub BUN_NEEDS_PROC_SELF_WORKAROUND: boolean, "BUN_NEEDS_PROC_SELF_WORKAROUND", { default: false }); new!(pub BUN_OPTIONS: string, "BUN_OPTIONS", {}); new!(pub BUN_POSTGRES_SOCKET_MONITOR: string, "BUN_POSTGRES_SOCKET_MONITOR", {}); new!(pub BUN_POSTGRES_SOCKET_MONITOR_READER: string, "BUN_POSTGRES_SOCKET_MONITOR_READER", {}); @@ -147,9 +146,6 @@ platform_specific_new!(pub HOME: string, posix = "HOME", windows = "USERPROFILE" new!(pub HYPERFINE_RANDOMIZED_ENVIRONMENT_OFFSET: string, "HYPERFINE_RANDOMIZED_ENVIRONMENT_OFFSET", {}); new!(pub IS_BUN_AUTO_UPDATE: boolean, "IS_BUN_AUTO_UPDATE", { default: false }); new!(pub JENKINS_URL: string, "JENKINS_URL", {}); -// Dump mimalloc statistics at the end of the process. Note that this is not the same as -// `MIMALLOC_VERBOSE`, documented here: https://microsoft.github.io/mimalloc/environment.html -new!(pub MI_VERBOSE: boolean, "MI_VERBOSE", { default: false }); new!(pub NO_COLOR: boolean, "NO_COLOR", { default: false }); new!(pub NODE_CHANNEL_FD: string, "NODE_CHANNEL_FD", {}); // A string, not a boolean: node suppresses warnings only when the value is @@ -175,7 +171,6 @@ new!(pub TERM_PROGRAM: string, "TERM_PROGRAM", {}); platform_specific_new!(pub TMP: string, posix = "TMP", windows = "TMP", {}); platform_specific_new!(pub TMPDIR: string, posix = "TMPDIR", windows = "TMPDIR", {}); new!(pub TMUX: string, "TMUX", {}); -new!(pub TODIUM: string, "TODIUM", {}); platform_specific_new!(pub USER: string, posix = "USER", windows = "USERNAME", {}); new!(pub WANTS_LOUD: boolean, "WANTS_LOUD", { default: false }); // The same as system_root. diff --git a/src/bun_core/util.rs b/src/bun_core/util.rs index a781c3b5eb78..94b612e4bcbe 100644 --- a/src/bun_core/util.rs +++ b/src/bun_core/util.rs @@ -1269,23 +1269,6 @@ impl Stdio { } } -/// Niche-packed `Option`: the invalid-fd bit pattern is the `none` sentinel. -/// Use instead of encoding the invalid value directly. -#[repr(transparent)] -#[derive(Copy, Clone, Eq, PartialEq)] -pub struct FdOptional(FdBacking); -impl FdOptional { - pub const NONE: FdOptional = FdOptional(Fd::INVALID.0); - #[inline] - pub const fn unwrap(self) -> Option { - if self.0 == FdOptional::NONE.0 { - None - } else { - Some(Fd(self.0)) - } - } -} - /// Best-effort fd → path. Returns bytes written (>0), 0 on misc failure, /// -1 on EBADF/ENOENT (caller may render `[BADF]`). Body is libc-only /// (`readlink("/proc/self/fd/N")` on Linux, `fcntl(F_GETPATH)` on macOS, diff --git a/src/collections/Cargo.toml b/src/collections/Cargo.toml index 5c7da9258b7c..32e9732b98ee 100644 --- a/src/collections/Cargo.toml +++ b/src/collections/Cargo.toml @@ -10,7 +10,6 @@ path = "lib.rs" workspace = true [dependencies] -strum.workspace = true # `raw-entry` powers `StringHashMap::{get_hashed, put_static_key_hashed}` — the # precomputed-hash probe/insert path the resolver's `DirEntry::add_entry` hot # loop uses so it hashes each basename once instead of on every lookup + insert. @@ -29,6 +28,5 @@ bun_wyhash.workspace = true bun_ptr.workspace = true rustc-hash = "2" -thiserror.workspace = true bun_simdutf_sys.workspace = true diff --git a/src/css/Cargo.toml b/src/css/Cargo.toml index a59b7543ac7e..532247f8a73a 100644 --- a/src/css/Cargo.toml +++ b/src/css/Cargo.toml @@ -14,12 +14,7 @@ thiserror.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 -typed-arena.workspace = true bun_base64.workspace = true bun_alloc.workspace = true bun_core.workspace = true diff --git a/src/css/css_modules.rs b/src/css/css_modules.rs index c342a548d35e..120055dcfdf1 100644 --- a/src/css/css_modules.rs +++ b/src/css/css_modules.rs @@ -456,8 +456,7 @@ impl<'a> CssModuleReference<'a> { /// LAYERING: canonical implementation lives in `bun_base64::wyhash_url_safe` /// (a leaf crate) so `bun_bundler::LinkerContext::mangle_local_css` can call /// the *same* hasher without depending on `bun_css`. Re-export here so -/// in-crate callers (`dependencies.rs`, `rules/import.rs`) keep the -/// `css_modules::hash` path. +/// in-crate callers keep the `css_modules::hash` path. #[inline] pub(crate) fn hash<'a>(bump: &'a Bump, args: Arguments<'_>, at_start: bool) -> &'a [u8] { bun_base64::wyhash_url_safe(bump, args, at_start) diff --git a/src/css/css_parser.rs b/src/css/css_parser.rs index 3e1c9d02e635..57ae7865c266 100644 --- a/src/css/css_parser.rs +++ b/src/css/css_parser.rs @@ -27,7 +27,7 @@ pub use crate::css_modules::{ self, Config as CssModuleConfig, CssModule, CssModuleExports, CssModuleReference, CssModuleReferences, }; -pub use crate::dependencies::{self, Dependency}; +pub use crate::dependencies; pub use crate::error::{ self as errors_, BasicParseError, BasicParseErrorKind, Err, ErrorLocation, MinifyErr, MinifyError, MinifyErrorKind, ParseError, ParserError, PrinterError, PrinterErrorKind, diff --git a/src/css/dependencies.rs b/src/css/dependencies.rs index f0682860c504..3fb847cca127 100644 --- a/src/css/dependencies.rs +++ b/src/css/dependencies.rs @@ -1,21 +1,7 @@ -//! CSS dependency tracking — `@import` and `url()` references collected during printing. +//! Source location for CSS `url()` values and printer errors. use crate::SourceLocation; -/// Options for `analyze_dependencies` in `PrinterOptions`. -pub struct DependencyOptions { - /// Whether to remove `@import` rules. - pub(crate) remove_imports: bool, -} - -/// A dependency. -pub enum Dependency { - /// An `@import` dependency. - Import(ImportDependency), - /// A `url()` dependency. - Url(UrlDependency), -} - /// A line and column position within a source file. #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct Location { @@ -33,58 +19,3 @@ impl Location { } } } - -/// An `@import` dependency. -pub struct ImportDependency { - /// The placeholder that the URL was replaced with. - // Lifetime: arena-allocated by `css_modules::hash`. - pub(crate) placeholder: *const [u8], -} - -impl ImportDependency { - pub(crate) fn new<'bump>( - bump: &'bump bun_alloc::Arena, - rule: &crate::css_rules::import::ImportRule, - filename: &[u8], - ) -> ImportDependency { - let placeholder = crate::css_modules::hash( - bump, - format_args!( - "{}_{}", - bstr::BStr::new(filename), - bstr::BStr::new(rule.url) - ), - false, - ); - - ImportDependency { - placeholder: std::ptr::from_ref::<[u8]>(placeholder), - } - } -} - -/// A `url()` dependency. -pub struct UrlDependency { - /// The placeholder that the URL was replaced with. - // Lifetime: arena-allocated by `css_modules::hash`. - pub(crate) placeholder: *const [u8], -} - -impl UrlDependency { - pub(crate) fn new<'bump>( - bump: &'bump bun_alloc::Arena, - url: &crate::values::url::Url, - filename: &[u8], - import_records: &[bun_ast::ImportRecord], - ) -> UrlDependency { - let theurl: &[u8] = import_records[url.import_record_idx as usize].path.pretty; - let placeholder = crate::css_modules::hash( - bump, - format_args!("{}_{}", bstr::BStr::new(filename), bstr::BStr::new(theurl)), - false, - ); - UrlDependency { - placeholder: std::ptr::from_ref::<[u8]>(placeholder), - } - } -} diff --git a/src/css/error.rs b/src/css/error.rs index bcefd472d809..f271842433ef 100644 --- a/src/css/error.rs +++ b/src/css/error.rs @@ -204,19 +204,12 @@ impl fmt::Display for ErrorLocation { /// A printer error type. #[allow(non_camel_case_types)] pub enum PrinterErrorKind { - /// An ambiguous relative `url()` was encountered in a custom property declaration. - ambiguous_url_in_custom_property { - /// The ambiguous URL. - url: Str, - }, /// A [std::fmt::Error](std::fmt::Error) was encountered in the underlying destination. fmt_error, /// The CSS modules `composes` property cannot be used within nested rules. invalid_composes_nesting, /// The CSS modules `composes` property cannot be used with a simple class selector. invalid_composes_selector, - /// The CSS modules pattern must end with `[local]` for use in CSS grid. - invalid_css_modules_pattern_in_grid, /// Substituting parent selectors for `&` while compiling CSS nesting for /// the configured targets exceeded the expansion limit. maximum_nesting_expansion, @@ -231,11 +224,6 @@ pub enum PrinterErrorKind { impl fmt::Display for PrinterErrorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Self::ambiguous_url_in_custom_property { url } => write!( - f, - "Ambiguous relative URL '{}' in custom property declaration", - bs(*url) - ), Self::fmt_error => f.write_str("Formatting error occurred"), Self::invalid_composes_nesting => { f.write_str("The 'composes' property cannot be used within nested rules") @@ -243,9 +231,6 @@ impl fmt::Display for PrinterErrorKind { Self::invalid_composes_selector => { f.write_str("The 'composes' property can only be used with a simple class selector") } - Self::invalid_css_modules_pattern_in_grid => { - f.write_str("CSS modules pattern must end with '[local]' when used in CSS grid") - } Self::maximum_nesting_expansion => f.write_str( "Maximum nesting expansion exceeded when compiling CSS nesting for the configured targets", ), diff --git a/src/css/lib.rs b/src/css/lib.rs index 771ffc9a3999..259ee6812c7a 100644 --- a/src/css/lib.rs +++ b/src/css/lib.rs @@ -179,15 +179,13 @@ impl core::error::Error for PrintErr {} /// signal (the *kind* lives in `Printer.error_kind`). pub(crate) type PrintResult = core::result::Result; -pub use dependencies::Dependency; - // Re-export the hub types at the crate root so `bun_css::Foo` paths resolve // for css_jsc / bundler. pub use css_parser::{ DefaultAtRule, LocalsResultsMap, MinifyOptions, Parser, ParserFlags, ParserInput, ParserOptions, StyleAttribute, StyleSheet, StylesheetExtra, ToCssResult, }; -pub use printer::{ImportInfo, Printer, PrinterOptions, PseudoClasses}; +pub use printer::{ImportInfo, Printer, PrinterOptions}; /// Dependent crates name this `ImportRecordHandler`; the surviving type is /// `printer::ImportInfo`, exposed under both names. pub type ImportRecordHandler<'a> = printer::ImportInfo<'a>; diff --git a/src/css/printer.rs b/src/css/printer.rs index e8de3e9ece39..0f2f9f2fb221 100644 --- a/src/css/printer.rs +++ b/src/css/printer.rs @@ -21,17 +21,6 @@ pub struct PrinterOptions<'a> { pub project_root: Option<&'a [u8]>, /// Targets to output the CSS for. pub targets: Targets, - /// Whether to analyze dependencies (i.e. `@import` and `url()`). - /// If true, the dependencies are returned as part of the - /// [ToCssResult](super::stylesheet::ToCssResult). - /// - /// When enabled, `@import` and `url()` dependencies - /// are replaced with hashed placeholders that can be replaced with the final - /// urls later (after bundling). - pub analyze_dependencies: Option, - /// A mapping of pseudo classes to replace with class names that can be applied - /// from JavaScript. Useful for polyfills, for example. - pub pseudo_classes: Option>, } impl<'a> PrinterOptions<'a> { @@ -47,8 +36,6 @@ impl<'a> PrinterOptions<'a> { browsers: None, ..Targets::default() }, - analyze_dependencies: None, - pseudo_classes: None, } } } @@ -59,23 +46,6 @@ impl<'a> Default for PrinterOptions<'a> { } } -/// A mapping of user action pseudo classes to replace with class names. -/// -/// See [PrinterOptions](PrinterOptions). -#[derive(Default, Clone, Copy)] -pub struct PseudoClasses<'a> { - /// The class name to replace `:hover` with. - pub(crate) hover: Option<&'a [u8]>, - /// The class name to replace `:active` with. - pub(crate) active: Option<&'a [u8]>, - /// The class name to replace `:focus` with. - pub(crate) focus: Option<&'a [u8]>, - /// The class name to replace `:focus-visible` with. - pub(crate) focus_visible: Option<&'a [u8]>, - /// The class name to replace `:focus-within` with. - pub(crate) focus_within: Option<&'a [u8]>, -} - pub use css::targets::Targets; pub use css::targets::Features; @@ -130,11 +100,6 @@ pub struct Printer<'a> { pub(crate) skip_prefixed_nested_rules: bool, pub(crate) in_calc: bool, pub(crate) css_module: Option>, - pub(crate) dependencies: Option>, - pub(crate) remove_imports: bool, - /// A mapping of pseudo classes to replace with class names that can be applied - /// from JavaScript. Useful for polyfills, for example. - pub(crate) pseudo_classes: Option>, // INVARIANT: `with_context()` points this at a stack-local `StyleContext` (via an // unsafe variance cast — see the SAFETY note there) and always restores the parent // before that frame returns; never stash `ctx` beyond the `with_context` call. @@ -261,7 +226,7 @@ impl<'a> Printer<'a> { Err(PrintErr::CSSPrintError) } - // deinit() dropped — scratchbuf/dependencies are arena-backed + // deinit() dropped — scratchbuf is arena-backed // BumpVec<'a, _>; freed in bulk by `arena.reset()`. No explicit Drop impl needed. /// If `import_records` is null, then the printer will error when it encounters code that relies on import records (urls()) @@ -279,17 +244,6 @@ impl<'a> Printer<'a> { dest, minify: options.minify, targets: options.targets, - dependencies: if options.analyze_dependencies.is_some() { - Some(BumpVec::new_in(arena)) - } else { - None - }, - remove_imports: options - .analyze_dependencies - .as_ref() - .map(|d| d.remove_imports) - .unwrap_or(false), - pseudo_classes: options.pseudo_classes, import_info, scratchbuf, arena, @@ -314,14 +268,6 @@ impl<'a> Printer<'a> { } } - #[inline] - pub(crate) fn get_import_records(&mut self) -> PrintResult<&'a [ImportRecord]> { - if let Some(info) = &self.import_info { - return Ok(info.import_records); - } - Err(self.add_no_import_record_error()) - } - #[inline] pub(crate) fn import_record(&mut self, import_record_idx: u32) -> PrintResult<&ImportRecord> { if let Some(info) = &self.import_info { diff --git a/src/css/properties/custom.rs b/src/css/properties/custom.rs index ddc8252a7c2c..2aea70ff2e56 100644 --- a/src/css/properties/custom.rs +++ b/src/css/properties/custom.rs @@ -61,36 +61,6 @@ mod ext { /// Inline of `Url::to_css`. pub(super) fn url_to_css(this: &Url, dest: &mut Printer) -> PrintResult<()> { - let dep: Option = if dest.dependencies.is_some() { - // `get_import_records` borrows &mut *dest, so capture - // arena/filename first. - let arena = dest.arena; - // SAFETY: filename borrows the printer arena/options which outlive `dest`. - let filename: &[u8] = unsafe { &*std::ptr::from_ref::<[u8]>(dest.filename()) }; - let records = dest.get_import_records()?; - Some(dependencies::UrlDependency::new( - arena, this, filename, records, - )) - } else { - None - }; - - // If adding dependencies, always write url() with quotes so that the placeholder can - // be replaced without escaping more easily. Quotes may be removed later during minification. - if let Some(d) = dep { - dest.write_str("url(")?; - // SAFETY: placeholder borrows the printer arena. - let placeholder = unsafe { crate::arena_str(d.placeholder) }; - dest.serialize_string(placeholder)?; - dest.write_char(b')')?; - - if let Some(dependencies) = &mut dest.dependencies { - dependencies.push(crate::Dependency::Url(d)); - } - - return Ok(()); - } - let import_record = dest.import_record(this.import_record_idx)?; let is_internal = import_record.tag.is_internal(); // `get_import_record_url` reborrows &mut *dest, so capture @@ -316,20 +286,6 @@ impl TokenList { has_whitespace = false; } TokenOrValue::Url(url) => { - if dest.dependencies.is_some() - && is_custom_property - && !url.is_absolute(dest.get_import_records()?) - { - let pretty = std::ptr::from_ref::<[u8]>( - dest.get_import_records()?[url.import_record_idx as usize] - .path - .pretty, - ); - return dest.new_error( - css::PrinterErrorKind::ambiguous_url_in_custom_property { url: pretty }, - Some(url.loc), - ); - } ext::url_to_css(url, dest)?; has_whitespace = false; } diff --git a/src/css/rules/import.rs b/src/css/rules/import.rs index df95395a0989..7fe614a86a94 100644 --- a/src/css/rules/import.rs +++ b/src/css/rules/import.rs @@ -1,4 +1,3 @@ -use crate as css; use crate::css_rules::Location; use crate::css_rules::layer::LayerName; use crate::css_rules::supports::SupportsCondition; @@ -205,32 +204,11 @@ impl ImportRule { } pub fn to_css(&self, dest: &mut Printer) -> Result<(), PrintErr> { - let dep: Option = if dest.dependencies.is_some() { - Some(css::dependencies::ImportDependency::new( - dest.arena, - self, - dest.filename(), - )) - } else { - None - }; - // #[cfg(feature = "sourcemap")] // dest.add_mapping(self.loc); dest.write_str("@import ")?; - if let Some(d) = dep { - // SAFETY: `placeholder` is arena-allocated by `css_modules::hash` - // and outlives this print call. - let placeholder = unsafe { crate::arena_str(d.placeholder) }; - dest.serialize_string(placeholder)?; - - if let Some(deps) = &mut dest.dependencies { - deps.push(css::Dependency::Import(d)); - } - } else { - dest.serialize_string(self.url)?; - } + dest.serialize_string(self.url)?; if let Some(lyr) = &self.layer { dest.write_str(" layer")?; diff --git a/src/css/rules/mod.rs b/src/css/rules/mod.rs index 78ac8c937465..8d2eae64170b 100644 --- a/src/css/rules/mod.rs +++ b/src/css/rules/mod.rs @@ -438,30 +438,6 @@ impl CssRuleList { continue; } - // Skip @import rules if collecting dependencies. - if let CssRule::Import(import_rule) = rule - && dest.remove_imports - { - let dep = if dest.dependencies.is_some() { - Some(css::dependencies::Dependency::Import( - css::dependencies::ImportDependency::new( - dest.arena, - import_rule, - dest.filename(), - ), - )) - } else { - None - }; - - if let Some(deps) = dest.dependencies.as_mut() { - if let Some(d) = dep { - deps.push(d); - } - continue; - } - } - if first { first = false; } else { diff --git a/src/css/selectors/selector.rs b/src/css/selectors/selector.rs index df3e053cde40..36ba0ce73aa2 100644 --- a/src/css/selectors/selector.rs +++ b/src/css/selectors/selector.rs @@ -1019,29 +1019,13 @@ pub(crate) mod serialize { d.write_str(val) } - macro_rules! pseudo { - ($d:expr, $field:ident, $s:literal) => {{ - let class = if let Some(pseudo_classes) = &$d.pseudo_classes { - pseudo_classes.$field - } else { - None - }; - if let Some(class) = class { - $d.write_char(b'.')?; - $d.serialize_identifier(class)?; - } else { - $d.write_str($s)?; - } - }}; - } - match pseudo_class { // https://drafts.csswg.org/selectors-4/#useraction-pseudos - PseudoClass::Hover => pseudo!(dest, hover, b":hover"), - PseudoClass::Active => pseudo!(dest, active, b":active"), - PseudoClass::Focus => pseudo!(dest, focus, b":focus"), - PseudoClass::FocusVisible => pseudo!(dest, focus_visible, b":focus-visible"), - PseudoClass::FocusWithin => pseudo!(dest, focus_within, b":focus-within"), + PseudoClass::Hover => dest.write_str(b":hover")?, + PseudoClass::Active => dest.write_str(b":active")?, + PseudoClass::Focus => dest.write_str(b":focus")?, + PseudoClass::FocusVisible => dest.write_str(b":focus-visible")?, + PseudoClass::FocusWithin => dest.write_str(b":focus-within")?, // https://drafts.csswg.org/selectors-4/#time-pseudos PseudoClass::Current => dest.write_str(b":current")?, diff --git a/src/css/values/image.rs b/src/css/values/image.rs index 91d7c8c9572f..ac8acf2ab6f2 100644 --- a/src/css/values/image.rs +++ b/src/css/values/image.rs @@ -1,6 +1,5 @@ use crate as css; use crate::css_parser::CssResult as Result; -use crate::dependencies::UrlDependency; use crate::generics::DeepClone as _; use crate::values::color::ColorFallbackKind; use crate::values::gradient::Gradient; @@ -427,35 +426,11 @@ impl ImageSetOption { let Image::Url(url) = &self.image else { unreachable!() }; - let dep_: Option = if dest.dependencies.is_some() { - // Hoist `get_import_records` (mut borrow) out of the - // arg list so `filename()` (shared borrow) can run; result is `&'a _`. - let import_records = dest.get_import_records()?; - Some(UrlDependency::new( - dest.arena, - url, - dest.filename(), - import_records, - )) - } else { - None - }; - - if let Some(dep) = dep_ { - // SAFETY: placeholder borrows the printer arena. - let placeholder = unsafe { crate::arena_str(dep.placeholder) }; - dest.serialize_string(placeholder)?; - if let Some(dependencies) = &mut dest.dependencies { - // Vec::push aborts on OOM by default. - dependencies.push(css::Dependency::Url(dep)); - } - } else { - let record_url = dest.get_import_record_url(url.import_record_idx)?; - // SAFETY: `record_url` borrows arena-backed `import_info` data - // valid for the printer's `'a`; detach so `dest` is reusable. - let record_url: &[u8] = unsafe { &*std::ptr::from_ref::<[u8]>(record_url) }; - dest.serialize_string(record_url)?; - } + let record_url = dest.get_import_record_url(url.import_record_idx)?; + // SAFETY: `record_url` borrows arena-backed `import_info` data + // valid for the printer's `'a`; detach so `dest` is reusable. + let record_url: &[u8] = unsafe { &*std::ptr::from_ref::<[u8]>(record_url) }; + dest.serialize_string(record_url)?; } else { self.image.to_css(dest)?; } diff --git a/src/css/values/url.rs b/src/css/values/url.rs index 8c228fa0af53..93dd7f64fa03 100644 --- a/src/css/values/url.rs +++ b/src/css/values/url.rs @@ -1,9 +1,6 @@ use crate::css_parser as css; use css::{CssResult, PrintErr, Printer}; -use bun_ast::ImportRecord; -use bun_core::strings; - /// A CSS [url()](https://www.w3.org/TR/css-values-4/#urls) value and its source location. pub struct Url { /// The url string. @@ -25,77 +22,7 @@ impl Url { }) } - /// Returns whether the URL is absolute, and not relative. - pub(crate) fn is_absolute(&self, import_records: &[ImportRecord]) -> bool { - let url: &[u8] = import_records[self.import_record_idx as usize].path.pretty; - - // Quick checks. If the url starts with '.', it is relative. - if strings::starts_with_char(url, b'.') { - return false; - } - - // If the url starts with '/' it is absolute. - if strings::starts_with_char(url, b'/') { - return true; - } - - // If the url starts with '#' we have a fragment URL. - // These are resolved relative to the document rather than the CSS file. - // https://drafts.csswg.org/css-values-4/#local-urls - if strings::starts_with_char(url, b'#') { - return true; - } - - // Otherwise, we might have a scheme. These must start with an ascii alpha character. - // https://url.spec.whatwg.org/#scheme-start-state - if url.is_empty() || !url[0].is_ascii_alphabetic() { - return false; - } - - // https://url.spec.whatwg.org/#scheme-state - for &c in url { - match c { - b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9' | b'+' | b'-' | b'.' => {} - b':' => return true, - _ => break, - } - } - - false - } - pub fn to_css(&self, dest: &mut Printer) -> Result<(), PrintErr> { - use crate::dependencies::UrlDependency; - let dep: Option = if dest.dependencies.is_some() { - // `get_import_records` (mut borrow) is hoisted out of the arg - // list so `filename()` (shared borrow) can run; result is `&'a _`. - let import_records = dest.get_import_records()?; - Some(UrlDependency::new( - dest.arena, - self, - dest.filename(), - import_records, - )) - } else { - None - }; - - // If adding dependencies, always write url() with quotes so that the placeholder can - // be replaced without escaping more easily. Quotes may be removed later during minification. - if let Some(d) = dep { - dest.write_str("url(")?; - // SAFETY: placeholder borrows the printer arena. - let placeholder = unsafe { crate::arena_str(d.placeholder) }; - dest.serialize_string(placeholder)?; - dest.write_char(b')')?; - - if let Some(dependencies) = &mut dest.dependencies { - dependencies.push(crate::Dependency::Url(d)); - } - - return Ok(()); - } - let import_record = dest.import_record(self.import_record_idx)?; let is_internal = import_record .flags diff --git a/src/glob/Cargo.toml b/src/glob/Cargo.toml index 450b9d2abd62..5649a1120316 100644 --- a/src/glob/Cargo.toml +++ b/src/glob/Cargo.toml @@ -13,11 +13,6 @@ 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_alloc.workspace = true bun_core.workspace = true bun_collections.workspace = true diff --git a/src/io/Cargo.toml b/src/io/Cargo.toml index 162e1fb7abfc..ef315b5137cb 100644 --- a/src/io/Cargo.toml +++ b/src/io/Cargo.toml @@ -11,12 +11,9 @@ workspace = true [dependencies] thiserror.workspace = true -bun_opaque.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 @@ -27,6 +24,5 @@ bun_collections.workspace = true bun_spawn_sys.workspace = true bun_sys.workspace = true bun_uws_sys.workspace = true -bun_paths.workspace = true bun_errno.workspace = true bun_threading.workspace = true diff --git a/src/js/builtins.d.ts b/src/js/builtins.d.ts index 40d69928146c..9c1d61b979ad 100644 --- a/src/js/builtins.d.ts +++ b/src/js/builtins.d.ts @@ -349,7 +349,6 @@ declare function $fatal(): TODO; declare function $filePath(): TODO; declare function $filter(): TODO; declare function $format(): TODO; -declare function $fulfillModuleSync(key: string): void; declare function $esmNamespaceForCjs(key: string): any | undefined; declare function $esmRegistryDelete(key: string): boolean; declare function $esmRegistryEvaluatedKeys(): string[]; diff --git a/src/js/builtins/BunBuiltinNames.h b/src/js/builtins/BunBuiltinNames.h index 1e25949df538..b5efcd5fd4d0 100644 --- a/src/js/builtins/BunBuiltinNames.h +++ b/src/js/builtins/BunBuiltinNames.h @@ -99,7 +99,6 @@ using namespace JSC; macro(filename) \ macro(flush) \ macro(format) \ - macro(fulfillModuleSync) \ macro(handleEvent) \ macro(headers) \ macro(highWaterMark) \ diff --git a/src/js/builtins/CommonJS.ts b/src/js/builtins/CommonJS.ts index 31d0360d17ba..28639d7a897f 100644 --- a/src/js/builtins/CommonJS.ts +++ b/src/js/builtins/CommonJS.ts @@ -184,138 +184,6 @@ export function loadEsmIntoCjs(resolvedSpecifier: string) { return $esmLoadSync(resolvedSpecifier); } -/* Legacy implementation removed: relied on the old JS-side JSModuleLoader - * (Loader.registry JSMap, $setStateToMax, parseModule, etc.) which no longer - * exists after the upstream module-loader rewrite. -function loadEsmIntoCjs__dead(resolvedSpecifier: string) { - var loader = Loader; - var queue = $createFIFO(); - let key = resolvedSpecifier; - const registry = loader.registry; - - while (key) { - // we need to explicitly check because state could be $ModuleFetch - // it will throw this error if we do not: - // $throwTypeError("Requested module is already fetched."); - let entry = registry.$get(key)!, - moduleRecordPromise, - state = 0, - // entry.fetch is a Promise - // SourceCode is not a string, it's a JSC::SourceCode object - fetch: Promise | undefined; - - if (entry) { - ({ state, fetch } = entry); - } - - if ( - !entry || - // if we need to fetch it - (state <= $ModuleFetch && - // either: - // - we've never fetched it - // - a fetch is in progress - (!$isPromise(fetch) || - ($peekPromiseStatus(fetch)) === 0)) - ) { - // force it to be no longer pending - $fulfillModuleSync(key); - - entry = registry.$get(key)!; - - // the state can transition here - // https://github.com/oven-sh/bun/issues/8965 - if (entry) { - ({ state = 0, fetch } = entry); - } - } - - if (state < $ModuleLink && $isPromise(fetch)) { - // This will probably never happen, but just in case - if (($peekPromiseStatus(fetch)) === 0) { - registry.$delete(resolvedSpecifier); - - throw new TypeError(`require() async module "${key}" is unsupported. use "await import()" instead.`); - } - - // this pulls it out of the promise without delaying by a tick - // the promise is already fulfilled by $fulfillModuleSync - const sourceCodeObject = $peekPromiseSettledValue(fetch); - moduleRecordPromise = loader.parseModule(key, sourceCodeObject); - } - let mod = entry?.module; - - if (moduleRecordPromise && $isPromise(moduleRecordPromise)) { - let reactionsOrResult = $peekPromiseSettledValue(moduleRecordPromise); - let state = $peekPromiseStatus(moduleRecordPromise); - // this branch should never happen, but just to be safe - if (state === 0 || (reactionsOrResult && $isPromise(reactionsOrResult))) { - registry.$delete(resolvedSpecifier); - - throw new TypeError(`require() async module "${key}" is unsupported. use "await import()" instead.`); - } else if (state === 2) { - if (!reactionsOrResult?.message) { - throw new TypeError( - `${ - reactionsOrResult + "" ? reactionsOrResult : "An error occurred" - } occurred while parsing module \"${key}\"`, - ); - } - - throw reactionsOrResult; - } - entry.module = mod = reactionsOrResult; - } else if (moduleRecordPromise && !mod) { - entry.module = mod = moduleRecordPromise as LoaderModule; - } - - // This is very similar to "requestInstantiate" in ModuleLoader.js in JavaScriptCore. - $setStateToMax(entry, $ModuleLink); - const dependenciesMap = mod.dependenciesMap; - const requestedModules = loader.requestedModules(mod); - const dependencies = $newArrayWithSize(requestedModules.length); - for (var i = 0, length = requestedModules.length; i < length; ++i) { - const depName = requestedModules[i]; - // optimization: if it starts with a slash then it's an absolute path - // we don't need to run the resolver a 2nd time - const depKey = depName[0] === "/" ? depName : loader.resolve(depName, key); - const depEntry = loader.ensureRegistered(depKey); - - if (depEntry.state < $ModuleLink) { - queue.push(depKey); - } - - $putByValDirect(dependencies, i, depEntry); - dependenciesMap.$set(depName, depEntry); - } - - entry.dependencies = dependencies; - // All dependencies resolved, set instantiate and satisfy field directly. - entry.instantiate = Promise.$resolve(entry); - entry.satisfy = Promise.$resolve(entry); - entry.isSatisfied = true; - - key = queue.shift(); - while (key && (registry.$get(key)?.state ?? $ModuleFetch) >= $ModuleLink) { - key = queue.shift(); - } - } - - var linkAndEvaluateResult = loader.linkAndEvaluateModule(resolvedSpecifier, undefined); - if (linkAndEvaluateResult && $isPromise(linkAndEvaluateResult)) { - registry.$delete(resolvedSpecifier); - - // if you use top-level await, or any dependencies use top-level await, then we throw here - // this means the module will still actually load eventually, but that's okay. - throw new TypeError( - `require() async module \"${resolvedSpecifier}\" is unsupported. use "await import()" instead.`, - ); - } - - return registry.$get(resolvedSpecifier); -} -*/ - $visibility = "Private"; export function requireESM(this, resolved: string) { var exports = $esmNamespaceForCjs(resolved); diff --git a/src/js/builtins/JSBufferPrototype.ts b/src/js/builtins/JSBufferPrototype.ts index 81bb7507ef87..6f9fbe54ace0 100644 --- a/src/js/builtins/JSBufferPrototype.ts +++ b/src/js/builtins/JSBufferPrototype.ts @@ -8,14 +8,6 @@ interface BufferExt extends Buffer { toString(offset: number, length: number, encoding?: BufferEncoding): string; } -export function setBigUint64(this: BufferExt, offset, value, le) { - return (this.$dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength)).setBigUint64( - offset, - value, - le, - ); -} - export function readInt8(this: BufferExt, offset) { if (offset === undefined) offset = 0; if (typeof offset !== "number" || this[offset] === undefined) $checkBufferRead(this, offset, 1); diff --git a/src/js/internal/http.ts b/src/js/internal/http.ts index 394f2a08a924..cbc3d3bc3b67 100644 --- a/src/js/internal/http.ts +++ b/src/js/internal/http.ts @@ -42,57 +42,27 @@ const { setServerIdleTimeout: (server: any, timeout: number) => void; }; -const getRawKeys = $newCppFunction("JSFetchHeaders.cpp", "jsFetchHeaders_getRawKeys", 0); - const kDeprecatedReplySymbol = Symbol("deprecatedReply"); -const kBodyChunks = Symbol("bodyChunks"); const kPath = Symbol("path"); -const kPort = Symbol("port"); -const kMethod = Symbol("method"); -const kHost = Symbol("host"); -const kProtocol = Symbol("protocol"); -const kAgent = Symbol("agent"); -const kFetchRequest = Symbol("fetchRequest"); -const kTls = Symbol("tls"); -const kUseDefaultPort = Symbol("useDefaultPort"); -const kRes = Symbol("res"); -const kUpgradeOrConnect = Symbol("upgradeOrConnect"); -const kParser = Symbol("parser"); -const kMaxHeadersCount = Symbol("maxHeadersCount"); -const kReusedSocket = Symbol("reusedSocket"); -const kTimeoutTimer = Symbol("timeoutTimer"); const kOptions = Symbol("options"); -const kSocketPath = Symbol("socketPath"); -const kSignal = Symbol("signal"); -const kMaxHeaderSize = Symbol("maxHeaderSize"); const abortedSymbol = Symbol("aborted"); -const kClearTimeout = Symbol("kClearTimeout"); const headerStateSymbol = Symbol("headerState"); -// used for pretending to emit events in the right order -const kEmitState = Symbol("emitState"); -const bodyStreamSymbol = Symbol("bodyStream"); const controllerSymbol = Symbol("controller"); const runSymbol = Symbol("run"); const deferredSymbol = Symbol("deferred"); const eofInProgress = Symbol("eofInProgress"); const fakeSocketSymbol = Symbol("fakeSocket"); const firstWriteSymbol = Symbol("firstWrite"); -const headersSymbol = Symbol("headers"); const isTlsSymbol = Symbol("is_tls"); const kHandle = Symbol("handle"); const kRealListen = Symbol("kRealListen"); const noBodySymbol = Symbol("noBody"); const optionsSymbol = Symbol("options"); -const reqSymbol = Symbol("req"); -const timeoutTimerSymbol = Symbol("timeoutTimer"); const tlsSymbol = Symbol("tls"); const typeSymbol = Symbol("type"); -const webRequestOrResponse = Symbol("FetchAPI"); -const statusCodeSymbol = Symbol("statusCode"); const kAbortController = Symbol.for("kAbortController"); -const statusMessageSymbol = Symbol("statusMessage"); const kInternalSocketData = Symbol.for("::bunternal::"); const serverSymbol = Symbol.for("::bunternal::"); const kPendingCallbacks = Symbol("pendingCallbacks"); @@ -101,13 +71,6 @@ const kCloseCallback = Symbol("closeCallback"); const kEmptyObject = Object.freeze(Object.create(null)); -export const enum ClientRequestEmitState { - socket = 1, - prefinish = 2, - finish = 3, - response = 4, -} - export const enum NodeHTTPResponseAbortEvent { none = 0, abort = 1, @@ -185,15 +148,6 @@ function emitCloseNT(self) { self.emit("close"); } } -function emitCloseNTAndComplete(self) { - if (!self._closed) { - self._closed = true; - callCloseCallback(self); - self.emit("close"); - } - - self.complete = true; -} function emitEOFIncomingMessageOuter(self) { self.complete = true; @@ -595,14 +549,12 @@ export { STATUS_CODES, abortedSymbol, assignHeadersFast, - bodyStreamSymbol, callCloseCallback, checkShouldUseProxy, controllerSymbol, deferredSymbol, drainMicrotasks, emitCloseNT, - emitCloseNTAndComplete, emitEOFIncomingMessage, emitErrorNextTickIfErrorListenerNT, eofInProgress, @@ -613,54 +565,31 @@ export { getHeader, getIsNextIncomingMessageHTTPS, getMaxHTTPHeaderSize, - getRawKeys, hasServerResponseFinished, headerStateSymbol, - headersSymbol, headersTuple, isAbortError, isTlsSymbol, kAbortController, - kAgent, - kBodyChunks, - kClearTimeout, kCloseCallback, kDeprecatedReplySymbol, - kEmitState, kEmptyObject, - kFetchRequest, kHandle, - kHost, kInternalSocketData, - kMaxHeaderSize, - kMaxHeadersCount, - kMethod, kNeedDrain, kOptions, kOutHeaders, - kParser, kPath, kPendingCallbacks, - kPort, - kProtocol, kProxyConfig, kRealListen, kRequest, - kRes, - kReusedSocket, - kSignal, - kSocketPath, - kTimeoutTimer, - kTls, - kUpgradeOrConnect, - kUseDefaultPort, kWaitForProxyTunnel, noBodySymbol, onDataIncomingMessage, optionsSymbol, parseProxyConfigFromEnv, parseProxyUrl, - reqSymbol, runSymbol, serverSymbol, setHeader, @@ -670,13 +599,9 @@ export { setServerAppFlags, setServerCustomOptions, setServerIdleTimeout, - statusCodeSymbol, - statusMessageSymbol, - timeoutTimerSymbol, tlsSymbol, typeSymbol, utcDate, validateMsecs, - webRequestOrResponse, webRequestOrResponseHasBodyValue, }; diff --git a/src/jsc/DOMFormData.rs b/src/jsc/DOMFormData.rs index bdfc2e7d1d79..d23bf9157564 100644 --- a/src/jsc/DOMFormData.rs +++ b/src/jsc/DOMFormData.rs @@ -23,8 +23,7 @@ unsafe extern "C" { // safe: `DOMFormData`/`JSGlobalObject` are opaque `UnsafeCell`-backed ZST // handles; `&ZigString` is ABI-identical to non-null `*const ZigString` and // C++ only reads the named struct via `toStringCopy`. `arg3` is an opaque - // `*Blob` C++ owns (never dereferenced as Rust data) — same round-trip - // contract as `Zig__GlobalObject__resetModuleRegistryMap`'s `map` param. + // `*Blob` C++ owns (never dereferenced as Rust data). safe fn WebCore__DOMFormData__appendBlob( arg0: &mut DOMFormData, arg1: &JSGlobalObject, diff --git a/src/jsc/FetchHeaders.rs b/src/jsc/FetchHeaders.rs index 5f019f49bd6e..577714799d37 100644 --- a/src/jsc/FetchHeaders.rs +++ b/src/jsc/FetchHeaders.rs @@ -35,8 +35,7 @@ unsafe extern "C" { safe fn WebCore__FetchHeaders__count(arg0: &FetchHeaders, arg1: &mut u32, arg2: &mut u32); safe fn WebCore__FetchHeaders__createEmpty() -> *mut FetchHeaders; // safe: `arg0`/`arg1` are opaque handles to C++-owned request structs - // (PicoHeaders / uWS HttpRequest); never dereferenced as Rust data — same - // round-trip contract as `Zig__GlobalObject__resetModuleRegistryMap`. + // (PicoHeaders / uWS HttpRequest); never dereferenced as Rust data. safe fn WebCore__FetchHeaders__createFromPicoHeaders_(arg0: *const c_void) -> *mut FetchHeaders; safe fn WebCore__FetchHeaders__createFromUWS(arg1: *mut c_void) -> *mut FetchHeaders; diff --git a/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp b/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp index c8c5b87b71e1..5936f80d61d5 100644 --- a/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp +++ b/src/jsc/bindings/BakeAdditionsToGlobalObject.cpp @@ -69,12 +69,6 @@ extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getEnsureAsyncLocalStorageInstance return JSValue::encode(zig->bakeAdditions().ensureAsyncLocalStorageInstanceJSFunction(globalObject)); } -extern "C" SYSV_ABI JSC::EncodedJSValue Bake__getSSRResponseConstructor(JSC::JSGlobalObject* globalObject) -{ - auto* zig = static_cast(globalObject); - return JSValue::encode(zig->bakeAdditions().JSBakeResponseConstructor(globalObject)); -} - BUN_DEFINE_HOST_FUNCTION(jsFunctionBakeGetAsyncLocalStorage, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callframe)) { auto* zig = static_cast(globalObject); diff --git a/src/jsc/bindings/Cookie.cpp b/src/jsc/bindings/Cookie.cpp index 379aea375f18..86dcc3fd82e9 100644 --- a/src/jsc/bindings/Cookie.cpp +++ b/src/jsc/bindings/Cookie.cpp @@ -10,11 +10,6 @@ #include "HTTPParsers.h" namespace WebCore { -extern "C" WebCore::Cookie* Cookie__fromJS(JSC::EncodedJSValue value) -{ - return WebCoreCast(value); -} - Cookie::~Cookie() = default; Cookie::Cookie(const String& name, const String& value, diff --git a/src/jsc/bindings/JSBundlerPlugin.cpp b/src/jsc/bindings/JSBundlerPlugin.cpp index 8c87b28467d3..f664896d01ce 100644 --- a/src/jsc/bindings/JSBundlerPlugin.cpp +++ b/src/jsc/bindings/JSBundlerPlugin.cpp @@ -51,7 +51,6 @@ extern "C" void OnBeforeParseResult__reset(OnBeforeParseResult* result); extern "C" void JSBundlerPlugin__addError(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue); extern "C" void JSBundlerPlugin__onLoadAsync(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue); extern "C" void JSBundlerPlugin__onResolveAsync(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::EncodedJSValue); -extern "C" void JSBundlerPlugin__onVirtualModulePlugin(void*, void*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::EncodedJSValue); extern "C" JSC::EncodedJSValue JSBundlerPlugin__onDefer(void*, JSC::JSGlobalObject*); JSC_DECLARE_HOST_FUNCTION(jsBundlerPluginFunction_addFilter); diff --git a/src/jsc/bindings/NodeFSStatFSBinding.cpp b/src/jsc/bindings/NodeFSStatFSBinding.cpp index 28e867c06a0e..f40672c7e183 100644 --- a/src/jsc/bindings/NodeFSStatFSBinding.cpp +++ b/src/jsc/bindings/NodeFSStatFSBinding.cpp @@ -430,16 +430,6 @@ JSC_DEFINE_HOST_FUNCTION(callBigIntStatFS, (JSC::JSGlobalObject * lexicalGlobalO return JSValue::encode(callJSStatFSFunction(lexicalGlobalObject, callFrame)); } -extern "C" JSC::EncodedJSValue Bun__JSBigIntStatFSObjectConstructor(Zig::GlobalObject* globalobject) -{ - return JSValue::encode(globalobject->m_JSStatFSBigIntClassStructure.constructor(globalobject)); -} - -extern "C" JSC::EncodedJSValue Bun__JSStatFSObjectConstructor(Zig::GlobalObject* globalobject) -{ - return JSValue::encode(globalobject->m_JSStatFSClassStructure.constructor(globalobject)); -} - void JSStatFSPrototype::finishCreation(VM& vm) { Base::finishCreation(vm); diff --git a/src/jsc/bindings/RegularExpression.cpp b/src/jsc/bindings/RegularExpression.cpp index 1a4b03568917..8100d61a7855 100644 --- a/src/jsc/bindings/RegularExpression.cpp +++ b/src/jsc/bindings/RegularExpression.cpp @@ -23,14 +23,6 @@ extern "C" bool Yarr__RegularExpression__isValid(RegularExpression* re) { return re->isValid(); } -extern "C" int Yarr__RegularExpression__matchedLength(RegularExpression* re) -{ - return re->matchedLength(); -} -extern "C" int Yarr__RegularExpression__searchRev(RegularExpression* re, BunString string) -{ - return re->searchRev(string.toWTFString(BunString::ZeroCopy)); -} // extern "C" int Yarr__RegularExpression__match(RegularExpression* re, BunString string, int32_t start, int32_t* matchLength) // { // return re->match(string.toWTFString(BunString::ZeroCopy), start, matchLength); diff --git a/src/jsc/bindings/SQLClient.cpp b/src/jsc/bindings/SQLClient.cpp index bf32a796274c..18c90a59ed94 100644 --- a/src/jsc/bindings/SQLClient.cpp +++ b/src/jsc/bindings/SQLClient.cpp @@ -487,21 +487,6 @@ extern "C" EncodedJSValue JSC__createStructure(JSC::JSGlobalObject* globalObject return JSValue::encode(structure); } -extern "C" EncodedJSValue JSC__createEmptyObjectWithStructure(JSC::JSGlobalObject* globalObject, JSC::Structure* structure) -{ - auto& vm = JSC::getVM(globalObject); - auto* object = JSC::constructEmptyObject(vm, structure); - - ensureStillAliveHere(object); - vm.writeBarrier(object); - - return JSValue::encode(object); -} - -extern "C" void JSC__putDirectOffset(JSC::VM* vm, JSC::EncodedJSValue object, uint32_t offset, JSC::EncodedJSValue value) -{ - JSValue::decode(object).getObject()->putDirectOffset(*vm, offset, JSValue::decode(value)); -} extern "C" uint32_t JSC__JSObject__maxInlineCapacity = JSC::JSFinalObject::maxInlineCapacity; // PostgreSQL time formatting helpers - following WebKit's pattern diff --git a/src/jsc/bindings/ScriptExecutionContext.cpp b/src/jsc/bindings/ScriptExecutionContext.cpp index 60f4ca58b9ef..d98ce91aee5d 100644 --- a/src/jsc/bindings/ScriptExecutionContext.cpp +++ b/src/jsc/bindings/ScriptExecutionContext.cpp @@ -8,7 +8,6 @@ #include "BunClientData.h" #include "EventLoopTask.h" #include -extern "C" void Bun__startLoop(us_loop_t* loop); namespace WebCore { static constexpr ScriptExecutionContextIdentifier INITIAL_IDENTIFIER_INTERNAL = 1; @@ -290,11 +289,6 @@ void ScriptExecutionContext::postTask(EventLoopTask* task) } // Native bindings -extern "C" ScriptExecutionContextIdentifier ScriptExecutionContextIdentifier__forGlobalObject(JSC::JSGlobalObject* globalObject) -{ - return defaultGlobalObject(globalObject)->scriptExecutionContext()->identifier(); -} - extern "C" JSC::JSGlobalObject* ScriptExecutionContextIdentifier__getGlobalObject(ScriptExecutionContextIdentifier id) { auto* context = ScriptExecutionContext::getScriptExecutionContext(id); diff --git a/src/jsc/bindings/StringBuilderBinding.cpp b/src/jsc/bindings/StringBuilderBinding.cpp index 4e397570bdb1..58f63f76d8f7 100644 --- a/src/jsc/bindings/StringBuilderBinding.cpp +++ b/src/jsc/bindings/StringBuilderBinding.cpp @@ -20,11 +20,6 @@ extern "C" void StringBuilder__appendLatin1(WTF::StringBuilder* builder, Latin1C builder->append({ ptr, len }); } -extern "C" void StringBuilder__appendUtf16(WTF::StringBuilder* builder, UChar const* ptr, size_t len) -{ - builder->append({ ptr, len }); -} - extern "C" void StringBuilder__appendDouble(WTF::StringBuilder* builder, double num) { builder->append(num); @@ -55,12 +50,6 @@ extern "C" void StringBuilder__appendUChar(WTF::StringBuilder* builder, UChar c) builder->append(c); } -extern "C" void StringBuilder__appendQuotedJsonString(WTF::StringBuilder* builder, BunString str) -{ - auto string = str.toWTFString(BunString::ZeroCopy); - builder->appendQuotedJSONString(string); -} - extern "C" JSC::EncodedJSValue StringBuilder__toString(WTF::StringBuilder* builder, JSC::JSGlobalObject* globalObject) { auto& vm = globalObject->vm(); diff --git a/src/jsc/bindings/ZigGlobalObject.cpp b/src/jsc/bindings/ZigGlobalObject.cpp index 091f2ced6304..3e5f81ef1bc2 100644 --- a/src/jsc/bindings/ZigGlobalObject.cpp +++ b/src/jsc/bindings/ZigGlobalObject.cpp @@ -269,11 +269,6 @@ static consteval unsigned getWebKitBytecodeCacheVersion() } #undef WEBKIT_BYTECODE_CACHE_HASH_KEY -extern "C" unsigned getJSCBytecodeCacheVersion() -{ - return getWebKitBytecodeCacheVersion(); -} - // Declare fuzzilli function registration from FuzzilliREPRL.cpp #ifdef FUZZILLI_ENABLED extern "C" void Bun__REPRL__registerFuzzilliFunctions(Zig::GlobalObject*); @@ -683,48 +678,6 @@ extern "C" JSC::JSGlobalObject* Zig__GlobalObject__createForTestIsolation(Zig::G return globalObject; } -JSC_DEFINE_HOST_FUNCTION(functionFulfillModuleSync, - (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - Zig::GlobalObject* globalObject = uncheckedDowncast(lexicalGlobalObject); - - auto& vm = JSC::getVM(globalObject); - auto scope = DECLARE_THROW_SCOPE(vm); - JSC::JSValue keyAny = callFrame->argument(0); - JSC::JSString* moduleKeyString = keyAny.toString(globalObject); - RETURN_IF_EXCEPTION(scope, {}); - // Not `auto` (GCOwnedDataScope): fetchESMSourceCodeSync can spin the event loop for an async macro, and IncrementalSweeper asserts no scope is live with entryScope null. - WTF::String moduleKey = moduleKeyString->value(globalObject); - RETURN_IF_EXCEPTION(scope, {}); - - if (moduleKey.endsWith(".node"_s)) { - throwException(globalObject, scope, createTypeError(globalObject, "To load Node-API modules, use require() or process.dlopen instead of importSync."_s)); - return {}; - } - - auto specifier = Bun::toString(moduleKey); - ErrorableResolvedSource res; - res.success = false; - // zero-initialize entire result union. zeroed BunString has BunStringTag::Dead, and zeroed - // EncodedJSValues are empty, which our code should be handling - memset(&res.result, 0, sizeof res.result); - - JSValue result = Bun::fetchESMSourceCodeSync( - globalObject, - moduleKeyString, - &res, - &specifier, - &specifier, - nullptr); - - if (scope.exception() || !result) { - RELEASE_AND_RETURN(scope, JSValue::encode(JSC::jsUndefined())); - } - - globalObject->moduleLoader()->provideFetch(globalObject, JSC::Identifier::fromString(vm, moduleKey), JSC::ScriptFetchParameters::Type::JavaScript, uncheckedDowncast(result)); - RELEASE_AND_RETURN(scope, JSValue::encode(JSC::jsUndefined())); -} - static bool isModuleEvaluated(JSC::AbstractModuleRecord* record) { if (!record) @@ -878,20 +831,6 @@ JSC_DEFINE_HOST_FUNCTION(functionEsmLoadSync, (JSC::JSGlobalObject * lexicalGlob return JSValue::encode(ns); } -extern "C" void* Zig__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject*) -{ - // The JSC module loader registry is no longer a JS Map; snapshot/restore - // is no longer supported. This symbol has no callers, so this is dead - // code kept for ABI compatibility. - return nullptr; -} - -extern "C" bool Zig__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject*, void*) -{ - // See Zig__GlobalObject__getModuleRegistryMap above. - return false; -} - #define WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ConstructorName) \ JSValue ConstructorName##ConstructorCallback(VM& vm, JSObject* lexicalGlobalObject) \ { \ @@ -3099,7 +3038,6 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm) GlobalPropertyInfo(builtinNames.pokePromiseAsHandledPrivateName(), JSFunction::create(vm, this, 1, String(), jsBunPokePromiseAsHandled, ImplementationVisibility::Public), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), GlobalPropertyInfo(builtinNames.webStreamClosedPromisePrivateName(), JSFunction::create(vm, this, 1, String(), jsWebStreamClosedPromise, ImplementationVisibility::Public), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), GlobalPropertyInfo(builtinNames.webStreamControllerErrorPrivateName(), JSFunction::create(vm, this, 2, String(), jsWebStreamControllerError, ImplementationVisibility::Public), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), - GlobalPropertyInfo(builtinNames.fulfillModuleSyncPrivateName(), JSFunction::create(vm, this, 1, String(), functionFulfillModuleSync, ImplementationVisibility::Public), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), GlobalPropertyInfo(builtinNames.esmNamespaceForCjsPrivateName(), JSFunction::create(vm, this, 1, String(), functionEsmNamespaceForCjs, ImplementationVisibility::Public), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), GlobalPropertyInfo(builtinNames.esmRegistryDeletePrivateName(), JSFunction::create(vm, this, 1, String(), functionEsmRegistryDelete, ImplementationVisibility::Public), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), GlobalPropertyInfo(builtinNames.esmRegistryEvaluatedKeysPrivateName(), JSFunction::create(vm, this, 0, String(), functionEsmRegistryEvaluatedKeys, ImplementationVisibility::Public), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), @@ -3373,13 +3311,6 @@ extern "C" bool JSGlobalObject__setTimeZone(JSC::JSGlobalObject* globalObject, c return false; } -extern "C" void JSGlobalObject__requestTermination(JSC::JSGlobalObject* globalObject) -{ - auto& vm = JSC::getVM(globalObject); - vm.ensureTerminationException(); - vm.setHasTerminationRequest(); -} - extern "C" void JSGlobalObject__clearTerminationException(JSC::JSGlobalObject* globalObject) { auto& vm = JSC::getVM(globalObject); diff --git a/src/jsc/bindings/ZigLazyStaticFunctions-inlines.h b/src/jsc/bindings/ZigLazyStaticFunctions-inlines.h deleted file mode 100644 index 19ff293f93aa..000000000000 --- a/src/jsc/bindings/ZigLazyStaticFunctions-inlines.h +++ /dev/null @@ -1,33 +0,0 @@ -// GENERATED FILE -#pragma once - -namespace Zig { - -/* -- BEGIN DOMCall DEFINITIONS -- */ - -static void DOMCall__FFI__ptr__put(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value) -{ - JSC::JSObject* thisObject = uncheckedDowncast(JSC::JSValue::decode(value)); - static const JSC::DOMJIT::Signature DOMJIT_ptr_signature( - FFI__ptr__fastpath, - thisObject->classInfo(), - JSC::DOMJIT::Effect::forPure(), - JSC::SpecHeapTop, - JSC::SpecUint8Array); - JSFunction* function = JSFunction::create( - globalObject->vm(), - globalObject, - 1, - String("ptr"_s), - FFI__ptr__slowpath, ImplementationVisibility::Public, NoIntrinsic, FFI__ptr__slowpath, - &DOMJIT_ptr_signature); - thisObject->putDirect( - globalObject->vm(), - Identifier::fromString(globalObject->vm(), "ptr"_s), - function, - 0); -} - -/* -- END DOMCall DEFINITIONS-- */ - -} // namespace Zig diff --git a/src/jsc/bindings/bindings.cpp b/src/jsc/bindings/bindings.cpp index d99045a75ad4..18b08e145ffd 100644 --- a/src/jsc/bindings/bindings.cpp +++ b/src/jsc/bindings/bindings.cpp @@ -5118,21 +5118,6 @@ JSC::EncodedJSValue JSC__JSValue__fastGet(JSC::EncodedJSValue JSValue0, JSC::JSG return JSC::JSValue::encode(Bun::getIfPropertyExistsPrototypePollutionMitigationUnsafe(vm, globalObject, object, property)); } -extern "C" JSC::EncodedJSValue JSC__JSValue__fastGetOwn(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObject* globalObject, unsigned char arg2) -{ - JSC::JSValue value = JSC::JSValue::decode(JSValue0); - ASSERT(value.isCell()); - PropertySlot slot = PropertySlot(value, PropertySlot::InternalMethodType::GetOwnProperty); - const Identifier name = builtinNameMap(globalObject->vm(), arg2); - auto* object = value.getObject(); - - if (object->getOwnPropertySlot(object, globalObject, name, slot)) { - return JSValue::encode(slot.getValue(globalObject, name)); - } - - return {}; -} - __attribute__((__always_inline__)) bool JSC__JSValue__toBoolean(JSC::EncodedJSValue JSValue0) { // We count masquerades as undefined as true. @@ -5531,11 +5516,6 @@ bool JSC__JSValue__isInstanceOf(JSC::EncodedJSValue JSValue0, JSC::JSGlobalObjec return result; } -extern "C" JSC::EncodedJSValue JSC__JSValue__createRopeString(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* globalObject) -{ - return JSValue::encode(JSC::jsString(globalObject, JSC::JSValue::decode(JSValue0).toString(globalObject), JSC::JSValue::decode(JSValue1).toString(globalObject))); -} - extern "C" size_t JSC__VM__blockBytesAllocated(JSC::VM* vm) { #if ENABLE(RESOURCE_USAGE) @@ -5544,14 +5524,6 @@ extern "C" size_t JSC__VM__blockBytesAllocated(JSC::VM* vm) return 0; #endif } -extern "C" size_t JSC__VM__externalMemorySize(JSC::VM* vm) -{ -#if ENABLE(RESOURCE_USAGE) - return vm->heap.externalMemorySize(); -#else - return 0; -#endif -} extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC::JSGlobalObject* arg0, JSC::EncodedJSValue JSValue1, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4) { @@ -5841,14 +5813,6 @@ extern "C" EncodedJSValue JSC__JSValue__dateInstanceFromNumber(JSC::JSGlobalObje return JSValue::encode(date); } -extern "C" EncodedJSValue JSC__JSValue__dateInstanceFromNullTerminatedString(JSC::JSGlobalObject* globalObject, const Latin1Character* nullTerminatedChars) -{ - double dateSeconds = WTF::parseDate(std::span(nullTerminatedChars, strlen(reinterpret_cast(nullTerminatedChars)))); - JSC::DateInstance* date = JSC::DateInstance::create(globalObject->vm(), globalObject->dateStructure(), dateSeconds); - - return JSValue::encode(date); -} - // Formats a Date's internal time value with JSC's date cache, as // `Date.prototype.toISOString` does (`Bun::toISOString` is copied from it). // Returns -1 when `dateValue` is not a Date or its time value is NaN. @@ -5866,40 +5830,6 @@ extern "C" int JSC__JSValue__toISOString(EncodedJSValue dateValue, JSC::JSGlobal return static_cast(Bun::toISOString(vm, thisDateObj->internalNumber(), buf)); } -extern "C" int JSC__JSValue__DateNowISOString(JSC::JSGlobalObject* globalObject, char* buf) -{ - char buffer[29]; - JSC::DateInstance* thisDateObj = JSC::DateInstance::create(globalObject->vm(), globalObject->dateStructure(), globalObject->jsDateNow()); - - if (!std::isfinite(thisDateObj->internalNumber())) - return -1; - - auto& vm = JSC::getVM(globalObject); - - const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(vm.dateCache); - if (!gregorianDateTime) - return -1; - - // If the year is outside the bounds of 0 and 9999 inclusive we want to use the extended year format (ES 15.9.1.15.1). - int ms = static_cast(fmod(thisDateObj->internalNumber(), msPerSecond)); - if (ms < 0) - ms += msPerSecond; - - int charactersWritten; - if (gregorianDateTime->year() > 9999 || gregorianDateTime->year() < 0) - charactersWritten = snprintf(buffer, sizeof(buffer), "%+07d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); - else - charactersWritten = snprintf(buffer, sizeof(buffer), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); - - memcpy(buf, buffer, charactersWritten); - - ASSERT(charactersWritten > 0 && static_cast(charactersWritten) < sizeof(buffer)); - if (static_cast(charactersWritten) >= sizeof(buffer)) - return -1; - - return charactersWritten; -} - #pragma mark - WebCore::DOMFormData CPP_DECL void WebCore__DOMFormData__append(WebCore::DOMFormData* arg0, ZigString* arg1, ZigString* arg2) @@ -5917,16 +5847,6 @@ CPP_DECL size_t WebCore__DOMFormData__count(WebCore::DOMFormData* arg0) return arg0->count(); } -extern "C" void DOMFormData__toQueryString( - DOMFormData* formData, - void* ctx, - void (*callback)(void* ctx, ZigString* encoded)) -{ - auto str = formData->toURLEncodedString(); - ZigString encoded = toZigString(str); - callback(ctx, &encoded); -} - CPP_DECL JSC::EncodedJSValue WebCore__DOMFormData__createFromURLQuery(JSC::JSGlobalObject* arg0, ZigString* arg1) { Zig::GlobalObject* globalObject = static_cast(arg0); @@ -6497,46 +6417,6 @@ extern "C" JSC::EncodedJSValue Bun__REPL__getCompletions( return JSC::JSValue::encode(completions); } -// Format a value for REPL output using util.inspect style -extern "C" JSC::EncodedJSValue Bun__REPL__formatValue( - JSC::JSGlobalObject* globalObject, - JSC::EncodedJSValue valueEncoded, - int32_t depth, - bool colors) -{ - auto& vm = JSC::getVM(globalObject); - auto scope = DECLARE_THROW_SCOPE(vm); - - // Get the util.inspect function from the global object - auto* bunGlobal = uncheckedDowncast(globalObject); - JSC::JSValue inspectFn = bunGlobal->utilInspectFunction(); - - if (!inspectFn || !inspectFn.isCallable()) { - // Fallback to toString if util.inspect is not available - JSC::JSValue value = JSC::JSValue::decode(valueEncoded); - JSString* str = value.toString(globalObject); - RETURN_IF_EXCEPTION(scope, JSC::JSValue::encode(JSC::jsUndefined())); - return JSC::JSValue::encode(str); - } - - // Create options object - JSC::JSObject* options = JSC::constructEmptyObject(globalObject); - options->putDirect(vm, JSC::Identifier::fromString(vm, "depth"_s), JSC::jsNumber(depth)); - options->putDirect(vm, JSC::Identifier::fromString(vm, "colors"_s), JSC::jsBoolean(colors)); - options->putDirect(vm, JSC::Identifier::fromString(vm, "maxArrayLength"_s), JSC::jsNumber(100)); - options->putDirect(vm, JSC::Identifier::fromString(vm, "maxStringLength"_s), JSC::jsNumber(10000)); - options->putDirect(vm, JSC::Identifier::fromString(vm, "breakLength"_s), JSC::jsNumber(80)); - - JSC::MarkedArgumentBuffer args; - args.append(JSC::JSValue::decode(valueEncoded)); - args.append(options); - - JSC::JSValue result = JSC::call(globalObject, inspectFn, JSC::ArgList(args), "util.inspect"_s); - RETURN_IF_EXCEPTION(scope, JSC::JSValue::encode(JSC::jsUndefined())); - - return JSC::JSValue::encode(result); -} - // Collects every ArrayBufferView in a JSArray and the (data, byteLength) span // of each. Two passes, mirroring Buffer.concat: the first reads every element // into a MarkedArgumentBuffer, so any user code an indexed read can run diff --git a/src/jsc/bindings/c-bindings.cpp b/src/jsc/bindings/c-bindings.cpp index f5270305621d..8ce56222e615 100644 --- a/src/jsc/bindings/c-bindings.cpp +++ b/src/jsc/bindings/c-bindings.cpp @@ -70,13 +70,6 @@ extern "C" bool is_executable_file(const char* path) } #endif -extern "C" void bun_ignore_sigpipe() -{ -#if !OS(WINDOWS) - // ignore SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif -} extern "C" ssize_t bun_sysconf__SC_CLK_TCK() { #ifdef __APPLE__ @@ -751,26 +744,6 @@ extern "C" [[ZIG_EXPORT(nothrow)]] size_t Bun__ramSize() return WTF::ramSize(); } -#if !OS(WINDOWS) - -extern "C" void Bun__disableSOLinger(int fd) -{ - struct linger l = { 1, 0 }; - setsockopt(fd, SOL_SOCKET, SO_LINGER, &l, sizeof(l)); -} - -#else - -#include - -extern "C" void Bun__disableSOLinger(SOCKET fd) -{ - struct linger l = { 1, 0 }; - setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&l, sizeof(l)); -} - -#endif - extern "C" int ffi_vprintf(const char* fmt, va_list ap) { int ret = vfprintf(stderr, fmt, ap); diff --git a/src/jsc/bindings/headers.h b/src/jsc/bindings/headers.h index 5c39535ec2fc..585145f881bc 100644 --- a/src/jsc/bindings/headers.h +++ b/src/jsc/bindings/headers.h @@ -167,7 +167,6 @@ CPP_DECL void JSC__JSFunction__optimizeSoon(JSC::EncodedJSValue JSValue0); CPP_DECL JSC::EncodedJSValue Bun__REPL__evaluate(JSC::JSGlobalObject* globalObject, const unsigned char* sourcePtr, size_t sourceLen, const unsigned char* filenamePtr, size_t filenameLen, JSC::EncodedJSValue* exception); CPP_DECL JSC::EncodedJSValue Bun__REPL__getCompletions(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue targetValue, const unsigned char* prefixPtr, size_t prefixLen); -CPP_DECL JSC::EncodedJSValue Bun__REPL__formatValue(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue valueEncoded, int32_t depth, bool colors); #pragma mark - JSC::JSGlobalObject @@ -209,7 +208,6 @@ CPP_DECL JSC::EncodedJSValue JSC__JSValue__createEmptyObject(JSC::JSGlobalObject CPP_DECL JSC::EncodedJSValue JSC__JSValue__createInternalPromise(JSC::JSGlobalObject* arg0); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createObject2(JSC::JSGlobalObject* arg0, const ZigString* arg1, const ZigString* arg2, JSC::EncodedJSValue JSValue3, JSC::EncodedJSValue JSValue4); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createRangeError(const ZigString* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); -CPP_DECL JSC::EncodedJSValue JSC__JSValue__createRopeString(JSC::EncodedJSValue JSValue0, JSC::EncodedJSValue JSValue1, JSC::JSGlobalObject* arg2); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createStringArray(JSC::JSGlobalObject* arg0, const ZigString* arg1, size_t arg2, bool arg3); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createTypeError(const ZigString* arg0, const ZigString* arg1, JSC::JSGlobalObject* arg2); CPP_DECL JSC::EncodedJSValue JSC__JSValue__createUninitializedUint8Array(JSC::JSGlobalObject* arg0, size_t arg1); @@ -302,7 +300,6 @@ CPP_DECL JSC::VM* JSC__VM__create(unsigned char HeapType0); CPP_DECL void JSC__VM__deleteAllCode(JSC::VM* arg0, JSC::JSGlobalObject* arg1); CPP_DECL void JSC__VM__drainMicrotasks(JSC::VM* arg0); CPP_DECL bool JSC__VM__executionForbidden(JSC::VM* arg0); -CPP_DECL size_t JSC__VM__externalMemorySize(JSC::VM* arg0); CPP_DECL size_t JSC__VM__heapSize(JSC::VM* arg0); CPP_DECL void JSC__VM__holdAPILock(JSC::VM* arg0, void* arg1, void(* ArgFn2)(void* arg0)); CPP_DECL bool JSC__VM__isEntered(JSC::VM* arg0); @@ -428,8 +425,6 @@ extern "C" JSC::EncodedJSValue SYSV_ABI Reader__intptr__slowpath(JSC::JSGlobalOb #pragma mark - Zig::GlobalObject CPP_DECL JSC::JSGlobalObject* Zig__GlobalObject__create(void* arg0, int32_t arg1, bool arg2, bool arg3, void* arg4); -CPP_DECL void* Zig__GlobalObject__getModuleRegistryMap(JSC::JSGlobalObject* arg0); -CPP_DECL bool Zig__GlobalObject__resetModuleRegistryMap(JSC::JSGlobalObject* arg0, void* arg1); #ifdef __cplusplus diff --git a/src/jsc/bindings/highway_json.cpp b/src/jsc/bindings/highway_json.cpp index d3fba90f25a1..5c549fd892f1 100644 --- a/src/jsc/bindings/highway_json.cpp +++ b/src/jsc/bindings/highway_json.cpp @@ -175,17 +175,5 @@ extern "C" size_t highway_json_index_chunk(const uint8_t* input, size_t len, siz return HWY_DYNAMIC_DISPATCH(JsonIndexImpl)( input, len, base_offset, out_indices, out_dirty, inout_state, out_flags); } - -// Whole-document form; appends the two `len` sentinels stage 2 relies on. -extern "C" size_t highway_json_index(const uint8_t* input, size_t len, uint32_t* out_indices, - uint64_t* out_dirty, uint32_t* out_flags) -{ - uint64_t state[3] = { 0, 0, 0 }; - size_t n = HWY_DYNAMIC_DISPATCH(JsonIndexImpl)( - input, len, 0, out_indices, out_dirty, state, out_flags); - out_indices[n] = (uint32_t)len; - out_indices[n + 1] = (uint32_t)len; - return n; -} } // namespace bun #endif diff --git a/src/jsc/bindings/objects.h b/src/jsc/bindings/objects.h deleted file mode 100644 index 246cc3fc5773..000000000000 --- a/src/jsc/bindings/objects.h +++ /dev/null @@ -1,254 +0,0 @@ -// #pragma once - -// #include "root.h" -// #include "headers.h" - -// #include -// -// #include - -// namespace Zig { - -// class ModulePrototype final : public JSC::JSNonFinalObject { -// public: -// using Base = JSC::JSNonFinalObject; -// DECLARE_EXPORT_INFO; -// static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::ImplementsHasInstance | JSC::ImplementsDefaultHasInstance; -// static constexpr JSC::DestructionMode needsDestruction = NeedsDestruction; - -// template -// static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) -// { -// STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(Headers, Base); -// return &vm.plainObjectSpace; -// } - -// static ModulePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) -// { -// ModulePrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) ModulePrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); -// return object; -// } - -// static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject&); -// static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject&); - -// static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) -// { -// return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); -// } - -// void* m_zigBase; - -// private: -// ModulePrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; -// }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*); - -// }; - -// class ModuleExportsMap final : public JSC::JSNonFinalObject { -// public: -// using Base = JSC::JSNonFinalObject; -// DECLARE_EXPORT_INFO; -// static constexpr unsigned StructureFlags = Base::StructureFlags; -// static constexpr JSC::DestructionMode needsDestruction = NeedsDestruction; - -// template -// static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) -// { -// STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(Headers, Base); -// return &vm.plainObjectSpace; -// } - -// static ModulePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) -// { -// ModulePrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) ModulePrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); -// return object; -// } - -// static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject&); -// static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject&); - -// static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) -// { -// return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); -// } - -// void* m_zigBase; - -// private: -// ModulePrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; -// }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*); - -// }; - -// } - -// namespace Zig { - -// class HeadersPrototype final : public JSC::JSNonFinalObject { -// public: -// using Base = JSC::JSNonFinalObject; -// DECLARE_EXPORT_INFO; -// static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::ImplementsHasInstance | JSC::ImplementsDefaultHasInstance; -// static constexpr JSC::DestructionMode needsDestruction = NeedsDestruction; - -// template -// static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) -// { -// STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(Headers, Base); -// return &vm.plainObjectSpace; -// } - -// static HeadersPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) -// { -// HeadersPrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) HeadersPrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); -// return object; -// } - -// static HeadersPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) -// { -// HeadersPrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) HeadersPrototype(vm, structure); -// object->finishCreation(vm, globalObject); -// return object; -// } - -// JSC::JSValue get(JSC::JSGlobalObject&, JSC::JSValue); -// bool put(JSC::JSGlobalObject&, JSC::JSValue, JSC::JSValue); -// bool has(JSC::JSGlobalObject&, JSC::JSValue); -// void remove(JSC::JSGlobalObject&, JSC::JSValue); -// void clear(JSC::JSGlobalObject&, JSC::JSValue); - -// static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject&); -// static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject&); - -// static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) -// { -// return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); -// } - -// void* m_zigBase; - -// private: -// HeadersPrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; -// }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*); - -// }; - -// JSC_DECLARE_HOST_FUNCTION(headersFuncPrototypeGet); -// JSC_DECLARE_HOST_FUNCTION(headersFuncPrototypePut); -// JSC_DECLARE_HOST_FUNCTION(headersFuncPrototypeHas); -// JSC_DECLARE_HOST_FUNCTION(headersFuncPrototypeRemove); -// JSC_DECLARE_HOST_FUNCTION(headersFuncPrototypeClear); - -// class HeadersConstructor final : public JSC::InternalFunction { -// public: -// typedef InternalFunction Base; - -// static HeadersConstructor* create(JSC::VM& vm, JSC::Structure* structure, HeadersPrototype* mapPrototype) -// { -// HeadersConstructor* constructor = new (NotNull, JSC::allocateCell(vm.heap)) HeadersConstructor(vm, structure); -// constructor->finishCreation(vm, mapPrototype); -// return constructor; -// } - -// DECLARE_EXPORT_INFO; - -// static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) -// { -// return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); -// } - -// private: -// HeadersConstructor(JSC::VM&, JSC::Structure*); - -// void finishCreation(JSC::VM&, HeadersPrototype*); -// }; - -// JSC_DECLARE_HOST_FUNCTION(headersFuncConstructor); - -// class RequestConstructor final : public JSC::InternalFunction { -// public: -// typedef InternalFunction Base; - -// static RequestConstructor* create(JSC::VM& vm, JSC::Structure* structure, RequestPrototype* mapPrototype) -// { -// RequestConstructor* constructor = new (NotNull, JSC::allocateCell(vm.heap)) RequestConstructor(vm, structure); -// constructor->finishCreation(vm, mapPrototype); -// return constructor; -// } - -// DECLARE_EXPORT_INFO; - -// static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) -// { -// return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::InternalFunctionType, StructureFlags), info()); -// } - -// private: -// RequestConstructor(JSC::VM&, JSC::Structure*); - -// void finishCreation(JSC::VM&, RequestPrototype*); -// }; - -// JSC_DECLARE_HOST_FUNCTION(requestFuncConstructor); - -// class RequestPrototype final : public JSC::JSNonFinalObject { -// public: -// using Base = JSC::JSNonFinalObject; -// DECLARE_EXPORT_INFO; -// static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::ImplementsHasInstance | JSC::ImplementsDefaultHasInstance; -// static constexpr JSC::DestructionMode needsDestruction = NeedsDestruction; - -// template -// static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) -// { -// STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(Headers, Base); -// return &vm.plainObjectSpace; -// } - -// static RequestPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure, void* zigBase) -// { -// RequestPrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) RequestPrototype(vm, structure); -// !!zigBase ? object->finishCreation(vm, globalObject, zigBase) : object->finishCreation(vm, globalObject); -// return object; -// } - -// static RequestPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) -// { -// RequestPrototype* object = new (NotNull, JSC::allocateCell(vm.heap)) RequestPrototype(vm, structure); -// object->finishCreation(vm, globalObject); -// return object; -// } - -// static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject&); -// static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject&); - -// static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) -// { -// return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); -// } - -// void* m_zigBase; - -// private: -// RequestPrototype(JSC::VM&, JSC::Structure*) : Base(vm, structure) { -// m_zigBase = nullptr; -// }; -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*, void* zigBase); -// void finishCreation(JSC::VM&, JSC::JSGlobalObject*); - -// }; - -// } diff --git a/src/jsc/bindings/webcore/JSFetchHeaders.cpp b/src/jsc/bindings/webcore/JSFetchHeaders.cpp index efbd551b2873..fccd6ad98557 100644 --- a/src/jsc/bindings/webcore/JSFetchHeaders.cpp +++ b/src/jsc/bindings/webcore/JSFetchHeaders.cpp @@ -583,36 +583,6 @@ JSC_DEFINE_HOST_FUNCTION(jsFetchHeadersPrototypeFunction_keys, (JSC::JSGlobalObj return IDLOperation::call(*lexicalGlobalObject, *callFrame, "keys"); } -JSC_DEFINE_HOST_FUNCTION(jsFetchHeaders_getRawKeys, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) -{ - VM& vm = lexicalGlobalObject->vm(); - auto scope = DECLARE_THROW_SCOPE(vm); - - auto* thisObject = castThisValue(*lexicalGlobalObject, callFrame->thisValue()); - - if (!thisObject) { - throwTypeError(lexicalGlobalObject, scope, "\"this\" must be an instance of Headers"_s); - return {}; - } - - FetchHeaders& headers = thisObject->wrapped(); - // HTTPHeaderMap's iterator covers only the common and uncommon segments; - // set-cookie values live in their own segment, so size() (which counts - // every cookie) used to leave trailing holes in the array. Size for one - // entry per unique name and append "set-cookie" explicitly. - JSArray* outArray = JSC::JSArray::create(vm, lexicalGlobalObject->arrayStructureForIndexingTypeDuringAllocation(JSC::ArrayWithContiguous), headers.sizeAfterJoiningSetCookieHeader()); - - unsigned int i = 0; - for (const auto& header : headers.internalHeaders()) { - outArray->putDirectIndex(lexicalGlobalObject, i++, jsString(vm, header.name())); - } - if (!headers.internalHeaders().getSetCookieHeaders().isEmpty()) { - outArray->putDirectIndex(lexicalGlobalObject, i++, jsString(vm, WTF::httpHeaderNameDefaultCaseStringImpl(HTTPHeaderName::SetCookie))); - } - - RELEASE_AND_RETURN(scope, JSValue::encode(outArray)); -} - static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunction_valuesCaller(JSGlobalObject*, CallFrame*, JSFetchHeaders* thisObject) { return JSValue::encode(iteratorCreate(*thisObject, IterationKind::Values)); diff --git a/src/jsc/bindings/webcore/JSFetchHeaders.h b/src/jsc/bindings/webcore/JSFetchHeaders.h index 33ba3640987b..2f81752cda2b 100644 --- a/src/jsc/bindings/webcore/JSFetchHeaders.h +++ b/src/jsc/bindings/webcore/JSFetchHeaders.h @@ -100,6 +100,4 @@ template<> struct JSDOMWrapperConverterTraits { JSC::EncodedJSValue fetchHeadersGetSetCookie(JSC::JSGlobalObject* lexicalGlobalObject, VM& vm, WebCore::FetchHeaders* impl); -JSC_DECLARE_HOST_FUNCTION(jsFetchHeaders_getRawKeys); - } // namespace WebCore diff --git a/src/paths/Cargo.toml b/src/paths/Cargo.toml index a24ff093693a..b48d0d2a738f 100644 --- a/src/paths/Cargo.toml +++ b/src/paths/Cargo.toml @@ -12,13 +12,8 @@ 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 -bytemuck = "1" bun_alloc.workspace = true bun_core.workspace = true bun_errno.workspace = true diff --git a/src/sys/lib.rs b/src/sys/lib.rs index d9b75097803f..6bc5dd08d8c1 100644 --- a/src/sys/lib.rs +++ b/src/sys/lib.rs @@ -907,7 +907,7 @@ use core::ffi::{c_char, c_void}; // ────────────────────────────────────────────────────────────────────────── // Re-exports from lower-tier crates (PORTING.md crate map). // ────────────────────────────────────────────────────────────────────────── -pub use bun_core::{Fd, FdKind, FdNative, FdOptional, FileKind, Mode, Stdio, kind_from_mode}; +pub use bun_core::{Fd, FdKind, FdNative, FileKind, Mode, Stdio, kind_from_mode}; /// Anything that can hand out an [`Fd`] without giving up ownership: a raw /// `Fd`, or a reference to an owning [`File`] / [`Dir`]. Mirrors diff --git a/test/internal/source-lints/dead-symbols-35437.test.ts b/test/internal/source-lints/dead-symbols-35437.test.ts new file mode 100644 index 000000000000..1ccbfa4317ac --- /dev/null +++ b/test/internal/source-lints/dead-symbols-35437.test.ts @@ -0,0 +1,68 @@ +// Guards against reintroduction of symbols removed in #35437. Each entry was +// verified to have zero callers across src/, vendor/, packages/, and +// build/debug/codegen/ before deletion; this test fails if any of them +// reappear (e.g. via a merge that resurrects a stale file, or a copy-paste +// from an old branch). +// +// 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"); +} + +test("dead extern C symbols removed in #35437 do not reappear", () => { + const checks: Array<[string, RegExp]> = [ + ["src/jsc/bindings/ZigGlobalObject.cpp", /\bfunctionFulfillModuleSync\b/], + ["src/jsc/bindings/ZigGlobalObject.cpp", /\bZig__GlobalObject__resetModuleRegistryMap\b/], + ["src/jsc/bindings/bindings.cpp", /\bBun__REPL__formatValue\b/], + ["src/jsc/bindings/bindings.cpp", /\bJSC__JSValue__DateNowISOString\b/], + ["src/jsc/bindings/bindings.cpp", /\bDOMFormData__toQueryString\b/], + ["src/jsc/bindings/c-bindings.cpp", /\bBun__disableSOLinger\b/], + ["src/jsc/bindings/SQLClient.cpp", /\bJSC__createEmptyObjectWithStructure\b/], + ["src/jsc/bindings/RegularExpression.cpp", /\bYarr__RegularExpression__searchRev\b/], + ["src/jsc/bindings/webcore/JSFetchHeaders.cpp", /\bjsFetchHeaders_getRawKeys\b/], + ]; + const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); + expect(resurrected).toEqual([]); +}); + +test("dead JS builtins removed in #35437 do not reappear", () => { + const checks: Array<[string, RegExp]> = [ + ["src/js/builtins/CommonJS.ts", /\bloadEsmIntoCjs__dead\b/], + ["src/js/builtins/JSBufferPrototype.ts", /export function setBigUint64\b/], + ["src/js/internal/http.ts", /\bemitCloseNTAndComplete\b/], + ["src/js/internal/http.ts", /\bClientRequestEmitState\b/], + ["src/js/internal/http.ts", /const kUpgradeOrConnect = Symbol/], + ["src/js/builtins/BunBuiltinNames.h", /macro\(fulfillModuleSync\)/], + ]; + const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); + expect(resurrected).toEqual([]); +}); + +test("dead CSS option chains removed in #35437 do not reappear", () => { + const checks: Array<[string, RegExp]> = [ + ["src/css/printer.rs", /pub analyze_dependencies:/], + ["src/css/printer.rs", /pub struct PseudoClasses\b/], + ["src/css/dependencies.rs", /pub struct ImportDependency\b/], + ["src/css/dependencies.rs", /pub struct UrlDependency\b/], + ["src/css/error.rs", /ambiguous_url_in_custom_property/], + ]; + const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); + expect(resurrected).toEqual([]); +}); + +test("dead Rust pub items removed in #35437 do not reappear", () => { + const checks: Array<[string, RegExp]> = [ + ["src/bun_core/util.rs", /pub struct FdOptional\b/], + ["src/bun_core/env_var.rs", /\bBUN_NEEDS_PROC_SELF_WORKAROUND\b/], + ]; + const resurrected = checks.filter(([file, re]) => re.test(src(file))).map(([file, re]) => `${file}: ${re.source}`); + expect(resurrected).toEqual([]); +}); From 2e5aa9a0208f538702512984eb822d88de979057 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 08:37:28 +0000 Subject: [PATCH 02/10] Update comments that named deleted ZigLazyStaticFunctions-inlines.h and the removed hive get() API --- src/install/NetworkTask.rs | 4 ++-- src/install/PackageManager/runTasks.rs | 2 +- src/jsc/host_fn.rs | 2 +- src/runtime/ffi/FFIObject.rs | 22 ++++++++++------------ src/runtime/ffi/mod.rs | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/install/NetworkTask.rs b/src/install/NetworkTask.rs index e51d69789fba..358669329a33 100644 --- a/src/install/NetworkTask.rs +++ b/src/install/NetworkTask.rs @@ -933,11 +933,11 @@ impl NetworkTask { /// Initialize a freshly-vended pool slot in place — a full struct overwrite /// that resets every other field to its struct default. The slot may be - /// uninitialized heap memory (from `HiveArrayFallback::get()`'s + /// uninitialized heap memory (from `HiveArrayFallback::claim()`'s /// `Box::new_uninit()` fallback) or stale (reused hive slot whose prior /// contents ARE now dropped on `put` since 1e76047), so each field is /// written via `addr_of_mut!().write()` without dropping the previous - /// value — the slot is freshly poisoned/uninit from `get()`. + /// value — the slot is freshly poisoned/uninit from `claim()`. /// /// Caller-initialized fields (`unsafe_http_client`, `callback`, /// `response_buffer`) are written here with drop-safe diff --git a/src/install/PackageManager/runTasks.rs b/src/install/PackageManager/runTasks.rs index b4fee5fbb9d9..aff62b755062 100644 --- a/src/install/PackageManager/runTasks.rs +++ b/src/install/PackageManager/runTasks.rs @@ -1818,7 +1818,7 @@ pub fn generate_network_task_for_tarball<'a>( // every other field (`retried`, `response`, `streaming_committed`, // `tarball_stream`, `streaming_extract_task`, `next`, `url_buf`, // `signal_store`) to its struct default. The slot may be uninitialized - // (`HiveArrayFallback::get()` heap fallback) or stale (reused hive slot). + // (`HiveArrayFallback::claim()` heap fallback) or stale (reused hive slot). // SAFETY: `net_ptr` is the unique handle to a freshly-vended pool slot; no // other alias exists until we return it. unsafe { NetworkTask::write_init(net_ptr, task_id, this_backref, apply_patch_task) }; diff --git a/src/jsc/host_fn.rs b/src/jsc/host_fn.rs index 886e6c9a26da..8f88a958ca16 100644 --- a/src/jsc/host_fn.rs +++ b/src/jsc/host_fn.rs @@ -776,7 +776,7 @@ pub fn new_function_with_data( pub struct DomCall { pub class_name: &'static str, pub function_name: &'static str, - /// `____put` — generated in `ZigLazyStaticFunctions-inlines.h`. + /// `____put` — defined in `ZigGeneratedCode.cpp`. pub put: unsafe extern "C" fn(*mut JSGlobalObject, JSValue), } diff --git a/src/runtime/ffi/FFIObject.rs b/src/runtime/ffi/FFIObject.rs index 0c48941d71e4..7ca052049894 100644 --- a/src/runtime/ffi/FFIObject.rs +++ b/src/runtime/ffi/FFIObject.rs @@ -59,7 +59,7 @@ fn create_buffer_with_ctx( } } -// ── DOM-call C++ put helpers (generated in ZigLazyStaticFunctions-inlines.h) ── +// ── DOM-call C++ put helpers (defined in ZigGeneratedCode.cpp) ── #[allow(non_snake_case)] unsafe extern "C" { fn FFI__ptr__put(global: *mut JSGlobalObject, value: JSValue); @@ -110,10 +110,9 @@ unsafe extern "C" { fn Bun__FFI__CStringConstructor(global: *const JSGlobalObject) -> JSValue; } -// DOMJIT fast-path descriptor + slow-path host fn, represented here as a const -// descriptor. The `DOMEffect.forRead(.TypedArrayProperties)` argument is consumed -// by the C++ codegen, not the runtime descriptor; it lives in the generated -// `ZigLazyStaticFunctions-inlines.h` already. +// DOMJIT slow-path host fn, represented here as a const descriptor. The DOMJIT +// signature (effect/type filters) lives on the C++ side in `ZigGeneratedCode.cpp`, +// currently commented out there, so `FFI__ptr__put` installs a plain host fn. const DOM_CALL: DomCall = DomCall { class_name: "FFI", function_name: "ptr", @@ -148,10 +147,9 @@ pub fn to_js(global_object: &JSGlobalObject) -> JSValue { pub mod reader { use super::*; - // Same DOMCall shape as `DOM_CALL` above. The - // `DOMEffect.forRead(.World)` argument is encoded on the C++ side - // (generated `Reader__*__put` in ZigLazyStaticFunctions-inlines.h); the - // runtime descriptor here only needs the `put` extern. + // Same DOMCall shape as `DOM_CALL` above: the C++ side is the + // `Reader__*__put` helpers in `ZigGeneratedCode.cpp`; the runtime + // descriptor here only needs the `put` extern. const DOM_CALLS: &[(&str, DomCall)] = &[ ( "u8", @@ -431,9 +429,9 @@ pub mod reader { JSValue::from_uint64_no_truncate(global_object, value) } - // The DOMJIT fast-path (no type checks) readers — called directly from - // JIT code — live on the C++ side (generated - // `ZigLazyStaticFunctions-inlines.h`); only the slow paths above are here. + // The DOMJIT fast-path (no type checks) readers are currently disabled + // (commented-out wrappers in `ZigGeneratedCode.cpp`); only the slow paths + // above are live. } pub(crate) fn ptr(global_this: &JSGlobalObject, _: JSValue, arguments: &[JSValue]) -> JSValue { diff --git a/src/runtime/ffi/mod.rs b/src/runtime/ffi/mod.rs index 3551e861c688..f958bcfc96b6 100644 --- a/src/runtime/ffi/mod.rs +++ b/src/runtime/ffi/mod.rs @@ -48,7 +48,7 @@ mod dom_call_slowpath { arguments_len: usize, ) -> JSValue { // SAFETY: C++ DOMJIT slowpath caller passes a live global and a - // valid `[JSValue; arguments_len]` span (ZigLazyStaticFunctions). + // valid `[JSValue; arguments_len]` span (ZigGeneratedCode.cpp). let (global, arguments) = unsafe { (&*global, core::slice::from_raw_parts(arguments_ptr, arguments_len)) }; From ac9c42bb71ec3dc75f20d8ca40c86f64d00d7c26 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 08:38:08 +0000 Subject: [PATCH 03/10] Trim FFIObject comments --- src/runtime/ffi/FFIObject.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/runtime/ffi/FFIObject.rs b/src/runtime/ffi/FFIObject.rs index 7ca052049894..bf9b72b06c78 100644 --- a/src/runtime/ffi/FFIObject.rs +++ b/src/runtime/ffi/FFIObject.rs @@ -110,9 +110,8 @@ unsafe extern "C" { fn Bun__FFI__CStringConstructor(global: *const JSGlobalObject) -> JSValue; } -// DOMJIT slow-path host fn, represented here as a const descriptor. The DOMJIT -// signature (effect/type filters) lives on the C++ side in `ZigGeneratedCode.cpp`, -// currently commented out there, so `FFI__ptr__put` installs a plain host fn. +// `FFI__ptr__put` installs a plain host fn; its DOMJIT wiring in +// `ZigGeneratedCode.cpp` is commented out. const DOM_CALL: DomCall = DomCall { class_name: "FFI", function_name: "ptr", @@ -147,9 +146,6 @@ pub fn to_js(global_object: &JSGlobalObject) -> JSValue { pub mod reader { use super::*; - // Same DOMCall shape as `DOM_CALL` above: the C++ side is the - // `Reader__*__put` helpers in `ZigGeneratedCode.cpp`; the runtime - // descriptor here only needs the `put` extern. const DOM_CALLS: &[(&str, DomCall)] = &[ ( "u8", @@ -429,9 +425,8 @@ pub mod reader { JSValue::from_uint64_no_truncate(global_object, value) } - // The DOMJIT fast-path (no type checks) readers are currently disabled - // (commented-out wrappers in `ZigGeneratedCode.cpp`); only the slow paths - // above are live. + // The DOMJIT fast-path readers are disabled (commented out in + // `ZigGeneratedCode.cpp`); these slow paths are the only implementations. } pub(crate) fn ptr(global_this: &JSGlobalObject, _: JSValue, arguments: &[JSValue]) -> JSValue { From 0eb58dff1b9b94b5b1e6a05fdb72e80bf88727cb Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 09:03:44 +0000 Subject: [PATCH 04/10] Remove unused ZigLazyStaticFunctions.h, write-only Url.loc field, and stale appendUtf16 comment --- src/css/properties/custom.rs | 10 ++-------- src/css/values/image.rs | 3 --- src/css/values/url.rs | 13 ++----------- src/jsc/StringBuilder.rs | 4 ++-- src/jsc/bindings/ZigLazyStaticFunctions.h | 21 --------------------- 5 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 src/jsc/bindings/ZigLazyStaticFunctions.h diff --git a/src/css/properties/custom.rs b/src/css/properties/custom.rs index 2aea70ff2e56..f8a1d903ffac 100644 --- a/src/css/properties/custom.rs +++ b/src/css/properties/custom.rs @@ -41,22 +41,17 @@ use bun_alloc::Arena; // not circularly depend on those modules. mod ext { use super::*; - use crate::dependencies; /// Inline of `Url::parse`. pub(super) fn url_parse(input: &mut Parser) -> Result { let start_pos = input.position(); - let loc = input.current_source_location(); let url = input.expect_url()?; // SAFETY: `url` borrows the parser source/arena which outlives the // `add_import_record` call (same lifetime erasure as `src_str`). let url: &'static [u8] = unsafe { &*std::ptr::from_ref::<[u8]>(url) }; let import_record_idx = input.add_import_record(url, start_pos, bun_ast::ImportKind::Url)?; - Ok(Url { - import_record_idx, - loc: dependencies::Location::from_source_location(loc), - }) + Ok(Url { import_record_idx }) } /// Inline of `Url::to_css`. @@ -1339,10 +1334,9 @@ impl Clone for TokenOrValue { TokenOrValue::Token(t) => TokenOrValue::Token(t.clone()), TokenOrValue::Color(c) => TokenOrValue::Color(c.clone()), TokenOrValue::UnresolvedColor(c) => TokenOrValue::UnresolvedColor(c.clone()), - // `Url` has no `#[derive(Clone)]` but both fields are `Copy`. + // `Url` has no `#[derive(Clone)]` but its field is `Copy`. TokenOrValue::Url(u) => TokenOrValue::Url(Url { import_record_idx: u.import_record_idx, - loc: u.loc, }), TokenOrValue::Var(v) => TokenOrValue::Var(v.clone()), TokenOrValue::Env(e) => TokenOrValue::Env(e.clone()), diff --git a/src/css/values/image.rs b/src/css/values/image.rs index ac8acf2ab6f2..dc3d1f87b757 100644 --- a/src/css/values/image.rs +++ b/src/css/values/image.rs @@ -120,7 +120,6 @@ impl Image { Image::None => Image::None, Image::Url(u) => Image::Url(Url { import_record_idx: u.import_record_idx, - loc: u.loc, }), Image::Gradient(g) => Image::Gradient(g.deep_clone(arena)), Image::ImageSet(s) => Image::ImageSet(s.deep_clone(arena)), @@ -379,7 +378,6 @@ pub struct ImageSetOption { impl ImageSetOption { fn parse(input: &mut css::Parser) -> Result { let start_position = input.input.tokenizer.get_position(); - let loc = input.current_source_location(); // `expect_url_or_string` returns a borrow of the parser, so // it can't be used as a `try_parse` callback directly (the result type // `R` may not borrow the closure arg). Erase the borrow via `*const` @@ -392,7 +390,6 @@ impl ImageSetOption { let record_idx = input.add_import_record(url, start_position, ImportKind::Url)?; Image::Url(Url { import_record_idx: record_idx, - loc: css::dependencies::Location::from_source_location(loc), }) } else { Image::parse(input)? diff --git a/src/css/values/url.rs b/src/css/values/url.rs index 93dd7f64fa03..0f9f086d9e5f 100644 --- a/src/css/values/url.rs +++ b/src/css/values/url.rs @@ -1,25 +1,19 @@ use crate::css_parser as css; use css::{CssResult, PrintErr, Printer}; -/// A CSS [url()](https://www.w3.org/TR/css-values-4/#urls) value and its source location. +/// A CSS [url()](https://www.w3.org/TR/css-values-4/#urls) value. pub struct Url { /// The url string. pub(crate) import_record_idx: u32, - /// The location where the `url()` was seen in the CSS source file. - pub(crate) loc: crate::dependencies::Location, } impl Url { pub fn parse(input: &mut css::Parser) -> CssResult { let start_pos = input.position(); - let loc = input.current_source_location(); let url = input.expect_url_cloned()?; let import_record_idx = input.add_import_record(url, start_pos, bun_ast::ImportKind::Url)?; - Ok(Url { - import_record_idx, - loc: crate::dependencies::Location::from_source_location(loc), - }) + Ok(Url { import_record_idx }) } pub fn to_css(&self, dest: &mut Printer) -> Result<(), PrintErr> { @@ -75,7 +69,6 @@ impl Url { pub(crate) fn deep_clone(&self, _bump: &bun_alloc::Arena) -> Self { Url { import_record_idx: self.import_record_idx, - loc: self.loc, } } @@ -88,8 +81,6 @@ impl Url { // TODO: dedupe import records?? // This might not fucking work pub(crate) fn hash(&self, hasher: &mut bun_wyhash::Wyhash) { - // Only `import_record_idx` participates in identity (matches `eql` - // above); `loc` is presentation metadata. hasher.update(&self.import_record_idx.to_ne_bytes()); } } diff --git a/src/jsc/StringBuilder.rs b/src/jsc/StringBuilder.rs index 8161b439bd7d..18332b0f776f 100644 --- a/src/jsc/StringBuilder.rs +++ b/src/jsc/StringBuilder.rs @@ -76,8 +76,8 @@ impl Drop for StringBuilder { // inline `WTF::StringBuilder` storage. The shims that take only that handle // plus by-value scalars/`bun.String` are declared `safe fn` — the validity // proof is in the type signature. `__init` keeps a raw `*mut c_void` (writes -// into a `MaybeUninit`); `__appendLatin1`/`__appendUtf16` keep `unsafe fn` -// because the C++ side dereferences the `(ptr, len)` slice. +// into a `MaybeUninit`); `__appendLatin1` keeps `unsafe fn` because the C++ +// side dereferences the `(ptr, len)` slice. unsafe extern "C" { fn StringBuilder__init(this: *mut c_void); safe fn StringBuilder__deinit(this: &mut StringBuilder); diff --git a/src/jsc/bindings/ZigLazyStaticFunctions.h b/src/jsc/bindings/ZigLazyStaticFunctions.h deleted file mode 100644 index 38033b52d19c..000000000000 --- a/src/jsc/bindings/ZigLazyStaticFunctions.h +++ /dev/null @@ -1,21 +0,0 @@ -// GENERATED FILE -#pragma once -#include "root.h" - -namespace Zig { -class GlobalObject; -class JSFFIFunction; - -class LazyStaticFunctions { -public: - void init(Zig::GlobalObject* globalObject); - - template - void visit(Visitor& visitor); - - /* -- BEGIN FUNCTION DEFINITIONS -- */ - - /* -- END FUNCTION DEFINITIONS-- */ -}; - -} // namespace Zig From 39696fd0b1e27ce9696459048d7a286200f94af2 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 09:39:58 +0000 Subject: [PATCH 05/10] Remove unused kPath/kOptions exports and update stale dependencies.rs module doc --- src/css/dependencies.rs | 2 +- src/js/internal/http.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/css/dependencies.rs b/src/css/dependencies.rs index 3fb847cca127..8a5c148e0fcd 100644 --- a/src/css/dependencies.rs +++ b/src/css/dependencies.rs @@ -1,4 +1,4 @@ -//! Source location for CSS `url()` values and printer errors. +//! Source location for the CSS Modules `composes` property and printer errors. use crate::SourceLocation; diff --git a/src/js/internal/http.ts b/src/js/internal/http.ts index cbc3d3bc3b67..13547bda6923 100644 --- a/src/js/internal/http.ts +++ b/src/js/internal/http.ts @@ -43,8 +43,6 @@ const { }; const kDeprecatedReplySymbol = Symbol("deprecatedReply"); -const kPath = Symbol("path"); -const kOptions = Symbol("options"); const abortedSymbol = Symbol("aborted"); const headerStateSymbol = Symbol("headerState"); @@ -577,9 +575,7 @@ export { kHandle, kInternalSocketData, kNeedDrain, - kOptions, kOutHeaders, - kPath, kPendingCallbacks, kProxyConfig, kRealListen, From abdb03654a3a383b5d231f6494461df1510de999 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 09:54:33 +0000 Subject: [PATCH 06/10] ci: retrigger From 78e8639ff774d97d3abe20c59009f75b43529474 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 10:14:23 +0000 Subject: [PATCH 07/10] Remove orphaned usockets includes, DOMFormData::toURLEncodedString, and the dead setServerIdleTimeout/filterEnvForProxies chains --- src/js/internal/http.ts | 15 ------- src/jsc/bindings/DOMFormData.cpp | 12 ----- src/jsc/bindings/DOMFormData.h | 2 - src/jsc/bindings/NodeHTTP.cpp | 21 --------- src/jsc/bindings/ScriptExecutionContext.cpp | 2 - src/runtime/server/mod.rs | 4 -- src/runtime/server/server_body.rs | 49 --------------------- 7 files changed, 105 deletions(-) diff --git a/src/js/internal/http.ts b/src/js/internal/http.ts index 13547bda6923..c8968388a266 100644 --- a/src/js/internal/http.ts +++ b/src/js/internal/http.ts @@ -12,7 +12,6 @@ const { setServerAppFlags, getCompleteWebRequestOrResponseBodyValueAsArrayBuffer, drainMicrotasks, - setServerIdleTimeout, } = $cpp("NodeHTTP.cpp", "createNodeHTTPInternalBinding") as { getHeader: (headers: Headers, name: string) => string | undefined; setHeader: (headers: Headers, name: string, value: string) => void; @@ -39,7 +38,6 @@ const { ) => void; getCompleteWebRequestOrResponseBodyValueAsArrayBuffer: (arg: any) => ArrayBuffer | undefined; drainMicrotasks: () => void; - setServerIdleTimeout: (server: any, timeout: number) => void; }; const kDeprecatedReplySymbol = Symbol("deprecatedReply"); @@ -530,17 +528,6 @@ function checkShouldUseProxy(proxyConfig: ProxyConfig, reqOptions: any) { return proxyConfig.shouldUseProxy(reqOptions.host || "localhost", reqOptions.port); } -function filterEnvForProxies(env) { - return { - http_proxy: env.http_proxy, - HTTP_PROXY: env.HTTP_PROXY, - https_proxy: env.https_proxy, - HTTPS_PROXY: env.HTTPS_PROXY, - no_proxy: env.no_proxy, - NO_PROXY: env.NO_PROXY, - }; -} - export { Headers, METHODS, @@ -557,7 +544,6 @@ export { emitErrorNextTickIfErrorListenerNT, eofInProgress, fakeSocketSymbol, - filterEnvForProxies, firstWriteSymbol, getCompleteWebRequestOrResponseBodyValueAsArrayBuffer, getHeader, @@ -594,7 +580,6 @@ export { setRequestTimeout, setServerAppFlags, setServerCustomOptions, - setServerIdleTimeout, tlsSymbol, typeSymbol, utcDate, diff --git a/src/jsc/bindings/DOMFormData.cpp b/src/jsc/bindings/DOMFormData.cpp index 2bf5daf577f1..5d9aed0a99bf 100644 --- a/src/jsc/bindings/DOMFormData.cpp +++ b/src/jsc/bindings/DOMFormData.cpp @@ -57,18 +57,6 @@ Ref DOMFormData::create(ScriptExecutionContext* context, const Stri return newFormData; } -String DOMFormData::toURLEncodedString() -{ - WTF::URLParser::URLEncodedForm form; - form.reserveInitialCapacity(m_items.size()); - for (auto& item : m_items) { - if (auto value = std::get_if(&item.data)) - form.append({ item.name, *value }); - } - - return WTF::URLParser::serialize(form); -} - extern "C" void DOMFormData__forEach(DOMFormData* form, void* context, void (*callback)(void* context, ZigString*, void*, ZigString*, uint8_t)) { for (auto& item : form->items()) { diff --git a/src/jsc/bindings/DOMFormData.h b/src/jsc/bindings/DOMFormData.h index d38b38f48073..49433d58dfec 100644 --- a/src/jsc/bindings/DOMFormData.h +++ b/src/jsc/bindings/DOMFormData.h @@ -75,8 +75,6 @@ class DOMFormData : public RefCounted, public ContextDestructionObs size_t count() const { return m_items.size(); } size_t memoryCost() const; - String toURLEncodedString(); - class Iterator { public: explicit Iterator(DOMFormData&); diff --git a/src/jsc/bindings/NodeHTTP.cpp b/src/jsc/bindings/NodeHTTP.cpp index 9baf0b8d436c..759ee2a9dffd 100644 --- a/src/jsc/bindings/NodeHTTP.cpp +++ b/src/jsc/bindings/NodeHTTP.cpp @@ -37,7 +37,6 @@ extern "C" uWS::HttpRequest* Request__getUWSRequest(void*); extern "C" void Request__setInternalEventCallback(void*, EncodedJSValue, JSC::JSGlobalObject*); extern "C" void Request__setTimeout(void*, EncodedJSValue, JSC::JSGlobalObject*); extern "C" bool NodeHTTPResponse__setTimeout(void*, EncodedJSValue, JSC::JSGlobalObject*); -extern "C" void Server__setIdleTimeout(EncodedJSValue, EncodedJSValue, JSC::JSGlobalObject*); extern "C" EncodedJSValue Server__setAppFlags(JSC::JSGlobalObject*, EncodedJSValue, bool require_host_header, bool use_strict_method_validation, bool use_insecure_http_parser, bool http_allow_half_open); extern "C" EncodedJSValue Server__setOnClientError(JSC::JSGlobalObject*, EncodedJSValue, EncodedJSValue); extern "C" EncodedJSValue Server__setOnConnection(JSC::JSGlobalObject*, EncodedJSValue, EncodedJSValue); @@ -1238,22 +1237,6 @@ JSC_DEFINE_HOST_FUNCTION(jsHTTPSetTimeout, (JSGlobalObject * globalObject, CallF return JSValue::encode(jsUndefined()); } -JSC_DEFINE_HOST_FUNCTION(jsHTTPSetServerIdleTimeout, (JSGlobalObject * globalObject, CallFrame* callFrame)) -{ - auto& vm = JSC::getVM(globalObject); - auto scope = DECLARE_THROW_SCOPE(vm); - - // This is an internal binding. - JSValue serverValue = callFrame->uncheckedArgument(0); - JSValue seconds = callFrame->uncheckedArgument(1); - - ASSERT(callFrame->argumentCount() == 2); - - Server__setIdleTimeout(JSValue::encode(serverValue), JSValue::encode(seconds), globalObject); - - return JSValue::encode(jsUndefined()); -} - JSC_DEFINE_HOST_FUNCTION(jsHTTPSetCustomOptions, (JSGlobalObject * globalObject, CallFrame* callFrame)) { auto& vm = JSC::getVM(globalObject); @@ -1458,10 +1441,6 @@ JSValue createNodeHTTPInternalBinding(Zig::GlobalObject* globalObject) vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "setRequestTimeout"_s)), JSC::JSFunction::create(vm, globalObject, 2, "setRequestTimeout"_s, jsHTTPSetTimeout, ImplementationVisibility::Public), 0); - obj->putDirect( - vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "setServerIdleTimeout"_s)), - JSC::JSFunction::create(vm, globalObject, 2, "setServerIdleTimeout"_s, jsHTTPSetServerIdleTimeout, ImplementationVisibility::Public), 0); - obj->putDirect( vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "setServerCustomOptions"_s)), JSC::JSFunction::create(vm, globalObject, 2, "setServerCustomOptions"_s, jsHTTPSetCustomOptions, ImplementationVisibility::Public), 0); diff --git a/src/jsc/bindings/ScriptExecutionContext.cpp b/src/jsc/bindings/ScriptExecutionContext.cpp index d98ce91aee5d..c4261ff3a510 100644 --- a/src/jsc/bindings/ScriptExecutionContext.cpp +++ b/src/jsc/bindings/ScriptExecutionContext.cpp @@ -3,8 +3,6 @@ #include "ScriptExecutionContext.h" #include "ContextDestructionObserver.h" -#include "libusockets.h" -#include "_libusockets.h" #include "BunClientData.h" #include "EventLoopTask.h" #include diff --git a/src/runtime/server/mod.rs b/src/runtime/server/mod.rs index 9551413e57ed..ff957aca5bee 100644 --- a/src/runtime/server/mod.rs +++ b/src/runtime/server/mod.rs @@ -1519,10 +1519,6 @@ impl NewServer { self.listener.is_some() || (Self::HAS_H3 && self.h3_listener.is_some()) } - pub(crate) fn set_idle_timeout(&mut self, seconds: core::ffi::c_uint) { - self.config.idle_timeout = seconds.min(255) as u8; - } - pub(crate) fn set_flags( &mut self, require_host_header: bool, diff --git a/src/runtime/server/server_body.rs b/src/runtime/server/server_body.rs index 36d0aa29b2b6..42477e7c10f0 100644 --- a/src/runtime/server/server_body.rs +++ b/src/runtime/server/server_body.rs @@ -3720,55 +3720,6 @@ bun_jsc::impl_js_class_via_generated!(DebugHTTPServer => crate::generated_classe bun_jsc::impl_js_class_via_generated!(DebugHTTPSServer => crate::generated_classes::js_DebugHTTPSServer, no_constructor); // ─── Exported fns ──────────────────────────────────────────────────────────── -#[unsafe(no_mangle)] -extern "C" fn Server__setIdleTimeout(server: JSValue, seconds: JSValue, global: &JSGlobalObject) { - match server_set_idle_timeout(server, seconds, global) { - Ok(()) => {} - Err(JsError::Thrown) => {} - Err(JsError::OutOfMemory) => { - let _ = global.throw_out_of_memory_value(); - } - Err(JsError::Terminated) => {} - } -} - -fn server_set_idle_timeout( - server: JSValue, - seconds: JSValue, - global: &JSGlobalObject, -) -> JsResult<()> { - if !server.is_object() { - return Err(global.throw(format_args!( - "Failed to set timeout: The 'this' value is not a Server." - ))); - } - - if !seconds.is_number() { - return Err(global.throw(format_args!( - "Failed to set timeout: The provided value is not of type 'number'." - ))); - } - let value = seconds.to_u32(); - if let Some(this) = server.as_::() { - // SAFETY: `as_` returned a non-null `*mut` to a live JS-wrapped server. - unsafe { &mut *this }.set_idle_timeout(value); - } else if let Some(this) = server.as_::() { - // SAFETY: `as_` returned a non-null `*mut` to a live JS-wrapped server. - unsafe { &mut *this }.set_idle_timeout(value); - } else if let Some(this) = server.as_::() { - // SAFETY: `as_` returned a non-null `*mut` to a live JS-wrapped server. - unsafe { &mut *this }.set_idle_timeout(value); - } else if let Some(this) = server.as_::() { - // SAFETY: `as_` returned a non-null `*mut` to a live JS-wrapped server. - unsafe { &mut *this }.set_idle_timeout(value); - } else { - return Err(global.throw(format_args!( - "Failed to set timeout: The 'this' value is not a Server." - ))); - } - Ok(()) -} - fn server_set_on_client_error( global: &JSGlobalObject, server: JSValue, From 26d192bbf1b23bb3ec612436b72e495df432b64c Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 10:39:35 +0000 Subject: [PATCH 08/10] Drop orphaned sys/socket.h include and stale dependency-placeholder comment --- src/base64/Cargo.toml | 3 +-- src/jsc/bindings/c-bindings.cpp | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/base64/Cargo.toml b/src/base64/Cargo.toml index 9d17a0911bdc..c269ae4a24ee 100644 --- a/src/base64/Cargo.toml +++ b/src/base64/Cargo.toml @@ -24,7 +24,6 @@ thiserror.workspace = true bun_simdutf_sys.workspace = true bun_collections.workspace = true -# `wyhash_url_safe` (CSS-modules / dependency placeholder hasher) — leaf crates, -# no cycle. +# `wyhash_url_safe` (CSS-modules hasher) — leaf crates, no cycle. bun_wyhash.workspace = true bun_alloc.workspace = true diff --git a/src/jsc/bindings/c-bindings.cpp b/src/jsc/bindings/c-bindings.cpp index 8ce56222e615..a4176c5cc6f3 100644 --- a/src/jsc/bindings/c-bindings.cpp +++ b/src/jsc/bindings/c-bindings.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #else #include #include From ad5d2dfeccabf489e1978bdfc4c95ccd22580256 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 11:11:45 +0000 Subject: [PATCH 09/10] Drop orphaned JSCookie.h include --- src/jsc/bindings/Cookie.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/jsc/bindings/Cookie.cpp b/src/jsc/bindings/Cookie.cpp index 86dcc3fd82e9..69d44e0e0fe1 100644 --- a/src/jsc/bindings/Cookie.cpp +++ b/src/jsc/bindings/Cookie.cpp @@ -1,6 +1,5 @@ #include "Cookie.h" #include "EncodeURIComponent.h" -#include "JSCookie.h" #include "helpers.h" #include #include From 0506a51ec5fa9345e2b0e94a7e19862701aed60d Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 2 Aug 2026 11:42:38 +0000 Subject: [PATCH 10/10] Remove dead is_custom_property parameter and project_root option; fix remaining hive get() comment references --- src/css/css_modules.rs | 18 +--------- src/css/css_parser.rs | 13 +++---- src/css/media_query.rs | 4 +-- src/css/printer.rs | 15 ++++---- src/css/properties/custom.rs | 40 +++++++++++----------- src/css/properties/properties_generated.rs | 6 ++-- src/css/rules/font_face.rs | 2 +- src/css/rules/font_palette_values.rs | 2 +- src/css/rules/unknown.rs | 4 +-- src/css/values/syntax.rs | 2 +- src/install/NetworkTask.rs | 6 ++-- src/install/TarballStream.rs | 2 +- 12 files changed, 44 insertions(+), 70 deletions(-) diff --git a/src/css/css_modules.rs b/src/css/css_modules.rs index 120055dcfdf1..cd0b857ae110 100644 --- a/src/css/css_modules.rs +++ b/src/css/css_modules.rs @@ -23,31 +23,15 @@ impl<'a> CssModule<'a> { bump: &'a Bump, config: &'a Config, sources: &'a Vec>, - project_root: Option<&[u8]>, references: &'a mut CssModuleReferences<'a>, ) -> CssModule<'a> { // TODO: this is BAAAAAAAAAAD we are going to remove it let hashes = 'hashes: { let mut hashes = BumpVec::with_capacity_in(sources.len(), bump); for path in sources.iter() { - let mut alloced = false; - let source: &[u8] = 'source: { - // Make paths relative to project root so hashes are stable - if let Some(root) = project_root { - if bun_paths::is_absolute(root) { - alloced = true; - break 'source bump.alloc_slice_copy( - bun_paths::resolve_path::relative(root, path.as_ref()), - ); - } - } - break 'source path.as_ref(); - }; - // `source` is arena-allocated, bulk-freed on bump.reset() - let _ = alloced; hashes.push(hash( bump, - format_args!("{}", bstr::BStr::new(source)), + format_args!("{}", bstr::BStr::new(path.as_ref())), matches!(config.pattern.segments.at(0), Segment::Hash), )); } diff --git a/src/css/css_parser.rs b/src/css/css_parser.rs index 57ae7865c266..008fd5902f19 100644 --- a/src/css/css_parser.rs +++ b/src/css/css_parser.rs @@ -2458,14 +2458,11 @@ mod stylesheet_impl { &'a self, arena: &'a Bump, writer: &'a mut dyn bun_io::Write, - options: &PrinterOptions<'a>, + options: &PrinterOptions, import_info: Option>, local_names: Option<&'a LocalsResultsMap>, symbols: &'a bun_ast::symbol::Map, ) -> PrintResult<()> { - // Note: PrinterOptions has `&mut SourceMap` and so isn't Copy; capture - // the lone field we re-read after moving `options` into Printer::new. - let project_root = options.project_root; let mut printer = Printer::new( arena, bun_alloc::ArenaVec::new_in(arena), @@ -2475,7 +2472,7 @@ mod stylesheet_impl { local_names, symbols, ); - match self.to_css_with_writer_impl(&mut printer, project_root) { + match self.to_css_with_writer_impl(&mut printer) { Ok(result) => Ok(result), Err(_) => { debug_assert!(printer.error_kind.is_some()); @@ -2487,7 +2484,6 @@ mod stylesheet_impl { pub(crate) fn to_css_with_writer_impl<'a>( &'a self, printer: &mut Printer<'a>, - project_root: Option<&[u8]>, ) -> Result<(), PrintErr> { // #[cfg(feature = "sourcemap")] { printer.sources = Some(&self.sources); } // #[cfg(feature = "sourcemap")] if printer.source_map.is_some() { ... } @@ -2514,7 +2510,6 @@ mod stylesheet_impl { printer.arena, config, &self.sources, - project_root, references_mut, )); @@ -2542,7 +2537,7 @@ mod stylesheet_impl { pub fn to_css<'a>( &'a self, arena: &'a Bump, - options: &PrinterOptions<'a>, + options: &PrinterOptions, import_info: Option>, local_names: Option<&'a LocalsResultsMap>, symbols: &'a bun_ast::symbol::Map, @@ -2723,7 +2718,7 @@ mod stylesheet_impl { pub fn to_css<'a>( &'a self, arena: &'a Bump, - options: &PrinterOptions<'a>, + options: &PrinterOptions, import_info: Option>, ) -> Result { // #[cfg(feature = "sourcemap")] diff --git a/src/css/media_query.rs b/src/css/media_query.rs index 24c9e39d3fe8..eba1425afcb2 100644 --- a/src/css/media_query.rs +++ b/src/css/media_query.rs @@ -85,7 +85,7 @@ pub trait QueryCondition: Sized + ToCss { fn as_operation(&self) -> Option<(Operator, &[Self])>; /// Serialize the leaf feature. Not defaulted: `Property::to_css` takes an - /// extra `is_custom_property` flag, and `QueryFeature::to_css` is inherent + /// extra `important` flag, and `QueryFeature::to_css` is inherent /// (not the `ToCss` trait), so callers must spell the dispatch. fn feature_to_css(f: &Self::Feature, dest: &mut Printer) -> core::result::Result<(), PrintErr>; @@ -1077,7 +1077,7 @@ impl MediaFeatureValue { MediaFeatureValue::Resolution(res) => res.to_css(dest), MediaFeatureValue::Ratio(ratio) => ratio.to_css(dest), MediaFeatureValue::Ident(id) => id.to_css(dest), - MediaFeatureValue::Env(env) => env.to_css(dest, false), + MediaFeatureValue::Env(env) => env.to_css(dest), } } diff --git a/src/css/printer.rs b/src/css/printer.rs index 0f2f9f2fb221..4eca6322165b 100644 --- a/src/css/printer.rs +++ b/src/css/printer.rs @@ -14,24 +14,21 @@ use css_values::ident::DashedIdent; use bun_io::Write; /// Options that control how CSS is serialized to a string. -pub struct PrinterOptions<'a> { +pub struct PrinterOptions { /// Whether to minify the CSS, i.e. remove white space. pub minify: bool, - /// An optional project root path, used to generate relative paths for sources used in CSS module hashes. - pub project_root: Option<&'a [u8]>, /// Targets to output the CSS for. pub targets: Targets, } -impl<'a> PrinterOptions<'a> { - pub fn default() -> PrinterOptions<'a> { +impl PrinterOptions { + pub fn default() -> PrinterOptions { Self::default_with_minify(false) } - pub(crate) fn default_with_minify(minify: bool) -> PrinterOptions<'a> { + pub(crate) fn default_with_minify(minify: bool) -> PrinterOptions { PrinterOptions { minify, - project_root: None, targets: Targets { browsers: None, ..Targets::default() @@ -40,7 +37,7 @@ impl<'a> PrinterOptions<'a> { } } -impl<'a> Default for PrinterOptions<'a> { +impl Default for PrinterOptions { fn default() -> Self { Self::default() } @@ -234,7 +231,7 @@ impl<'a> Printer<'a> { arena: &'a Bump, scratchbuf: BumpVec<'a, u8>, dest: &'a mut dyn Write, - options: &PrinterOptions<'a>, + options: &PrinterOptions, import_info: Option>, local_names: Option<&'a css::LocalsResultsMap>, symbols: &'a SymbolMap, diff --git a/src/css/properties/custom.rs b/src/css/properties/custom.rs index f8a1d903ffac..e93b5a72a803 100644 --- a/src/css/properties/custom.rs +++ b/src/css/properties/custom.rs @@ -264,7 +264,7 @@ pub struct TokenList { impl TokenList { // deinit(): body only freed owned `Vec` fields — handled by `Drop` on `Vec`. - pub fn to_css(&self, dest: &mut Printer, is_custom_property: bool) -> PrintResult<()> { + pub fn to_css(&self, dest: &mut Printer) -> PrintResult<()> { if !dest.minify && self.v.len() == 1 && self.v[0].is_whitespace() { return Ok(()); } @@ -277,7 +277,7 @@ impl TokenList { has_whitespace = false; } TokenOrValue::UnresolvedColor(color) => { - color.to_css(dest, is_custom_property)?; + color.to_css(dest)?; has_whitespace = false; } TokenOrValue::Url(url) => { @@ -285,15 +285,15 @@ impl TokenList { has_whitespace = false; } TokenOrValue::Var(var) => { - var.to_css(dest, is_custom_property)?; + var.to_css(dest)?; has_whitespace = self.write_whitespace_if_needed(i, dest)?; } TokenOrValue::Env(env) => { - env.to_css(dest, is_custom_property)?; + env.to_css(dest)?; has_whitespace = self.write_whitespace_if_needed(i, dest)?; } TokenOrValue::Function(f) => { - f.to_css(dest, is_custom_property)?; + f.to_css(dest)?; has_whitespace = self.write_whitespace_if_needed(i, dest)?; } TokenOrValue::Length(v) => { @@ -842,7 +842,7 @@ impl UnresolvedColor { // deinit(): body only freed owned `TokenList` fields — handled by `Drop`. - fn to_css(&self, dest: &mut Printer, is_custom_property: bool) -> PrintResult<()> { + fn to_css(&self, dest: &mut Printer) -> PrintResult<()> { fn conv(c: f32) -> i32 { css_values::color::clamp_unit_f32(c) as i32 } @@ -859,7 +859,7 @@ impl UnresolvedColor { css_parser::to_css::integer(conv(*g), dest)?; dest.delim(b',', false)?; css_parser::to_css::integer(conv(*b), dest)?; - alpha.to_css(dest, is_custom_property)?; + alpha.to_css(dest)?; dest.write_char(b')')?; return Ok(()); } @@ -871,7 +871,7 @@ impl UnresolvedColor { dest.write_char(b' ')?; css_parser::to_css::integer(conv(*b), dest)?; dest.delim(b'/', true)?; - alpha.to_css(dest, is_custom_property)?; + alpha.to_css(dest)?; dest.write_char(b')') } UnresolvedColor::HSL { h, s, l, alpha } => { @@ -886,7 +886,7 @@ impl UnresolvedColor { dest.delim(b',', false)?; Percentage { v: *l }.to_css(dest)?; dest.delim(b',', false)?; - alpha.to_css(dest, is_custom_property)?; + alpha.to_css(dest)?; dest.write_char(b')')?; return Ok(()); } @@ -898,26 +898,26 @@ impl UnresolvedColor { dest.write_char(b' ')?; Percentage { v: *l }.to_css(dest)?; dest.delim(b'/', true)?; - alpha.to_css(dest, is_custom_property)?; + alpha.to_css(dest)?; dest.write_char(b')') } UnresolvedColor::LightDark { light, dark } => { if !dest.targets.is_compatible(css::compat::Feature::LightDark) { dest.write_str("var(--buncss-light")?; dest.delim(b',', false)?; - light.to_css(dest, is_custom_property)?; + light.to_css(dest)?; dest.write_char(b')')?; dest.whitespace()?; dest.write_str("var(--buncss-dark")?; dest.delim(b',', false)?; - dark.to_css(dest, is_custom_property)?; + dark.to_css(dest)?; return dest.write_char(b')'); } dest.write_str("light-dark(")?; - light.to_css(dest, is_custom_property)?; + light.to_css(dest)?; dest.delim(b',', false)?; - dark.to_css(dest, is_custom_property)?; + dark.to_css(dest)?; dest.write_char(b')') } } @@ -1034,12 +1034,12 @@ impl Variable { Ok(Variable { name, fallback }) } - fn to_css(&self, dest: &mut Printer, is_custom_property: bool) -> PrintResult<()> { + fn to_css(&self, dest: &mut Printer) -> PrintResult<()> { dest.write_str("var(")?; ext::dashed_ident_ref_to_css(&self.name, dest)?; if let Some(fallback) = &self.fallback { dest.delim(b',', false)?; - fallback.to_css(dest, is_custom_property)?; + fallback.to_css(dest)?; } dest.write_char(b')') } @@ -1105,7 +1105,7 @@ impl EnvironmentVariable { }) } - pub(crate) fn to_css(&self, dest: &mut Printer, is_custom_property: bool) -> PrintResult<()> { + pub(crate) fn to_css(&self, dest: &mut Printer) -> PrintResult<()> { dest.write_str("env(")?; self.name.to_css(dest)?; @@ -1116,7 +1116,7 @@ impl EnvironmentVariable { if let Some(fallback) = &self.fallback { dest.delim(b',', false)?; - fallback.to_css(dest, is_custom_property)?; + fallback.to_css(dest)?; } dest.write_char(b')') @@ -1256,10 +1256,10 @@ pub struct Function { impl Function { // deinit(): body only freed owned `TokenList` field — handled by `Drop`. - fn to_css(&self, dest: &mut Printer, is_custom_property: bool) -> PrintResult<()> { + fn to_css(&self, dest: &mut Printer) -> PrintResult<()> { IdentFns::to_css(&self.name, dest)?; dest.write_char(b'(')?; - self.arguments.to_css(dest, is_custom_property)?; + self.arguments.to_css(dest)?; dest.write_char(b')') } diff --git a/src/css/properties/properties_generated.rs b/src/css/properties/properties_generated.rs index 56e539c6ece6..231fa78a9299 100644 --- a/src/css/properties/properties_generated.rs +++ b/src/css/properties/properties_generated.rs @@ -3914,10 +3914,8 @@ impl Property { Property::MaskBoxImageRepeat(v) => css::generic::to_css(&v.0, dest), Property::ColorScheme(v) => css::generic::to_css(v, dest), Property::All(v) => css::generic::to_css(v, dest), - Property::Unparsed(u) => u.value.to_css(dest, false), - Property::Custom(c) => c - .value - .to_css(dest, matches!(c.name, CustomPropertyName::Custom(..))), + Property::Unparsed(u) => u.value.to_css(dest), + Property::Custom(c) => c.value.to_css(dest), } } diff --git a/src/css/rules/font_face.rs b/src/css/rules/font_face.rs index d1d8957fde8a..c32cc56a8f1b 100644 --- a/src/css/rules/font_face.rs +++ b/src/css/rules/font_face.rs @@ -76,7 +76,7 @@ impl FontFaceProperty { FontFaceProperty::Custom(custom) => { custom.name.to_css(dest)?; dest.delim(b':', false)?; - custom.value.to_css(dest, true) + custom.value.to_css(dest) } } } diff --git a/src/css/rules/font_palette_values.rs b/src/css/rules/font_palette_values.rs index 9f80077d982f..e12280dc72a2 100644 --- a/src/css/rules/font_palette_values.rs +++ b/src/css/rules/font_palette_values.rs @@ -109,7 +109,7 @@ impl FontPaletteValuesProperty { FontPaletteValuesProperty::Custom(custom) => { custom.name.to_css(dest)?; dest.delim(b':', false)?; - custom.value.to_css(dest, true) + custom.value.to_css(dest) } } } diff --git a/src/css/rules/unknown.rs b/src/css/rules/unknown.rs index 47e0e050a5ec..b48b704b6f65 100644 --- a/src/css/rules/unknown.rs +++ b/src/css/rules/unknown.rs @@ -25,13 +25,13 @@ impl UnknownAtRule { if !self.prelude.v.is_empty() { dest.write_char(b' ')?; - self.prelude.to_css(dest, false)?; + self.prelude.to_css(dest)?; } if let Some(block) = &self.block { dest.block(|d| { d.newline()?; - block.to_css(d, false) + block.to_css(d) }) } else { dest.write_char(b';') diff --git a/src/css/values/syntax.rs b/src/css/values/syntax.rs index d12b585f5308..28f7d826b65c 100644 --- a/src/css/values/syntax.rs +++ b/src/css/values/syntax.rs @@ -471,7 +471,7 @@ impl ParsedComponent { }, |d, c| c.to_css(d), ), - ParsedComponent::TokenList(t) => t.to_css(dest, false), + ParsedComponent::TokenList(t) => t.to_css(dest), } } diff --git a/src/install/NetworkTask.rs b/src/install/NetworkTask.rs index 358669329a33..1e1e55c6e83c 100644 --- a/src/install/NetworkTask.rs +++ b/src/install/NetworkTask.rs @@ -45,7 +45,7 @@ pub struct NetworkTask { // // `MaybeUninit` because the slot comes from `HiveArrayFallback` // as *uninitialized* memory (often zero-page on first mmap, but not - // guaranteed — `get()`'s heap fallback is `Box::new_uninit()`) and is + // guaranteed — `claim()`'s heap fallback is `Box::new_uninit()`) and is // overwritten by plain `=` in `for_manifest`/`for_tarball`. // `MaybeUninit` is the spec-correct mapping for that semantic — unlike // `ManuallyDrop`, it suppresses `T`'s validity invariant, so @@ -907,7 +907,7 @@ impl NetworkTask { if !self.streaming_extract_task.is_null() { // ARENA: returned to `preallocated_resolve_tasks` pool, not freed. // SAFETY: `streaming_extract_task` was obtained from this same - // `preallocated_resolve_tasks` pool via `get()` and is not aliased + // `preallocated_resolve_tasks` pool via `get_init()` and is not aliased // (cleared immediately below); `put()` runs `Task::drop` on the // slot — the Task was fully initialized via // `enqueue::create_extract_task_for_streaming` so this is sound. @@ -949,7 +949,7 @@ impl NetworkTask { /// /// # Safety /// `slot` must be the unique handle to a `HiveArrayFallback` - /// slot returned by `get()`; its prior contents are treated as garbage + /// slot returned by `claim()`; its prior contents are treated as garbage /// (no destructors run). pub(crate) unsafe fn write_init( slot: *mut NetworkTask, diff --git a/src/install/TarballStream.rs b/src/install/TarballStream.rs index 2eccd74be538..4506431da82b 100644 --- a/src/install/TarballStream.rs +++ b/src/install/TarballStream.rs @@ -1049,7 +1049,7 @@ impl TarballStream { // leaves `tarball_stream = None` so `HiveArray::put`'s // `drop_in_place` (1e76047) does not double-free a // dangling Box. Before 1e76047 the dangling `Some` was harmless - // (overwritten on next `get()`); now it use-after-frees. + // (overwritten on next `claim()`); now it use-after-frees. debug_assert!( (*network).tarball_stream.as_deref().map(std::ptr::from_ref) == Some(this.cast_const()),