From f6aabfce9c4b7bcd46bd6fdec593ec26f7dc1a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Sat, 14 Aug 2021 19:33:16 +0900 Subject: [PATCH] perf: Use ahash instead of sip hash (#2073) swc_common: - Add `AHashMap`. - Add `AHashSet`. --- Cargo.lock | 55 ++++++++++--------- Cargo.toml | 34 ++++++------ bundler/Cargo.toml | 22 ++++---- bundler/src/id.rs | 5 +- bundler/src/inline.rs | 6 +- bundler/src/util.rs | 4 +- bundler/tests/deno.rs | 8 +-- common/Cargo.toml | 3 +- common/src/collections.rs | 5 ++ common/src/errors.rs | 8 +-- common/src/lib.rs | 1 + common/src/source_map.rs | 4 +- common/src/syntax_pos/hygiene.rs | 4 +- ecmascript/Cargo.toml | 20 +++---- ecmascript/ast/Cargo.toml | 4 +- ecmascript/codegen/Cargo.toml | 12 ++-- ecmascript/dep-graph/Cargo.toml | 12 ++-- ecmascript/ext-transforms/Cargo.toml | 12 ++-- ecmascript/jsdoc/Cargo.toml | 10 ++-- ecmascript/loader/Cargo.toml | 10 ++-- ecmascript/loader/tests/tsc_resolver.rs | 4 +- ecmascript/minifier/Cargo.toml | 22 ++++---- ecmascript/minifier/src/pass/mangle_props.rs | 13 +++-- ecmascript/parser/Cargo.toml | 10 ++-- ecmascript/preset-env/Cargo.toml | 18 +++--- ecmascript/preset-env/src/corejs2/builtin.rs | 6 +- ecmascript/preset-env/src/transform_data.rs | 10 ++-- ecmascript/preset-env/tests/test.rs | 7 ++- ecmascript/transforms/Cargo.toml | 32 +++++------ ecmascript/transforms/base/Cargo.toml | 16 +++--- .../transforms/base/src/hygiene/tests.rs | 7 +-- ecmascript/transforms/classes/Cargo.toml | 12 ++-- ecmascript/transforms/compat/Cargo.toml | 20 +++---- .../compat/src/es2015/block_scoping.rs | 13 ++--- ecmascript/transforms/module/Cargo.toml | 22 ++++---- ecmascript/transforms/module/src/util.rs | 11 ++-- ecmascript/transforms/optimization/Cargo.toml | 28 +++++----- ecmascript/transforms/proposal/Cargo.toml | 24 ++++---- ecmascript/transforms/react/Cargo.toml | 24 ++++---- .../react/src/pure_annotations/mod.rs | 7 +-- .../transforms/react/src/refresh/mod.rs | 15 ++--- .../transforms/react/src/refresh/util.rs | 6 +- ecmascript/transforms/testing/Cargo.toml | 18 +++--- ecmascript/transforms/typescript/Cargo.toml | 26 ++++----- ecmascript/utils/Cargo.toml | 10 ++-- ecmascript/visit/Cargo.toml | 6 +- node/base/Cargo.toml | 4 +- node/bundler/src/config/mod.rs | 4 +- testing/Cargo.toml | 4 +- testing/src/lib.rs | 4 +- 50 files changed, 324 insertions(+), 318 deletions(-) create mode 100644 common/src/collections.rs diff --git a/Cargo.lock b/Cargo.lock index d3e45cf4c8bf..fbb8e420630e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -842,7 +842,7 @@ dependencies = [ [[package]] name = "jsdoc" -version = "0.34.0" +version = "0.34.1" dependencies = [ "anyhow", "dashmap", @@ -2103,7 +2103,7 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "swc" -version = "0.40.0" +version = "0.40.1" dependencies = [ "ahash", "anyhow", @@ -2198,7 +2198,7 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.52.0" +version = "0.52.1" dependencies = [ "ahash", "anyhow", @@ -2235,8 +2235,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.11.5" +version = "0.11.6" dependencies = [ + "ahash", "arbitrary", "ast_node", "atty", @@ -2263,7 +2264,7 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.49.3" +version = "0.49.4" dependencies = [ "arbitrary", "is-macro", @@ -2277,7 +2278,7 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.66.2" +version = "0.66.3" dependencies = [ "bitflags", "num-bigint", @@ -2303,7 +2304,7 @@ dependencies = [ [[package]] name = "swc_ecma_dep_graph" -version = "0.34.0" +version = "0.34.1" dependencies = [ "swc_atoms", "swc_common", @@ -2315,7 +2316,7 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.24.0" +version = "0.24.1" dependencies = [ "phf", "swc_atoms", @@ -2328,7 +2329,7 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.14.0" +version = "0.14.1" dependencies = [ "anyhow", "dashmap", @@ -2348,7 +2349,7 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.20.0" +version = "0.20.1" dependencies = [ "ansi_term 0.12.1", "anyhow", @@ -2380,7 +2381,7 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.66.3" +version = "0.66.4" dependencies = [ "either", "enum_kind", @@ -2404,7 +2405,7 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.36.0" +version = "0.36.1" dependencies = [ "dashmap", "fxhash", @@ -2430,7 +2431,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.65.0" +version = "0.65.1" dependencies = [ "pretty_assertions 0.6.1", "sourcemap", @@ -2457,7 +2458,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.26.2" +version = "0.26.3" dependencies = [ "fxhash", "once_cell", @@ -2476,7 +2477,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.12.1" +version = "0.12.2" dependencies = [ "swc_atoms", "swc_common", @@ -2488,7 +2489,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.29.3" +version = "0.29.4" dependencies = [ "arrayvec", "fxhash", @@ -2524,7 +2525,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.32.0" +version = "0.32.1" dependencies = [ "Inflector", "anyhow", @@ -2547,7 +2548,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.35.0" +version = "0.35.1" dependencies = [ "dashmap", "fxhash", @@ -2574,7 +2575,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.32.0" +version = "0.32.1" dependencies = [ "either", "fxhash", @@ -2596,7 +2597,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.33.0" +version = "0.33.1" dependencies = [ "base64 0.13.0", "dashmap", @@ -2622,7 +2623,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.26.2" +version = "0.26.3" dependencies = [ "ansi_term 0.12.1", "anyhow", @@ -2641,7 +2642,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.34.0" +version = "0.34.1" dependencies = [ "fxhash", "serde", @@ -2663,7 +2664,7 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.41.1" +version = "0.41.2" dependencies = [ "once_cell", "scoped-tls", @@ -2677,7 +2678,7 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.35.1" +version = "0.35.2" dependencies = [ "num-bigint", "swc_atoms", @@ -2688,7 +2689,7 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.55.0" +version = "0.55.1" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", @@ -2723,7 +2724,7 @@ dependencies = [ [[package]] name = "swc_node_base" -version = "0.2.1" +version = "0.2.2" dependencies = [ "dashmap", "mimalloc-rust", @@ -2819,7 +2820,7 @@ dependencies = [ [[package]] name = "testing" -version = "0.12.1" +version = "0.12.2" dependencies = [ "ansi_term 0.12.1", "difference", diff --git a/Cargo.toml b/Cargo.toml index c18a1952f8ac..47336c327c27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc" repository = "https://github.com/swc-project/swc.git" -version = "0.40.0" +version = "0.40.1" [lib] name = "swc" @@ -30,16 +30,16 @@ serde = {version = "1", features = ["derive"]} serde_json = "1" sourcemap = "6" swc_atoms = {version = "0.2", path = "./atoms"} -swc_bundler = {version = "0.52.0", path = "./bundler"} -swc_common = {version = "0.11.0", path = "./common", features = ["sourcemap", "concurrent"]} -swc_ecma_ast = {version = "0.49.0", path = "./ecmascript/ast"} -swc_ecma_codegen = {version = "0.66.0", path = "./ecmascript/codegen"} -swc_ecma_ext_transforms = {version = "0.24.0", path = "./ecmascript/ext-transforms"} -swc_ecma_loader = {version = "0.14.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]} -swc_ecma_minifier = {version = "0.20.0", path = "./ecmascript/minifier"} -swc_ecma_parser = {version = "0.66.0", path = "./ecmascript/parser"} -swc_ecma_preset_env = {version = "0.36.0", path = "./ecmascript/preset-env"} -swc_ecma_transforms = {version = "0.65.0", path = "./ecmascript/transforms", features = [ +swc_bundler = {version = "0.52.1", path = "./bundler"} +swc_common = {version = "0.11.6", path = "./common", features = ["sourcemap", "concurrent"]} +swc_ecma_ast = {version = "0.49.4", path = "./ecmascript/ast"} +swc_ecma_codegen = {version = "0.66.3", path = "./ecmascript/codegen"} +swc_ecma_ext_transforms = {version = "0.24.1", path = "./ecmascript/ext-transforms"} +swc_ecma_loader = {version = "0.14.1", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]} +swc_ecma_minifier = {version = "0.20.1", path = "./ecmascript/minifier"} +swc_ecma_parser = {version = "0.66.4", path = "./ecmascript/parser"} +swc_ecma_preset_env = {version = "0.36.1", path = "./ecmascript/preset-env"} +swc_ecma_transforms = {version = "0.65.1", path = "./ecmascript/transforms", features = [ "compat", "module", "optimization", @@ -47,16 +47,16 @@ swc_ecma_transforms = {version = "0.65.0", path = "./ecmascript/transforms", fea "react", "typescript", ]} -swc_ecma_transforms_base = {version = "0.26.0", path = "./ecmascript/transforms/base"} -swc_ecma_utils = {version = "0.41.0", path = "./ecmascript/utils"} -swc_ecma_visit = {version = "0.35.0", path = "./ecmascript/visit"} -swc_ecmascript = {version = "0.55.0", path = "./ecmascript"} -swc_node_base = {version = "0.2.0", path = "./node/base"} +swc_ecma_transforms_base = {version = "0.26.3", path = "./ecmascript/transforms/base"} +swc_ecma_utils = {version = "0.41.2", path = "./ecmascript/utils"} +swc_ecma_visit = {version = "0.35.2", path = "./ecmascript/visit"} +swc_ecmascript = {version = "0.55.1", path = "./ecmascript"} +swc_node_base = {version = "0.2.2", path = "./node/base"} swc_visit = {version = "0.2.3", path = "./visit"} [dev-dependencies] rayon = "1" -testing = {version = "0.12.0", path = "./testing"} +testing = {version = "0.12.2", path = "./testing"} walkdir = "2" [[example]] diff --git a/bundler/Cargo.toml b/bundler/Cargo.toml index f1313235aaa0..22acdf495b1b 100644 --- a/bundler/Cargo.toml +++ b/bundler/Cargo.toml @@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"] license = "Apache-2.0/MIT" name = "swc_bundler" repository = "https://github.com/swc-project/swc.git" -version = "0.52.0" +version = "0.52.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] @@ -32,22 +32,22 @@ rayon = {version = "1", optional = true} relative-path = "1.2" retain_mut = "0.1.2" swc_atoms = {version = "0.2.4", path = "../atoms"} -swc_common = {version = "0.11.0", path = "../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ecmascript/ast"} -swc_ecma_codegen = {version = "0.66.0", path = "../ecmascript/codegen"} -swc_ecma_loader = {version = "0.14.0", path = "../ecmascript/loader"} -swc_ecma_parser = {version = "0.66.0", path = "../ecmascript/parser"} -swc_ecma_transforms = {version = "0.65.0", path = "../ecmascript/transforms", features = ["optimization"]} -swc_ecma_utils = {version = "0.41.0", path = "../ecmascript/utils"} -swc_ecma_visit = {version = "0.35.0", path = "../ecmascript/visit"} +swc_common = {version = "0.11.6", path = "../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ecmascript/ast"} +swc_ecma_codegen = {version = "0.66.3", path = "../ecmascript/codegen"} +swc_ecma_loader = {version = "0.14.1", path = "../ecmascript/loader"} +swc_ecma_parser = {version = "0.66.4", path = "../ecmascript/parser"} +swc_ecma_transforms = {version = "0.65.1", path = "../ecmascript/transforms", features = ["optimization"]} +swc_ecma_utils = {version = "0.41.2", path = "../ecmascript/utils"} +swc_ecma_visit = {version = "0.35.2", path = "../ecmascript/visit"} [dev-dependencies] hex = "0.4" ntest = "0.7.2" reqwest = {version = "0.11.4", features = ["blocking"]} sha-1 = "0.9" -swc_ecma_transforms = {version = "0.65.0", path = "../ecmascript/transforms", features = ["react", "typescript"]} +swc_ecma_transforms = {version = "0.65.1", path = "../ecmascript/transforms", features = ["react", "typescript"]} tempfile = "3.1.0" -testing = {version = "0.12.0", path = "../testing"} +testing = {version = "0.12.2", path = "../testing"} url = "2.1.1" walkdir = "2" diff --git a/bundler/src/id.rs b/bundler/src/id.rs index b0c24498d24b..6b9f9453563a 100644 --- a/bundler/src/id.rs +++ b/bundler/src/id.rs @@ -1,10 +1,9 @@ use std::{ - collections::HashMap, fmt, sync::atomic::{AtomicU32, Ordering::SeqCst}, }; use swc_atoms::JsWord; -use swc_common::{sync::Lock, FileName, Mark, SyntaxContext, DUMMY_SP}; +use swc_common::{collections::AHashMap, sync::Lock, FileName, Mark, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::{Expr, Ident}; use swc_ecma_utils::ident::IdentLike; @@ -28,7 +27,7 @@ impl fmt::Debug for ModuleId { pub(crate) struct ModuleIdGenerator { v: AtomicU32, /// `(module_id, local_mark, export_mark)` - cache: Lock>, + cache: Lock>, } impl ModuleIdGenerator { diff --git a/bundler/src/inline.rs b/bundler/src/inline.rs index d9bb47ab2767..14440d1d0aa2 100644 --- a/bundler/src/inline.rs +++ b/bundler/src/inline.rs @@ -1,7 +1,5 @@ use crate::{id::Id, modules::Modules}; -use ahash::RandomState; -use std::collections::HashMap; -use swc_common::{SyntaxContext, DUMMY_SP}; +use swc_common::{collections::AHashMap, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_visit::{ noop_visit_mut_type, noop_visit_type, Node, Visit, VisitMut, VisitMutWith, VisitWith, @@ -9,7 +7,7 @@ use swc_ecma_visit::{ #[derive(Debug, Default)] pub(crate) struct InlineData { - ids: HashMap, + ids: AHashMap, } /// Inline **injected** variables. diff --git a/bundler/src/util.rs b/bundler/src/util.rs index 65621bb97b35..c93d07862892 100644 --- a/bundler/src/util.rs +++ b/bundler/src/util.rs @@ -241,9 +241,9 @@ where V: Clone, { #[cfg(feature = "concurrent")] - inner: dashmap::DashMap, + inner: dashmap::DashMap, #[cfg(not(feature = "concurrent"))] - inner: std::cell::RefCell>, + inner: std::cell::RefCell>, } impl Default for CloneMap diff --git a/bundler/tests/deno.rs b/bundler/tests/deno.rs index b5fbf3a30361..7a3a9de79fc6 100644 --- a/bundler/tests/deno.rs +++ b/bundler/tests/deno.rs @@ -7,14 +7,14 @@ use self::common::*; use anyhow::Error; use ntest::timeout; use std::{ - collections::{HashMap, HashSet}, + collections::HashMap, fs::write, path::PathBuf, process::{Command, Stdio}, }; use swc_atoms::js_word; use swc_bundler::{Bundler, Load, ModuleRecord}; -use swc_common::{FileName, Span, GLOBALS}; +use swc_common::{collections::AHashSet, FileName, Span, GLOBALS}; use swc_ecma_ast::*; use swc_ecma_codegen::{text_writer::JsWriter, Emitter}; use swc_ecma_utils::{find_ids, Id}; @@ -1102,7 +1102,7 @@ impl swc_bundler::Hook for Hook { } } -fn collect_exports(module: &Module) -> HashSet { +fn collect_exports(module: &Module) -> AHashSet { let mut v = ExportCollector::default(); module.visit_with(module, &mut v); @@ -1111,7 +1111,7 @@ fn collect_exports(module: &Module) -> HashSet { #[derive(Default)] struct ExportCollector { - exports: HashSet, + exports: AHashSet, } impl Visit for ExportCollector { diff --git a/common/Cargo.toml b/common/Cargo.toml index 37ebac9f5226..276a0c147287 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_common" repository = "https://github.com/swc-project/swc.git" -version = "0.11.5" +version = "0.11.6" [features] concurrent = ["parking_lot"] @@ -14,6 +14,7 @@ default = [] tty-emitter = ["atty", "termcolor"] [dependencies] +ahash = "0.7.4" arbitrary = {version = "1", optional = true, features = ["derive"]} ast_node = {version = "0.7.3", path = "../macros/ast_node"} atty = {version = "0.2", optional = true} diff --git a/common/src/collections.rs b/common/src/collections.rs new file mode 100644 index 000000000000..cef1a8c35714 --- /dev/null +++ b/common/src/collections.rs @@ -0,0 +1,5 @@ +use std::collections::{HashMap, HashSet}; + +pub type AHashMap = HashMap; + +pub type AHashSet = HashSet; diff --git a/common/src/errors.rs b/common/src/errors.rs index 9f256707b876..b804a60a656c 100644 --- a/common/src/errors.rs +++ b/common/src/errors.rs @@ -15,6 +15,7 @@ pub use self::{ emitter::{ColorConfig, Emitter, EmitterWriter}, }; use crate::{ + collections::AHashSet, rustc_data_structures::stable_hasher::StableHasher, sync::{Lock, LockCell, Lrc}, syntax_pos::{BytePos, FileLinesResult, FileName, Loc, MultiSpan, Span, NO_EXPANSION}, @@ -22,7 +23,6 @@ use crate::{ use std::{ borrow::Cow, cell::RefCell, - collections::HashSet, error, fmt, io::Write, panic, @@ -280,15 +280,15 @@ pub struct Handler { // This set contains the `DiagnosticId` of all emitted diagnostics to avoid // emitting the same diagnostic with extended help (`--teach`) twice, which // would be unnecessary repetition. - taught_diagnostics: Lock>, + taught_diagnostics: Lock>, /// Used to suggest rustc --explain - emitted_diagnostic_codes: Lock>, + emitted_diagnostic_codes: Lock>, // This set contains a hash of every diagnostic that has been emitted by // this handler. These hashes is used to avoid emitting the same error // twice. - emitted_diagnostics: Lock>, + emitted_diagnostics: Lock>, } fn default_track_diagnostic(_: &Diagnostic) {} diff --git a/common/src/lib.rs b/common/src/lib.rs index 322b33ea920b..4d3aaac7efb6 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -38,6 +38,7 @@ pub trait AstNode: Debug + PartialEq + Clone + Spanned + Serialize { const TYPE: &'static str; } +pub mod collections; pub mod comments; mod eq; pub mod errors; diff --git a/common/src/source_map.rs b/common/src/source_map.rs index f6e504f6b6e1..f7bea928fec8 100644 --- a/common/src/source_map.rs +++ b/common/src/source_map.rs @@ -18,6 +18,7 @@ //! information, source code snippets, etc. pub use crate::syntax_pos::*; use crate::{ + collections::AHashMap, errors::SourceMapper, rustc_data_structures::stable_hasher::StableHasher, sync::{Lock, LockGuard, Lrc, MappedLockGuard}, @@ -28,7 +29,6 @@ use sourcemap::SourceMapBuilder; use std::{ cmp, cmp::{max, min}, - collections::HashMap, env, fs, hash::Hash, io::{self, Read}, @@ -100,7 +100,7 @@ impl StableSourceFileId { #[derive(Default)] pub(super) struct SourceMapFiles { pub(super) source_files: Vec>, - stable_id_to_source_file: HashMap>, + stable_id_to_source_file: AHashMap>, } /// The interner for spans. diff --git a/common/src/syntax_pos/hygiene.rs b/common/src/syntax_pos/hygiene.rs index 2921ef1751ce..422c66e1154f 100644 --- a/common/src/syntax_pos/hygiene.rs +++ b/common/src/syntax_pos/hygiene.rs @@ -15,6 +15,8 @@ //! and definition contexts*. J. Funct. Program. 22, 2 (March 2012), 181-216. //! DOI=10.1017/S0956796812000093 +use crate::collections::AHashMap; + use super::GLOBALS; use serde::{Deserialize, Serialize}; use std::{ @@ -143,7 +145,7 @@ impl Mark { pub(crate) struct HygieneData { marks: Vec, syntax_contexts: Vec, - markings: HashMap<(SyntaxContext, Mark), SyntaxContext>, + markings: AHashMap<(SyntaxContext, Mark), SyntaxContext>, } impl Default for HygieneData { diff --git a/ecmascript/Cargo.toml b/ecmascript/Cargo.toml index 17f6a1a7200b..2d508a25b209 100644 --- a/ecmascript/Cargo.toml +++ b/ecmascript/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecmascript" repository = "https://github.com/swc-project/swc.git" -version = "0.55.0" +version = "0.55.1" [package.metadata.docs.rs] all-features = true @@ -32,14 +32,14 @@ react = ["swc_ecma_transforms/react"] typescript = ["typescript-parser", "swc_ecma_transforms/typescript"] [dependencies] -swc_ecma_ast = {version = "0.49.0", path = "./ast"} -swc_ecma_codegen = {version = "0.66.0", path = "./codegen", optional = true} -swc_ecma_dep_graph = {version = "0.34.0", path = "./dep-graph", optional = true} -swc_ecma_minifier = {version = "0.20.0", path = "./minifier", optional = true} -swc_ecma_parser = {version = "0.66.0", path = "./parser", optional = true, default-features = false} -swc_ecma_preset_env = {version = "0.36.0", path = "./preset-env", optional = true} -swc_ecma_transforms = {version = "0.65.0", path = "./transforms", optional = true} -swc_ecma_utils = {version = "0.41.0", path = "./utils", optional = true} -swc_ecma_visit = {version = "0.35.0", path = "./visit", optional = true} +swc_ecma_ast = {version = "0.49.4", path = "./ast"} +swc_ecma_codegen = {version = "0.66.3", path = "./codegen", optional = true} +swc_ecma_dep_graph = {version = "0.34.1", path = "./dep-graph", optional = true} +swc_ecma_minifier = {version = "0.20.1", path = "./minifier", optional = true} +swc_ecma_parser = {version = "0.66.4", path = "./parser", optional = true, default-features = false} +swc_ecma_preset_env = {version = "0.36.1", path = "./preset-env", optional = true} +swc_ecma_transforms = {version = "0.65.1", path = "./transforms", optional = true} +swc_ecma_utils = {version = "0.41.2", path = "./utils", optional = true} +swc_ecma_visit = {version = "0.35.2", path = "./visit", optional = true} [dev-dependencies] diff --git a/ecmascript/ast/Cargo.toml b/ecmascript/ast/Cargo.toml index 0690af7a41a4..25378175cd0e 100644 --- a/ecmascript/ast/Cargo.toml +++ b/ecmascript/ast/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_ast" repository = "https://github.com/swc-project/swc.git" -version = "0.49.3" +version = "0.49.4" [features] default = [] @@ -19,7 +19,7 @@ num-bigint = {version = "0.2", features = ["serde"]} serde = {version = "1.0.88", features = ["derive"]} string_enum = {version = "0.3.1", path = "../../macros/string_enum"} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} +swc_common = {version = "0.11.6", path = "../../common"} [dev-dependencies] serde_json = "1" diff --git a/ecmascript/codegen/Cargo.toml b/ecmascript/codegen/Cargo.toml index a4a55fb886d6..394776874df4 100644 --- a/ecmascript/codegen/Cargo.toml +++ b/ecmascript/codegen/Cargo.toml @@ -7,18 +7,18 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_codegen" repository = "https://github.com/swc-project/swc.git" -version = "0.66.2" +version = "0.66.3" [dependencies] bitflags = "1" num-bigint = {version = "0.2", features = ["serde"]} sourcemap = "6" swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"} -swc_ecma_parser = {version = "0.66.0", path = "../parser"} +swc_ecma_parser = {version = "0.66.4", path = "../parser"} [dev-dependencies] -swc_common = {version = "0.11.0", path = "../../common", features = ["sourcemap"]} -testing = {version = "0.12.0", path = "../../testing"} +swc_common = {version = "0.11.6", path = "../../common", features = ["sourcemap"]} +testing = {version = "0.12.2", path = "../../testing"} diff --git a/ecmascript/dep-graph/Cargo.toml b/ecmascript/dep-graph/Cargo.toml index 999abdde43fc..0fc48b953b8a 100644 --- a/ecmascript/dep-graph/Cargo.toml +++ b/ecmascript/dep-graph/Cargo.toml @@ -6,14 +6,14 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_dep_graph" repository = "https://github.com/swc-project/swc.git" -version = "0.34.0" +version = "0.34.1" [dependencies] swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} [dev-dependencies] -swc_ecma_parser = {version = "0.66.0", path = "../parser"} -testing = {version = "0.12.0", path = "../../testing"} +swc_ecma_parser = {version = "0.66.4", path = "../parser"} +testing = {version = "0.12.2", path = "../../testing"} diff --git a/ecmascript/ext-transforms/Cargo.toml b/ecmascript/ext-transforms/Cargo.toml index 70a5df423f80..fb9bfb02ed4b 100644 --- a/ecmascript/ext-transforms/Cargo.toml +++ b/ecmascript/ext-transforms/Cargo.toml @@ -5,15 +5,15 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_ext_transforms/" edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_ext_transforms" -version = "0.24.0" +version = "0.24.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] phf = {version = "0.8.0", features = ["macros"]} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_parser = {version = "0.66.0", path = "../parser"} -swc_ecma_utils = {version = "0.41.0", path = "../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_parser = {version = "0.66.4", path = "../parser"} +swc_ecma_utils = {version = "0.41.2", path = "../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} diff --git a/ecmascript/jsdoc/Cargo.toml b/ecmascript/jsdoc/Cargo.toml index b413fd9e9aeb..5582d70ea558 100644 --- a/ecmascript/jsdoc/Cargo.toml +++ b/ecmascript/jsdoc/Cargo.toml @@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/jsdoc/" edition = "2018" license = "Apache-2.0/MIT" name = "jsdoc" -version = "0.34.0" +version = "0.34.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -13,12 +13,12 @@ version = "0.34.0" nom = "5.1.2" serde = {version = "1", features = ["derive"]} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} +swc_common = {version = "0.11.6", path = "../../common"} [dev-dependencies] anyhow = "1" dashmap = "4.0.2" -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_parser = {version = "0.66.0", path = "../parser"} -testing = {version = "0.12.0", path = "../../testing"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_parser = {version = "0.66.4", path = "../parser"} +testing = {version = "0.12.2", path = "../../testing"} walkdir = "2" diff --git a/ecmascript/loader/Cargo.toml b/ecmascript/loader/Cargo.toml index 5fbe5bce0d3b..86396d900d74 100644 --- a/ecmascript/loader/Cargo.toml +++ b/ecmascript/loader/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_loader" repository = "https://github.com/swc-project/swc.git" -version = "0.14.0" +version = "0.14.1" [package.metadata.docs.rs] all-features = true @@ -29,12 +29,12 @@ regex = {version = "1", optional = true} serde = {version = "1.0.126", optional = true} serde_json = {version = "1.0.64", optional = true} swc_atoms = {version = "0.2.3", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} [dev-dependencies] -testing = {version = "0.12.0", path = "../../testing"} +testing = {version = "0.12.2", path = "../../testing"} [target.'cfg(windows)'.dependencies] normpath = {version = "0.2", optional = true} diff --git a/ecmascript/loader/tests/tsc_resolver.rs b/ecmascript/loader/tests/tsc_resolver.rs index 3662aa5014c9..884a8b46ef7e 100644 --- a/ecmascript/loader/tests/tsc_resolver.rs +++ b/ecmascript/loader/tests/tsc_resolver.rs @@ -2,7 +2,7 @@ use anyhow::{anyhow, Error}; use std::collections::HashMap; -use swc_common::FileName; +use swc_common::{collections::AHashMap, FileName}; use swc_ecma_loader::{resolve::Resolve, resolvers::tsc::TsConfigResolver}; #[test] @@ -81,7 +81,7 @@ fn pattern_1() { } } -struct TestResolver(HashMap); +struct TestResolver(AHashMap); impl Resolve for TestResolver { fn resolve(&self, _: &FileName, src: &str) -> Result { diff --git a/ecmascript/minifier/Cargo.toml b/ecmascript/minifier/Cargo.toml index 9b64d333b304..70b8459f9a0d 100644 --- a/ecmascript/minifier/Cargo.toml +++ b/ecmascript/minifier/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"] license = "Apache-2.0/MIT" name = "swc_ecma_minifier" repository = "https://github.com/swc-project/swc.git" -version = "0.20.0" +version = "0.20.1" [features] debug = [] @@ -25,20 +25,20 @@ serde = {version = "1.0.118", features = ["derive"]} serde_json = "1.0.61" serde_regex = "1.1.0" swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.2", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_codegen = {version = "0.66.0", path = "../codegen"} -swc_ecma_parser = {version = "0.66.0", path = "../parser"} -swc_ecma_transforms = {version = "0.65.0", path = "../transforms/", features = ["optimization"]} -swc_ecma_transforms_base = {version = "0.26.0", path = "../transforms/base"} -swc_ecma_utils = {version = "0.41.0", path = "../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_codegen = {version = "0.66.3", path = "../codegen"} +swc_ecma_parser = {version = "0.66.4", path = "../parser"} +swc_ecma_transforms = {version = "0.65.1", path = "../transforms/", features = ["optimization"]} +swc_ecma_transforms_base = {version = "0.26.3", path = "../transforms/base"} +swc_ecma_utils = {version = "0.41.2", path = "../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} unicode-xid = "0.2.2" [dev-dependencies] ansi_term = "0.12.1" anyhow = "1" pretty_assertions = "0.6.1" -swc_node_base = {version = "0.2.0", path = "../../node/base"} -testing = {version = "0.12.0", path = "../../testing"} +swc_node_base = {version = "0.2.2", path = "../../node/base"} +testing = {version = "0.12.2", path = "../../testing"} walkdir = "2.3.1" diff --git a/ecmascript/minifier/src/pass/mangle_props.rs b/ecmascript/minifier/src/pass/mangle_props.rs index 6b7a28c0fbfc..69a5ee37c97f 100644 --- a/ecmascript/minifier/src/pass/mangle_props.rs +++ b/ecmascript/minifier/src/pass/mangle_props.rs @@ -4,8 +4,9 @@ use crate::{ util::base54::incr_base54, }; use once_cell::sync::Lazy; -use std::collections::{HashMap, HashSet}; +use std::collections::HashSet; use swc_atoms::JsWord; +use swc_common::collections::{AHashMap, AHashSet}; use swc_ecma_ast::{ CallExpr, Expr, ExprOrSuper, Ident, KeyValueProp, Lit, MemberExpr, Module, Prop, PropName, Str, StrKind, @@ -13,14 +14,14 @@ use swc_ecma_ast::{ use swc_ecma_utils::ident::IdentLike; use swc_ecma_visit::{VisitMut, VisitMutWith}; -pub static JS_ENVIRONMENT_PROPS: Lazy> = Lazy::new(|| { +pub static JS_ENVIRONMENT_PROPS: Lazy> = Lazy::new(|| { let domprops: Vec = serde_json::from_str(include_str!("../lists/domprops.json")) .expect("failed to parse domprops.json for property mangler"); let jsprops: Vec = serde_json::from_str(include_str!("../lists/jsprops.json")) .expect("Failed to parse jsprops.json for property mangler"); - let mut word_set: HashSet = HashSet::new(); + let mut word_set: AHashSet = HashSet::default(); for name in domprops.iter().chain(jsprops.iter()) { word_set.insert(name.clone()); @@ -33,11 +34,11 @@ pub static JS_ENVIRONMENT_PROPS: Lazy> = Lazy::new(|| { struct ManglePropertiesState { options: ManglePropertiesOptions, - names_to_mangle: HashSet, - unmangleable: HashSet, + names_to_mangle: AHashSet, + unmangleable: AHashSet, // Cache of already mangled names - cache: HashMap, + cache: AHashMap, // Numbers to pass to base54() n: usize, diff --git a/ecmascript/parser/Cargo.toml b/ecmascript/parser/Cargo.toml index bf7aa1a448c7..e4bc54175e46 100644 --- a/ecmascript/parser/Cargo.toml +++ b/ecmascript/parser/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_parser" repository = "https://github.com/swc-project/swc.git" -version = "0.66.3" +version = "0.66.4" [package.metadata.docs.rs] all-features = true @@ -26,16 +26,16 @@ num-bigint = "0.2" serde = {version = "1", features = ["derive"]} smallvec = "1" swc_atoms = {version = "0.2.3", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} unicode-xid = "0.2" [dev-dependencies] env_logger = "0.7" pretty_assertions = "0.6" serde_json = "1" -testing = {version = "0.12.0", path = "../../testing"} +testing = {version = "0.12.2", path = "../../testing"} walkdir = "2" [[example]] diff --git a/ecmascript/preset-env/Cargo.toml b/ecmascript/preset-env/Cargo.toml index 4b36a8eca833..b272ba956318 100644 --- a/ecmascript/preset-env/Cargo.toml +++ b/ecmascript/preset-env/Cargo.toml @@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_preset_env/" edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_preset_env" -version = "0.36.0" +version = "0.36.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -20,15 +20,15 @@ serde_json = "1" st-map = "0.1.2" string_enum = {version = "0.3.1", path = "../../macros/string_enum"} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_transforms = {version = "0.65.0", path = "../transforms", features = ["compat", "proposal"]} -swc_ecma_utils = {version = "0.41.0", path = "../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_transforms = {version = "0.65.1", path = "../transforms", features = ["compat", "proposal"]} +swc_ecma_utils = {version = "0.41.2", path = "../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} walkdir = "2" [dev-dependencies] pretty_assertions = "0.6" -swc_ecma_codegen = {version = "0.66.0", path = "../codegen"} -swc_ecma_parser = {version = "0.66.0", path = "../parser"} -testing = {version = "0.12.0", path = "../../testing"} +swc_ecma_codegen = {version = "0.66.3", path = "../codegen"} +swc_ecma_parser = {version = "0.66.4", path = "../parser"} +testing = {version = "0.12.2", path = "../../testing"} diff --git a/ecmascript/preset-env/src/corejs2/builtin.rs b/ecmascript/preset-env/src/corejs2/builtin.rs index e125ae3f3ccc..27eef47c81c0 100644 --- a/ecmascript/preset-env/src/corejs2/builtin.rs +++ b/ecmascript/preset-env/src/corejs2/builtin.rs @@ -1,9 +1,9 @@ use crate::{BrowserData, Versions}; use once_cell::sync::Lazy; -use std::collections::HashMap; +use swc_common::collections::AHashMap; -pub(crate) static BUILTINS: Lazy> = Lazy::new(|| { - let map: HashMap<_, BrowserData>> = +pub(crate) static BUILTINS: Lazy> = Lazy::new(|| { + let map: AHashMap<_, BrowserData>> = serde_json::from_str(include_str!("builtin.json")).expect("failed to parse json"); map.into_iter() diff --git a/ecmascript/preset-env/src/transform_data.rs b/ecmascript/preset-env/src/transform_data.rs index ac9aa37d903b..2d3480e7cfe2 100644 --- a/ecmascript/preset-env/src/transform_data.rs +++ b/ecmascript/preset-env/src/transform_data.rs @@ -1,7 +1,7 @@ use crate::{version::should_enable, BrowserData, Version, Versions}; use once_cell::sync::Lazy; -use std::collections::HashMap; use string_enum::StringEnum; +use swc_common::collections::AHashMap; impl Feature { pub fn should_enable(self, target: Versions, bugfixes: bool, default: bool) -> bool { @@ -150,9 +150,9 @@ pub enum Feature { BugfixTaggedTemplateCaching, } -pub(crate) static FEATURES: Lazy>>> = +pub(crate) static FEATURES: Lazy>>> = Lazy::new(|| { - let map: HashMap>> = + let map: AHashMap>> = serde_json::from_str(include_str!("transform_data.json")) .expect("failed to parse json"); @@ -166,9 +166,9 @@ pub(crate) static FEATURES: Lazy>>> .collect() }); -pub(crate) static BUGFIX_FEATURES: Lazy>>> = +pub(crate) static BUGFIX_FEATURES: Lazy>>> = Lazy::new(|| { - let map: HashMap>> = + let map: AHashMap>> = serde_json::from_str(include_str!("transform_data_bugfixes.json")) .expect("failed to parse json"); diff --git a/ecmascript/preset-env/tests/test.rs b/ecmascript/preset-env/tests/test.rs index cc5dac81992e..cd3a850f54e0 100644 --- a/ecmascript/preset-env/tests/test.rs +++ b/ecmascript/preset-env/tests/test.rs @@ -3,14 +3,15 @@ use serde::Deserialize; use serde_json::Value; use std::{ cmp::Ordering, - collections::HashMap, env, fs::File, io, io::Read, path::{Path, PathBuf}, }; -use swc_common::{comments::SingleThreadedComments, input::StringInput, FromVariant, Mark}; +use swc_common::{ + collections::AHashMap, comments::SingleThreadedComments, input::StringInput, FromVariant, Mark, +}; use swc_ecma_ast::*; use swc_ecma_codegen::Emitter; use swc_ecma_parser::{EsConfig, Parser, Syntax}; @@ -64,7 +65,7 @@ struct PresetConfig { #[serde(untagged)] pub enum CoreJs { Ver(Version), - Val(HashMap), + Val(AHashMap), } impl Default for CoreJs { diff --git a/ecmascript/transforms/Cargo.toml b/ecmascript/transforms/Cargo.toml index 5f3ff8f2f6b7..a50e259bc87c 100644 --- a/ecmascript/transforms/Cargo.toml +++ b/ecmascript/transforms/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms" repository = "https://github.com/swc-project/swc.git" -version = "0.65.0" +version = "0.65.1" [package.metadata.docs.rs] all-features = true @@ -22,25 +22,25 @@ typescript = ["swc_ecma_transforms_typescript"] [dependencies] swc_atoms = {version = "0.2.0", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_parser = {version = "0.66.0", path = "../parser"} -swc_ecma_transforms_base = {version = "0.26.0", path = "./base"} -swc_ecma_transforms_compat = {version = "0.29.0", path = "./compat", optional = true} -swc_ecma_transforms_module = {version = "0.32.0", path = "./module", optional = true} -swc_ecma_transforms_optimization = {version = "0.35.0", path = "./optimization", optional = true} -swc_ecma_transforms_proposal = {version = "0.32.0", path = "./proposal", optional = true} -swc_ecma_transforms_react = {version = "0.33.0", path = "./react", optional = true} -swc_ecma_transforms_typescript = {version = "0.34.0", path = "./typescript", optional = true} -swc_ecma_utils = {version = "0.41.0", path = "../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_parser = {version = "0.66.4", path = "../parser"} +swc_ecma_transforms_base = {version = "0.26.3", path = "./base"} +swc_ecma_transforms_compat = {version = "0.29.4", path = "./compat", optional = true} +swc_ecma_transforms_module = {version = "0.32.1", path = "./module", optional = true} +swc_ecma_transforms_optimization = {version = "0.35.1", path = "./optimization", optional = true} +swc_ecma_transforms_proposal = {version = "0.32.1", path = "./proposal", optional = true} +swc_ecma_transforms_react = {version = "0.33.1", path = "./react", optional = true} +swc_ecma_transforms_typescript = {version = "0.34.1", path = "./typescript", optional = true} +swc_ecma_utils = {version = "0.41.2", path = "../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} unicode-xid = "0.2" [dev-dependencies] pretty_assertions = "0.6" sourcemap = "6" -swc_ecma_codegen = {version = "0.66.0", path = "../codegen"} -swc_ecma_transforms_testing = {version = "0.26.0", path = "./testing"} +swc_ecma_codegen = {version = "0.66.3", path = "../codegen"} +swc_ecma_transforms_testing = {version = "0.26.3", path = "./testing"} tempfile = "3" -testing = {version = "0.12.0", path = "../../testing"} +testing = {version = "0.12.2", path = "../../testing"} walkdir = "2" diff --git a/ecmascript/transforms/base/Cargo.toml b/ecmascript/transforms/base/Cargo.toml index c1ada2832fad..7f66a62f83f6 100644 --- a/ecmascript/transforms/base/Cargo.toml +++ b/ecmascript/transforms/base/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_base" repository = "https://github.com/swc-project/swc.git" -version = "0.26.2" +version = "0.26.3" [dependencies] fxhash = "0.2.1" @@ -15,12 +15,12 @@ phf = {version = "0.8.0", features = ["macros"]} scoped-tls = "1.0.0" smallvec = "1.6.0" swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} [dev-dependencies] -swc_ecma_codegen = {version = "0.66.0", path = "../../codegen"} -testing = {version = "0.12.0", path = "../../../testing"} +swc_ecma_codegen = {version = "0.66.3", path = "../../codegen"} +testing = {version = "0.12.2", path = "../../../testing"} diff --git a/ecmascript/transforms/base/src/hygiene/tests.rs b/ecmascript/transforms/base/src/hygiene/tests.rs index 0f30a0810406..54c47cb3942e 100644 --- a/ecmascript/transforms/base/src/hygiene/tests.rs +++ b/ecmascript/transforms/base/src/hygiene/tests.rs @@ -1,13 +1,12 @@ use super::*; use crate::tests::{HygieneVisualizer, Tester}; -use std::collections::HashMap; -use swc_common::{hygiene::*, DUMMY_SP}; +use swc_common::{collections::AHashMap, hygiene::*, DUMMY_SP}; use swc_ecma_parser::Syntax; use swc_ecma_utils::quote_ident; use swc_ecma_visit::{Fold, FoldWith}; struct Marker { - map: HashMap, + map: AHashMap, } fn marker(markers: &[(&str, Mark)]) -> Marker { @@ -27,7 +26,7 @@ impl Fold for Marker { } struct OnceMarker { - map: HashMap>, + map: AHashMap>, } impl OnceMarker { diff --git a/ecmascript/transforms/classes/Cargo.toml b/ecmascript/transforms/classes/Cargo.toml index 7f47167660d3..7856c5cf2ef9 100644 --- a/ecmascript/transforms/classes/Cargo.toml +++ b/ecmascript/transforms/classes/Cargo.toml @@ -6,12 +6,12 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_classes" repository = "https://github.com/swc-project/swc.git" -version = "0.12.1" +version = "0.12.2" [dependencies] swc_atoms = {version = "0.2.6", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} diff --git a/ecmascript/transforms/compat/Cargo.toml b/ecmascript/transforms/compat/Cargo.toml index 3a3a2a236328..7dc9e79b36d2 100644 --- a/ecmascript/transforms/compat/Cargo.toml +++ b/ecmascript/transforms/compat/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_compat" repository = "https://github.com/swc-project/swc.git" -version = "0.29.3" +version = "0.29.4" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -19,15 +19,15 @@ ordered-float = "2.0.1" serde = {version = "1.0.118", features = ["derive"]} smallvec = "1.6.0" swc_atoms = {version = "0.2.5", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_transforms_classes = {version = "0.12.0", path = "../classes"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_transforms_classes = {version = "0.12.2", path = "../classes"} swc_ecma_transforms_macros = {version = "0.2.1", path = "../macros"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} [dev-dependencies] -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_transforms_testing = {version = "0.26.0", path = "../testing"} -testing = {version = "0.12.0", path = "../../../testing"} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_transforms_testing = {version = "0.26.3", path = "../testing"} +testing = {version = "0.12.2", path = "../../../testing"} diff --git a/ecmascript/transforms/compat/src/es2015/block_scoping.rs b/ecmascript/transforms/compat/src/es2015/block_scoping.rs index e9012eb93402..1f93b778d4eb 100644 --- a/ecmascript/transforms/compat/src/es2015/block_scoping.rs +++ b/ecmascript/transforms/compat/src/es2015/block_scoping.rs @@ -1,10 +1,7 @@ use smallvec::SmallVec; -use std::{ - collections::HashMap, - mem::{replace, take}, -}; +use std::mem::{replace, take}; use swc_atoms::js_word; -use swc_common::{util::map::Map, Mark, Spanned, SyntaxContext, DUMMY_SP}; +use swc_common::{collections::AHashMap, util::map::Map, Mark, Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms_base::helper; use swc_ecma_utils::{ @@ -48,7 +45,7 @@ enum ScopeKind { /// Produced by identifier reference and consumed by for-of/in loop. used: Vec, /// Map of original identifer to modified syntax context - mutated: HashMap, + mutated: AHashMap, }, Fn, Block, @@ -749,7 +746,7 @@ struct FlowHelper<'a> { has_break: bool, has_return: bool, all: &'a Vec, - mutated: HashMap, + mutated: AHashMap, in_switch_case: bool, } @@ -878,7 +875,7 @@ impl Fold for FlowHelper<'_> { } struct MutationHandler<'a> { - map: &'a mut HashMap, + map: &'a mut AHashMap, in_function: bool, this: Option, arguments: Option, diff --git a/ecmascript/transforms/module/Cargo.toml b/ecmascript/transforms/module/Cargo.toml index f889fe713885..c0287196f77a 100644 --- a/ecmascript/transforms/module/Cargo.toml +++ b/ecmascript/transforms/module/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_module" repository = "https://github.com/swc-project/swc.git" -version = "0.32.0" +version = "0.32.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -17,15 +17,15 @@ indexmap = "1.6.1" pathdiff = "0.2.0" serde = {version = "1.0.118", features = ["derive"]} swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_loader = {version = "0.14.0", path = "../../loader", features = ["node"]} -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_loader = {version = "0.14.1", path = "../../loader", features = ["node"]} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} [dev-dependencies] -swc_ecma_transforms_compat = {version = "0.29.0", path = "../compat"} -swc_ecma_transforms_testing = {version = "0.26.0", path = "../testing/"} -testing = {version = "0.12.0", path = "../../../testing/"} +swc_ecma_transforms_compat = {version = "0.29.4", path = "../compat"} +swc_ecma_transforms_testing = {version = "0.26.3", path = "../testing/"} +testing = {version = "0.12.2", path = "../../../testing/"} diff --git a/ecmascript/transforms/module/src/util.rs b/ecmascript/transforms/module/src/util.rs index 506bb60b7b5e..fb747bf81a18 100644 --- a/ecmascript/transforms/module/src/util.rs +++ b/ecmascript/transforms/module/src/util.rs @@ -6,11 +6,14 @@ use inflector::Inflector; use serde::{Deserialize, Serialize}; use std::{ cell::{Ref, RefMut}, - collections::{hash_map::Entry, HashMap, HashSet}, + collections::hash_map::Entry, iter, }; use swc_atoms::{js_word, JsWord}; -use swc_common::{FileName, Mark, Span, SyntaxContext, DUMMY_SP}; +use swc_common::{ + collections::{AHashMap, AHashSet}, + FileName, Mark, Span, SyntaxContext, DUMMY_SP, +}; use swc_ecma_ast::*; use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ @@ -125,11 +128,11 @@ pub struct Scope { /// /// - `export { a as b }` /// -> `{ a: [b] }` - pub(crate) exported_vars: HashMap<(JsWord, SyntaxContext), Vec<(JsWord, SyntaxContext)>>, + pub(crate) exported_vars: AHashMap<(JsWord, SyntaxContext), Vec<(JsWord, SyntaxContext)>>, /// This is required to handle /// `export * from 'foo';` - pub(crate) lazy_blacklist: HashSet, + pub(crate) lazy_blacklist: AHashSet, } impl Scope { diff --git a/ecmascript/transforms/optimization/Cargo.toml b/ecmascript/transforms/optimization/Cargo.toml index 209372c1ebfd..ca9176fe67bd 100644 --- a/ecmascript/transforms/optimization/Cargo.toml +++ b/ecmascript/transforms/optimization/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_optimization" repository = "https://github.com/swc-project/swc.git" -version = "0.35.0" +version = "0.35.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -18,18 +18,18 @@ once_cell = "1.5.2" retain_mut = "0.1.2" serde_json = "1.0.61" swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} [dev-dependencies] -swc_ecma_transforms_compat = {version = "0.29.0", path = "../compat"} -swc_ecma_transforms_module = {version = "0.32.0", path = "../module"} -swc_ecma_transforms_proposal = {version = "0.32.0", path = "../proposal"} -swc_ecma_transforms_react = {version = "0.33.0", path = "../react"} -swc_ecma_transforms_testing = {version = "0.26.0", path = "../testing"} -swc_ecma_transforms_typescript = {version = "0.34.0", path = "../typescript"} -testing = {version = "0.12.0", path = "../../../testing"} +swc_ecma_transforms_compat = {version = "0.29.4", path = "../compat"} +swc_ecma_transforms_module = {version = "0.32.1", path = "../module"} +swc_ecma_transforms_proposal = {version = "0.32.1", path = "../proposal"} +swc_ecma_transforms_react = {version = "0.33.1", path = "../react"} +swc_ecma_transforms_testing = {version = "0.26.3", path = "../testing"} +swc_ecma_transforms_typescript = {version = "0.34.1", path = "../typescript"} +testing = {version = "0.12.2", path = "../../../testing"} diff --git a/ecmascript/transforms/proposal/Cargo.toml b/ecmascript/transforms/proposal/Cargo.toml index 47a5355b9121..28a50d3d3be7 100644 --- a/ecmascript/transforms/proposal/Cargo.toml +++ b/ecmascript/transforms/proposal/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_proposal" repository = "https://github.com/swc-project/swc.git" -version = "0.32.0" +version = "0.32.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -20,16 +20,16 @@ fxhash = "0.2.1" serde = {version = "1.0.118", features = ["derive"]} smallvec = "1.6.0" swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_loader = {version = "0.14.0", path = "../../loader", optional = true} -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_transforms_classes = {version = "0.12.0", path = "../classes"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_loader = {version = "0.14.1", path = "../../loader", optional = true} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_transforms_classes = {version = "0.12.2", path = "../classes"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} [dev-dependencies] -swc_ecma_transforms_compat = {version = "0.29.0", path = "../compat"} -swc_ecma_transforms_module = {version = "0.32.0", path = "../module"} -swc_ecma_transforms_testing = {version = "0.26.0", path = "../testing"} +swc_ecma_transforms_compat = {version = "0.29.4", path = "../compat"} +swc_ecma_transforms_module = {version = "0.32.1", path = "../module"} +swc_ecma_transforms_testing = {version = "0.26.3", path = "../testing"} diff --git a/ecmascript/transforms/react/Cargo.toml b/ecmascript/transforms/react/Cargo.toml index 12eafe1298cf..047c8bc3f478 100644 --- a/ecmascript/transforms/react/Cargo.toml +++ b/ecmascript/transforms/react/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_transforms_react" repository = "https://github.com/swc-project/swc.git" -version = "0.33.0" +version = "0.33.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -20,16 +20,16 @@ serde = {version = "1.0.118", features = ["derive"]} sha-1 = "0.9.4" string_enum = {version = "0.3.1", path = "../../../macros/string_enum"} swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} [dev-dependencies] -swc_ecma_codegen = {version = "0.66.0", path = "../../codegen/"} -swc_ecma_transforms_compat = {version = "0.29.0", path = "../compat/"} -swc_ecma_transforms_module = {version = "0.32.0", path = "../module"} -swc_ecma_transforms_testing = {version = "0.26.0", path = "../testing/"} -testing = {version = "0.12.0", path = "../../../testing"} +swc_ecma_codegen = {version = "0.66.3", path = "../../codegen/"} +swc_ecma_transforms_compat = {version = "0.29.4", path = "../compat/"} +swc_ecma_transforms_module = {version = "0.32.1", path = "../module"} +swc_ecma_transforms_testing = {version = "0.26.3", path = "../testing/"} +testing = {version = "0.12.2", path = "../../../testing"} diff --git a/ecmascript/transforms/react/src/pure_annotations/mod.rs b/ecmascript/transforms/react/src/pure_annotations/mod.rs index ac60a4e37fb5..1bba2e1ba28a 100644 --- a/ecmascript/transforms/react/src/pure_annotations/mod.rs +++ b/ecmascript/transforms/react/src/pure_annotations/mod.rs @@ -1,6 +1,5 @@ -use std::collections::HashMap; use swc_atoms::{js_word, JsWord}; -use swc_common::comments::Comments; +use swc_common::{collections::AHashMap, comments::Comments}; use swc_ecma_ast::*; use swc_ecma_utils::{id, Id}; use swc_ecma_visit::{Fold, FoldWith}; @@ -17,7 +16,7 @@ where C: Comments, { PureAnnotations { - imports: HashMap::new(), + imports: Default::default(), comments, } } @@ -26,7 +25,7 @@ struct PureAnnotations where C: Comments, { - imports: HashMap, + imports: AHashMap, comments: Option, } diff --git a/ecmascript/transforms/react/src/refresh/mod.rs b/ecmascript/transforms/react/src/refresh/mod.rs index 1b953ea0567e..6efc885ea1ff 100644 --- a/ecmascript/transforms/react/src/refresh/mod.rs +++ b/ecmascript/transforms/react/src/refresh/mod.rs @@ -11,6 +11,7 @@ use sha1::{Digest, Sha1}; use swc_atoms::JsWord; use swc_common::{ + collections::{AHashMap, AHashSet}, comments::{Comments, CommentsExt}, sync::Lrc, BytePos, SourceMap, Span, Spanned, DUMMY_SP, @@ -55,9 +56,9 @@ fn get_persistent_id(ident: &Ident) -> Persist { } } -fn hook_to_handle_map(hook_fn: Vec) -> (HashMap, HashSet) { - let mut has_ident = HashMap::new(); - let mut ignore = HashSet::new(); +fn hook_to_handle_map(hook_fn: Vec) -> (AHashMap, AHashSet) { + let mut has_ident = HashMap::default(); + let mut ignore = HashSet::default(); for hook in hook_fn { if let Some(binding) = &hook.binding { has_ident.insert(binding.clone(), hook); @@ -100,7 +101,7 @@ pub fn refresh( comments, should_reset: false, options: options.unwrap_or(Default::default()), - used_in_jsx: HashSet::new(), + used_in_jsx: HashSet::default(), curr_hook_fn: Vec::new(), scope_binding: IndexSet::new(), } @@ -111,7 +112,7 @@ struct Refresh { options: RefreshOptions, cm: Lrc, should_reset: bool, - used_in_jsx: HashSet, + used_in_jsx: AHashSet, comments: Option, curr_hook_fn: Vec, // bindings in current and all parent scope @@ -397,7 +398,7 @@ impl Refresh { fn get_persistent_id_from_var_decl( &self, var_decl: &mut VarDecl, - ignore: &HashSet, + ignore: &AHashSet, ) -> Persist { // We only handle the case when a single variable is declared if let [VarDeclarator { @@ -446,7 +447,7 @@ impl Refresh { mut reg: Vec<(Ident, String)>, // sadly unlike orignal implent our transform for component happens before hook // so we should just ignore hook register - ignore: &HashSet, + ignore: &AHashSet, ) -> Persist { if let Some(ident) = callee_should_ignore(ignore, &call_expr.callee) { // there's at least one item in reg diff --git a/ecmascript/transforms/react/src/refresh/util.rs b/ecmascript/transforms/react/src/refresh/util.rs index 0c58ae3f0210..7632dea9730a 100644 --- a/ecmascript/transforms/react/src/refresh/util.rs +++ b/ecmascript/transforms/react/src/refresh/util.rs @@ -1,8 +1,6 @@ use indexmap::IndexSet; -use std::collections::HashSet; use swc_atoms::JsWord; - -use swc_common::{Spanned, DUMMY_SP}; +use swc_common::{collections::AHashSet, Spanned, DUMMY_SP}; use swc_ecma_ast::*; pub trait CollectIdent { @@ -201,7 +199,7 @@ pub fn is_import_or_require(expr: &Expr) -> bool { } pub fn callee_should_ignore<'a>( - ignore: &'a HashSet, + ignore: &'a AHashSet, callee: &ExprOrSuper, ) -> Option { let expr = if let ExprOrSuper::Expr(expr) = callee { diff --git a/ecmascript/transforms/testing/Cargo.toml b/ecmascript/transforms/testing/Cargo.toml index 1181b63da40c..1e5451bae114 100644 --- a/ecmascript/transforms/testing/Cargo.toml +++ b/ecmascript/transforms/testing/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_testing" repository = "https://github.com/swc-project/swc.git" -version = "0.26.2" +version = "0.26.3" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,12 +15,12 @@ ansi_term = "0.12.1" anyhow = "1" serde = "1" serde_json = "1" -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_codegen = {version = "0.66.0", path = "../../codegen"} -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_codegen = {version = "0.66.3", path = "../../codegen"} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} tempfile = "3.1.0" -testing = {version = "0.12.0", path = "../../../testing"} +testing = {version = "0.12.2", path = "../../../testing"} diff --git a/ecmascript/transforms/typescript/Cargo.toml b/ecmascript/transforms/typescript/Cargo.toml index 87046a490b75..f138d96d4380 100644 --- a/ecmascript/transforms/typescript/Cargo.toml +++ b/ecmascript/transforms/typescript/Cargo.toml @@ -6,25 +6,25 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_typescript" repository = "https://github.com/swc-project/swc.git" -version = "0.34.0" +version = "0.34.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] fxhash = "0.2.1" serde = {version = "1.0.118", features = ["derive"]} swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.0", path = "../../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../../ast"} -swc_ecma_parser = {version = "0.66.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.26.0", path = "../base"} -swc_ecma_utils = {version = "0.41.0", path = "../../utils"} -swc_ecma_visit = {version = "0.35.0", path = "../../visit"} +swc_common = {version = "0.11.6", path = "../../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../../ast"} +swc_ecma_parser = {version = "0.66.4", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.26.3", path = "../base"} +swc_ecma_utils = {version = "0.41.2", path = "../../utils"} +swc_ecma_visit = {version = "0.35.2", path = "../../visit"} [dev-dependencies] -swc_ecma_codegen = {version = "0.66.0", path = "../../codegen"} -swc_ecma_transforms_compat = {version = "0.29.0", path = "../compat"} -swc_ecma_transforms_module = {version = "0.32.0", path = "../module"} -swc_ecma_transforms_proposal = {version = "0.32.0", path = "../proposal/"} -swc_ecma_transforms_testing = {version = "0.26.0", path = "../testing"} -testing = {version = "0.12.0", path = "../../../testing"} +swc_ecma_codegen = {version = "0.66.3", path = "../../codegen"} +swc_ecma_transforms_compat = {version = "0.29.4", path = "../compat"} +swc_ecma_transforms_module = {version = "0.32.1", path = "../module"} +swc_ecma_transforms_proposal = {version = "0.32.1", path = "../proposal/"} +swc_ecma_transforms_testing = {version = "0.26.3", path = "../testing"} +testing = {version = "0.12.2", path = "../../../testing"} walkdir = "2.3.1" diff --git a/ecmascript/utils/Cargo.toml b/ecmascript/utils/Cargo.toml index 60df1d4ddb55..5ff4d8ce3358 100644 --- a/ecmascript/utils/Cargo.toml +++ b/ecmascript/utils/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_utils" repository = "https://github.com/swc-project/swc.git" -version = "0.41.1" +version = "0.41.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,10 +14,10 @@ version = "0.41.1" once_cell = "1" scoped-tls = "1" swc_atoms = {version = "0.2.0", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} -swc_ecma_visit = {version = "0.35.0", path = "../visit"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} +swc_ecma_visit = {version = "0.35.2", path = "../visit"} unicode-xid = "0.2" [dev-dependencies] -testing = {version = "0.12.0", path = "../../testing"} +testing = {version = "0.12.2", path = "../../testing"} diff --git a/ecmascript/visit/Cargo.toml b/ecmascript/visit/Cargo.toml index 433d3e1c5eae..2e44e70da2de 100644 --- a/ecmascript/visit/Cargo.toml +++ b/ecmascript/visit/Cargo.toml @@ -6,11 +6,11 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_visit" repository = "https://github.com/swc-project/swc.git" -version = "0.35.1" +version = "0.35.2" [dependencies] num-bigint = {version = "0.2", features = ["serde"]} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.0", path = "../../common"} -swc_ecma_ast = {version = "0.49.0", path = "../ast"} +swc_common = {version = "0.11.6", path = "../../common"} +swc_ecma_ast = {version = "0.49.4", path = "../ast"} swc_visit = {version = "0.2.3", path = "../../visit"} diff --git a/node/base/Cargo.toml b/node/base/Cargo.toml index 782d12126f9e..76df17f9825f 100644 --- a/node/base/Cargo.toml +++ b/node/base/Cargo.toml @@ -6,13 +6,13 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_node_base" repository = "https://github.com/swc-project/swc.git" -version = "0.2.1" +version = "0.2.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] dashmap = "4.0.2" -swc_common = {version = "0.11.0", path = "../../common"} +swc_common = {version = "0.11.6", path = "../../common"} [target.'cfg(all(target_arch = "x86_64", not(target_env = "musl")))'.dependencies] mimalloc-rust = "=0.1.1" diff --git a/node/bundler/src/config/mod.rs b/node/bundler/src/config/mod.rs index 1e6eee35c815..96d31f9bbd71 100644 --- a/node/bundler/src/config/mod.rs +++ b/node/bundler/src/config/mod.rs @@ -9,7 +9,7 @@ use serde::Deserialize; use std::{collections::HashMap, fmt, marker::PhantomData, path::PathBuf}; use string_enum::StringEnum; use swc_atoms::JsWord; -use swc_common::FileName; +use swc_common::{collections::AHashMap, FileName}; use swc_ecma_ast::TargetEnv; use swc_ecma_parser::JscTarget; @@ -84,7 +84,7 @@ impl Default for Mode { pub enum EntryConfig { File(String), Multiple(Vec), - Files(HashMap), + Files(AHashMap), } impl From for HashMap { diff --git a/testing/Cargo.toml b/testing/Cargo.toml index 949548aa54e9..e7990b53a658 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "testing" repository = "https://github.com/swc-project/swc.git" -version = "0.12.1" +version = "0.12.2" [dependencies] ansi_term = "0.12.1" @@ -16,5 +16,5 @@ log = "0.4" once_cell = "1" pretty_assertions = "0.7.2" regex = "1" -swc_common = {version = "0.11.0", path = "../common", features = ["tty-emitter"]} +swc_common = {version = "0.11.6", path = "../common", features = ["tty-emitter"]} testing_macros = {version = "0.2.0", path = "./macros"} diff --git a/testing/src/lib.rs b/testing/src/lib.rs index 0e2732279a5b..1d07224d1e7f 100644 --- a/testing/src/lib.rs +++ b/testing/src/lib.rs @@ -4,7 +4,6 @@ use once_cell::sync::Lazy; pub use pretty_assertions::{assert_eq, assert_ne}; use regex::Regex; use std::{ - collections::HashMap, env, fmt, fmt::{Debug, Display, Formatter}, fs::{create_dir_all, File}, @@ -14,6 +13,7 @@ use std::{ thread, }; use swc_common::{ + collections::AHashMap, errors::{Diagnostic, Handler}, sync::Lrc, FilePathMapping, SourceMap, @@ -63,7 +63,7 @@ pub fn init() { } pub fn find_executable(name: &str) -> Option { - static CACHE: Lazy>> = Lazy::new(|| Default::default()); + static CACHE: Lazy>> = Lazy::new(|| Default::default()); { let locked = CACHE.read().unwrap();