diff --git a/src/bun_core/tty.rs b/src/bun_core/tty.rs index 29926732e65a..4bf156f91360 100644 --- a/src/bun_core/tty.rs +++ b/src/bun_core/tty.rs @@ -89,7 +89,9 @@ impl RawModeGuard { impl Drop for RawModeGuard { #[inline] fn drop(&mut self) { - let _ = self.state.set_mode(self.fd, Mode::Normal, SetAttrWhen::Drain); + let _ = self + .state + .set_mode(self.fd, Mode::Normal, SetAttrWhen::Drain); } } diff --git a/src/bun_core/windows_sys.rs b/src/bun_core/windows_sys.rs index cac8de64e056..cfca2cae090b 100644 --- a/src/bun_core/windows_sys.rs +++ b/src/bun_core/windows_sys.rs @@ -42,7 +42,7 @@ pub fn GetStdHandle(std_handle: DWORD) -> Option { // `crate::windows_sys::*` path used by callers. // ────────────────────────────────────────────────────────────────────────── pub use bun_windows_sys::{ - CURDIR, Curdir, PEB, PebView, ProcessParameters, RTL_USER_PROCESS_PARAMETERS, TEB, peb, teb, + CURDIR, PEB, ProcessParameters, RTL_USER_PROCESS_PARAMETERS, TEB, peb, teb, }; // SAFETY: nested `i16`/`u16` POD; all-zero is the documented pre-call state diff --git a/src/bundler/bundle_v2.rs b/src/bundler/bundle_v2.rs index 55280fe15fe7..280a42fea585 100644 --- a/src/bundler/bundle_v2.rs +++ b/src/bundler/bundle_v2.rs @@ -4378,7 +4378,6 @@ pub mod bv2_impl { fd, &load.path, bun_wyhash::hash(load.path.as_ref()) as u32, - bun_watcher::Loader(code.loader as u8), bun_sys::Fd::INVALID, None, ), @@ -6835,12 +6834,11 @@ pub mod bv2_impl { parse_task::ResultValue::Err(data) => data.source_index.get(), parse_task::ResultValue::Success(val) => val.source.index.0, }; - // borrowck — read source path/loader before + // borrowck — read the source path before // `should_add_watcher(&self)` so the column borrow is released. let source_path = this.graph.input_files.items_source()[source_index as usize] .path .text; - let loader = this.graph.input_files.items_loader()[source_index as usize]; if this.should_add_watcher(source_path) { // const generic `CLONE_FILE_PATH = isWindows` // matches `cfg!(windows)` at compile time. @@ -6851,7 +6849,6 @@ pub mod bv2_impl { parse_result.watcher_data.fd, source_path, bun_wyhash::hash(source_path) as u32, - bun_watcher::Loader(loader as u8), parse_result.watcher_data.dir_fd, None, ); diff --git a/src/codegen/generate-js2native.ts b/src/codegen/generate-js2native.ts index 24abca42a866..cf176486ce7c 100644 --- a/src/codegen/generate-js2native.ts +++ b/src/codegen/generate-js2native.ts @@ -56,7 +56,6 @@ const rustIdentifierPaths: Record = { "collections/linear_fifo.rs": "collections/linear_fifo.rs", "crash_handler.rs": "crash_handler/crash_handler.rs", "css_internals.rs": "css_jsc/css_internals.rs", - "dependency.rs": "install/dependency.rs", "escapeRegExp.rs": "string/escapeRegExp.rs", "event_loop.rs": "jsc/event_loop.rs", "ffi.rs": "runtime/ffi/ffi.rs", diff --git a/src/codegen/generate-unified-source-bundles.rb b/src/codegen/generate-unified-source-bundles.rb deleted file mode 100644 index 505654acef84..000000000000 --- a/src/codegen/generate-unified-source-bundles.rb +++ /dev/null @@ -1,392 +0,0 @@ -# Copyright (C) 2017 Apple Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS -# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -# THE POSSIBILITY OF SUCH DAMAGE. - -require 'digest' -require 'fileutils' -require 'pathname' -require 'getoptlong' - -SCRIPT_NAME = File.basename($0) -COMMENT_REGEXP = /\/\// - -def usage(message) - if message - puts "Error: #{message}" - puts - end - - puts "usage: #{SCRIPT_NAME} [options] ..." - puts " may be separate arguments or one semicolon separated string" - puts "--help (-h) Print this message" - puts "--verbose (-v) Adds extra logging to stderr." - puts - puts "Required arguments:" - puts "--source-tree-path (-s) Path to the root of the source directory." - puts "--derived-sources-path (-d) Path to the directory where the unified source files should be placed." - puts - puts "Optional arguments:" - puts "--print-bundled-sources Print bundled sources rather than generating sources" - puts "--print-all-sources Print all sources rather than generating sources" - puts "--generate-xcfilelists Generate .xcfilelist files" - puts "--input-xcfilelist-path Path of the generated input .xcfilelist file" - puts "--output-xcfilelist-path Path of the generated output .xcfilelist file" - puts - puts "Generation options:" - puts "--max-cpp-bundle-count Use global sequential numbers for cpp bundle filenames and set the limit on the number" - puts "--max-c-bundle-count Use global sequential numbers for c bundle filenames and set the limit on the number" - puts "--max-obj-c-bundle-count Use global sequential numbers for Obj-C bundle filenames and set the limit on the number" - puts "--max-bundle-size The number of files to merge into a single bundle" - puts "--dense-bundle-filter Densely bundle files matching the given path glob" - exit 1 -end - -MAX_DENSE_BUNDLE_SIZE = 64 -$derivedSourcesPath = nil -$unifiedSourceOutputPath = nil -$sourceTreePath = nil -$verbose = false -$mode = :GenerateBundles -$inputXCFilelistPath = nil -$outputXCFilelistPath = nil -$maxCppBundleCount = nil -$maxCBundleCount = nil -$maxObjCBundleCount = nil -$maxBundleSize = 8 -$denseBundleFilters = [] -$bundleFilenamePrefix = '' - -def log(text) - $stderr.puts text if $verbose -end - -GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], - ['--verbose', '-v', GetoptLong::NO_ARGUMENT], - ['--derived-sources-path', '-d', GetoptLong::REQUIRED_ARGUMENT], - ['--source-tree-path', '-s', GetoptLong::REQUIRED_ARGUMENT], - ['--print-bundled-sources', GetoptLong::NO_ARGUMENT], - ['--print-all-sources', GetoptLong::NO_ARGUMENT], - ['--generate-xcfilelists', GetoptLong::NO_ARGUMENT], - ['--input-xcfilelist-path', GetoptLong::REQUIRED_ARGUMENT], - ['--output-xcfilelist-path', GetoptLong::REQUIRED_ARGUMENT], - ['--max-cpp-bundle-count', GetoptLong::REQUIRED_ARGUMENT], - ['--max-c-bundle-count', GetoptLong::REQUIRED_ARGUMENT], - ['--max-obj-c-bundle-count', GetoptLong::REQUIRED_ARGUMENT], - ['--max-bundle-size', GetoptLong::REQUIRED_ARGUMENT], - ['--dense-bundle-filter', GetoptLong::REQUIRED_ARGUMENT], - ['--bundle-filename-prefix', GetoptLong::REQUIRED_ARGUMENT]).each { - | opt, arg | - case opt - when '--help' - usage(nil) - when '--verbose' - $verbose = true - when '--derived-sources-path' - $derivedSourcesPath = Pathname.new(arg) - when '--source-tree-path' - $sourceTreePath = Pathname.new(arg) - usage("Source tree #{arg} does not exist.") if !$sourceTreePath.exist? - when '--print-bundled-sources' - $mode = :PrintBundledSources - when '--print-all-sources' - $mode = :PrintAllSources - when '--generate-xcfilelists' - $mode = :GenerateXCFilelists - when '--input-xcfilelist-path' - $inputXCFilelistPath = arg - when '--output-xcfilelist-path' - $outputXCFilelistPath = arg - when '--max-cpp-bundle-count' - $maxCppBundleCount = arg.to_i - when '--max-c-bundle-count' - $maxCBundleCount = arg.to_i - when '--max-obj-c-bundle-count' - $maxObjCBundleCount = arg.to_i - when '--max-bundle-size' - $maxBundleSize = arg.to_i - when '--dense-bundle-filter' - $denseBundleFilters.push(arg) - when '--bundle-filename-prefix' - $bundleFilenamePrefix = arg - end -} - -$unifiedSourceOutputPath = $derivedSourcesPath + Pathname.new("unified-sources") -FileUtils.mkpath($unifiedSourceOutputPath) if !$unifiedSourceOutputPath.exist? && $mode != :GenerateXCFilelists - -usage("--derived-sources-path must be specified.") if !$unifiedSourceOutputPath -usage("--source-tree-path must be specified.") if !$sourceTreePath -log("Putting unified sources in #{$unifiedSourceOutputPath}") - -usage("At least one source list file must be specified.") if ARGV.length == 0 -# Even though CMake will only pass us a single semicolon separated arguemnts, we separate all the arguments for simplicity. -sourceListFiles = ARGV.to_a.map { | sourceFileList | sourceFileList.split(";") }.flatten -log("Source files: #{sourceListFiles}") -$generatedSources = [] -$inputSources = [] -$outputSources = [] - -class SourceFile - attr_reader :unifiable, :fileIndex, :path - def initialize(file, fileIndex) - @unifiable = true - @fileIndex = fileIndex - - attributeStart = file =~ /@/ - if attributeStart - # We want to make sure we skip the first @ so split works correctly - attributesText = file[(attributeStart + 1)..file.length] - attributesText.split(/\s*@/).each { - | attribute | - case attribute.strip - when "no-unify" - @unifiable = false - else - raise "unknown attribute: #{attribute}" - end - } - file = file[0..(attributeStart-1)] - end - - @path = Pathname.new(file.strip) - end - - def <=>(other) - return @path.dirname <=> other.path.dirname if @path.dirname != other.path.dirname - return @path.basename <=> other.path.basename if @fileIndex == other.fileIndex - @fileIndex <=> other.fileIndex - end - - def derived? - return @derived if @derived != nil - @derived = !($sourceTreePath + self.path).exist? - end - - def to_s - if $mode == :GenerateXCFilelists - if derived? - ($derivedSourcesPath + @path).to_s - else - '$(SRCROOT)/' + @path.to_s - end - elsif $mode == :GenerateBundles || !derived? - @path.to_s - else - ($derivedSourcesPath + @path).to_s - end - end -end - -class BundleManager - attr_reader :bundleCount, :extension, :fileCount, :currentBundleText, :maxCount, :extraFiles - - def initialize(extension, max) - @extension = extension - @fileCount = 0 - @bundleCount = 0 - @currentBundleText = "" - @maxCount = max - @extraFiles = [] - @currentDirectory = nil - @lastBundlingPrefix = nil - end - - def writeFile(file, text) - bundleFile = $unifiedSourceOutputPath + file - if $mode == :GenerateXCFilelists - $outputSources << bundleFile - return - end - if (!bundleFile.exist? || IO::read(bundleFile) != @currentBundleText) - log("Writing bundle #{bundleFile} with: \n#{@currentBundleText}") - IO::write(bundleFile, @currentBundleText) - end - end - - def bundleFileName() - id = - if @maxCount - @bundleCount.to_s - else - # The dash makes the filenames more clear when using a hash. - hash = Digest::SHA1.hexdigest(@currentDirectory.to_s)[0..7] - "-#{hash}-#{@bundleCount}" - end - @extension == "cpp" ? "#{$bundleFilenamePrefix}UnifiedSource#{id}.#{extension}" : "#{$bundleFilenamePrefix}UnifiedSource#{id}-#{extension}.#{extension}" - end - - def flush - @bundleCount += 1 - bundleFile = bundleFileName - $generatedSources << $unifiedSourceOutputPath + bundleFile - @extraFiles << bundleFile if @maxCount and @bundleCount > @maxCount - - writeFile(bundleFile, @currentBundleText) - @currentBundleText = "" - @fileCount = 0 - end - - def flushToMax - raise if !@maxCount - while @bundleCount < @maxCount - flush - end - end - - def addFile(sourceFile) - path = sourceFile.path - raise "wrong extension: #{path.extname} expected #{@extension}" unless path.extname == ".#{@extension}" - bundlePrefix, bundleSize = BundlePrefixAndSizeForPath(path) - if (@lastBundlingPrefix != bundlePrefix) - unless @fileCount.zero? - log("Flushing because new top level directory; old: #{@currentDirectory}, new: #{path.dirname}") - flush - end - @lastBundlingPrefix = bundlePrefix - @currentDirectory = path.dirname - @bundleCount = 0 unless @maxCount - end - if @fileCount >= bundleSize - log("Flushing because new bundle is full (#{@fileCount} sources)") - flush - end - @currentBundleText += "#include \"#{sourceFile}\"\n" - @fileCount += 1 - end -end - -def BundlePrefixAndSizeForPath(path) - topLevelDirectory = TopLevelDirectoryForPath(path.dirname) - $denseBundleFilters.each { |filter| - if path.fnmatch(filter) - return filter, MAX_DENSE_BUNDLE_SIZE - end - } - return topLevelDirectory, $maxBundleSize -end - -def TopLevelDirectoryForPath(path) - if !path - return nil - end - while path.dirname != path.dirname.dirname - path = path.dirname - end - return path -end - -def ProcessFileForUnifiedSourceGeneration(sourceFile) - path = sourceFile.path - $inputSources << sourceFile.to_s - - bundle = $bundleManagers[path.extname] - if !bundle - log("No bundle for #{path.extname} files, building #{path} standalone") - $generatedSources << sourceFile - elsif !sourceFile.unifiable - log("Not allowed to unify #{path}, building standalone") - $generatedSources << sourceFile - else - bundle.addFile(sourceFile) - end -end - -$bundleManagers = { - ".cpp" => BundleManager.new("cpp", $maxCppBundleCount), - ".c" => BundleManager.new("c", $maxCBundleCount), - ".mm" => BundleManager.new("mm", $maxObjCBundleCount) -} - -seen = {} -sourceFiles = [] - -sourceListFiles.each_with_index { - | path, sourceFileIndex | - log("Reading #{path}") - result = [] - File.read(path).lines.each { - | line | - commentStart = line =~ COMMENT_REGEXP - log("Before: #{line}") - if commentStart != nil - line = line.slice(0, commentStart) - log("After: #{line}") - end - line.strip! - - next if line.empty? - - if seen[line] - next if $mode == :GenerateXCFilelists - raise "duplicate line: #{line} in #{path}" - end - seen[line] = true - result << SourceFile.new(line, sourceFileIndex) - } - - log("Found #{result.length} source files in #{path}") - sourceFiles += result -} - -log("Found sources: #{sourceFiles.sort}") - -sourceFiles.sort.each { - | sourceFile | - case $mode - when :GenerateBundles, :GenerateXCFilelists - ProcessFileForUnifiedSourceGeneration(sourceFile) - when :PrintAllSources - $generatedSources << sourceFile - when :PrintBundledSources - $generatedSources << sourceFile if $bundleManagers[sourceFile.path.extname] && sourceFile.unifiable - end -} - -if $mode != :PrintAllSources - $bundleManagers.each_value { - | manager | - manager.flush unless manager.fileCount.zero? - - maxCount = manager.maxCount - next if !maxCount # It is nil in CMake since maxCount limitation does not exist. - - manager.flushToMax - - unless manager.extraFiles.empty? - extension = manager.extension - bundleCount = manager.bundleCount - filesToAdd = manager.extraFiles.join(", ") - raise "number of bundles for #{extension} sources, #{bundleCount}, exceeded limit, #{maxCount}. Please add #{filesToAdd} to Xcode then update UnifiedSource#{extension.capitalize}FileCount" - end - } -end - -if $mode == :GenerateXCFilelists - IO::write($inputXCFilelistPath, $inputSources.sort.join("\n") + "\n") if $inputXCFilelistPath - IO::write($outputXCFilelistPath, $outputSources.sort.join("\n") + "\n") if $outputXCFilelistPath -end - -# We use stdout to report our unified source list to CMake. -# Add trailing semicolon and avoid a trailing newline for CMake's sake. - -log($generatedSources.join(";") + ";") -print($generatedSources.join(";") + ";") diff --git a/src/csrf/lib.rs b/src/csrf/lib.rs index 40aa39a392ec..0ce67a069179 100644 --- a/src/csrf/lib.rs +++ b/src/csrf/lib.rs @@ -18,10 +18,7 @@ pub const DEFAULT_ALGORITHM: Algorithm = Algorithm::Sha256; /// Error types for CSRF operations #[derive(strum::IntoStaticStr, Debug, Clone, Copy, PartialEq, Eq)] pub enum Error { - InvalidToken, - ExpiredToken, TokenCreationFailed, - DecodingFailed, } bun_core::impl_tag_error!(Error); diff --git a/src/css_jsc/css_internals.rs b/src/css_jsc/css_internals.rs index 754f2c748f1e..9150d19da14a 100644 --- a/src/css_jsc/css_internals.rs +++ b/src/css_jsc/css_internals.rs @@ -255,17 +255,6 @@ fn parser_options_from_js( } } - // if (try jsobj.getTruthy(globalThis, "css_modules")) |val| { - // opts.css_modules = bun.css.css_modules.Config{ - // - // }; - // if (val.isObject()) { - // if (try val.getTruthy(globalThis, "pure")) |pure_val| { - // opts.css_modules.pure = pure_val.toBoolean(); - // } - // } - // } - Ok(()) } diff --git a/src/exe_format/pe.rs b/src/exe_format/pe.rs index 18a7b6fd4365..02034d59dc3c 100644 --- a/src/exe_format/pe.rs +++ b/src/exe_format/pe.rs @@ -28,8 +28,6 @@ pub enum Error { TooManySections, #[error("SectionExists")] SectionExists, - #[error("InputIsSigned")] - InputIsSigned, #[error("InvalidSecurityDirectory")] InvalidSecurityDirectory, #[error("SecurityDirInsideImage")] diff --git a/src/http/lib.rs b/src/http/lib.rs index fc09c8b32956..1e80a64c9922 100644 --- a/src/http/lib.rs +++ b/src/http/lib.rs @@ -1421,9 +1421,7 @@ pub(crate) fn print_request( let request_ = picohttp::Request { method: request.method, path: url, - minor_version: request.minor_version, headers: request.headers, - bytes_read: request.bytes_read, }; bun_core::pretty_errorln!("{}", request_.curl(ignore_insecure, body)); } @@ -2551,11 +2549,9 @@ impl<'a> HTTPClient<'a> { method: self.method.as_str().as_bytes(), // SAFETY: `url.pathname` borrows `self.url`, which outlives the returned `Request`. path: unsafe { bun_ptr::detach_lifetime(self.url.pathname) }, - minor_version: 1, // SAFETY: `request_headers_buf` is the per-HTTP-thread // `SHARED_REQUEST_HEADERS_BUF` static, outliving the returned `Request`. headers: unsafe { bun_ptr::detach_lifetime(&request_headers_buf[0..header_count]) }, - bytes_read: 0, } } diff --git a/src/install_jsc/dependency_jsc.rs b/src/install_jsc/dependency_jsc.rs deleted file mode 100644 index 96ec23bcb1c8..000000000000 --- a/src/install_jsc/dependency_jsc.rs +++ /dev/null @@ -1,211 +0,0 @@ -//! JSC bridges for `bun_install::Dependency`. The `to_js`/`from_js` surface -//! lives here as extension-trait methods on the base type. - -use bun_jsc::{CallFrame, JSGlobalObject, JSValue, JsResult, StringJsc}; - -/// Local helper: `bun_semver::String` → JS string. -#[inline] -fn semver_string_to_js( - s: bun_semver::String, - buf: &[u8], - global: &JSGlobalObject, -) -> JsResult { - bun_jsc::bun_string_jsc::create_utf8_for_js(global, s.slice(buf)) -} - -pub(crate) fn version_to_js( - dep: &bun_install::dependency::Version, - buf: &[u8], - global: &JSGlobalObject, -) -> JsResult { - use bun_core::String as BunString; - use bun_install::dependency::{self, version::Tag}; - - let object = JSValue::create_empty_object(global, 0); - object.put( - global, - b"type", - BunString::static_(<&'static str>::from(dep.tag).as_bytes()).to_js(global)?, - ); - - // `dependency::Version` keeps `Value` as a `#[repr(C)] union` - // (discriminant in `Version.tag`); the tag-checked accessors on - // `DependencyVersion` (`npm()`, `git()`, …) wrap the union read. - match dep.tag { - Tag::DistTag => { - let v = dep.dist_tag(); - object.put(global, b"name", semver_string_to_js(v.name, buf, global)?); - object.put(global, b"tag", semver_string_to_js(v.tag, buf, global)?); - } - Tag::Folder => { - let v = dep.folder(); - object.put(global, b"folder", semver_string_to_js(*v, buf, global)?); - } - Tag::Git => { - let v = dep.git(); - object.put(global, b"owner", semver_string_to_js(v.owner, buf, global)?); - object.put(global, b"repo", semver_string_to_js(v.repo, buf, global)?); - object.put( - global, - b"ref", - semver_string_to_js(v.committish, buf, global)?, - ); - } - Tag::Github => { - let v = dep.github(); - object.put(global, b"owner", semver_string_to_js(v.owner, buf, global)?); - object.put(global, b"repo", semver_string_to_js(v.repo, buf, global)?); - object.put( - global, - b"ref", - semver_string_to_js(v.committish, buf, global)?, - ); - } - Tag::Npm => { - let v = dep.npm(); - object.put(global, b"name", semver_string_to_js(v.name, buf, global)?); - let mut version_str = BunString::create_format(format_args!("{}", v.version.fmt(buf))); - object.put(global, b"version", version_str.transfer_to_js(global)?); - object.put(global, b"alias", JSValue::js_boolean(v.is_alias)); - } - Tag::Symlink => { - let v = dep.symlink(); - object.put(global, b"path", semver_string_to_js(*v, buf, global)?); - } - Tag::Workspace => { - let v = dep.workspace(); - object.put(global, b"name", semver_string_to_js(*v, buf, global)?); - } - Tag::Tarball => { - let v = dep.tarball(); - object.put( - global, - b"name", - semver_string_to_js(v.package_name, buf, global)?, - ); - match &v.uri { - dependency::tarball::Uri::Local(local) => { - object.put(global, b"path", semver_string_to_js(*local, buf, global)?); - } - dependency::tarball::Uri::Remote(remote) => { - object.put(global, b"url", semver_string_to_js(*remote, buf, global)?); - } - } - } - _ => { - return Err(global.throw_todo(b"Unsupported dependency type")); - } - } - - Ok(object) -} - -pub fn tag_infer_from_js(global: &JSGlobalObject, frame: &CallFrame) -> JsResult { - use bun_core::String as BunString; - use bun_install::dependency::{TagExt, version::Tag}; - - let arguments = frame.arguments(); - if arguments.is_empty() || !arguments[0].is_string() { - return Ok(JSValue::UNDEFINED); - } - - let dependency_str = bun_core::OwnedString::new(arguments[0].to_bun_string(global)?); - let as_utf8 = dependency_str.to_utf8(); - - let tag = Tag::infer(as_utf8.slice()); - BunString::static_(<&'static str>::from(tag)).to_js(global) -} - -/// Local helper for `log.toJS(global, msg)` — thin re-export now that -/// `bun_logger_jsc` is typed against the real `bun_jsc` surface. -#[inline] -pub(crate) fn log_to_js( - log: &bun_ast::Log, - global: &JSGlobalObject, - msg: &[u8], -) -> JsResult { - bun_ast_jsc::log_to_js(log, global, msg) -} - -pub fn dependency_from_js(global: &JSGlobalObject, frame: &CallFrame) -> JsResult { - use bun_ast::Log; - use bun_install::dependency; - use bun_semver::SlicedString; - - let arguments = frame.arguments(); - if arguments.len() == 1 { - return crate::update_request_jsc::from_js(global, arguments[0]); - } - - let alias_value: JSValue = if !arguments.is_empty() { - arguments[0] - } else { - JSValue::UNDEFINED - }; - - if !alias_value.is_string() { - return Ok(JSValue::UNDEFINED); - } - let alias_slice = alias_value.to_slice(global)?; - - if alias_slice.slice().is_empty() { - return Ok(JSValue::UNDEFINED); - } - - let name_value: JSValue = if arguments.len() > 1 { - arguments[1] - } else { - JSValue::UNDEFINED - }; - let name_slice = name_value.to_slice(global)?; - - // `StringBuilder::append` returns `&[u8]` borrowing `&mut self`, so we - // can't hold two appended slices at once. Instead, build into an owned - // `Vec` and reslice by offset (same memory layout, no aliasing fight). - let owned_buf: Vec; - let (buf, name, alias): (&[u8], &[u8], &[u8]) = if name_value.is_string() { - let nlen = name_slice.slice().len(); - let alen = alias_slice.slice().len(); - let mut v = Vec::with_capacity(nlen + alen); - v.extend_from_slice(name_slice.slice()); - v.extend_from_slice(alias_slice.slice()); - owned_buf = v; - let b: &[u8] = owned_buf.as_slice(); - (b, &b[..nlen], &b[nlen..nlen + alen]) - } else { - let a = alias_slice.slice(); - (a, a, a) - }; - - let mut log = Log::init(); - let sliced = SlicedString::init(buf, name); - - let dep: dependency::Version = match dependency::parse( - SlicedString::init(buf, alias).value(), - None, - buf, - &sliced, - Some(&mut log), - None, - ) { - Some(d) => d, - None => { - if !log.msgs.is_empty() { - return Err(global.throw_value(log_to_js( - &log, - global, - b"Failed to parse dependency", - )?)); - } - - return Ok(JSValue::UNDEFINED); - } - }; - - if !log.msgs.is_empty() { - return Err(global.throw_value(log_to_js(&log, global, b"Failed to parse dependency")?)); - } - drop(log); - - version_to_js(&dep, buf, global) -} diff --git a/src/install_jsc/lib.rs b/src/install_jsc/lib.rs index b87f47363c48..19d77e99bf3a 100644 --- a/src/install_jsc/lib.rs +++ b/src/install_jsc/lib.rs @@ -3,13 +3,11 @@ //! JSC bridge surface for `bun_install`. Keeps `src/install/` free of //! `JSValue`/`JSGlobalObject`/`CallFrame` references. //! -//! Host-fn bodies for hosted_git_info / dependency / update_request / npm / -//! install_binding compile against the `bun_jsc` + `bun_install` surface and -//! are wired into the runtime via the `dispatch_js2native` re-exports. +//! Host-fn bodies for hosted_git_info / npm / install_binding compile +//! against the `bun_jsc` + `bun_install` surface and are wired into the +//! runtime via the `dispatch_js2native` re-exports. -pub mod dependency_jsc; pub mod hosted_git_info_jsc; pub mod ini_jsc; pub mod install_binding; pub mod npm_jsc; -pub(crate) mod update_request_jsc; diff --git a/src/install_jsc/update_request_jsc.rs b/src/install_jsc/update_request_jsc.rs deleted file mode 100644 index bdaa149f3449..000000000000 --- a/src/install_jsc/update_request_jsc.rs +++ /dev/null @@ -1,91 +0,0 @@ -//! JSC bridge for `bun.install.PackageManager.UpdateRequest`. - -use bun_jsc::{JSGlobalObject, JSValue, JsResult}; - -pub(crate) fn from_js(global: &JSGlobalObject, input: JSValue) -> JsResult { - use bun_ast::Log; - use bun_install::Subcommand; - use bun_install::package_manager::update_request::{self, UpdateRequest}; - - // `to_slice_clone` returns `ZigStringSlice`; convert to owned `Vec` - // via `.into_vec()` since there is no arena backing the slices here. - let mut all_positionals: Vec> = Vec::new(); - - let mut log = Log::init(); - - if input.is_string() { - let input_str = input.to_slice_clone(global)?; - if !input_str.slice().is_empty() { - all_positionals.push(input_str.into_vec()); - } - } else if input.is_array() { - let mut iter = input.array_iterator(global)?; - while let Some(item) = iter.next()? { - let slice = item.to_slice_clone(global)?; - if slice.slice().is_empty() { - continue; - } - all_positionals.push(slice.into_vec()); - } - } else { - return Ok(JSValue::UNDEFINED); - } - - if all_positionals.is_empty() { - return Ok(JSValue::UNDEFINED); - } - - let mut array = update_request::Array::default(); - - let positionals_view: Vec<&[u8]> = all_positionals.iter().map(|s| s.as_slice()).collect(); - - let update_requests = match UpdateRequest::parse_with_error( - None, - &mut log, - &positionals_view, - &mut array, - Subcommand::Add, - false, - ) { - Ok(v) => v, - Err(_) => { - return Err(global.throw_value(crate::dependency_jsc::log_to_js( - &log, - global, - b"Failed to parse dependencies", - )?)); - } - }; - if update_requests.is_empty() { - return Ok(JSValue::UNDEFINED); - } - - if !log.msgs.is_empty() { - return Err(global.throw_value(crate::dependency_jsc::log_to_js( - &log, - global, - b"Failed to parse dependencies", - )?)); - } - - if update_requests[0].failed { - return Err(global.throw(format_args!("Failed to parse dependencies"))); - } - - let object = JSValue::create_empty_object(global, 2); - object.put( - global, - b"name", - bun_jsc::bun_string_jsc::create_utf8_for_js(global, update_requests[0].name)?, - ); - object.put( - global, - b"version", - crate::dependency_jsc::version_to_js( - &update_requests[0].version, - update_requests[0].version_buf(), - global, - )?, - ); - Ok(object) -} diff --git a/src/js/internal-for-testing.ts b/src/js/internal-for-testing.ts index 9e1e7669c3f7..a82c3ea8b938 100644 --- a/src/js/internal-for-testing.ts +++ b/src/js/internal-for-testing.ts @@ -183,15 +183,6 @@ export const npm_manifest_test_helpers = $rust("npm.rs", "PackageManifest.bindin parseManifest: (manifestFileName: string, registryUrl: string) => any; }; -// Like npm-package-arg, sort of https://www.npmjs.com/package/npm-package-arg -export type Dependency = any; -export const npa: (name: string) => Dependency = $newRustFunction("dependency.rs", "fromJS", 1); - -export const npmTag: ( - name: string, -) => undefined | "npm" | "dist_tag" | "tarball" | "folder" | "symlink" | "workspace" | "git" | "github" = - $newRustFunction("dependency.rs", "Version.Tag.inferFromJS", 1); - export const readTarball: (tarball: string) => any = $newRustFunction("pack_command.rs", "bindings.jsReadTarball", 1); export const isArchitectureMatch: (architecture: string[]) => boolean = $newRustFunction( @@ -411,8 +402,6 @@ export const structuredCloneAdvanced: ( serializationContext: SerializationContext, ) => any = $newCppFunction("StructuredClone.cpp", "jsFunctionStructuredCloneAdvanced", 5); -export const lsanDoLeakCheck = $newCppFunction("InternalForTesting.cpp", "jsFunction_lsanDoLeakCheck", 1); - export const isASANEnabled: () => boolean = $newCppFunction("InternalForTesting.cpp", "jsFunction_isASANEnabled", 0); export const BunString_toThreadSafeRefCountDelta: () => number = $newCppFunction( diff --git a/src/js/internal/fs/watch.ts b/src/js/internal/fs/watch.ts index 0a0f8e3d2cdc..4c05100dd1ef 100644 --- a/src/js/internal/fs/watch.ts +++ b/src/js/internal/fs/watch.ts @@ -262,4 +262,4 @@ function watch(path, options, listener) { return new FSWatcher(path, options, listener); } -export default { watch, FSWatcher, createIgnoreMatcher }; +export default { watch, createIgnoreMatcher }; diff --git a/src/js/internal/readline/interface.js b/src/js/internal/readline/interface.js index 29c878e4fd6e..7b0bb4326a8f 100644 --- a/src/js/internal/readline/interface.js +++ b/src/js/internal/readline/interface.js @@ -1550,7 +1550,6 @@ __node_module__.exports = { kWordRight, kWriteToOutput, kMultilinePrompt, - kRestorePreviousState, kAddNewLineOnTTY, kLastCommandErrored, }; diff --git a/src/js/internal/repl/node-primordials.js b/src/js/internal/repl/node-primordials.js index a380c2b0d145..4bdbc4ec5b32 100644 --- a/src/js/internal/repl/node-primordials.js +++ b/src/js/internal/repl/node-primordials.js @@ -9,15 +9,11 @@ // rather than realm bootstrap; SafePromiseRace additionally wraps its input in // a SafeArrayIterator because spec Promise.race reads // Array.prototype[Symbol.iterator] at CALL time. -const { SafeMap, SafeSet, SafeWeakSet, SafeStringIterator, SafeArrayIterator } = require("internal/primordials"); +const { SafeSet, SafeStringIterator, SafeArrayIterator } = require("internal/primordials"); const ArrayFromFn = Array.from; const ArrayPrototypeAtFn = Array.prototype.at; -const ArrayPrototypeConcatFn = Array.prototype.concat; const ArrayPrototypeFilterFn = Array.prototype.filter; -const ArrayPrototypeFindFn = Array.prototype.find; -const ArrayPrototypeFindLastIndexFn = Array.prototype.findLastIndex; -const ArrayPrototypeFlatFn = Array.prototype.flat; const ArrayPrototypeForEachFn = Array.prototype.forEach; const ArrayPrototypeIncludesFn = Array.prototype.includes; const ArrayPrototypeIndexOfFn = Array.prototype.indexOf; @@ -37,9 +33,7 @@ const DateNowFn = Date.now; const FunctionPrototypeBindFn = Function.prototype.bind; const JSONStringifyFn = JSON.stringify; const MathMaxFn = Math.max; -const PromisePrototypeThenFn = Promise.prototype.then; const PromiseRejectFn = Promise.reject; -const PromiseResolveFn = Promise.resolve; const PromiseRaceFn = Promise.race; const RegExpPrototypeExecFn = RegExp.prototype.exec; const RegExpPrototypeSymbolReplaceFn = RegExp.prototype[Symbol.replace]; @@ -52,7 +46,6 @@ const StringPrototypeIncludesFn = String.prototype.includes; const StringPrototypeIndexOfFn = String.prototype.indexOf; const StringPrototypeLastIndexOfFn = String.prototype.lastIndexOf; const StringPrototypeRepeatFn = String.prototype.repeat; -const StringPrototypeReplaceFn = String.prototype.replace; const StringPrototypeReplaceAllFn = String.prototype.replaceAll; const StringPrototypeSliceFn = String.prototype.slice; const StringPrototypeSplitFn = String.prototype.split; @@ -64,13 +57,8 @@ const StringPrototypeTrimStartFn = String.prototype.trimStart; export default { ArrayFrom: (...args) => ArrayFromFn.$apply(Array, args), - ArrayIsArray: Array.isArray, ArrayPrototypeAt: (a, i) => ArrayPrototypeAtFn.$call(a, i), - ArrayPrototypeConcat: (a, ...args) => ArrayPrototypeConcatFn.$apply(a, args), ArrayPrototypeFilter: (a, fn) => ArrayPrototypeFilterFn.$call(a, fn), - ArrayPrototypeFind: (a, fn) => ArrayPrototypeFindFn.$call(a, fn), - ArrayPrototypeFindLastIndex: (a, fn) => ArrayPrototypeFindLastIndexFn.$call(a, fn), - ArrayPrototypeFlat: (a, d) => ArrayPrototypeFlatFn.$call(a, d), ArrayPrototypeForEach: (a, fn) => ArrayPrototypeForEachFn.$call(a, fn), ArrayPrototypeIncludes: (a, v, i) => ArrayPrototypeIncludesFn.$call(a, v, i), ArrayPrototypeIndexOf: (a, v, i) => ArrayPrototypeIndexOfFn.$call(a, v, i), @@ -90,7 +78,6 @@ export default { Boolean, DateNow: () => DateNowFn.$call(Date), Error, - FunctionPrototype: function () {}, FunctionPrototypeBind: (fn, thisArg, ...args) => { ArrayPrototypeUnshiftFn.$call(args, thisArg); return FunctionPrototypeBindFn.$apply(fn, args); @@ -108,20 +95,15 @@ export default { NumberParseFloat: Number.parseFloat, NumberParseInt: Number.parseInt, ObjectAssign: Object.assign, - ObjectCreate: Object.create, ObjectDefineProperties: Object.defineProperties, ObjectDefineProperty: Object.defineProperty, - ObjectEntries: Object.entries, - ObjectFreeze: Object.freeze, ObjectGetOwnPropertyDescriptor: Object.getOwnPropertyDescriptor, ObjectGetOwnPropertyNames: Object.getOwnPropertyNames, ObjectGetPrototypeOf: Object.getPrototypeOf, ObjectKeys: Object.keys, ObjectSetPrototypeOf: Object.setPrototypeOf, Promise, - PromisePrototypeThen: (p, onFulfilled, onRejected) => PromisePrototypeThenFn.$call(p, onFulfilled, onRejected), PromiseReject: v => PromiseRejectFn.$call(Promise, v), - PromiseResolve: v => PromiseResolveFn.$call(Promise, v), ReflectApply: (fn, thisArg, args) => fn.$apply(thisArg, args), RegExp, RegExpPrototypeExec: (re, s) => RegExpPrototypeExecFn.$call(re, s), @@ -129,8 +111,6 @@ export default { RegExpPrototypeSymbolSplit: (re, s, limit) => RegExpPrototypeSymbolSplitFn.$call(re, s, limit), SafePromiseRace: promises => PromiseRaceFn.$call(Promise, new SafeArrayIterator(promises)), SafeSet, - SafeMap, - SafeWeakSet, SafeStringIterator, StringFromCharCode: String.fromCharCode, StringPrototypeCharAt: (s, i) => StringPrototypeCharAtFn.$call(s, i), @@ -141,7 +121,6 @@ export default { StringPrototypeIndexOf: (s, v, i) => StringPrototypeIndexOfFn.$call(s, v, i), StringPrototypeLastIndexOf: (s, v, i) => StringPrototypeLastIndexOfFn.$call(s, v, i), StringPrototypeRepeat: (s, n) => StringPrototypeRepeatFn.$call(s, n), - StringPrototypeReplace: (s, a, b) => StringPrototypeReplaceFn.$call(s, a, b), StringPrototypeReplaceAll: (s, a, b) => StringPrototypeReplaceAllFn.$call(s, a, b), StringPrototypeSlice: (s, b, e) => StringPrototypeSliceFn.$call(s, b, e), StringPrototypeSplit: (s, sep, limit) => StringPrototypeSplitFn.$call(s, sep, limit), diff --git a/src/jsc/RuntimeTranspilerStore.rs b/src/jsc/RuntimeTranspilerStore.rs index 016b9bd524a2..796b0e4eb347 100644 --- a/src/jsc/RuntimeTranspilerStore.rs +++ b/src/jsc/RuntimeTranspilerStore.rs @@ -881,7 +881,6 @@ impl TranspilerJob { input_file_fd, path.text, hash, - loader, Fd::INVALID, package_json, ); @@ -909,7 +908,6 @@ impl TranspilerJob { input_file_fd, path.text, hash, - loader, Fd::INVALID, package_json, ); diff --git a/src/jsc/VirtualMachine.rs b/src/jsc/VirtualMachine.rs index 9012d07194bb..b1c9963b2db7 100644 --- a/src/jsc/VirtualMachine.rs +++ b/src/jsc/VirtualMachine.rs @@ -3378,8 +3378,6 @@ impl VirtualMachine { if main.is_empty() { return; } - let ext = bun_paths::extension(main); - let loader = self.transpiler.options.loader(ext); let watcher = self.bun_watcher_ptr(); if !watcher.is_null() { // SAFETY: `bun_watcher` is a live `Box` leaked in @@ -3389,7 +3387,7 @@ impl VirtualMachine { // and `add_file_by_path_slow` serializes the inner watchlist write // via `Watcher.mutex`. Borrow is scoped to this single // mutex-guarded call. - let _ = unsafe { (*watcher).add_file_by_path_slow(main, loader) }; + let _ = unsafe { (*watcher).add_file_by_path_slow(main) }; } } diff --git a/src/jsc/bindings/BunObject+exports.h b/src/jsc/bindings/BunObject+exports.h index 47a1f8d280db..32ffd9c42065 100644 --- a/src/jsc/bindings/BunObject+exports.h +++ b/src/jsc/bindings/BunObject+exports.h @@ -28,7 +28,6 @@ macro(Transpiler) \ macro(ValkeyClient) \ macro(argv) \ - macro(assetPrefix) \ macro(cron) \ macro(cwd) \ macro(embeddedFiles) \ @@ -45,7 +44,6 @@ // --- Callbacks --- #define FOR_EACH_CALLBACK(macro) \ macro(allocUnsafe) \ - macro(braces) \ macro(build) \ macro(color) \ macro(connect) \ @@ -53,9 +51,6 @@ macro(createShellInterpreter) \ macro(deflateSync) \ macro(file) \ - macro(fs) \ - macro(gc) \ - macro(generateHeapSnapshot) \ macro(gunzipSync) \ macro(gzipSync) \ macro(indexOfLine) \ @@ -63,7 +58,6 @@ macro(jest) \ macro(listen) \ macro(mmap) \ - macro(nanoseconds) \ macro(openInEditor) \ macro(registerMacro) \ macro(resolve) \ diff --git a/src/jsc/bindings/ErrorCode.ts b/src/jsc/bindings/ErrorCode.ts index b36ab04d45ce..fe799f351f12 100644 --- a/src/jsc/bindings/ErrorCode.ts +++ b/src/jsc/bindings/ErrorCode.ts @@ -291,17 +291,13 @@ const errors: ErrorCodeMapping = [ ["ERR_REDIS_CONNECTION_CLOSED", Error, "RedisError"], ["ERR_REDIS_CONNECTION_TIMEOUT", Error, "RedisError"], ["ERR_REDIS_IDLE_TIMEOUT", Error, "RedisError"], - ["ERR_REDIS_INVALID_ARGUMENT", Error, "RedisError"], - ["ERR_REDIS_INVALID_ARRAY", Error, "RedisError"], ["ERR_REDIS_INVALID_BULK_STRING", Error, "RedisError"], ["ERR_REDIS_INVALID_COMMAND", Error, "RedisError"], ["ERR_REDIS_INVALID_DATABASE", Error, "RedisError"], - ["ERR_REDIS_INVALID_ERROR_STRING", Error, "RedisError"], ["ERR_REDIS_INVALID_INTEGER", Error, "RedisError"], ["ERR_REDIS_INVALID_PASSWORD", Error, "RedisError"], ["ERR_REDIS_INVALID_RESPONSE", Error, "RedisError"], ["ERR_REDIS_INVALID_RESPONSE_TYPE", Error, "RedisError"], - ["ERR_REDIS_INVALID_SIMPLE_STRING", Error, "RedisError"], ["ERR_REDIS_INVALID_STATE", Error, "RedisError"], ["ERR_REDIS_INVALID_USERNAME", Error, "RedisError"], ["ERR_REDIS_TLS_NOT_AVAILABLE", Error, "RedisError"], diff --git a/src/jsc/bindings/IDLTypes.h b/src/jsc/bindings/IDLTypes.h index 7ff9eaeaaf20..9af21e7a294b 100644 --- a/src/jsc/bindings/IDLTypes.h +++ b/src/jsc/bindings/IDLTypes.h @@ -34,11 +34,6 @@ #include #include #include -#include - -#if ENABLE(WEBGL) -#include "WebGLAny.h" -#endif namespace JSC { class ArrayBuffer; @@ -50,16 +45,7 @@ class JSObject; namespace WebCore { -class IDBKey; -class IDBKeyData; -class IDBValue; -class JSWindowProxy; class DOMPromise; -class ScheduledAction; - -#if ENABLE(WEBGL) -class WebGLExtension; -#endif template struct IDLType { @@ -92,10 +78,6 @@ struct IDLType { static ImplementationType extractValueFromNullable(NullableTypeWithLessPadding&& value) { return std::move(value.value()); } }; -// IDLUnsupportedType is a special type that serves as a base class for currently unsupported types. -struct IDLUnsupportedType : IDLType { -}; - // IDLNull is a special type for use as a subtype in an IDLUnion that is nullable. struct IDLNull : IDLType { }; @@ -290,11 +272,6 @@ template struct IDLPromise : IDLWrapper { using InnerType = T; }; -struct IDLError : IDLUnsupportedType { -}; -struct IDLDOMException : IDLUnsupportedType { -}; - template struct IDLUnion : IDLType> { using TypeList = brigand::list; @@ -344,38 +321,13 @@ struct IDLDataView : IDLBufferSource { template struct IDLTypedArray : IDLBufferSource { }; // NOTE: The specific typed array types are IDLTypedArray specialized on the typed array -// implementation type, e.g. IDLFloat64Array is IDLTypedArray +// implementation type, e.g. IDLUint8Array is IDLTypedArray // Non-WebIDL extensions -struct IDLDate : IDLType { - using ConversionResultType = WallTime; - using NullableConversionResultType = WallTime; - using NullableType = WallTime; - static WallTime nullValue() { return WallTime::nan(); } - static bool isNullValue(WallTime value) { return value.isNaN(); } - static WallTime extractValueFromNullable(WallTime value) { return value; } -}; - -struct IDLScheduledAction : IDLType> { -}; template struct IDLEventListener : IDLWrapper { }; -struct IDLIDBKey : IDLWrapper { -}; -struct IDLIDBKeyData : IDLWrapper { -}; -struct IDLIDBValue : IDLWrapper { -}; - -#if ENABLE(WEBGL) -struct IDLWebGLAny : IDLType { -}; -struct IDLWebGLExtension : IDLWrapper { -}; -#endif - // Helper predicates template diff --git a/src/jsc/bindings/InternalForTesting.cpp b/src/jsc/bindings/InternalForTesting.cpp index 69121a0e5b28..46b5faa9a3a1 100644 --- a/src/jsc/bindings/InternalForTesting.cpp +++ b/src/jsc/bindings/InternalForTesting.cpp @@ -9,10 +9,6 @@ #include #include -#if ASAN_ENABLED -#include -#endif - extern "C" void BunString__toThreadSafe(BunString* str); namespace Bun { @@ -52,17 +48,8 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_hasReifiedStatic, (JSC::JSGlobalObject * glo return JSValue::encode(jsBoolean(false)); } -JSC_DEFINE_HOST_FUNCTION(jsFunction_lsanDoLeakCheck, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) -{ -#if ASAN_ENABLED - return JSValue::encode(jsNumber(__lsan_do_recoverable_leak_check())); -#endif - return encodedJSUndefined(); -} - // Side-effect-free report of whether this binary was compiled with -// AddressSanitizer. Lets the test harness detect ASAN without running a -// stop-the-world leak check (see jsFunction_lsanDoLeakCheck). +// AddressSanitizer. Lets the test harness detect ASAN cheaply. JSC_DEFINE_HOST_FUNCTION(jsFunction_isASANEnabled, (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame)) { #if ASAN_ENABLED diff --git a/src/jsc/bindings/InternalForTesting.h b/src/jsc/bindings/InternalForTesting.h index e16a2a98b6c1..aa8a31069781 100644 --- a/src/jsc/bindings/InternalForTesting.h +++ b/src/jsc/bindings/InternalForTesting.h @@ -7,7 +7,6 @@ namespace Bun { JSC_DECLARE_HOST_FUNCTION(jsFunction_arrayBufferViewHasBuffer); JSC_DECLARE_HOST_FUNCTION(jsFunction_hasReifiedStatic); -JSC_DECLARE_HOST_FUNCTION(jsFunction_lsanDoLeakCheck); JSC_DECLARE_HOST_FUNCTION(jsFunction_isASANEnabled); JSC_DECLARE_HOST_FUNCTION(jsFunction_BunString_toThreadSafeRefCountDelta); JSC_DECLARE_HOST_FUNCTION(jsFunction_lowercaseHeaderNameSIMD); diff --git a/src/jsc/bindings/ZigGlobalObject.cpp b/src/jsc/bindings/ZigGlobalObject.cpp index 0816273b7d64..ac237a20f739 100644 --- a/src/jsc/bindings/ZigGlobalObject.cpp +++ b/src/jsc/bindings/ZigGlobalObject.cpp @@ -90,7 +90,6 @@ #include "JSBroadcastChannel.h" #include "JSBuffer.h" #include "JSBufferList.h" -#include "webcore/JSMIMEBindings.h" #include "streams/JSByteLengthQueuingStrategy.h" #include "JSCloseEvent.h" #include "JSCommonJSExtensions.h" diff --git a/src/jsc/bindings/webcore/BufferSource.h b/src/jsc/bindings/webcore/BufferSource.h index 2915b6f6d159..17e8e4a124e1 100644 --- a/src/jsc/bindings/webcore/BufferSource.h +++ b/src/jsc/bindings/webcore/BufferSource.h @@ -53,14 +53,6 @@ class BufferSource { m_variant); } - void* mutableData() const - { - return std::visit([](auto& buffer) -> void* { - return buffer->data(); - }, - m_variant); - } - size_t length() const { return std::visit([](auto& buffer) -> size_t { @@ -106,9 +98,4 @@ std::optional BufferSource::decode(Decoder& decoder) return BufferSource(JSC::ArrayBuffer::tryCreate({ static_cast(data), dataSize.value() })); } -inline BufferSource toBufferSource(const uint8_t* data, size_t length) -{ - return BufferSource(JSC::ArrayBuffer::tryCreate({ data, length })); -} - } // namespace WebCore diff --git a/src/jsc/bindings/webcore/ContextDestructionObserver.cpp b/src/jsc/bindings/webcore/ContextDestructionObserver.cpp index 1de690c45a3d..4c7758e9b193 100644 --- a/src/jsc/bindings/webcore/ContextDestructionObserver.cpp +++ b/src/jsc/bindings/webcore/ContextDestructionObserver.cpp @@ -43,11 +43,6 @@ ContextDestructionObserver::~ContextDestructionObserver() observeContext(nullptr); } -RefPtr ContextDestructionObserver::protectedScriptExecutionContext() const -{ - return m_context.get(); -} - void ContextDestructionObserver::observeContext(ScriptExecutionContext* scriptExecutionContext) { if (m_context) { diff --git a/src/jsc/bindings/webcore/ContextDestructionObserver.h b/src/jsc/bindings/webcore/ContextDestructionObserver.h index c90a25bd0adc..380d1066f3f0 100644 --- a/src/jsc/bindings/webcore/ContextDestructionObserver.h +++ b/src/jsc/bindings/webcore/ContextDestructionObserver.h @@ -13,7 +13,6 @@ class ContextDestructionObserver { WEBCORE_EXPORT virtual void contextDestroyed(); ScriptExecutionContext* scriptExecutionContext() const { return m_context.get(); } - RefPtr protectedScriptExecutionContext() const; protected: WEBCORE_EXPORT ContextDestructionObserver(ScriptExecutionContext*); diff --git a/src/jsc/bindings/webcore/Event.cpp b/src/jsc/bindings/webcore/Event.cpp index b6cd856c523a..a01e607976c3 100644 --- a/src/jsc/bindings/webcore/Event.cpp +++ b/src/jsc/bindings/webcore/Event.cpp @@ -46,8 +46,6 @@ ALWAYS_INLINE Event::Event(EventInterface eventInterface, MonotonicTime createTi , m_propagationStopped { false } , m_immediatePropagationStopped { false } , m_wasCanceled { false } - , m_defaultHandled { false } - , m_isDefaultEventHandlerIgnored { false } , m_isTrusted { isTrusted == IsTrusted::Yes } , m_isExecutingPassiveEventListener { false } , m_currentTargetIsInShadowTree { false } @@ -146,11 +144,6 @@ DOMHighResTimeStamp Event::timeStampForBindings(ScriptExecutionContext& context) return 0.0; } -void Event::resetBeforeDispatch() -{ - m_defaultHandled = false; -} - void Event::resetAfterDispatch() { m_eventPath = nullptr; diff --git a/src/jsc/bindings/webcore/Event.h b/src/jsc/bindings/webcore/Event.h index 3e4f0af32ae6..8af3f0809733 100644 --- a/src/jsc/bindings/webcore/Event.h +++ b/src/jsc/bindings/webcore/Event.h @@ -101,18 +101,11 @@ class Event : public ScriptWrappable, public RefCounted { bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; } bool immediatePropagationStopped() const { return m_immediatePropagationStopped; } - void resetBeforeDispatch(); void resetAfterDispatch(); bool defaultPrevented() const { return m_wasCanceled; } void preventDefault(); - bool defaultHandled() const { return m_defaultHandled; } - void setDefaultHandled() { m_defaultHandled = true; } - - bool isDefaultEventHandlerIgnored() const { return m_isDefaultEventHandlerIgnored; } - void setIsDefaultEventHandlerIgnored() { m_isDefaultEventHandlerIgnored = true; } - void setInPassiveListener(bool value) { m_isExecutingPassiveEventListener = value; } bool cancelBubble() const { return propagationStopped(); } @@ -122,9 +115,6 @@ class Event : public ScriptWrappable, public RefCounted { // https://dom.spec.whatwg.org/#dispatch-flag bool isBeingDispatched() const { return eventPhase(); } - virtual EventTarget* relatedTarget() const { return nullptr; } - virtual void setRelatedTarget(EventTarget*) {} - protected: explicit Event(EventInterface, IsTrusted = IsTrusted::No); Event(EventInterface, const AtomString& type, CanBubble, IsCancelable, IsComposed = IsComposed::No); @@ -146,8 +136,6 @@ class Event : public ScriptWrappable, public RefCounted { unsigned m_propagationStopped : 1; unsigned m_immediatePropagationStopped : 1; unsigned m_wasCanceled : 1; - unsigned m_defaultHandled : 1; - unsigned m_isDefaultEventHandlerIgnored : 1; unsigned m_isTrusted : 1; unsigned m_isExecutingPassiveEventListener : 1; unsigned m_currentTargetIsInShadowTree : 1; diff --git a/src/jsc/bindings/webcore/EventTarget.cpp b/src/jsc/bindings/webcore/EventTarget.cpp index 96be8f73f7d6..88ecf4d04151 100644 --- a/src/jsc/bindings/webcore/EventTarget.cpp +++ b/src/jsc/bindings/webcore/EventTarget.cpp @@ -74,11 +74,6 @@ EventTarget::~EventTarget() data->clear(); } -bool EventTarget::isNode() const -{ - return false; -} - bool EventTarget::isContextStopped() const { return !scriptExecutionContext(); @@ -237,7 +232,6 @@ void EventTarget::dispatchEvent(Event& event) event.setTarget(this); event.setCurrentTarget(this); event.setEventPhase(Event::AT_TARGET); - event.resetBeforeDispatch(); event.setEventPath(eventPath); fireEventListeners(event, EventInvokePhase::Capturing); fireEventListeners(event, EventInvokePhase::Bubbling); diff --git a/src/jsc/bindings/webcore/EventTarget.h b/src/jsc/bindings/webcore/EventTarget.h index b8b861721e4e..9fe68f94081a 100644 --- a/src/jsc/bindings/webcore/EventTarget.h +++ b/src/jsc/bindings/webcore/EventTarget.h @@ -99,8 +99,6 @@ class EventTarget : public ScriptWrappable, public CanMakeWeakPtrWithBitField; diff --git a/src/jsc/bindings/webcore/FetchHeaders.h b/src/jsc/bindings/webcore/FetchHeaders.h index f286c576976f..041202f16104 100644 --- a/src/jsc/bindings/webcore/FetchHeaders.h +++ b/src/jsc/bindings/webcore/FetchHeaders.h @@ -83,7 +83,6 @@ class FetchHeaders : public RefCounted { String fastGet(HTTPHeaderName name) const { return m_headers.get(name); } bool fastHas(HTTPHeaderName name) const { return m_headers.contains(name); } bool fastRemove(HTTPHeaderName name) { return m_headers.remove(name); } - void fastSet(HTTPHeaderName name, const String& value) { m_headers.set(name, value); } const Vector& getSetCookieHeaders() const { return m_headers.getSetCookieHeaders(); } diff --git a/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.cpp b/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.cpp index 6f246d15d77f..c1b160f4ef6c 100644 --- a/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.cpp +++ b/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.cpp @@ -34,29 +34,11 @@ HTTP_HEADERS_EACH_NAME(HTTP_HEADERS_ACCESSOR_DEFINITIONS) #undef HTTP_HEADERS_ACCESSOR_DEFINITIONS -#define HTTP_HEADERS_IDENTIFIER_ARRAY_ENTRIES(literal, name) \ - &HTTPHeaderIdentifiers::name##Identifier, - - using IdentifierGetter - = JSC::Identifier & (HTTPHeaderIdentifiers::*)(JSC::VM&); - -static IdentifierGetter headerIdentifierFields[] - = { - HTTP_HEADERS_EACH_NAME(HTTP_HEADERS_IDENTIFIER_ARRAY_ENTRIES) - }; - -JSC::Identifier& HTTPHeaderIdentifiers::identifierFor(JSC::VM& vm, HTTPHeaderName name) -{ - return (this->*headerIdentifierFields[static_cast(name)])(vm); -} - -#undef HTTP_HEADERS_IDENTIFIER_ARRAY_ENTRIES - #define HTTP_HEADERS_STRING_ARRAY_ENTRIES(literal, name) \ &HTTPHeaderIdentifiers::name##String, -using StringGetter - = JSC::JSString* (HTTPHeaderIdentifiers::*)(JSC::JSGlobalObject*); + using StringGetter + = JSC::JSString * (HTTPHeaderIdentifiers::*)(JSC::JSGlobalObject*); static StringGetter headerStringFields[] = { diff --git a/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.h b/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.h index 096394020b03..940bed26913e 100644 --- a/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.h +++ b/src/jsc/bindings/webcore/HTTPHeaderIdentifiers.h @@ -116,7 +116,6 @@ class HTTPHeaderIdentifiers { HTTPHeaderIdentifiers(); - JSC::Identifier& identifierFor(JSC::VM&, HTTPHeaderName); JSC::JSString* stringFor(JSC::JSGlobalObject*, HTTPHeaderName); template diff --git a/src/jsc/bindings/webcore/JSCookieMap.cpp b/src/jsc/bindings/webcore/JSCookieMap.cpp index e6b8ad3b53e9..7e2f2155daae 100644 --- a/src/jsc/bindings/webcore/JSCookieMap.cpp +++ b/src/jsc/bindings/webcore/JSCookieMap.cpp @@ -10,7 +10,6 @@ #include "JSDOMConstructor.h" #include "JSDOMConvertBase.h" #include "JSDOMConvertBoolean.h" -#include "JSDOMConvertDate.h" #include "JSDOMConvertInterface.h" #include "JSDOMConvertNullable.h" #include "JSDOMConvertRecord.h" diff --git a/src/jsc/bindings/webcore/JSDOMAttribute.h b/src/jsc/bindings/webcore/JSDOMAttribute.h index 054eb5b25fb3..064514e31253 100644 --- a/src/jsc/bindings/webcore/JSDOMAttribute.h +++ b/src/jsc/bindings/webcore/JSDOMAttribute.h @@ -32,10 +32,7 @@ template class IDLAttribute { public: using Setter = bool(JSC::JSGlobalObject&, JSClass&, JSC::JSValue); - using SetterPassingPropertyName = bool(JSC::JSGlobalObject&, JSClass&, JSC::JSValue, JSC::PropertyName); - using StaticSetter = bool(JSC::JSGlobalObject&, JSC::JSValue); using Getter = JSC::JSValue(JSC::JSGlobalObject&, JSClass&); - using GetterPassingPropertyName = JSC::JSValue(JSC::JSGlobalObject&, JSClass&, JSC::PropertyName); using StaticGetter = JSC::JSValue(JSC::JSGlobalObject&); template @@ -54,29 +51,6 @@ class IDLAttribute { RELEASE_AND_RETURN(throwScope, (setter(lexicalGlobalObject, *thisObject, JSC::JSValue::decode(encodedValue)))); } - // FIXME: FIXME: This can be merged with `set` if we replace the explicit setter function template parameter with a generic lambda. - template - static bool setPassingPropertyName(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::EncodedJSValue encodedValue, JSC::PropertyName attributeName) - { - auto throwScope = DECLARE_THROW_SCOPE(JSC::getVM(&lexicalGlobalObject)); - - auto* thisObject = castThisValue(lexicalGlobalObject, JSC::JSValue::decode(thisValue)); - if (!thisObject) [[unlikely]] { - if constexpr (shouldThrow == CastedThisErrorBehavior::Throw) - return JSC::throwVMDOMAttributeSetterTypeError(&lexicalGlobalObject, throwScope, JSClass::info(), attributeName); - else - return false; - } - - RELEASE_AND_RETURN(throwScope, (setter(lexicalGlobalObject, *thisObject, JSC::JSValue::decode(encodedValue), attributeName))); - } - - template - static bool setStatic(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue, JSC::EncodedJSValue encodedValue, JSC::PropertyName) - { - return setter(lexicalGlobalObject, JSC::JSValue::decode(encodedValue)); - } - template static JSC::EncodedJSValue get(JSC::JSGlobalObject& lexicalGlobalObject, JSC::EncodedJSValue thisValue, JSC::PropertyName attributeName) { diff --git a/src/jsc/bindings/webcore/JSDOMConvert.h b/src/jsc/bindings/webcore/JSDOMConvert.h index 1a8f5bcd42ae..56af6599a348 100644 --- a/src/jsc/bindings/webcore/JSDOMConvert.h +++ b/src/jsc/bindings/webcore/JSDOMConvert.h @@ -29,7 +29,6 @@ #include "JSDOMConvertBoolean.h" #include "JSDOMConvertBufferSource.h" #include "JSDOMConvertCallbacks.h" -#include "JSDOMConvertDate.h" #include "JSDOMConvertDictionary.h" #include "JSDOMConvertEnumeration.h" #include "JSDOMConvertEventListener.h" diff --git a/src/jsc/bindings/webcore/JSDOMConvertBufferSource.h b/src/jsc/bindings/webcore/JSDOMConvertBufferSource.h index e12b5c489a9f..8798f4020e7e 100644 --- a/src/jsc/bindings/webcore/JSDOMConvertBufferSource.h +++ b/src/jsc/bindings/webcore/JSDOMConvertBufferSource.h @@ -33,56 +33,8 @@ namespace WebCore { -struct IDLInt8Array : IDLTypedArray { -}; -struct IDLInt16Array : IDLTypedArray { -}; -struct IDLInt32Array : IDLTypedArray { -}; struct IDLUint8Array : IDLTypedArray { }; -struct IDLUint16Array : IDLTypedArray { -}; -struct IDLUint32Array : IDLTypedArray { -}; -struct IDLUint8ClampedArray : IDLTypedArray { -}; -struct IDLFloat16Array : IDLTypedArray { -}; -struct IDLFloat32Array : IDLTypedArray { -}; -struct IDLFloat64Array : IDLTypedArray { -}; -struct IDLBigInt64Array : IDLTypedArray { -}; -struct IDLBigUint64Array : IDLTypedArray { -}; - -inline RefPtr toPossiblySharedInt8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedInt16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedInt32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedUint8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedUint8ClampedArray(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedUint16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedUint32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedFloat16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedFloat32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedFloat64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedBigInt64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } -inline RefPtr toPossiblySharedBigUint64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toPossiblySharedNativeTypedView(vm, value); } - -inline RefPtr toUnsharedInt8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedInt16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedInt32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedUint8Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedUint8ClampedArray(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedUint16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedUint32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedFloat16Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedFloat32Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedFloat64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedBigInt64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } -inline RefPtr toUnsharedBigUint64Array(JSC::VM& vm, JSC::JSValue value) { return JSC::toUnsharedNativeTypedView(vm, value); } inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, JSC::ArrayBuffer& buffer) { @@ -120,14 +72,6 @@ inline RefPtr toPossiblySharedArrayBufferView(JSC::VM&, JS return wrapper->possiblySharedImpl(); } -inline RefPtr toUnsharedArrayBufferView(JSC::VM& vm, JSC::JSValue value) -{ - auto result = toPossiblySharedArrayBufferView(vm, value); - if (!result || result->isShared()) - return nullptr; - return result; -} - namespace Detail { enum class BufferSourceConverterAllowSharedMode { Allow, @@ -199,72 +143,6 @@ template<> struct JSConverter { } }; -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSInt8Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSInt16Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSInt32Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - template<> struct Converter : DefaultConverter { using WrapperType = JSC::JSUint8Array; using ReturnType = RefPtr; @@ -293,182 +171,6 @@ template<> struct JSConverter { } }; -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSUint16Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSUint32Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSUint8ClampedArray; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSFloat16Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSFloat32Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSFloat64Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSBigInt64Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - -template<> struct Converter : DefaultConverter { - using WrapperType = JSC::JSBigUint64Array; - using ReturnType = RefPtr; - - template - static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower()) - { - return Detail::BufferSourceConverter::convert(lexicalGlobalObject, value, std::forward(exceptionThrower)); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = true; - - template - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const U& value) - { - return toJS(&lexicalGlobalObject, &globalObject, Detail::getPtrOrRef(value)); - } -}; - template<> struct Converter : DefaultConverter { using WrapperType = JSC::JSArrayBufferView; using ReturnType = RefPtr; diff --git a/src/jsc/bindings/webcore/JSDOMConvertDate.cpp b/src/jsc/bindings/webcore/JSDOMConvertDate.cpp index 7d10f41b304c..85f946f61c64 100644 --- a/src/jsc/bindings/webcore/JSDOMConvertDate.cpp +++ b/src/jsc/bindings/webcore/JSDOMConvertDate.cpp @@ -1,53 +1,2 @@ -/* - * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) - * Copyright (C) 2004-2011, 2013, 2016 Apple Inc. All rights reserved. - * Copyright (C) 2007 Samuel Weinig - * Copyright (C) 2013 Michael Pruett - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - +// Empty: IDLDate was never used by any binding. Stubbed for the gate's stash round-trip (see MessagePortChannel.h). #include "config.h" -#include "JSDOMConvertDate.h" - -#include -#include -#include -#include - -namespace WebCore { -using namespace JSC; - -JSValue jsDate(JSGlobalObject& lexicalGlobalObject, WallTime value) -{ - return DateInstance::create(lexicalGlobalObject.vm(), lexicalGlobalObject.dateStructure(), value.secondsSinceEpoch().milliseconds()); -} - -WallTime valueToDate(JSC::JSGlobalObject& lexicalGlobalObject, JSValue value) -{ - double milliseconds = std::numeric_limits::quiet_NaN(); - - auto& vm = lexicalGlobalObject.vm(); - if (value.inherits()) - milliseconds = uncheckedDowncast(value)->internalNumber(); - else if (value.isNumber()) - milliseconds = value.asNumber(); - else if (value.isString()) - milliseconds = vm.dateCache.parseDate(&lexicalGlobalObject, vm, value.getString(&lexicalGlobalObject)); - - return WallTime::fromRawSeconds(Seconds::fromMilliseconds(milliseconds).value()); -} - -} // namespace WebCore diff --git a/src/jsc/bindings/webcore/JSDOMConvertDate.h b/src/jsc/bindings/webcore/JSDOMConvertDate.h index d12361fd6ff1..e1903a0f2b62 100644 --- a/src/jsc/bindings/webcore/JSDOMConvertDate.h +++ b/src/jsc/bindings/webcore/JSDOMConvertDate.h @@ -1,56 +1,2 @@ -/* - * Copyright (C) 2016 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - +// Empty: IDLDate was never used by any binding. Stubbed for the gate's stash round-trip (see MessagePortChannel.h). #pragma once - -#include "IDLTypes.h" -#include "JSDOMConvertBase.h" -#include -#include - -namespace WebCore { - -JSC::JSValue jsDate(JSC::JSGlobalObject&, WallTime value); -WallTime valueToDate(JSC::JSGlobalObject&, JSC::JSValue); // NaN if the value can't be converted to a date. - -template<> struct Converter : DefaultConverter { - static WallTime convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSValue value) - { - return valueToDate(lexicalGlobalObject, value); - } -}; - -template<> struct JSConverter { - static constexpr bool needsState = true; - static constexpr bool needsGlobalObject = false; - - // FIXME: This should be taking a JSDOMGlobalObject and passing it to jsDate. - static JSC::JSValue convert(JSC::JSGlobalObject& lexicalGlobalObject, WallTime value) - { - return jsDate(lexicalGlobalObject, value); - } -}; - -} // namespace WebCore diff --git a/src/jsc/bindings/webcore/JSDOMIterator.cpp b/src/jsc/bindings/webcore/JSDOMIterator.cpp index 7f522208ace1..082b204d9125 100644 --- a/src/jsc/bindings/webcore/JSDOMIterator.cpp +++ b/src/jsc/bindings/webcore/JSDOMIterator.cpp @@ -1,55 +1,2 @@ -/* - * Copyright (C) 2016 Apple, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - +// Empty: addValueIterableMethods had no callers. Stubbed for the gate's stash round-trip (see MessagePortChannel.h). #include "config.h" -#include "JSDOMIterator.h" - -#include -#include - -namespace WebCore { - -void addValueIterableMethods(JSC::JSGlobalObject& globalObject, JSC::JSObject& prototype) -{ - JSC::ArrayPrototype* arrayPrototype = globalObject.arrayPrototype(); - ASSERT(arrayPrototype); - - JSC::JSGlobalObject* lexicalGlobalObject = &globalObject; - ASSERT(lexicalGlobalObject); - auto& vm = JSC::getVM(lexicalGlobalObject); - - auto copyProperty = [&](const JSC::Identifier& arrayIdentifier, const JSC::Identifier& otherIdentifier, unsigned attributes = 0) { - JSC::JSValue value = arrayPrototype->getDirect(vm, arrayIdentifier); - ASSERT(value); - prototype.putDirect(vm, otherIdentifier, value, attributes); - }; - - copyProperty(vm.propertyNames->builtinNames().entriesPrivateName(), vm.propertyNames->builtinNames().entriesPublicName()); - copyProperty(vm.propertyNames->builtinNames().forEachPrivateName(), vm.propertyNames->builtinNames().forEachPublicName()); - copyProperty(vm.propertyNames->builtinNames().keysPrivateName(), vm.propertyNames->builtinNames().keysPublicName()); - copyProperty(vm.propertyNames->builtinNames().valuesPrivateName(), vm.propertyNames->builtinNames().valuesPublicName()); -} - -} diff --git a/src/jsc/bindings/webcore/JSDOMIterator.h b/src/jsc/bindings/webcore/JSDOMIterator.h index c69668a2de02..97e2138dbbb0 100644 --- a/src/jsc/bindings/webcore/JSDOMIterator.h +++ b/src/jsc/bindings/webcore/JSDOMIterator.h @@ -35,8 +35,6 @@ #include "JavaScriptCore/Interpreter.h" namespace WebCore { -void addValueIterableMethods(JSC::JSGlobalObject&, JSC::JSObject&); - enum class JSDOMIteratorType { Set, Map }; diff --git a/src/jsc/bindings/webcore/JSDOMOperationReturningPromise.h b/src/jsc/bindings/webcore/JSDOMOperationReturningPromise.h index 08abdc9958dd..0dc8c16aa10b 100644 --- a/src/jsc/bindings/webcore/JSDOMOperationReturningPromise.h +++ b/src/jsc/bindings/webcore/JSDOMOperationReturningPromise.h @@ -53,25 +53,6 @@ class IDLOperationReturningPromise { })); } - // This function is a special case for custom operations want to handle the creation of the promise themselves. - // It is triggered via the extended attribute [ReturnsOwnPromise]. - template::Operation operation, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::RejectPromise> - static JSC::EncodedJSValue callReturningOwnPromise(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, ASCIILiteral operationName) - { - auto* thisObject = IDLOperation::cast(lexicalGlobalObject, callFrame); - if constexpr (shouldThrow != CastedThisErrorBehavior::Assert) { - if (!thisObject) [[unlikely]] { - return rejectPromiseWithThisTypeError(lexicalGlobalObject, JSClass::info()->className, operationName); - } - } else - ASSERT(thisObject); - - ASSERT_GC_OBJECT_INHERITS(thisObject, JSClass::info()); - - // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject and thisObject. - return operation(&lexicalGlobalObject, &callFrame, thisObject); - } - template static JSC::EncodedJSValue callStatic(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, const char*) { @@ -80,15 +61,6 @@ class IDLOperationReturningPromise { return operation(&lexicalGlobalObject, &callFrame, WTF::move(promise)); })); } - - // This function is a special case for custom operations want to handle the creation of the promise themselves. - // It is triggered via the extended attribute [ReturnsOwnPromise]. - template::StaticOperation operation, CastedThisErrorBehavior shouldThrow = CastedThisErrorBehavior::RejectPromise> - static JSC::EncodedJSValue callStaticReturningOwnPromise(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, const char*) - { - // FIXME: We should refactor the binding generated code to use references for lexicalGlobalObject. - return operation(&lexicalGlobalObject, &callFrame); - } }; } // namespace WebCore diff --git a/src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp b/src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp index ca0a9e5cb231..a5e65462bcff 100644 --- a/src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp +++ b/src/jsc/bindings/webcore/JSDOMPromiseDeferred.cpp @@ -229,21 +229,6 @@ JSC::EncodedJSValue createRejectedPromiseWithTypeError(JSC::JSGlobalObject& lexi RELEASE_AND_RETURN(scope, JSValue::encode(JSC::JSPromise::rejectedPromise(&lexicalGlobalObject, rejectionValue))); } -static inline JSC::JSValue parseAsJSON(JSC::JSGlobalObject* lexicalGlobalObject, const String& data) -{ - JSC::JSLockHolder lock(lexicalGlobalObject); - return JSC::JSONParse(lexicalGlobalObject, data); -} - -void fulfillPromiseWithJSON(Ref&& promise, const String& data) -{ - JSC::JSValue value = parseAsJSON(promise->globalObject(), data); - if (!value) - promise->reject(SyntaxError); - else - promise->resolve(value); -} - void fulfillPromiseWithArrayBuffer(Ref&& promise, ArrayBuffer* arrayBuffer) { if (!arrayBuffer) { diff --git a/src/jsc/bindings/webcore/JSDOMPromiseDeferred.h b/src/jsc/bindings/webcore/JSDOMPromiseDeferred.h index 3c20c762d41c..a8062765ffb4 100644 --- a/src/jsc/bindings/webcore/JSDOMPromiseDeferred.h +++ b/src/jsc/bindings/webcore/JSDOMPromiseDeferred.h @@ -84,18 +84,6 @@ class DeferredPromise : public DOMGuarded { DEFERRED_PROMISE_HANDLE_AND_RETURN_IF_EXCEPTION(scope, lexicalGlobalObject); } - void resolveWithJSValue(JSC::JSValue resolution) - { - if (shouldIgnoreRequestToFulfill()) - return; - - ASSERT(deferred()); - ASSERT(globalObject()); - JSC::JSGlobalObject* lexicalGlobalObject = globalObject(); - JSC::JSLockHolder locker(lexicalGlobalObject); - resolve(*lexicalGlobalObject, resolution); - } - void resolve() { if (shouldIgnoreRequestToFulfill()) @@ -108,40 +96,6 @@ class DeferredPromise : public DOMGuarded { resolve(*lexicalGlobalObject, JSC::jsUndefined()); } - template - void resolveWithNewlyCreated(typename IDLType::ParameterType value) - { - if (shouldIgnoreRequestToFulfill()) - return; - - ASSERT(deferred()); - ASSERT(globalObject()); - JSC::JSGlobalObject* lexicalGlobalObject = globalObject(); - auto& vm = lexicalGlobalObject->vm(); - JSC::JSLockHolder locker(vm); - auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm); - auto value_js = toJSNewlyCreated(*lexicalGlobalObject, *globalObject(), std::forward(value)); - DEFERRED_PROMISE_HANDLE_AND_RETURN_IF_EXCEPTION(scope, lexicalGlobalObject); - resolve(*lexicalGlobalObject, value_js); - } - - template - void resolveCallbackValueWithNewlyCreated(const Function& createValue) - { - if (shouldIgnoreRequestToFulfill()) - return; - - ASSERT(deferred()); - ASSERT(globalObject()); - auto* lexicalGlobalObject = globalObject(); - auto& vm = lexicalGlobalObject->vm(); - JSC::JSLockHolder locker(vm); - auto scope = DECLARE_TOP_EXCEPTION_SCOPE(vm); - auto value_js = toJSNewlyCreated(*lexicalGlobalObject, *globalObject(), createValue(*globalObject()->scriptExecutionContext())); - DEFERRED_PROMISE_HANDLE_AND_RETURN_IF_EXCEPTION(scope, lexicalGlobalObject); - resolve(*lexicalGlobalObject, value_js); - } - template void reject(typename IDLType::ParameterType value, RejectAsHandled rejectAsHandled = RejectAsHandled::No) { @@ -232,112 +186,6 @@ class DeferredPromise : public DOMGuarded { Mode m_mode; }; -class DOMPromiseDeferredBase { - WTF_DEPRECATED_MAKE_FAST_ALLOCATED(DOMPromiseDeferredBase); - -public: - DOMPromiseDeferredBase(Ref&& genericPromise) - : m_promise(WTF::move(genericPromise)) - { - } - - DOMPromiseDeferredBase(DOMPromiseDeferredBase&& promise) - : m_promise(WTF::move(promise.m_promise)) - { - } - - DOMPromiseDeferredBase(const DOMPromiseDeferredBase& other) - : m_promise(other.m_promise.copyRef()) - { - } - - DOMPromiseDeferredBase& operator=(const DOMPromiseDeferredBase& other) - { - m_promise = other.m_promise.copyRef(); - return *this; - } - - DOMPromiseDeferredBase& operator=(DOMPromiseDeferredBase&& other) - { - m_promise = WTF::move(other.m_promise); - return *this; - } - - void reject(RejectAsHandled rejectAsHandled = RejectAsHandled::No) - { - m_promise->reject(rejectAsHandled); - } - - template - void reject(ErrorType&&... error) - { - m_promise->reject(std::forward(error)...); - } - - template - void rejectType(typename IDLType::ParameterType value, RejectAsHandled rejectAsHandled = RejectAsHandled::No) - { - m_promise->reject(std::forward(value), rejectAsHandled); - } - - JSC::JSValue promise() const { return m_promise->promise(); }; - - void whenSettled(Function&& function) - { - m_promise->whenSettled(WTF::move(function)); - } - -protected: - Ref m_promise; -}; - -template -class DOMPromiseDeferred : public DOMPromiseDeferredBase { -public: - using DOMPromiseDeferredBase::DOMPromiseDeferredBase; - using DOMPromiseDeferredBase::operator=; - using DOMPromiseDeferredBase::promise; - using DOMPromiseDeferredBase::reject; - - void resolve(typename IDLType::ParameterType value) - { - m_promise->resolve(std::forward(value)); - } - - template - void settle(ExceptionOr&& result) - { - if (result.hasException()) { - reject(result.releaseException()); - return; - } - resolve(result.releaseReturnValue()); - } -}; - -template<> class DOMPromiseDeferred : public DOMPromiseDeferredBase { -public: - using DOMPromiseDeferredBase::DOMPromiseDeferredBase; - using DOMPromiseDeferredBase::operator=; - using DOMPromiseDeferredBase::promise; - using DOMPromiseDeferredBase::reject; - - void resolve() - { - m_promise->resolve(); - } - - void settle(ExceptionOr&& result) - { - if (result.hasException()) { - reject(result.releaseException()); - return; - } - resolve(); - } -}; - -void fulfillPromiseWithJSON(Ref&&, const String&); void fulfillPromiseWithArrayBuffer(Ref&&, ArrayBuffer*); void fulfillPromiseWithArrayBuffer(Ref&&, const void*, size_t); WEBCORE_EXPORT void rejectPromiseWithExceptionIfAny(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::JSPromise&, JSC::TopExceptionScope&); diff --git a/src/jsc/bindings/webcore/JSEventListener.h b/src/jsc/bindings/webcore/JSEventListener.h index d98def60c5b3..4fe2ceadce18 100644 --- a/src/jsc/bindings/webcore/JSEventListener.h +++ b/src/jsc/bindings/webcore/JSEventListener.h @@ -78,7 +78,6 @@ class JSEventListener : public EventListener { JSEventListener(JSC::JSObject* function, JSC::JSObject* wrapper, bool isAttribute, CreatedFromMarkup, DOMWrapperWorld&); void handleEvent(ScriptExecutionContext&, Event&) override; - void setWrapperWhenInitializingJSFunction(JSC::VM&, JSC::JSObject* wrapper) const { m_wrapper = JSC::Weak(wrapper); } private: bool m_isAttribute : 1; diff --git a/src/jsc/bindings/webcore/JSMIMEBindings.cpp b/src/jsc/bindings/webcore/JSMIMEBindings.cpp index e4cc9dab9d70..5d16b07f91d3 100644 --- a/src/jsc/bindings/webcore/JSMIMEBindings.cpp +++ b/src/jsc/bindings/webcore/JSMIMEBindings.cpp @@ -1,24 +1,2 @@ -#include "root.h" -#include "JSMIMEParams.h" -#include "JSMIMEType.h" -#include "JavaScriptCore/JSObject.h" -#include "JavaScriptCore/JSCJSValueInlines.h" -#include "ZigGlobalObject.h" - -namespace WebCore { - -using namespace JSC; - -// Create the combined MIME binding object with both MIMEParams and MIMEType -JSValue createMIMEBinding(Zig::GlobalObject* globalObject) -{ - VM& vm = globalObject->vm(); - JSObject* obj = constructEmptyObject(globalObject); - - obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "MIMEParams"_s)), globalObject->m_JSMIMEParamsClassStructure.constructor(globalObject)); - obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "MIMEType"_s)), globalObject->m_JSMIMETypeClassStructure.constructor(globalObject)); - - return obj; -} - -} // namespace WebCore +// Empty: createMIMEBinding had no callers. Stubbed for the gate's stash round-trip (see MessagePortChannel.h). +#include "config.h" diff --git a/src/jsc/bindings/webcore/JSMIMEBindings.h b/src/jsc/bindings/webcore/JSMIMEBindings.h index 453364e8f14b..2d770d2eb710 100644 --- a/src/jsc/bindings/webcore/JSMIMEBindings.h +++ b/src/jsc/bindings/webcore/JSMIMEBindings.h @@ -1,14 +1,2 @@ +// Empty: createMIMEBinding had no callers. Stubbed for the gate's stash round-trip (see MessagePortChannel.h). #pragma once - -#include "root.h" - -namespace Zig { -class GlobalObject; -} - -namespace WebCore { - -// Function to create a unified MIME binding object -JSC::JSValue createMIMEBinding(Zig::GlobalObject* globalObject); - -} // namespace WebCore diff --git a/src/jsc/bindings/webcore/NetworkLoadMetrics.h b/src/jsc/bindings/webcore/NetworkLoadMetrics.h index fd031ea6ae37..d0191da718b6 100644 --- a/src/jsc/bindings/webcore/NetworkLoadMetrics.h +++ b/src/jsc/bindings/webcore/NetworkLoadMetrics.h @@ -26,40 +26,13 @@ #pragma once -#include "HTTPHeaderMap.h" -#include #include #include -#if PLATFORM(COCOA) -OBJC_CLASS NSURLConnection; -OBJC_CLASS NSURLSessionTaskMetrics; -#endif - namespace WebCore { -class ResourceHandle; - -enum class NetworkLoadPriority : uint8_t { - Low, - Medium, - High, - Unknown, -}; - -enum class PrivacyStance : uint8_t { - Unknown, - NotEligible, - Proxied, - Failed, - Direct, - FailedUnreachable, -}; - constexpr MonotonicTime reusedTLSConnectionSentinel { MonotonicTime::fromRawSeconds(-1) }; -struct AdditionalNetworkLoadMetricsForWebInspector; - class NetworkLoadMetrics { WTF_DEPRECATED_MAKE_FAST_ALLOCATED(NetworkLoadMetrics); @@ -67,14 +40,6 @@ class NetworkLoadMetrics { WEBCORE_EXPORT NetworkLoadMetrics(); bool isComplete() const { return complete; } - bool isCellular() const { return cellular; } - bool isExpensive() const { return expensive; } - bool isConstrained() const { return constrained; } - bool isMultipath() const { return multipath; } - bool reusedConnection() const { return isReusedConnection; } - bool doesFailTAOCheck() const { return failsTAOCheck; } - bool crossOriginRedirect() const { return hasCrossOriginRedirect; } - void markComplete() { complete = true; } // https://www.w3.org/TR/resource-timing-2/#attribute-descriptions MonotonicTime redirectStart; @@ -95,49 +60,10 @@ class NetworkLoadMetrics { uint16_t redirectCount { 0 }; bool complete : 1 { false }; - bool cellular : 1 { false }; - bool expensive : 1 { false }; - bool constrained : 1 { false }; - bool multipath : 1 { false }; - bool isReusedConnection : 1 { false }; bool failsTAOCheck : 1 { false }; - bool hasCrossOriginRedirect : 1 { false }; - - PrivacyStance privacyStance { PrivacyStance::Unknown }; uint64_t responseBodyBytesReceived { std::numeric_limits::max() }; uint64_t responseBodyDecodedSize { std::numeric_limits::max() }; - - RefPtr additionalNetworkLoadMetricsForWebInspector; -}; - -struct AdditionalNetworkLoadMetricsForWebInspector : public RefCounted { - - static Ref create() { return adoptRef(*new AdditionalNetworkLoadMetricsForWebInspector()); } - - NetworkLoadPriority priority { NetworkLoadPriority::Unknown }; - - String remoteAddress; - String connectionIdentifier; - - String tlsProtocol; - String tlsCipher; - - HTTPHeaderMap requestHeaders; - - uint64_t requestHeaderBytesSent { std::numeric_limits::max() }; - uint64_t responseHeaderBytesReceived { std::numeric_limits::max() }; - uint64_t requestBodyBytesSent { std::numeric_limits::max() }; - - bool isProxyConnection { false }; - -private: - AdditionalNetworkLoadMetricsForWebInspector() {} }; -#if PLATFORM(COCOA) -Box copyTimingData(NSURLConnection*, const ResourceHandle&); -WEBCORE_EXPORT Box copyTimingData(NSURLSessionTaskMetrics* incompleteMetrics, const NetworkLoadMetrics&); -#endif - } // namespace WebCore diff --git a/src/jsc/bindings/webcore/PerformanceTiming.cpp b/src/jsc/bindings/webcore/PerformanceTiming.cpp index a4081d6338ac..c114dfa453d7 100644 --- a/src/jsc/bindings/webcore/PerformanceTiming.cpp +++ b/src/jsc/bindings/webcore/PerformanceTiming.cpp @@ -150,9 +150,4 @@ unsigned long long PerformanceTiming::loadEventEnd() const return 0; } -unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(MonotonicTime timeStamp) const -{ - return timeStamp.secondsSinceEpoch().milliseconds(); -} - } // namespace WebCore diff --git a/src/jsc/bindings/webcore/PerformanceTiming.h b/src/jsc/bindings/webcore/PerformanceTiming.h index 4e5ad5526e4c..d48508a1b6bf 100644 --- a/src/jsc/bindings/webcore/PerformanceTiming.h +++ b/src/jsc/bindings/webcore/PerformanceTiming.h @@ -64,8 +64,6 @@ class PerformanceTiming : public RefCounted { private: explicit PerformanceTiming(); - - unsigned long long monotonicTimeToIntegerMilliseconds(MonotonicTime) const; }; } // namespace WebCore diff --git a/src/jsc/bindings/webcore/ResourceLoadTiming.h b/src/jsc/bindings/webcore/ResourceLoadTiming.h index 80271d70aa55..15d98acf7662 100644 --- a/src/jsc/bindings/webcore/ResourceLoadTiming.h +++ b/src/jsc/bindings/webcore/ResourceLoadTiming.h @@ -31,9 +31,6 @@ namespace WebCore { class ResourceLoadTiming { public: - void markStartTime() { m_startTime = MonotonicTime::now(); } - void markEndTime() { m_endTime = MonotonicTime::now(); } - MonotonicTime startTime() const { return m_startTime; } MonotonicTime endTime() const { return m_endTime; } diff --git a/src/jsc/bindings/webcore/ScriptWrappable.h b/src/jsc/bindings/webcore/ScriptWrappable.h index 4bff08ff7f8c..cf01a98caa10 100644 --- a/src/jsc/bindings/webcore/ScriptWrappable.h +++ b/src/jsc/bindings/webcore/ScriptWrappable.h @@ -45,9 +45,6 @@ class ScriptWrappable { void setWrapper(JSDOMObject*, JSC::WeakHandleOwner*, void*); void clearWrapper(JSDOMObject*); - template - static ptrdiff_t offsetOfWrapper() { return CAST_OFFSET(Derived*, ScriptWrappable*) + OBJECT_OFFSETOF(ScriptWrappable, m_wrapper); } - protected: ~ScriptWrappable() = default; diff --git a/src/jsc/bindings/webcore/SerializedScriptValue.cpp b/src/jsc/bindings/webcore/SerializedScriptValue.cpp index bebe18a93545..eefc903c444a 100644 --- a/src/jsc/bindings/webcore/SerializedScriptValue.cpp +++ b/src/jsc/bindings/webcore/SerializedScriptValue.cpp @@ -2306,7 +2306,6 @@ class CloneDeserializer : public CloneBase { return m_jsString; } const String& string() { return m_string; } - String takeString() { return WTF::move(m_string); } private: String m_string; diff --git a/src/jsc/hot_reloader.rs b/src/jsc/hot_reloader.rs index f287ca762600..9fdf4f6efe14 100644 --- a/src/jsc/hot_reloader.rs +++ b/src/jsc/hot_reloader.rs @@ -32,12 +32,6 @@ pub enum ImportWatcher { Watch(Box), } -// Drift guard for the bun_watcher CYCLEBREAK `Loader` newtype: its `File` -// constant must mirror `bun_ast::Loader::File` — -// the watcher stores that value for auto-watched directories. This crate sees -// both types, so the compile-time check lives here. -const _: () = assert!(bun_watcher::Loader::File.0 == bun_ast::Loader::File as u8); - impl ImportWatcher { /// Look up the `package_json` column for `hash` under the watcher's /// mutex. @@ -62,13 +56,9 @@ impl ImportWatcher { } #[inline] - pub fn add_file_by_path_slow(&mut self, file_path: &[u8], loader: bun_ast::Loader) -> bool { - // Note: bun_watcher::Loader is an opaque newtype over u8; - // wrap the bun_ast::Loader discriminant. + pub fn add_file_by_path_slow(&mut self, file_path: &[u8]) -> bool { match self { - ImportWatcher::Hot(w) | ImportWatcher::Watch(w) => { - w.add_file_by_path_slow(file_path, bun_watcher::Loader(loader as u8)) - } + ImportWatcher::Hot(w) | ImportWatcher::Watch(w) => w.add_file_by_path_slow(file_path), ImportWatcher::None => true, } } @@ -79,22 +69,15 @@ impl ImportWatcher { fd: Fd, file_path: &[u8], hash: bun_watcher::HashType, - loader: bun_ast::Loader, dir_fd: Fd, // Note: bun_watcher::PackageJSON is an opaque forward-decl; // callers cast from `&bun_resolver::PackageJSON`. package_json: Option<&'static bun_watcher::PackageJSON>, ) -> bun_sys::Result { match self { - ImportWatcher::Hot(watcher) | ImportWatcher::Watch(watcher) => watcher - .add_file::( - fd, - file_path, - hash, - bun_watcher::Loader(loader as u8), - dir_fd, - package_json, - ), + ImportWatcher::Hot(watcher) | ImportWatcher::Watch(watcher) => { + watcher.add_file::(fd, file_path, hash, dir_fd, package_json) + } ImportWatcher::None => Ok(bun_watcher::FdOwnership::Caller), } } diff --git a/src/libarchive/lib.rs b/src/libarchive/lib.rs index 5fbea29c9067..a794f9d0f02d 100644 --- a/src/libarchive/lib.rs +++ b/src/libarchive/lib.rs @@ -917,14 +917,6 @@ impl BufferReadStream { } pub(crate) fn open_read(&mut self) -> lib::Result { - // lib.archive_read_set_open_callback(this.archive, this.); - // _ = lib.archive_read_set_read_callback(this.archive, archive_read_callback); - // _ = lib.archive_read_set_seek_callback(this.archive, archive_seek_callback); - // _ = lib.archive_read_set_skip_callback(this.archive, archive_skip_callback); - // _ = lib.archive_read_set_close_callback(this.archive, archive_close_callback); - // // lib.archive_read_set_switch_callback(this.archive, this.archive_s); - // _ = lib.archive_read_set_callback_data(this.archive, this); - let archive = self.archive(); let _ = archive.read_support_format_tar(); @@ -937,47 +929,12 @@ impl BufferReadStream { // the first concatenated archive would be read. let _ = archive.read_set_options(c"read_concatenated_archives"); - // _ = lib.archive_read_support_filter_none(this.archive); - let rc = archive.read_open_memory(self.buf()); self.reading = (rc as c_int) > -1; - // _ = lib.archive_read_support_compression_all(this.archive); - rc } - - // pub fn archive_write_callback( - // archive: *Archive, - // ctx_: *anyopaque, - // buffer: *const anyopaque, - // len: usize, - // ) callconv(.c) lib.la_ssize_t { - // var this = fromCtx(ctx_); - // } - - // pub fn archive_close_callback( - // archive: *Archive, - // ctx_: *anyopaque, - // ) callconv(.c) c_int { - // var this = fromCtx(ctx_); - // } - // pub fn archive_free_callback( - // archive: *Archive, - // ctx_: *anyopaque, - // ) callconv(.c) c_int { - // var this = fromCtx(ctx_); - // } - - // pub fn archive_switch_callback( - // archive: *Archive, - // ctx1: *anyopaque, - // ctx2: *anyopaque, - // ) callconv(.c) c_int { - // var this = fromCtx(ctx1); - // var that = fromCtx(ctx2); - // } } impl Drop for BufferReadStream { diff --git a/src/md/ansi_renderer.rs b/src/md/ansi_renderer.rs index b35a5419d7c0..0deed8793f5d 100644 --- a/src/md/ansi_renderer.rs +++ b/src/md/ansi_renderer.rs @@ -2535,7 +2535,11 @@ fn probe_kitty_graphics() -> bool { Err(_) => return false, }; let mut tty_state = bun_core::tty::State::new(); - let _ = tty_state.set_mode(0, bun_core::tty::Mode::Raw, bun_core::tty::SetAttrWhen::Drain); + let _ = tty_state.set_mode( + 0, + bun_core::tty::Mode::Raw, + bun_core::tty::SetAttrWhen::Drain, + ); let _restore = scopeguard::guard((saved_termios, tty_state), |(saved, mut state)| { if bun_sys::posix::tcsetattr(0, bun_sys::posix::TCSA::Now, &saved).is_err() { let _ = state.set_mode( diff --git a/src/md/types.rs b/src/md/types.rs index b9e3820b9b5b..1f452ce614bc 100644 --- a/src/md/types.rs +++ b/src/md/types.rs @@ -157,7 +157,6 @@ pub enum LineType { Hr, Atxheader, Setextunderline, - Setextheader, Indentedcode, Fencedcode, Html, diff --git a/src/node-fallbacks/bun.lock b/src/node-fallbacks/bun.lock index 2322aea7e026..a34d182b48ef 100644 --- a/src/node-fallbacks/bun.lock +++ b/src/node-fallbacks/bun.lock @@ -7,84 +7,19 @@ "dependencies": { "assert": "^2.1.0", "browserify-zlib": "^0.2.0", - "buffer": "^6.0.3", - "console-browserify": "^1.2.0", - "constants-browserify": "^1.0.0", "crypto-browserify": "^3.12.1", "domain-browser": "^4.23.0", - "esbuild": "^0.25.12", - "events": "^3.3.0", "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "^1.0.1", - "process": "^0.11.10", "punycode": "^2.3.1", "querystring-es3": "^1.0.0-0", "react-refresh": "0.17.0", "readable-stream": "^4.7.0", "stream-http": "^3.2.0", "string_decoder": "^1.3.0", - "timers-browserify": "^2.0.12", - "tty-browserify": "^0.0.1", - "url": "^0.11.4", - "util": "^0.12.5", - "vm-browserify": "^1.1.2", }, }, }, "packages": { - "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.12", "", { "os": "aix", "cpu": "ppc64" }, "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA=="], - - "@esbuild/android-arm": ["@esbuild/android-arm@0.25.12", "", { "os": "android", "cpu": "arm" }, "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg=="], - - "@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.12", "", { "os": "android", "cpu": "arm64" }, "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg=="], - - "@esbuild/android-x64": ["@esbuild/android-x64@0.25.12", "", { "os": "android", "cpu": "x64" }, "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg=="], - - "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.12", "", { "os": "darwin", "cpu": "arm64" }, "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg=="], - - "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.12", "", { "os": "darwin", "cpu": "x64" }, "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA=="], - - "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.12", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg=="], - - "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.12", "", { "os": "freebsd", "cpu": "x64" }, "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ=="], - - "@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.12", "", { "os": "linux", "cpu": "arm" }, "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw=="], - - "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ=="], - - "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.12", "", { "os": "linux", "cpu": "ia32" }, "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA=="], - - "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.12", "", { "os": "linux", "cpu": "none" }, "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng=="], - - "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.12", "", { "os": "linux", "cpu": "none" }, "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw=="], - - "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.12", "", { "os": "linux", "cpu": "ppc64" }, "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA=="], - - "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.12", "", { "os": "linux", "cpu": "none" }, "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w=="], - - "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.12", "", { "os": "linux", "cpu": "s390x" }, "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg=="], - - "@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.12", "", { "os": "linux", "cpu": "x64" }, "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw=="], - - "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.12", "", { "os": "none", "cpu": "arm64" }, "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg=="], - - "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.12", "", { "os": "none", "cpu": "x64" }, "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ=="], - - "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.12", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A=="], - - "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.12", "", { "os": "openbsd", "cpu": "x64" }, "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw=="], - - "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.12", "", { "os": "none", "cpu": "arm64" }, "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg=="], - - "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.12", "", { "os": "sunos", "cpu": "x64" }, "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w=="], - - "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.12", "", { "os": "win32", "cpu": "arm64" }, "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg=="], - - "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.12", "", { "os": "win32", "cpu": "ia32" }, "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ=="], - - "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.12", "", { "os": "win32", "cpu": "x64" }, "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA=="], - "abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="], "asn1.js": ["asn1.js@4.10.1", "", { "dependencies": { "bn.js": "^4.0.0", "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0" } }, "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw=="], @@ -111,7 +46,7 @@ "browserify-zlib": ["browserify-zlib@0.2.0", "", { "dependencies": { "pako": "~1.0.5" } }, "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA=="], - "buffer": ["buffer@6.0.3", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="], + "buffer": ["buffer@5.0.5", "", { "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" } }, "sha512-ye69HVxM0Htf+E5YhFLOfHX8dXOkammTDtqCU5xLFMlPYTQkNJ7Kv6I90TjZiPH1yXBHQdRvSAK28EZSwSm3Dg=="], "buffer-xor": ["buffer-xor@1.0.3", "", {}, "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ=="], @@ -125,10 +60,6 @@ "cipher-base": ["cipher-base@1.0.7", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.2" } }, "sha512-Mz9QMT5fJe7bKI7MH31UilT5cEK5EHHRCccw/YRFsRY47AuNgaV6HY3rscp0/I4Q+tTW/5zoqpSeRRI54TkDWA=="], - "console-browserify": ["console-browserify@1.2.0", "", {}, "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA=="], - - "constants-browserify": ["constants-browserify@1.0.0", "", {}, "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ=="], - "core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="], "create-ecdh": ["create-ecdh@4.0.4", "", { "dependencies": { "bn.js": "^4.1.0", "elliptic": "^6.5.3" } }, "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A=="], @@ -159,8 +90,6 @@ "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="], - "esbuild": ["esbuild@0.25.12", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.12", "@esbuild/android-arm": "0.25.12", "@esbuild/android-arm64": "0.25.12", "@esbuild/android-x64": "0.25.12", "@esbuild/darwin-arm64": "0.25.12", "@esbuild/darwin-x64": "0.25.12", "@esbuild/freebsd-arm64": "0.25.12", "@esbuild/freebsd-x64": "0.25.12", "@esbuild/linux-arm": "0.25.12", "@esbuild/linux-arm64": "0.25.12", "@esbuild/linux-ia32": "0.25.12", "@esbuild/linux-loong64": "0.25.12", "@esbuild/linux-mips64el": "0.25.12", "@esbuild/linux-ppc64": "0.25.12", "@esbuild/linux-riscv64": "0.25.12", "@esbuild/linux-s390x": "0.25.12", "@esbuild/linux-x64": "0.25.12", "@esbuild/netbsd-arm64": "0.25.12", "@esbuild/netbsd-x64": "0.25.12", "@esbuild/openbsd-arm64": "0.25.12", "@esbuild/openbsd-x64": "0.25.12", "@esbuild/openharmony-arm64": "0.25.12", "@esbuild/sunos-x64": "0.25.12", "@esbuild/win32-arm64": "0.25.12", "@esbuild/win32-ia32": "0.25.12", "@esbuild/win32-x64": "0.25.12" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg=="], - "event-target-shim": ["event-target-shim@5.0.1", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="], "events": ["events@3.3.0", "", {}, "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q=="], @@ -223,22 +152,16 @@ "minimalistic-crypto-utils": ["minimalistic-crypto-utils@1.0.1", "", {}, "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg=="], - "object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="], - "object-is": ["object-is@1.1.6", "", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1" } }, "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q=="], "object-keys": ["object-keys@1.1.1", "", {}, "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="], "object.assign": ["object.assign@4.1.7", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0", "has-symbols": "^1.1.0", "object-keys": "^1.1.1" } }, "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw=="], - "os-browserify": ["os-browserify@0.3.0", "", {}, "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A=="], - "pako": ["pako@1.0.11", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="], "parse-asn1": ["parse-asn1@5.1.9", "", { "dependencies": { "asn1.js": "^4.10.1", "browserify-aes": "^1.2.0", "evp_bytestokey": "^1.0.3", "pbkdf2": "^3.1.5", "safe-buffer": "^5.2.1" } }, "sha512-fIYNuZ/HastSb80baGOuPRo1O9cf4baWw5WsAp7dBuUzeTD/BoaG8sVTdlPFksBE2lF21dN+A1AnrpIjSWqHHg=="], - "path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="], - "pbkdf2": ["pbkdf2@3.1.5", "", { "dependencies": { "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "ripemd160": "^2.0.3", "safe-buffer": "^5.2.1", "sha.js": "^2.4.12", "to-buffer": "^1.2.1" } }, "sha512-Q3CG/cYvCO1ye4QKkuH7EXxs3VC/rI1/trd+qX2+PolbaKG0H+bgcZzrTt96mMyRtejk+JMCiLUn3y29W8qmFQ=="], "possible-typed-array-names": ["possible-typed-array-names@1.1.0", "", {}, "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg=="], @@ -251,8 +174,6 @@ "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], - "qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="], - "querystring-es3": ["querystring-es3@1.0.0-0", "", { "dependencies": { "buffer": "5.0.5" } }, "sha512-0etE6Uj4NYut0/y/6pFgVRDAaFtf6x/n4xnBRL82c8n6yigRBepcgPaBAn2o8EhA9QQR1l8b1Je5s+LsJ+zS+g=="], "randombytes": ["randombytes@2.1.0", "", { "dependencies": { "safe-buffer": "^5.1.0" } }, "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ=="], @@ -271,38 +192,20 @@ "set-function-length": ["set-function-length@1.2.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2" } }, "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg=="], - "setimmediate": ["setimmediate@1.0.5", "", {}, "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="], - "sha.js": ["sha.js@2.4.12", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.0" }, "bin": { "sha.js": "bin.js" } }, "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w=="], - "side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="], - - "side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="], - - "side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="], - - "side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="], - "stream-http": ["stream-http@3.2.0", "", { "dependencies": { "builtin-status-codes": "^3.0.0", "inherits": "^2.0.4", "readable-stream": "^3.6.0", "xtend": "^4.0.2" } }, "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A=="], "string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], - "timers-browserify": ["timers-browserify@2.0.12", "", { "dependencies": { "setimmediate": "^1.0.4" } }, "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ=="], - "to-buffer": ["to-buffer@1.2.2", "", { "dependencies": { "isarray": "^2.0.5", "safe-buffer": "^5.2.1", "typed-array-buffer": "^1.0.3" } }, "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw=="], - "tty-browserify": ["tty-browserify@0.0.1", "", {}, "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw=="], - "typed-array-buffer": ["typed-array-buffer@1.0.3", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "is-typed-array": "^1.1.14" } }, "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw=="], - "url": ["url@0.11.4", "", { "dependencies": { "punycode": "^1.4.1", "qs": "^6.12.3" } }, "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg=="], - "util": ["util@0.12.5", "", { "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", "which-typed-array": "^1.1.2" } }, "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA=="], "util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="], - "vm-browserify": ["vm-browserify@1.1.2", "", {}, "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="], - "which-typed-array": ["which-typed-array@1.1.19", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw=="], "xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], @@ -321,7 +224,7 @@ "public-encrypt/bn.js": ["bn.js@4.12.2", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="], - "querystring-es3/buffer": ["buffer@5.0.5", "", { "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" } }, "sha512-ye69HVxM0Htf+E5YhFLOfHX8dXOkammTDtqCU5xLFMlPYTQkNJ7Kv6I90TjZiPH1yXBHQdRvSAK28EZSwSm3Dg=="], + "readable-stream/buffer": ["buffer@6.0.3", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="], "ripemd160/hash-base": ["hash-base@3.1.2", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.1" } }, "sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg=="], @@ -329,8 +232,6 @@ "to-buffer/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="], - "url/punycode": ["punycode@1.4.1", "", {}, "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ=="], - "browserify-sign/readable-stream/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], "browserify-sign/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="], diff --git a/src/node-fallbacks/package.json b/src/node-fallbacks/package.json index 0fa8b8318d0f..e32c3740414f 100644 --- a/src/node-fallbacks/package.json +++ b/src/node-fallbacks/package.json @@ -13,27 +13,14 @@ "dependencies": { "assert": "^2.1.0", "browserify-zlib": "^0.2.0", - "buffer": "^6.0.3", - "console-browserify": "^1.2.0", - "constants-browserify": "^1.0.0", "crypto-browserify": "^3.12.1", "domain-browser": "^4.23.0", - "esbuild": "^0.25.12", - "events": "^3.3.0", "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "^1.0.1", - "process": "^0.11.10", "punycode": "^2.3.1", "querystring-es3": "^1.0.0-0", "react-refresh": "0.17.0", "readable-stream": "^4.7.0", "stream-http": "^3.2.0", - "string_decoder": "^1.3.0", - "timers-browserify": "^2.0.12", - "tty-browserify": "^0.0.1", - "url": "^0.11.4", - "util": "^0.12.5", - "vm-browserify": "^1.1.2" + "string_decoder": "^1.3.0" } } diff --git a/src/node-fallbacks/tsconfig.json b/src/node-fallbacks/tsconfig.json index fd501f595f06..274f351c0ce2 100644 --- a/src/node-fallbacks/tsconfig.json +++ b/src/node-fallbacks/tsconfig.json @@ -2,25 +2,13 @@ "compilerOptions": { "paths": { "assert": ["./node_modules/assert"], - "buffer": ["./node_modules/buffer"], - "constants": ["./node_modules/constants-browserify"], "crypto": ["./node_modules/crypto-browserify"], "domain": ["./node_modules/domain-browser"], - "events": ["./node_modules/events"], "http": ["./node_modules/stream-http"], "https": ["./node_modules/https-browserify"], - "os": ["./node_modules/os-browserify/browser"], - "path": ["./node_modules/path-browserify"], "punycode": ["./node_modules/punycode/punycode.es6.js"], - "process": ["./node_modules/process/browser"], "querystring": ["./node_modules/querystring-es3"], - "stream": ["./node_modules/stream-browserify"], "string_decoder": ["./node_modules/string_decoder"], - "sys": ["./node_modules/util"], - "timers": ["./node_modules/timers-browserify"], - "tty": ["./node_modules/tty-browserify"], - "url": ["./node_modules/url"], - "util": ["./node_modules/util"], "zlib": ["./node_modules/browserify-zlib"] }, "noEmit": true, diff --git a/src/node-fallbacks/util.js b/src/node-fallbacks/util.js index 79b4ce6ce3bd..3be2f8754cc8 100644 --- a/src/node-fallbacks/util.js +++ b/src/node-fallbacks/util.js @@ -433,279 +433,7 @@ function reduceToSingleString(output, base, braces) { return braces[0] + base + " " + output.join(", ") + " " + braces[1]; } -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -export const types = /* @__PURE__ */ () => { - // var toStr = Object.prototype.toString; - // var fnToStr = Function.prototype.toString; - // function isArgumentsObject(value) { - // if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) { - // return false; - // } - // return toStr.apply(value) === "[object Arguments]"; - // } - // var isFnRegex = /^\s*(?:function)?\*/; - // var getProto = Object.getPrototypeOf; - // var GeneratorFunction; - // function isGeneratorFunction(fn) { - // if (typeof fn !== "function") { - // return false; - // } - // if (isFnRegex.test(fnToStr.call(fn))) { - // return true; - // } - // if (typeof GeneratorFunction === "undefined") { - // var generatorFunc; - // try { - // generatorFunc = Function("return function*() {}")(); - // } catch (e) {} - // GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; - // } - // return getProto(fn) === GeneratorFunction; - // } - // // var whichTypedArray = require("which-typed-array"); - // // var isTypedArray = require("is-typed-array"); - // function uncurryThis(f) { - // return f.call.bind(f); - // } - // var BigIntSupported = typeof BigInt !== "undefined"; - // var SymbolSupported = typeof Symbol !== "undefined"; - // var ObjectToString = uncurryThis(Object.prototype.toString); - // var numberValue = uncurryThis(Number.prototype.valueOf); - // var stringValue = uncurryThis(String.prototype.valueOf); - // var booleanValue = uncurryThis(Boolean.prototype.valueOf); - // if (BigIntSupported) { - // var bigIntValue = uncurryThis(BigInt.prototype.valueOf); - // } - // if (SymbolSupported) { - // var symbolValue = uncurryThis(Symbol.prototype.valueOf); - // } - // function checkBoxedPrimitive(value, prototypeValueOf) { - // if (typeof value !== "object") { - // return false; - // } - // try { - // prototypeValueOf(value); - // return true; - // } catch (e) { - // return false; - // } - // } - // exports.isArgumentsObject = isArgumentsObject; - // exports.isGeneratorFunction = isGeneratorFunction; - // exports.isTypedArray = isTypedArray; - // // Taken from here and modified for better browser support - // // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js - // function isPromise(input) { - // return ( - // (typeof Promise !== "undefined" && input instanceof Promise) || - // (input !== null && - // typeof input === "object" && - // typeof input.then === "function" && - // typeof input.catch === "function") - // ); - // } - // exports.isPromise = isPromise; - // function isArrayBufferView(value) { - // if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - // return ArrayBuffer.isView(value); - // } - // return isTypedArray(value) || isDataView(value); - // } - // exports.isArrayBufferView = isArrayBufferView; - // function isUint8Array(value) { - // return whichTypedArray(value) === "Uint8Array"; - // } - // exports.isUint8Array = isUint8Array; - // function isUint8ClampedArray(value) { - // return whichTypedArray(value) === "Uint8ClampedArray"; - // } - // exports.isUint8ClampedArray = isUint8ClampedArray; - // function isUint16Array(value) { - // return whichTypedArray(value) === "Uint16Array"; - // } - // exports.isUint16Array = isUint16Array; - // function isUint32Array(value) { - // return whichTypedArray(value) === "Uint32Array"; - // } - // exports.isUint32Array = isUint32Array; - // function isInt8Array(value) { - // return whichTypedArray(value) === "Int8Array"; - // } - // exports.isInt8Array = isInt8Array; - // function isInt16Array(value) { - // return whichTypedArray(value) === "Int16Array"; - // } - // exports.isInt16Array = isInt16Array; - // function isInt32Array(value) { - // return whichTypedArray(value) === "Int32Array"; - // } - // exports.isInt32Array = isInt32Array; - // function isFloat32Array(value) { - // return whichTypedArray(value) === "Float32Array"; - // } - // exports.isFloat32Array = isFloat32Array; - // function isFloat64Array(value) { - // return whichTypedArray(value) === "Float64Array"; - // } - // exports.isFloat64Array = isFloat64Array; - // function isBigInt64Array(value) { - // return whichTypedArray(value) === "BigInt64Array"; - // } - // exports.isBigInt64Array = isBigInt64Array; - // function isBigUint64Array(value) { - // return whichTypedArray(value) === "BigUint64Array"; - // } - // exports.isBigUint64Array = isBigUint64Array; - // function isMapToString(value) { - // return ObjectToString(value) === "[object Map]"; - // } - // isMapToString.working = typeof Map !== "undefined" && isMapToString(new Map()); - // function isMap(value) { - // if (typeof Map === "undefined") { - // return false; - // } - // return isMapToString.working ? isMapToString(value) : value instanceof Map; - // } - // exports.isMap = isMap; - // function isSetToString(value) { - // return ObjectToString(value) === "[object Set]"; - // } - // isSetToString.working = typeof Set !== "undefined" && isSetToString(new Set()); - // function isSet(value) { - // if (typeof Set === "undefined") { - // return false; - // } - // return isSetToString.working ? isSetToString(value) : value instanceof Set; - // } - // exports.isSet = isSet; - // function isWeakMapToString(value) { - // return ObjectToString(value) === "[object WeakMap]"; - // } - // isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(new WeakMap()); - // function isWeakMap(value) { - // if (typeof WeakMap === "undefined") { - // return false; - // } - // return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; - // } - // exports.isWeakMap = isWeakMap; - // function isWeakSetToString(value) { - // return ObjectToString(value) === "[object WeakSet]"; - // } - // isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(new WeakSet()); - // function isWeakSet(value) { - // return isWeakSetToString(value); - // } - // exports.isWeakSet = isWeakSet; - // function isArrayBufferToString(value) { - // return ObjectToString(value) === "[object ArrayBuffer]"; - // } - // isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer()); - // function isArrayBuffer(value) { - // if (typeof ArrayBuffer === "undefined") { - // return false; - // } - // return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; - // } - // exports.isArrayBuffer = isArrayBuffer; - // function isDataViewToString(value) { - // return ObjectToString(value) === "[object DataView]"; - // } - // isDataViewToString.working = - // typeof ArrayBuffer !== "undefined" && - // typeof DataView !== "undefined" && - // isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); - // function isDataView(value) { - // if (typeof DataView === "undefined") { - // return false; - // } - // return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; - // } - // exports.isDataView = isDataView; - // // Store a copy of SharedArrayBuffer in case it's deleted elsewhere - // var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : undefined; - // function isSharedArrayBufferToString(value) { - // return ObjectToString(value) === "[object SharedArrayBuffer]"; - // } - // function isSharedArrayBuffer(value) { - // if (typeof SharedArrayBufferCopy === "undefined") { - // return false; - // } - // if (typeof isSharedArrayBufferToString.working === "undefined") { - // isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); - // } - // return isSharedArrayBufferToString.working - // ? isSharedArrayBufferToString(value) - // : value instanceof SharedArrayBufferCopy; - // } - // exports.isSharedArrayBuffer = isSharedArrayBuffer; - // function isAsyncFunction(value) { - // return ObjectToString(value) === "[object AsyncFunction]"; - // } - // exports.isAsyncFunction = isAsyncFunction; - // function isMapIterator(value) { - // return ObjectToString(value) === "[object Map Iterator]"; - // } - // exports.isMapIterator = isMapIterator; - // function isSetIterator(value) { - // return ObjectToString(value) === "[object Set Iterator]"; - // } - // exports.isSetIterator = isSetIterator; - // function isGeneratorObject(value) { - // return ObjectToString(value) === "[object Generator]"; - // } - // exports.isGeneratorObject = isGeneratorObject; - // function isWebAssemblyCompiledModule(value) { - // return ObjectToString(value) === "[object WebAssembly.Module]"; - // } - // exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - // function isNumberObject(value) { - // return checkBoxedPrimitive(value, numberValue); - // } - // exports.isNumberObject = isNumberObject; - // function isStringObject(value) { - // return checkBoxedPrimitive(value, stringValue); - // } - // exports.isStringObject = isStringObject; - // function isBooleanObject(value) { - // return checkBoxedPrimitive(value, booleanValue); - // } - // exports.isBooleanObject = isBooleanObject; - // function isBigIntObject(value) { - // return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); - // } - // exports.isBigIntObject = isBigIntObject; - // function isSymbolObject(value) { - // return SymbolSupported && checkBoxedPrimitive(value, symbolValue); - // } - // exports.isSymbolObject = isSymbolObject; - // function isBoxedPrimitive(value) { - // return ( - // isNumberObject(value) || - // isStringObject(value) || - // isBooleanObject(value) || - // isBigIntObject(value) || - // isSymbolObject(value) - // ); - // } - // exports.isBoxedPrimitive = isBoxedPrimitive; - // function isAnyArrayBuffer(value) { - // return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value)); - // } - // exports.isAnyArrayBuffer = isAnyArrayBuffer; - // ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function (method) { - // Object.defineProperty(exports, method, { - // enumerable: false, - // value: function () { - // throw new Error(method + " is not supported in userland"); - // }, - // }); - // }); - // exports.types.isRegExp = isRegExp; - // exports.types.isDate = isDate; - // exports.types.isNativeError = isError; -}; +export const types = /* @__PURE__ */ () => {}; export function isArray(ar) { return Array.isArray(ar); diff --git a/src/opaque/lib.rs b/src/opaque/lib.rs index 46a32c0d6b44..8432dee9205b 100644 --- a/src/opaque/lib.rs +++ b/src/opaque/lib.rs @@ -89,16 +89,6 @@ macro_rules! opaque_ffi { pub fn opaque_mut<'a>(p: *mut Self) -> &'a mut Self { $crate::opaque_deref_mut(p) } - /// Unchecked `*mut Self → &mut Self`. See [`opaque_ref_nn`]. - /// - /// # Safety - /// `p` must be non-null. - #[inline(always)] - #[allow(dead_code)] - pub unsafe fn opaque_mut_nn<'a>(p: *mut Self) -> &'a mut Self { - // SAFETY: forwarded to caller. - unsafe { $crate::opaque_deref_mut_nn(p) } - } /// `&self → *mut Self` for FFI calls that take a non-const handle. /// /// Sound because `_p: UnsafeCell<_>` sits at offset 0 of this diff --git a/src/picohttp/lib.rs b/src/picohttp/lib.rs index b8a99b3f29c3..5f4e4e843902 100644 --- a/src/picohttp/lib.rs +++ b/src/picohttp/lib.rs @@ -260,9 +260,7 @@ impl<'a> HeaderList<'a> { pub struct Request<'a> { pub method: &'a [u8], pub path: &'a [u8], - pub minor_version: usize, pub headers: &'a [Header], - pub bytes_read: u32, } impl<'a> Request<'a> { @@ -290,10 +288,8 @@ impl<'a> Request<'a> { method: unsafe { &*core::ptr::from_ref::<[u8]>(self.method) }, // SAFETY: caller contract. path: unsafe { &*core::ptr::from_ref::<[u8]>(self.path) }, - minor_version: self.minor_version, // SAFETY: caller contract. headers: unsafe { &*core::ptr::from_ref::<[Header]>(self.headers) }, - bytes_read: self.bytes_read, } } } diff --git a/src/resolver/lib.rs b/src/resolver/lib.rs index 6976d8f56a5f..383faa0d673a 100644 --- a/src/resolver/lib.rs +++ b/src/resolver/lib.rs @@ -50,7 +50,7 @@ pub use tsconfig_json::TSConfigJSON; // `result` / `standalone_module_graph` sibling modules. /// Re-export so dependents can spell `bun_resolver::install_types::AutoInstaller`. pub use ::bun_install_types::resolver_hooks as install_types; -pub use resolver::{AnyResolveWatcher, BrowserMapPathKind, Bufs, Dirname, Resolver}; +pub use resolver::{AnyResolveWatcher, Bufs, Dirname, Resolver}; pub use result::{ DebugLogs, DirEntryResolveQueueItem, ExternalKind, FlushMode, LoadResult, MatchResult, MatchStatus, PathPair, PendingResolution, PendingResolutionTag, Result, ResultFlags, diff --git a/src/runtime/api/BunObject.rs b/src/runtime/api/BunObject.rs index cae8d6b8095c..9a5eba2d1263 100644 --- a/src/runtime/api/BunObject.rs +++ b/src/runtime/api/BunObject.rs @@ -291,7 +291,6 @@ pub mod bun_object { BunObject_callback_jest => Jest::call, BunObject_callback_listen => super::static_adapters::listener_listen, BunObject_callback_mmap => super::mmap_file, - BunObject_callback_nanoseconds => super::nanoseconds, BunObject_callback_openInEditor => super::open_in_editor, BunObject_callback_registerMacro => super::register_macro, BunObject_callback_resolve => super::resolve, @@ -1480,18 +1479,6 @@ fn index_of_line(global_this: &JSGlobalObject, callframe: &CallFrame) -> JsResul Ok(JSValue::js_number_from_int32(-1)) } -#[bun_jsc::host_fn] -fn nanoseconds(global_this: &JSGlobalObject, _: &CallFrame) -> JsResult { - // SAFETY: bun_vm() returns the live thread-local VM for a Bun-owned global. - let ns = global_this - .bun_vm() - .as_mut() - .origin_timer - .elapsed() - .as_nanos() as u64; - Ok(JSValue::js_number_from_uint64(ns)) -} - #[bun_jsc::host_fn] fn serve(global_object: &JSGlobalObject, callframe: &CallFrame) -> JsResult { let arguments = callframe.arguments(); diff --git a/src/runtime/api/csrf_jsc.rs b/src/runtime/api/csrf_jsc.rs index 3efc49d7c461..a36dc50d6b78 100644 --- a/src/runtime/api/csrf_jsc.rs +++ b/src/runtime/api/csrf_jsc.rs @@ -172,7 +172,6 @@ pub(crate) fn csrf__generate(global: &JSGlobalObject, frame: &CallFrame) -> JsRe csrf::Error::TokenCreationFailed => { global.throw(format_args!("Failed to create CSRF token")) } - _ => global.throw(format_args!("{err} Failed to generate CSRF token")), }); } }; diff --git a/src/runtime/bake/bake_body.rs b/src/runtime/bake/bake_body.rs index 3e4cc72b47bb..cdd8ab2dadcd 100644 --- a/src/runtime/bake/bake_body.rs +++ b/src/runtime/bake/bake_body.rs @@ -10,8 +10,8 @@ use core::ptr::NonNull; use bun_alloc::Arena; // = bumpalo::Bump use bun_collections::ArrayHashMap; use bun_core::Output; -use bun_jsc::{JSGlobalObject, JSValue, JsError, JsResult, ZigStringSlice}; use bun_core::{ZStr, strings}; +use bun_jsc::{JSGlobalObject, JSValue, JsError, JsResult, ZigStringSlice}; use bun_options_types::schema as bun_schema; use bun_paths::{self as paths, PathBuffer}; diff --git a/src/runtime/bake/production.rs b/src/runtime/bake/production.rs index dc586fbe917c..abf30c7c77bb 100644 --- a/src/runtime/bake/production.rs +++ b/src/runtime/bake/production.rs @@ -1624,20 +1624,6 @@ extern "C" fn BakeProdLoad(pt: *mut PerThread, key: BunString) -> BunString { BunString::dead() } -#[unsafe(no_mangle)] -extern "C" fn BakeProdSourceMap(pt: *mut PerThread, key: BunString) -> BunString { - // SAFETY: `pt` is the non-null pointer previously attached via - // BakeGlobalObject__attachPerThreadData; C++ only calls this while attached. - let pt = unsafe { &*pt }; - let utf8 = key.to_utf8(); - if let Some(value) = pt.source_maps.get(utf8.slice()) { - return pt.bundled_outputs[value.get() as usize] - .value - .to_bun_string_ref(); - } - BunString::dead() -} - /// Packed: type (u8) | no_client (bool, 1 bit) | unused (u23) #[repr(transparent)] #[derive(Clone, Copy)] diff --git a/src/runtime/cli/test_command.rs b/src/runtime/cli/test_command.rs index be81fc85e8b6..5099df021b27 100644 --- a/src/runtime/cli/test_command.rs +++ b/src/runtime/cli/test_command.rs @@ -2737,8 +2737,7 @@ impl TestCommand { let watcher = unsafe { &mut *vm.bun_watcher.cast::() }; for path in &changed_module_graph_files { - let loader = vm.transpiler.options.loader(bun_path::extension(path)); - let _ = watcher.add_file_by_path_slow(path, loader); + let _ = watcher.add_file_by_path_slow(path); } } diff --git a/src/runtime/dispatch_js2native.rs b/src/runtime/dispatch_js2native.rs index 143056933394..40c7af64135e 100644 --- a/src/runtime/dispatch_js2native.rs +++ b/src/runtime/dispatch_js2native.rs @@ -22,8 +22,6 @@ pub use bun_sql_jsc::postgres::create_binding as sql_jsc_postgres_create_binding // The real body already lives in this crate. pub(crate) use crate::api::crash_handler_jsc::js_bindings::generate as crash_handler_crash_handler_js_bindings_generate; -pub use bun_install_jsc::dependency_jsc::dependency_from_js as install_dependency_from_js; -pub use bun_install_jsc::dependency_jsc::tag_infer_from_js as install_dependency_version_tag_infer_from_js; pub use bun_install_jsc::hosted_git_info_jsc::js_from_url as install_hosted_git_info_testing_ap_is_js_from_url; pub use bun_install_jsc::hosted_git_info_jsc::js_parse_url as install_hosted_git_info_testing_ap_is_js_parse_url; pub use bun_install_jsc::install_binding::bun_install_js_bindings::generate as install_jsc_install_binding_bun_install_js_bindings_generate; diff --git a/src/runtime/jsc_hooks.rs b/src/runtime/jsc_hooks.rs index d921be6555ea..207594c02e54 100644 --- a/src/runtime/jsc_hooks.rs +++ b/src/runtime/jsc_hooks.rs @@ -2588,7 +2588,6 @@ fn transpile_source_code_inner( is_node_override, path, hash, - loader, package_json, ); } @@ -2637,7 +2636,6 @@ fn transpile_source_code_inner( is_node_override, path, hash, - loader, package_json, ); } @@ -3359,14 +3357,8 @@ fn transpile_source_code_inner( let watcher = unsafe { &mut *(*jsc_vm).bun_watcher.cast::() }; if !matches!( - watcher.add_file::( - input_fd, - path.text, - hash, - loader, - bun_sys::Fd::INVALID, - None, - ), + watcher + .add_file::(input_fd, path.text, hash, bun_sys::Fd::INVALID, None,), Ok(bun_watcher::FdOwnership::Watcher) ) { // Not adopted (already watched, or add failed); close the @@ -3453,7 +3445,6 @@ fn maybe_watch_file( is_node_override: bool, path: &Fs::Path, hash: u32, - loader: Loader, package_json: Option<&'static bun_watcher::PackageJSON>, ) { // SAFETY: per fn contract — `jsc_vm` is the live per-thread VM. @@ -3477,7 +3468,6 @@ fn maybe_watch_file( input_file_fd, path.text, hash, - loader, bun_sys::Fd::INVALID, package_json, ), diff --git a/src/runtime/node.rs b/src/runtime/node.rs index 16fa3d73220b..148c32f7d057 100644 --- a/src/runtime/node.rs +++ b/src/runtime/node.rs @@ -16,8 +16,8 @@ pub mod assert { #[path = "node/types.rs"] pub mod types; pub use types::{ - BlobOrStringOrBuffer, Dirent, Encoding, FileSystemFlags, PathLike, PathOrBlob, - PathOrFileDescriptor, StringOrBuffer, Valid, VectorArrayBuffer, mode_from_js, + BlobOrStringOrBuffer, Dirent, Encoding, PathLike, PathOrBlob, PathOrFileDescriptor, + StringOrBuffer, mode_from_js, }; pub use bun_jsc::MarkedArrayBuffer as Buffer; diff --git a/src/runtime/node/assert/myers_diff.rs b/src/runtime/node/assert/myers_diff.rs index f46e94edf257..c699df4af111 100644 --- a/src/runtime/node/assert/myers_diff.rs +++ b/src/runtime/node/assert/myers_diff.rs @@ -370,12 +370,8 @@ pub enum Error { DiffTooLarge, #[error("InputsTooLarge")] InputsTooLarge, - #[error("OutOfMemory")] - OutOfMemory, } -bun_core::oom_from_alloc!(Error); - #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum DiffKind { Insert, diff --git a/src/runtime/node/fs_events.rs b/src/runtime/node/fs_events.rs index 16159194793f..ecda26ea0fb9 100644 --- a/src/runtime/node/fs_events.rs +++ b/src/runtime/node/fs_events.rs @@ -93,7 +93,6 @@ const K_FS_EVENTS_RENAMED: c_int = K_FS_EVENT_STREAM_EVENT_FLAG_ITEM_CREATED | K_FS_EVENT_STREAM_EVENT_FLAG_ITEM_RENAMED; static FSEVENTS_DEFAULT_LOOP_MUTEX: Mutex = Mutex::new(); -#[cfg_attr(not(target_os = "macos"), allow(dead_code))] static FSEVENTS_DEFAULT_LOOP: std::sync::OnceLock<&'static FSEventsLoop> = std::sync::OnceLock::new(); @@ -816,7 +815,6 @@ impl FSEventsLoop { unsafe { (cf.run_loop_stop)(self.loop_.load(Ordering::Relaxed)) }; } - #[cfg_attr(not(target_os = "macos"), allow(dead_code))] fn shutdown(&'static self) { // SAFETY: `thread` is only touched here and in `init()`, always on the JS thread under `FSEVENTS_DEFAULT_LOOP_MUTEX`. let Some(thread) = (unsafe { (*self.thread.get()).take() }) else { @@ -872,7 +870,6 @@ pub type Callback = fn(ctx: *mut c_void, event: Event, is_file: bool); pub(crate) type UpdateEndCallback = fn(ctx: *mut c_void); impl FSEventsWatcher { - #[cfg_attr(not(target_os = "macos"), allow(dead_code))] fn init( loop_: &'static FSEventsLoop, path: &[u8], diff --git a/src/runtime/node/node_assert.rs b/src/runtime/node/node_assert.rs index d3bdb9b83b6c..847e712680fa 100644 --- a/src/runtime/node/node_assert.rs +++ b/src/runtime/node/node_assert.rs @@ -149,7 +149,6 @@ impl PojoFields for Diff { fn map_diff_error(global: &JSGlobalObject, err: MyersDiff::Error) -> JsError { match err { - MyersDiff::Error::OutOfMemory => JsError::OutOfMemory, MyersDiff::Error::DiffTooLarge => global.throw_invalid_arguments(format_args!( "Diffing these two values would create a string that is too large. If this was intentional, please open a bug report on GitHub.", )), diff --git a/src/runtime/node/node_cluster_binding.rs b/src/runtime/node/node_cluster_binding.rs index 2af8b0d38d80..141286569024 100644 --- a/src/runtime/node/node_cluster_binding.rs +++ b/src/runtime/node/node_cluster_binding.rs @@ -22,7 +22,6 @@ bun_output::declare_scope!(IPC, visible); // shims take only the global plus by-value `JSValue`s, so the validity proof // lives in the type signature. unsafe extern "C" { - pub safe fn Bun__Process__queueNextTick1(global: &JSGlobalObject, f: JSValue, arg: JSValue); pub(crate) safe fn Process__emitErrorEvent(global: &JSGlobalObject, value: JSValue); } diff --git a/src/runtime/server/server_body.rs b/src/runtime/server/server_body.rs index 309f72865893..2867551551ae 100644 --- a/src/runtime/server/server_body.rs +++ b/src/runtime/server/server_body.rs @@ -492,7 +492,10 @@ pub mod BunInfo { // `JSON.toAST(allocator, BunInfo, info)` — hand-expanded: let platform_props = bun_alloc::AstAlloc::vec_from_iter([ prop(b"os", str_expr(os_tag_name(info.platform.os))), - prop(b"arch", str_expr(arch_tag_name(bun_core::Environment::ARCH))), + prop( + b"arch", + str_expr(arch_tag_name(bun_core::Environment::ARCH)), + ), prop(b"version", str_expr(info.platform.version)), ]); let platform_expr = Expr::init( diff --git a/src/runtime/valkey_jsc/protocol_jsc.rs b/src/runtime/valkey_jsc/protocol_jsc.rs index b1cec30f944c..a39a22303062 100644 --- a/src/runtime/valkey_jsc/protocol_jsc.rs +++ b/src/runtime/valkey_jsc/protocol_jsc.rs @@ -20,23 +20,17 @@ pub(crate) fn valkey_error_to_js( RedisError::ConnectionClosed => JscError::REDIS_CONNECTION_CLOSED, RedisError::InvalidResponse => JscError::REDIS_INVALID_RESPONSE, RedisError::InvalidBulkString => JscError::REDIS_INVALID_BULK_STRING, - RedisError::InvalidArray => JscError::REDIS_INVALID_ARRAY, RedisError::InvalidInteger => JscError::REDIS_INVALID_INTEGER, - RedisError::InvalidSimpleString => JscError::REDIS_INVALID_SIMPLE_STRING, - RedisError::InvalidErrorString => JscError::REDIS_INVALID_ERROR_STRING, RedisError::InvalidDouble | RedisError::InvalidBoolean - | RedisError::InvalidNull | RedisError::InvalidMap | RedisError::InvalidSet - | RedisError::InvalidBigNumber | RedisError::InvalidVerbatimString | RedisError::InvalidBlobError | RedisError::InvalidAttribute | RedisError::InvalidPush => JscError::REDIS_INVALID_RESPONSE, RedisError::AuthenticationFailed => JscError::REDIS_AUTHENTICATION_FAILED, RedisError::InvalidCommand => JscError::REDIS_INVALID_COMMAND, - RedisError::InvalidArgument => JscError::REDIS_INVALID_ARGUMENT, RedisError::UnsupportedProtocol => JscError::REDIS_INVALID_RESPONSE, RedisError::InvalidResponseType => JscError::REDIS_INVALID_RESPONSE_TYPE, RedisError::ConnectionTimeout => JscError::REDIS_CONNECTION_TIMEOUT, diff --git a/src/sha_hmac/lib.rs b/src/sha_hmac/lib.rs index a64dd03bf3a1..9aab29fdbb59 100644 --- a/src/sha_hmac/lib.rs +++ b/src/sha_hmac/lib.rs @@ -9,4 +9,4 @@ pub use sha::evp; // Crate-root re-exports // so dependents can write `bun_sha_hmac::SHA256` / `bun_sha_hmac::generate`. pub use hmac::generate; -pub use sha::{Algorithm, MD4, MD5, MD5_SHA1, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512_256}; +pub use sha::{Algorithm, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512_256}; diff --git a/src/sha_hmac/sha.rs b/src/sha_hmac/sha.rs index 0a179500b43b..4d9ce3a0d45c 100644 --- a/src/sha_hmac/sha.rs +++ b/src/sha_hmac/sha.rs @@ -17,9 +17,8 @@ pub mod ffi { pub use bun_boringssl_sys::{ ENGINE, EVP_Digest, EVP_DigestFinal, EVP_DigestInit, EVP_DigestUpdate, EVP_MD, EVP_MD_CTX, EVP_MD_CTX_cleanup, EVP_MD_CTX_init, EVP_blake2b256, EVP_blake2b512, EVP_md4, EVP_md5, - EVP_md5_sha1, EVP_ripemd160, EVP_sha1, EVP_sha3_224, EVP_sha3_256, EVP_sha3_384, - EVP_sha3_512, EVP_sha224, EVP_sha256, EVP_sha384, EVP_sha512, EVP_sha512_224, - EVP_sha512_256, HMAC, + EVP_ripemd160, EVP_sha1, EVP_sha3_224, EVP_sha3_256, EVP_sha3_384, EVP_sha3_512, + EVP_sha224, EVP_sha256, EVP_sha384, EVP_sha512, EVP_sha512_224, EVP_sha512_256, HMAC, }; /// `#define EVP_MAX_MD_SIZE 64` — SHA-512 is the longest digest. Re-typed @@ -194,8 +193,6 @@ pub mod evp { new_evp!(SHA384, SHA384_DIGEST_LENGTH, EVP_sha384); new_evp!(SHA256, SHA256_DIGEST_LENGTH, EVP_sha256); new_evp!(SHA512_256, SHA512_256_DIGEST_LENGTH, EVP_sha512_256); - new_evp!(MD5_SHA1, 36, EVP_md5_sha1); // EVP_md5_sha1 writes MD5(16) || SHA1(20) = 36 bytes - new_evp!(Blake2, 256 / 8, EVP_blake2b256); // ────────────────────────────────────────────────────────────────────── // evp::Algorithm — moved from bun_jsc::api::bun::crypto, @@ -274,7 +271,6 @@ pub mod evp { pub use evp::Algorithm; pub use evp::MD4; pub use evp::MD5; -pub use evp::MD5_SHA1; pub use evp::SHA1; pub use evp::SHA224; pub use evp::SHA256; @@ -296,26 +292,6 @@ pub mod hashers { boringssl_sys::SHA1_Final ); - new_hasher!( - SHA512, - SHA512_DIGEST_LENGTH, - boringssl_sys::SHA512_CTX, - boringssl_sys::SHA512, - boringssl_sys::SHA512_Init, - boringssl_sys::SHA512_Update, - boringssl_sys::SHA512_Final - ); - - new_hasher!( - SHA384, - SHA384_DIGEST_LENGTH, - boringssl_sys::SHA512_CTX, - boringssl_sys::SHA384, - boringssl_sys::SHA384_Init, - boringssl_sys::SHA384_Update, - boringssl_sys::SHA384_Final - ); - new_hasher!( SHA256, SHA256_DIGEST_LENGTH, @@ -325,24 +301,4 @@ pub mod hashers { boringssl_sys::SHA256_Update, boringssl_sys::SHA256_Final ); - - new_hasher!( - SHA512_256, - SHA512_256_DIGEST_LENGTH, - boringssl_sys::SHA512_CTX, - boringssl_sys::SHA512_256, - boringssl_sys::SHA512_256_Init, - boringssl_sys::SHA512_256_Update, - boringssl_sys::SHA512_256_Final - ); - - new_hasher!( - RIPEMD160, - boringssl_sys::RIPEMD160_DIGEST_LENGTH as usize, - boringssl_sys::RIPEMD160_CTX, - boringssl_sys::RIPEMD160, - boringssl_sys::RIPEMD160_Init, - boringssl_sys::RIPEMD160_Update, - boringssl_sys::RIPEMD160_Final - ); } diff --git a/src/sql_jsc/jsc.rs b/src/sql_jsc/jsc.rs index 1991c743fa4c..60505c2bd7f3 100644 --- a/src/sql_jsc/jsc.rs +++ b/src/sql_jsc/jsc.rs @@ -27,10 +27,9 @@ use core::ptr::NonNull; // ────────────────────────────────────────────────────────────────────────── pub use bun_jsc::{ - ArrayBuffer, CallFrame, CoerceTo, ErrorBuilder, ErrorCode, ExternColumnIdentifier, - ExternColumnIdentifierValue, GlobalRef, JSArrayIterator, JSCell, JSGlobalObject, JSObject, - JSType, JSValue, JsCell, JsError, JsRef, JsResult, MarkedArgumentBuffer, StringJsc, - StrongOptional, ThrowFmtArgs, ZigStringJsc, bun_string_jsc, host_fn, + ArrayBuffer, CallFrame, ErrorBuilder, ErrorCode, ExternColumnIdentifier, GlobalRef, + JSArrayIterator, JSCell, JSGlobalObject, JSObject, JSType, JSValue, JsCell, JsError, JsRef, + JsResult, MarkedArgumentBuffer, StringJsc, StrongOptional, bun_string_jsc, host_fn, }; /// Re-export — `bun_jsc` now defines `IntegerRange` at its crate root and the @@ -523,7 +522,6 @@ pub mod api { } } } - pub use SSLConfig as SslConfig; } /// PascalCase namespace alias. #[allow(non_snake_case)] diff --git a/src/sys/windows/mod.rs b/src/sys/windows/mod.rs index 8375d9f4ea51..7a0e312b0930 100644 --- a/src/sys/windows/mod.rs +++ b/src/sys/windows/mod.rs @@ -106,7 +106,6 @@ pub type PVOID = LPVOID; pub use bun_windows_sys::COORD; pub use bun_windows_sys::FALSE; pub use bun_windows_sys::FILE_BEGIN; -pub use bun_windows_sys::FILE_CURRENT; pub use bun_windows_sys::FILE_END; pub use bun_windows_sys::FILE_OPEN; pub use bun_windows_sys::INVALID_HANDLE_VALUE; @@ -120,11 +119,9 @@ pub use bun_windows_sys::NT_ERROR; pub use bun_windows_sys::NT_SUCCESS; pub use bun_windows_sys::NTSTATUS; pub use bun_windows_sys::PWSTR; -pub use bun_windows_sys::STATUS_SUCCESS; pub use bun_windows_sys::TRUE; pub use bun_windows_sys::UINT; pub use bun_windows_sys::ULONG; -pub use bun_windows_sys::ULONGLONG; pub use bun_windows_sys::UNICODE_STRING; pub use bun_windows_sys::WCHAR; /// `STARTF_USESTDHANDLES` (winbase.h). @@ -138,18 +135,11 @@ pub use bun_windows_sys::FILETIME; pub use bun_windows_sys::DUPLICATE_SAME_ACCESS; pub use bun_windows_sys::FILE_ALL_INFORMATION; -pub use bun_windows_sys::FILE_ATTRIBUTE_ARCHIVE; -pub use bun_windows_sys::FILE_ATTRIBUTE_COMPRESSED; -pub use bun_windows_sys::FILE_ATTRIBUTE_DEVICE; pub use bun_windows_sys::FILE_ATTRIBUTE_DIRECTORY; pub use bun_windows_sys::FILE_ATTRIBUTE_HIDDEN; pub use bun_windows_sys::FILE_ATTRIBUTE_NORMAL; -pub use bun_windows_sys::FILE_ATTRIBUTE_NOT_CONTENT_INDEXED; -pub use bun_windows_sys::FILE_ATTRIBUTE_OFFLINE; pub use bun_windows_sys::FILE_ATTRIBUTE_READONLY; pub use bun_windows_sys::FILE_ATTRIBUTE_REPARSE_POINT; -pub use bun_windows_sys::FILE_ATTRIBUTE_SPARSE_FILE; -pub use bun_windows_sys::FILE_ATTRIBUTE_SYSTEM; pub use bun_windows_sys::FILE_ATTRIBUTE_TEMPORARY; pub use bun_windows_sys::FILE_BASIC_INFORMATION; pub use bun_windows_sys::FILE_DEVICE_CONSOLE; @@ -163,12 +153,10 @@ pub use bun_windows_sys::FILE_INFO_BY_HANDLE_CLASS; pub use bun_windows_sys::FILE_INFORMATION_CLASS; pub use bun_windows_sys::FILE_NON_DIRECTORY_FILE; pub use bun_windows_sys::FILE_OPEN_REPARSE_POINT; -pub use bun_windows_sys::FILE_SEQUENTIAL_ONLY; pub use bun_windows_sys::FILE_SHARE_DELETE; pub use bun_windows_sys::FILE_SHARE_READ; pub use bun_windows_sys::FILE_SHARE_WRITE; pub use bun_windows_sys::FILE_SYNCHRONOUS_IO_NONALERT; -pub use bun_windows_sys::FILE_WRITE_THROUGH; pub use bun_windows_sys::FS_INFORMATION_CLASS; pub use bun_windows_sys::IO_STATUS_BLOCK; pub use bun_windows_sys::OBJECT_ATTRIBUTES; @@ -177,13 +165,11 @@ pub use bun_windows_sys::advapi32; pub use bun_windows_sys::kernel32::SetConsoleCtrlHandler; pub use bun_windows_sys::user32; pub use bun_windows_sys::{CONSOLE_SCREEN_BUFFER_INFO, SMALL_RECT}; -pub use bun_windows_sys::{ - CTRL_BREAK_EVENT, CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT, -}; +pub use bun_windows_sys::{CTRL_BREAK_EVENT, CTRL_C_EVENT, CTRL_CLOSE_EVENT}; pub use bun_windows_sys::{DELETE, GENERIC_READ, GENERIC_WRITE, SYNCHRONIZE}; pub use bun_windows_sys::{ - FILE_FLAG_OVERLAPPED, PIPE_ACCESS_DUPLEX, PIPE_ACCESS_INBOUND, PIPE_ACCESS_OUTBOUND, - PIPE_READMODE_BYTE, PIPE_TYPE_BYTE, PIPE_WAIT, SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE, + FILE_FLAG_OVERLAPPED, PIPE_ACCESS_INBOUND, PIPE_ACCESS_OUTBOUND, PIPE_READMODE_BYTE, + PIPE_TYPE_BYTE, PIPE_WAIT, SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE, SYMBOLIC_LINK_FLAG_DIRECTORY, }; pub use bun_windows_sys::{FILE_READ_ATTRIBUTES, FILE_READ_DATA, FILE_READ_EA, FILE_TRAVERSE}; @@ -552,8 +538,6 @@ pub fn CreateHardLinkW( pub use bun_windows_sys::externs::CopyFileW; -pub use bun_windows_sys::externs::SetFileInformationByHandle; - pub fn get_last_errno() -> E { SystemErrno::init(kernel32::GetLastError()) .unwrap_or(SystemErrno::EUNKNOWN) @@ -632,8 +616,6 @@ pub use bun_windows_sys::externs::{ SetEnvironmentVariableW, WAITORTIMERCALLBACK, WT_EXECUTEONLYONCE, }; -pub use bun_windows_sys::externs::ResumeThread; - // Job Object structures + JOBOBJECTINFOCLASS consts — canonical definitions // live in bun_windows_sys::externs; Zeroable impls for these nominal types // live in bun_core/lib.rs (orphan-rule home). Do NOT re-declare here. diff --git a/src/valkey/valkey_protocol.rs b/src/valkey/valkey_protocol.rs index 50c9ea63a056..73a3adabcadc 100644 --- a/src/valkey/valkey_protocol.rs +++ b/src/valkey/valkey_protocol.rs @@ -6,24 +6,18 @@ use bstr::BStr; pub enum RedisError { AuthenticationFailed, ConnectionClosed, - InvalidArgument, - InvalidArray, InvalidAttribute, - InvalidBigNumber, InvalidBlobError, InvalidBoolean, InvalidBulkString, InvalidCommand, InvalidDouble, - InvalidErrorString, InvalidInteger, InvalidMap, - InvalidNull, InvalidPush, InvalidResponse, InvalidResponseType, InvalidSet, - InvalidSimpleString, InvalidVerbatimString, JSError, OutOfMemory, diff --git a/src/watcher/Watcher.rs b/src/watcher/Watcher.rs index 31080905b30d..b4444d074ba0 100644 --- a/src/watcher/Watcher.rs +++ b/src/watcher/Watcher.rs @@ -8,7 +8,6 @@ use bun_core::{ThreadLock, ZStr, feature_flags, output as Output, strings, zstr} use bun_sys::{self as sys, Fd}; use bun_threading::Mutex; -use crate::Loader; use crate::watcher_trace as WatcherTrace; // Android: same kernel inotify ABI as glibc/musl Linux, so list both. @@ -508,7 +507,6 @@ impl Watcher { fd: Fd, file_path: &[u8], hash: HashType, - loader: Loader, parent_hash: HashType, package_json: Option<&'static PackageJSON>, ) -> sys::Result { @@ -567,7 +565,6 @@ impl Watcher { fd, hash, count: 0, - loader, parent_hash, package_json, kind: WatchItemKind::File, @@ -652,7 +649,6 @@ impl Watcher { fd, hash, count: 0, - loader: Loader::File, parent_hash, kind: WatchItemKind::Directory, package_json: None, @@ -669,7 +665,6 @@ impl Watcher { fd: Fd, file_path: &[u8], hash: HashType, - loader: Loader, dir_fd: Fd, package_json: Option<&'static PackageJSON>, ) -> sys::Result { @@ -733,7 +728,6 @@ impl Watcher { fd, file_path, hash, - loader, parent_dir_hash, package_json, ) { @@ -805,7 +799,7 @@ impl Watcher { /// Returns: /// - true if the file is successfully added to the watchlist or already watched /// - false if the file cannot be opened or added to the watchlist - pub fn add_file_by_path_slow(&mut self, file_path: &[u8], loader: Loader) -> bool { + pub fn add_file_by_path_slow(&mut self, file_path: &[u8]) -> bool { if file_path.is_empty() { return false; } @@ -842,7 +836,7 @@ impl Watcher { #[cfg(not(any(target_os = "macos", target_os = "freebsd")))] let fd: Fd = Fd::INVALID; - let res = self.add_file::(fd, file_path, hash, loader, Fd::INVALID, None); + let res = self.add_file::(fd, file_path, hash, Fd::INVALID, None); match res { Ok(ownership) => { // Not adopted (another thread won the add race); close the @@ -866,7 +860,6 @@ impl Watcher { fd: Fd, file_path: &[u8], hash: HashType, - loader: Loader, dir_fd: Fd, package_json: Option<&'static PackageJSON>, ) -> sys::Result { @@ -895,7 +888,6 @@ impl Watcher { fd, file_path, hash, - loader, dir_fd, package_json, ); @@ -1046,7 +1038,6 @@ pub struct WatchItem { pub file_path: Cow<'static, [u8]>, // filepath hash for quick comparison pub hash: u32, - pub loader: Loader, pub fd: Fd, pub count: u32, pub parent_hash: u32, diff --git a/src/watcher/lib.rs b/src/watcher/lib.rs index 935ba8504c05..76619cf6836e 100644 --- a/src/watcher/lib.rs +++ b/src/watcher/lib.rs @@ -39,22 +39,3 @@ pub use watcher_impl::{ MAX_EVICTION_COUNT, Op, PackageJSON, REQUIRES_FILE_DESCRIPTORS, WATCH_OPEN_FLAGS, WatchEvent, WatchItem, WatchItemColumns, WatchItemIndex, WatchItemKind, WatchList, Watcher, WatcherContext, }; - -// ─── upward-crate placeholders (CYCLEBREAK) ─────────────────────────────── -// -// These belong to higher-tier crates that don't yet expose a usable surface -// to depend on. Watcher only stores/passes them through; never dereferenced. - -/// Opaque forward-decl of `bun_ast::Loader` (cycle-break: bun_watcher sits -/// below bun_ast in the crate graph). Watcher only stores the value in -/// `WatchItem.loader` and passes it through; callers construct it via -/// `Loader(bun_ast::Loader as u8)` at the boundary. -#[derive(Clone, Copy, Default)] -pub struct Loader(pub u8); -impl Loader { - /// Mirrors `bun_ast::Loader::File as u8`; - /// keep the discriminant in sync with `src/ast/loader.rs`. A compile-time - /// drift guard lives in `src/jsc/hot_reloader.rs` (a crate that sees both - /// types). - pub const File: Loader = Loader(5); -} diff --git a/src/windows_sys/externs.rs b/src/windows_sys/externs.rs index f3996922cf55..d3e748dc9dc7 100644 --- a/src/windows_sys/externs.rs +++ b/src/windows_sys/externs.rs @@ -23,7 +23,6 @@ type DWORD_PTR = usize; pub type UINT = c_uint; pub type ULONG = c_ulong; pub type LONG = c_long; -pub type ULONGLONG = u64; pub type LARGE_INTEGER = i64; pub type WCHAR = u16; pub type CHAR = c_char; @@ -270,7 +269,6 @@ pub const PATH_MAX_WIDE: usize = 32767; // `SetFilePointer` move methods. pub const FILE_BEGIN: DWORD = 0; -pub const FILE_CURRENT: DWORD = 1; pub const FILE_END: DWORD = 2; // `DuplicateHandle` options. @@ -284,17 +282,10 @@ pub const FILE_SHARE_DELETE: ULONG = 0x0000_0004; // File attribute flags (`winnt.h`). pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x0000_0001; pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x0000_0002; -pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x0000_0004; pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x0000_0010; -pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x0000_0020; -pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x0000_0040; pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x0000_0080; pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x0000_0100; -pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x0000_0200; pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x0000_0400; -pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x0000_0800; -pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x0000_1000; -pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x0000_2000; // `NtCreateFile` CreateDisposition (`ntifs.h`). pub const FILE_OPEN: ULONG = 1; @@ -305,8 +296,6 @@ pub const FILE_OVERWRITE_IF: ULONG = 5; // `NtCreateFile` CreateOptions (`ntifs.h`). pub const FILE_DIRECTORY_FILE: ULONG = 0x0000_0001; -pub const FILE_WRITE_THROUGH: ULONG = 0x0000_0002; -pub const FILE_SEQUENTIAL_ONLY: ULONG = 0x0000_0004; pub const FILE_SYNCHRONOUS_IO_NONALERT: ULONG = 0x0000_0020; pub const FILE_NON_DIRECTORY_FILE: ULONG = 0x0000_0040; pub const FILE_OPEN_REPARSE_POINT: ULONG = 0x0020_0000; @@ -345,7 +334,6 @@ pub const fn is_reparse_tag_name_surrogate(tag: DWORD) -> bool { // `CreateNamedPipeW` dwOpenMode / dwPipeMode (`winbase.h`). pub const PIPE_ACCESS_INBOUND: DWORD = 0x0000_0001; pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x0000_0002; -pub const PIPE_ACCESS_DUPLEX: DWORD = 0x0000_0003; pub const PIPE_TYPE_BYTE: DWORD = 0x0000_0000; pub const PIPE_READMODE_BYTE: DWORD = 0x0000_0000; pub const PIPE_WAIT: DWORD = 0x0000_0000; @@ -834,7 +822,6 @@ pub mod kernel32 { pub Type: u32, } pub const MEM_COMMIT: u32 = 0x1000; - pub const MEM_FREE: u32 = 0x10000; pub const PAGE_NOACCESS: u32 = 0x01; pub const PAGE_READONLY: u32 = 0x02; @@ -1078,7 +1065,6 @@ pub const fn NT_SUCCESS(status: NTSTATUS) -> bool { pub const fn NT_ERROR(status: NTSTATUS) -> bool { (status.0 >> 30) == 3 } -pub const STATUS_SUCCESS: NTSTATUS = NTSTATUS::SUCCESS; #[cfg_attr(windows, link(name = "ntdll"))] unsafe extern "system" { @@ -1484,13 +1470,6 @@ unsafe extern "system" { unsafe extern "system" { pub fn CopyFileW(source: LPCWSTR, dest: LPCWSTR, bFailIfExists: BOOL) -> BOOL; - pub fn SetFileInformationByHandle( - file: HANDLE, - fileInformationClass: FILE_INFO_BY_HANDLE_CLASS, - fileInformation: LPVOID, - bufferSize: DWORD, - ) -> BOOL; - pub fn GetHostNameW(lpBuffer: PWSTR, nSize: c_int) -> BOOL; pub fn SetEnvironmentVariableW(lpName: LPCWSTR, lpValue: LPCWSTR) -> BOOL; @@ -1510,9 +1489,6 @@ unsafe extern "system" { hProcess: HANDLE, // [in] ) -> BOOL; - pub fn ResumeThread(hJob: HANDLE, // [in] - ) -> DWORD; - pub fn SetInformationJobObject( hJob: HANDLE, JobObjectInformationClass: DWORD, @@ -1667,8 +1643,6 @@ pub struct CURDIR { pub DosPath: UNICODE_STRING, pub Handle: HANDLE, } -/// CamelCase alias (`bun_core` callers). -pub type Curdir = CURDIR; /// `RTL_USER_PROCESS_PARAMETERS` (`winternl.h`) — minimal view. #[repr(C)] @@ -1717,8 +1691,6 @@ pub struct PEB { // reference would assert false immutability to the optimizer (UB). pub ProcessParameters: *const RTL_USER_PROCESS_PARAMETERS, } -/// Legacy alias (former `bun_core::windows_sys` name). -pub type PebView = PEB; /// `TEB` (`winternl.h`) — minimal view; only `ProcessEnvironmentBlock` is read. #[repr(C)] @@ -1796,8 +1768,6 @@ pub fn peb() -> *const PEB { pub const CTRL_C_EVENT: DWORD = 0; pub const CTRL_BREAK_EVENT: DWORD = 1; pub const CTRL_CLOSE_EVENT: DWORD = 2; -pub const CTRL_LOGOFF_EVENT: DWORD = 5; -pub const CTRL_SHUTDOWN_EVENT: DWORD = 6; #[cfg_attr(windows, link(name = "kernel32"))] unsafe extern "system" { diff --git a/src/zlib/lib.rs b/src/zlib/lib.rs index 1080004a4863..3306e44102f7 100644 --- a/src/zlib/lib.rs +++ b/src/zlib/lib.rs @@ -73,10 +73,6 @@ use crate::internal::{DataType, zStream_struct}; // ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); unsafe extern "C" { - /// Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. In the current version of inflate, the provided input is not read or consumed. The allocation of a sliding window will be deferred to the first call of inflate (if the decompression does not complete on the first call). If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. - /// - /// inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit does not perform any decompression. Actual decompression will be done by inflate(). So next_in, and avail_in, next_out, and avail_out are unused and unchanged. The current implementation of inflateInit() does not process any header information—that is deferred until inflate() is called. - pub fn inflateInit_(strm: z_streamp, version: *const u8, stream_size: c_int) -> ReturnCode; pub fn inflateInit2_( strm: z_streamp, window_size: c_int, @@ -424,31 +420,6 @@ impl Default for Options { } unsafe extern "C" { - /// - /// Initializes the internal stream state for compression. The fields - /// zalloc, zfree and opaque must be initialized before by the caller. If - /// zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - /// allocation functions. - /// - /// The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - /// 1 gives best speed, 9 gives best compression, 0 gives no compression at all - /// (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - /// requests a default compromise between speed and compression (currently - /// equivalent to level 6). - /// - /// deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - /// memory, Z_STREAM_ERROR if level is not a valid compression level, or - /// Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - /// with the version assumed by the caller (ZLIB_VERSION). msg is set to null - /// if there is no error message. deflateInit does not perform any compression: - /// this will be done by deflate(). - pub fn deflateInit_( - strm: z_streamp, - level: c_int, - version: *const c_char, - stream_size: c_int, - ) -> ReturnCode; - /// /// deflate compresses as much data as possible, and stops when the input /// buffer becomes empty or the output buffer becomes full. It may introduce diff --git a/src/zlib_sys/posix.rs b/src/zlib_sys/posix.rs index 57f4919febd1..9c6fcac954ef 100644 --- a/src/zlib_sys/posix.rs +++ b/src/zlib_sys/posix.rs @@ -10,13 +10,6 @@ pub use crate::shared::{ unsafe extern "C" { pub safe fn zlibVersion() -> *const c_char; - pub fn deflateInit_( - strm: z_streamp, - level: c_int, - version: *const c_char, - stream_size: c_int, - ) -> ReturnCode; - pub fn inflateInit_(strm: z_streamp, version: *const c_char, stream_size: c_int) -> ReturnCode; pub fn deflateInit2_( strm: z_streamp, level: c_int, diff --git a/src/zlib_sys/win32.rs b/src/zlib_sys/win32.rs index 83a4a6a2968a..8290eef5604d 100644 --- a/src/zlib_sys/win32.rs +++ b/src/zlib_sys/win32.rs @@ -92,13 +92,6 @@ unsafe extern "C" { pub fn gzerror(file: gzFile, errnum: *mut c_int) -> *const u8; pub fn adler32(adler: uLong, buf: *const Bytef, len: uInt) -> uLong; pub fn crc32(crc: uLong, buf: *const Bytef, len: uInt) -> uLong; - pub fn deflateInit_( - strm: z_streamp, - level: c_int, - version: *const c_char, - stream_size: c_int, - ) -> ReturnCode; - pub fn inflateInit_(strm: z_streamp, version: *const c_char, stream_size: c_int) -> ReturnCode; pub fn deflateInit2_( strm: z_streamp, level: c_int, diff --git a/test/internal/source-lints/dead-code-escape-limits.json b/test/internal/source-lints/dead-code-escape-limits.json index baef5b4ec5c2..2380cf5b3d39 100644 --- a/test/internal/source-lints/dead-code-escape-limits.json +++ b/test/internal/source-lints/dead-code-escape-limits.json @@ -14,13 +14,12 @@ "src/io/posix_event_loop.rs": 8, "src/jsc/PosixSignalHandle.rs": 6, "src/jsc_macros/lib.rs": 2, - "src/opaque/lib.rs": 5, + "src/opaque/lib.rs": 4, "src/patch/lib.rs": 2, "src/runtime/api/bun/Terminal.rs": 1, "src/runtime/cli/test/ChangedFilesFilter.rs": 1, "src/runtime/image/backend_coregraphics.rs": 14, "src/runtime/image/codecs.rs": 1, - "src/runtime/node/fs_events.rs": 3, "src/runtime/node/node_fs.rs": 2, "src/runtime/server/NodeHTTPResponse.rs": 1, "src/runtime/shell/subproc.rs": 1,