Unverified Commit 01386058 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

chore(turbopack): Remove unmaintained fxhash crate, use rustc-hash instead (#75530)

The fxhash crate hasn't been updated in 7 years, the rust-hash crate is actively maintained.

We were using an awkward mix of both, unify on just using rustc-hash.
parent 461f0be2
...@@ -2539,15 +2539,6 @@ dependencies = [ ...@@ -2539,15 +2539,6 @@ dependencies = [
"slab", "slab",
] ]
[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
dependencies = [
"byteorder",
]
[[package]] [[package]]
name = "generator" name = "generator"
version = "0.8.2" version = "0.8.2"
...@@ -4531,7 +4522,6 @@ dependencies = [ ...@@ -4531,7 +4522,6 @@ dependencies = [
"dashmap 6.1.0", "dashmap 6.1.0",
"easy-error", "easy-error",
"either", "either",
"fxhash",
"hex", "hex",
"indexmap 2.7.1", "indexmap 2.7.1",
"indoc", "indoc",
...@@ -4568,7 +4558,6 @@ dependencies = [ ...@@ -4568,7 +4558,6 @@ dependencies = [
"console-subscriber", "console-subscriber",
"dashmap 6.1.0", "dashmap 6.1.0",
"dhat", "dhat",
"fxhash",
"getrandom", "getrandom",
"iana-time-zone", "iana-time-zone",
"indexmap 2.7.1", "indexmap 2.7.1",
...@@ -4584,6 +4573,7 @@ dependencies = [ ...@@ -4584,6 +4573,7 @@ dependencies = [
"once_cell", "once_cell",
"owo-colors 3.5.0", "owo-colors 3.5.0",
"rand", "rand",
"rustc-hash 1.1.0",
"serde", "serde",
"serde_json", "serde_json",
"shadow-rs", "shadow-rs",
......
...@@ -47,7 +47,6 @@ workspace = true ...@@ -47,7 +47,6 @@ workspace = true
anyhow = "1.0.66" anyhow = "1.0.66"
backtrace = "0.3" backtrace = "0.3"
console-subscriber = { workspace = true, optional = true } console-subscriber = { workspace = true, optional = true }
fxhash = "0.2.1"
dhat = { workspace = true, optional = true } dhat = { workspace = true, optional = true }
indexmap = { workspace = true } indexmap = { workspace = true }
owo-colors = { workspace = true } owo-colors = { workspace = true }
...@@ -64,6 +63,7 @@ napi = { version = "2", default-features = false, features = [ ...@@ -64,6 +63,7 @@ napi = { version = "2", default-features = false, features = [
napi-derive = "2" napi-derive = "2"
next-custom-transforms = { workspace = true } next-custom-transforms = { workspace = true }
rand = { workspace = true } rand = { workspace = true }
rustc-hash = { workspace = true }
serde = "1" serde = "1"
serde_json = "1" serde_json = "1"
shadow-rs = { workspace = true } shadow-rs = { workspace = true }
......
...@@ -41,8 +41,8 @@ use std::{ ...@@ -41,8 +41,8 @@ use std::{
use backtrace::Backtrace; use backtrace::Backtrace;
use dashmap::DashMap; use dashmap::DashMap;
use fxhash::FxHashSet;
use napi::bindgen_prelude::*; use napi::bindgen_prelude::*;
use rustc_hash::FxHashSet;
use swc_core::{ use swc_core::{
base::{Compiler, TransformOutput}, base::{Compiler, TransformOutput},
common::{FilePathMapping, SourceMap}, common::{FilePathMapping, SourceMap},
......
...@@ -27,8 +27,8 @@ DEALINGS IN THE SOFTWARE. ...@@ -27,8 +27,8 @@ DEALINGS IN THE SOFTWARE.
*/ */
use std::sync::Arc; use std::sync::Arc;
use fxhash::FxHashMap;
use napi::bindgen_prelude::*; use napi::bindgen_prelude::*;
use rustc_hash::FxHashMap;
use serde::Deserialize; use serde::Deserialize;
use swc_core::{ use swc_core::{
base::{config::JsMinifyOptions, try_with_handler, BoolOrDataConfig, TransformOutput}, base::{config::JsMinifyOptions, try_with_handler, BoolOrDataConfig, TransformOutput},
......
...@@ -36,10 +36,10 @@ use std::{ ...@@ -36,10 +36,10 @@ use std::{
use anyhow::{anyhow, bail, Context as _}; use anyhow::{anyhow, bail, Context as _};
use dashmap::DashMap; use dashmap::DashMap;
use fxhash::FxHashSet;
use napi::bindgen_prelude::*; use napi::bindgen_prelude::*;
use next_custom_transforms::chain_transforms::{custom_before_pass, TransformOptions}; use next_custom_transforms::chain_transforms::{custom_before_pass, TransformOptions};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rustc_hash::FxHashSet;
use swc_core::{ use swc_core::{
base::{try_with_handler, Compiler, TransformOutput}, base::{try_with_handler, Compiler, TransformOutput},
common::{comments::SingleThreadedComments, errors::ColorConfig, FileName, Mark, GLOBALS}, common::{comments::SingleThreadedComments, errors::ColorConfig, FileName, Mark, GLOBALS},
...@@ -87,7 +87,7 @@ impl Task for TransformTask { ...@@ -87,7 +87,7 @@ impl Task for TransformTask {
fn compute(&mut self) -> napi::Result<Self::Output> { fn compute(&mut self) -> napi::Result<Self::Output> {
GLOBALS.set(&Default::default(), || { GLOBALS.set(&Default::default(), || {
let eliminated_packages: Rc<RefCell<fxhash::FxHashSet<String>>> = Default::default(); let eliminated_packages: Rc<RefCell<FxHashSet<String>>> = Default::default();
let use_cache_telemetry_tracker: Rc<DashMap<String, usize>> = Default::default(); let use_cache_telemetry_tracker: Rc<DashMap<String, usize>> = Default::default();
let res = catch_unwind(AssertUnwindSafe(|| { let res = catch_unwind(AssertUnwindSafe(|| {
......
...@@ -17,7 +17,6 @@ workspace = true ...@@ -17,7 +17,6 @@ workspace = true
chrono = "0.4" chrono = "0.4"
easy-error = "1.0.0" easy-error = "1.0.0"
either = "1" either = "1"
fxhash = "0.2.1"
hex = "0.4.3" hex = "0.4.3"
indexmap = { workspace = true } indexmap = { workspace = true }
indoc = { workspace = true } indoc = { workspace = true }
......
...@@ -2,9 +2,9 @@ use std::{cell::RefCell, path::PathBuf, rc::Rc, sync::Arc}; ...@@ -2,9 +2,9 @@ use std::{cell::RefCell, path::PathBuf, rc::Rc, sync::Arc};
use dashmap::DashMap; use dashmap::DashMap;
use either::Either; use either::Either;
use fxhash::FxHashSet;
use modularize_imports; use modularize_imports;
use preset_env_base::query::targets_to_versions; use preset_env_base::query::targets_to_versions;
use rustc_hash::FxHashSet;
use serde::Deserialize; use serde::Deserialize;
use swc_core::{ use swc_core::{
common::{ common::{
......
use std::{cell::RefCell, mem::take, rc::Rc}; use std::{cell::RefCell, mem::take, rc::Rc};
use easy_error::{bail, Error}; use easy_error::{bail, Error};
use fxhash::FxHashSet; use rustc_hash::FxHashSet;
use swc_core::{ use swc_core::{
common::{ common::{
errors::HANDLER, errors::HANDLER,
......
use std::{cell::RefCell, rc::Rc, sync::Arc}; use std::{cell::RefCell, rc::Rc, sync::Arc};
use fxhash::FxHashSet;
use next_custom_transforms::transforms::next_ssg::next_ssg; use next_custom_transforms::transforms::next_ssg::next_ssg;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rustc_hash::FxHashSet;
use swc_core::{ use swc_core::{
base::{try_with_handler, Compiler}, base::{try_with_handler, Compiler},
common::{comments::SingleThreadedComments, FileName, FilePathMapping, SourceMap, GLOBALS}, common::{comments::SingleThreadedComments, FileName, FilePathMapping, SourceMap, GLOBALS},
...@@ -53,11 +53,11 @@ export function getServerSideProps() { ...@@ -53,11 +53,11 @@ export function getServerSideProps() {
}) })
.is_ok() .is_ok()
); );
assert_eq!( let mut eliminated_packages_vec = Rc::into_inner(eliminated_packages)
eliminated_packages .expect("we should have the only remaining reference to `eliminated_packages`")
.borrow() .into_inner()
.iter() .into_iter()
.collect::<Vec<&String>>(), .collect::<Vec<String>>();
vec!["@napi-rs/bcrypt", "http"] eliminated_packages_vec.sort_unstable(); // HashSet order is random/arbitrary
); assert_eq!(eliminated_packages_vec, vec!["@napi-rs/bcrypt", "http"]);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment