mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
refactor: Move HANDLER
to swc_common
(#2599)
swc_common: - Add `HANDLER`. swc_ecma_utils: - Replace `HANDLER` with one from `swc_common`. - Make `StmtLike` `: Send + Sync`.
This commit is contained in:
parent
cd2a2777d9
commit
e589d00f62
41
Cargo.lock
generated
41
Cargo.lock
generated
@ -2341,7 +2341,7 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||
|
||||
[[package]]
|
||||
name = "swc"
|
||||
version = "0.80.0"
|
||||
version = "0.81.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
@ -2447,7 +2447,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_bundler"
|
||||
version = "0.78.0"
|
||||
version = "0.79.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
@ -2490,7 +2490,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_common"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"arbitrary",
|
||||
@ -2660,7 +2660,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_ext_transforms"
|
||||
version = "0.35.0"
|
||||
version = "0.36.0"
|
||||
dependencies = [
|
||||
"phf",
|
||||
"swc_atoms 0.2.9",
|
||||
@ -2695,7 +2695,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_minifier"
|
||||
version = "0.47.1"
|
||||
version = "0.48.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ansi_term 0.12.1",
|
||||
@ -2753,7 +2753,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_preset_env"
|
||||
version = "0.62.0"
|
||||
version = "0.63.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"dashmap",
|
||||
@ -2779,7 +2779,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms"
|
||||
version = "0.91.0"
|
||||
version = "0.92.0"
|
||||
dependencies = [
|
||||
"pretty_assertions 0.6.1",
|
||||
"sourcemap",
|
||||
@ -2806,7 +2806,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_base"
|
||||
version = "0.41.3"
|
||||
version = "0.42.0"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"phf",
|
||||
@ -2827,7 +2827,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_classes"
|
||||
version = "0.27.0"
|
||||
version = "0.28.0"
|
||||
dependencies = [
|
||||
"swc_atoms 0.2.9",
|
||||
"swc_common",
|
||||
@ -2839,7 +2839,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_compat"
|
||||
version = "0.48.1"
|
||||
version = "0.49.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"arrayvec",
|
||||
@ -2866,7 +2866,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_macros"
|
||||
version = "0.2.3"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"pmutil",
|
||||
"proc-macro2",
|
||||
@ -2877,7 +2877,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_module"
|
||||
version = "0.54.1"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"Inflector",
|
||||
"ahash",
|
||||
@ -2900,7 +2900,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_optimization"
|
||||
version = "0.61.0"
|
||||
version = "0.62.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"dashmap",
|
||||
@ -2929,7 +2929,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_proposal"
|
||||
version = "0.54.0"
|
||||
version = "0.55.0"
|
||||
dependencies = [
|
||||
"either",
|
||||
"serde",
|
||||
@ -2953,7 +2953,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_react"
|
||||
version = "0.56.1"
|
||||
version = "0.57.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"base64 0.13.0",
|
||||
@ -2981,7 +2981,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_testing"
|
||||
version = "0.42.1"
|
||||
version = "0.43.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"anyhow",
|
||||
@ -3002,7 +3002,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_typescript"
|
||||
version = "0.57.0"
|
||||
version = "0.58.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"swc_atoms 0.2.9",
|
||||
@ -3024,11 +3024,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_utils"
|
||||
version = "0.49.0"
|
||||
version = "0.50.0"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"rayon",
|
||||
"scoped-tls",
|
||||
"swc_atoms 0.2.9",
|
||||
"swc_common",
|
||||
"swc_ecma_ast",
|
||||
@ -3050,7 +3049,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecmascript"
|
||||
version = "0.83.0"
|
||||
version = "0.84.0"
|
||||
dependencies = [
|
||||
"swc_ecma_ast",
|
||||
"swc_ecma_codegen",
|
||||
@ -3156,7 +3155,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_plugin_testing"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"swc_atoms 0.2.9",
|
||||
|
20
Cargo.toml
20
Cargo.toml
@ -21,7 +21,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.80.0"
|
||||
version = "0.81.0"
|
||||
|
||||
[lib]
|
||||
name = "swc"
|
||||
@ -63,12 +63,12 @@ swc_atoms = {version = "0.2", path = "./atoms"}
|
||||
swc_common = {version = "0.14.0", path = "./common", features = ["sourcemap", "concurrent"]}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "./ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "./ecmascript/codegen"}
|
||||
swc_ecma_ext_transforms = {version = "0.35.0", path = "./ecmascript/ext-transforms"}
|
||||
swc_ecma_ext_transforms = {version = "0.36.0", path = "./ecmascript/ext-transforms"}
|
||||
swc_ecma_loader = {version = "0.23.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
|
||||
swc_ecma_minifier = {version = "0.47.0", path = "./ecmascript/minifier"}
|
||||
swc_ecma_minifier = {version = "0.48.0", path = "./ecmascript/minifier"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "./ecmascript/parser"}
|
||||
swc_ecma_preset_env = {version = "0.62.0", path = "./ecmascript/preset-env"}
|
||||
swc_ecma_transforms = {version = "0.91.0", path = "./ecmascript/transforms", features = [
|
||||
swc_ecma_preset_env = {version = "0.63.0", path = "./ecmascript/preset-env"}
|
||||
swc_ecma_transforms = {version = "0.92.0", path = "./ecmascript/transforms", features = [
|
||||
"compat",
|
||||
"module",
|
||||
"optimization",
|
||||
@ -76,12 +76,12 @@ swc_ecma_transforms = {version = "0.91.0", path = "./ecmascript/transforms", fea
|
||||
"react",
|
||||
"typescript",
|
||||
]}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "./ecmascript/transforms/base"}
|
||||
swc_ecma_transforms_compat = {version = "0.48.0", path = "./ecmascript/transforms/compat"}
|
||||
swc_ecma_transforms_optimization = {version = "0.61.0", path = "./ecmascript/transforms/optimization"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "./ecmascript/utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "./ecmascript/transforms/base"}
|
||||
swc_ecma_transforms_compat = {version = "0.49.0", path = "./ecmascript/transforms/compat"}
|
||||
swc_ecma_transforms_optimization = {version = "0.62.0", path = "./ecmascript/transforms/optimization"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "./ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "./ecmascript/visit"}
|
||||
swc_ecmascript = {version = "0.83.0", path = "./ecmascript"}
|
||||
swc_ecmascript = {version = "0.84.0", path = "./ecmascript"}
|
||||
swc_visit = {version = "0.2.3", path = "./visit"}
|
||||
tracing = "0.1.28"
|
||||
|
||||
|
@ -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.78.0"
|
||||
version = "0.79.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[features]
|
||||
@ -42,9 +42,9 @@ swc_ecma_ast = {version = "0.56.0", path = "../ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../ecmascript/codegen"}
|
||||
swc_ecma_loader = {version = "0.23.0", path = "../ecmascript/loader"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../ecmascript/parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../ecmascript/transforms/base"}
|
||||
swc_ecma_transforms_optimization = {version = "0.61.0", path = "../ecmascript/transforms/optimization"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../ecmascript/utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../ecmascript/transforms/base"}
|
||||
swc_ecma_transforms_optimization = {version = "0.62.0", path = "../ecmascript/transforms/optimization"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../ecmascript/visit"}
|
||||
tracing = "0.1.28"
|
||||
|
||||
@ -55,9 +55,9 @@ path-clean = "=0.1.0"
|
||||
reqwest = {version = "0.11.4", features = ["blocking"]}
|
||||
sha-1 = "0.9"
|
||||
swc_ecma_loader = {version = "0.23.0", path = "../ecmascript/loader", features = ["node", "lru"]}
|
||||
swc_ecma_minifier = {version = "0.47.0", path = "../ecmascript/minifier"}
|
||||
swc_ecma_transforms_react = {version = "0.56.0", path = "../ecmascript/transforms/react"}
|
||||
swc_ecma_transforms_typescript = {version = "0.57.0", path = "../ecmascript/transforms/typescript"}
|
||||
swc_ecma_minifier = {version = "0.48.0", path = "../ecmascript/minifier"}
|
||||
swc_ecma_transforms_react = {version = "0.57.0", path = "../ecmascript/transforms/react"}
|
||||
swc_ecma_transforms_typescript = {version = "0.58.0", path = "../ecmascript/transforms/typescript"}
|
||||
swc_node_base = {version = "0.5.0", path = "../node/base"}
|
||||
tempfile = "3.1.0"
|
||||
testing = {version = "0.15.0", path = "../testing"}
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_common"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3"
|
||||
|
||||
[features]
|
||||
concurrent = ["parking_lot"]
|
||||
@ -27,7 +27,7 @@ once_cell = "1"
|
||||
owning_ref = "0.4"
|
||||
parking_lot = {version = "0.7.1", optional = true}
|
||||
rustc-hash = "1.1.0"
|
||||
scoped-tls = {version = "1"}
|
||||
scoped-tls = "1"
|
||||
serde = {version = "1.0.119", features = ["derive"]}
|
||||
sourcemap = {version = "6", optional = true}
|
||||
string_cache = "0.8.1"
|
||||
|
@ -20,6 +20,7 @@ use crate::{
|
||||
sync::{Lock, LockCell, Lrc},
|
||||
syntax_pos::{BytePos, FileLinesResult, FileName, Loc, MultiSpan, Span, NO_EXPANSION},
|
||||
};
|
||||
use scoped_tls::scoped_thread_local;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cell::RefCell,
|
||||
@ -825,3 +826,14 @@ impl Level {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scoped_thread_local!(
|
||||
/// Used for error reporting in transform.
|
||||
///
|
||||
/// This should be only used for errors from the api which does not returning errors.
|
||||
///
|
||||
/// e.g.
|
||||
/// - `parser` should not use this.
|
||||
/// - `transforms` should use this to report error, as it does not return [Result].
|
||||
pub static HANDLER: Handler
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecmascript"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.83.0"
|
||||
version = "0.84.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
@ -35,11 +35,11 @@ typescript = ["typescript-parser", "swc_ecma_transforms/typescript"]
|
||||
swc_ecma_ast = {version = "0.56.0", path = "./ast"}
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "./codegen", optional = true}
|
||||
swc_ecma_dep_graph = {version = "0.45.0", path = "./dep-graph", optional = true}
|
||||
swc_ecma_minifier = {version = "0.47.0", path = "./minifier", optional = true}
|
||||
swc_ecma_minifier = {version = "0.48.0", path = "./minifier", optional = true}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "./parser", optional = true, default-features = false}
|
||||
swc_ecma_preset_env = {version = "0.62.0", path = "./preset-env", optional = true}
|
||||
swc_ecma_transforms = {version = "0.91.0", path = "./transforms", optional = true}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "./utils", optional = true}
|
||||
swc_ecma_preset_env = {version = "0.63.0", path = "./preset-env", optional = true}
|
||||
swc_ecma_transforms = {version = "0.92.0", path = "./transforms", optional = true}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "./utils", optional = true}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "./visit", optional = true}
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_ext_transforms/"
|
||||
edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_ext_transforms"
|
||||
version = "0.35.0"
|
||||
version = "0.36.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -15,5 +15,5 @@ swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../parser"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../utils"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../visit"}
|
||||
|
@ -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.47.1"
|
||||
version = "0.48.0"
|
||||
|
||||
[features]
|
||||
debug = ["backtrace"]
|
||||
@ -29,9 +29,9 @@ swc_common = {version = "0.14.0", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../ast"}
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../codegen"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../parser"}
|
||||
swc_ecma_transforms = {version = "0.91.0", path = "../transforms/", features = ["optimization"]}
|
||||
swc_ecma_transforms_base = {version = "0.41.1", path = "../transforms/base"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../utils"}
|
||||
swc_ecma_transforms = {version = "0.92.0", path = "../transforms/", features = ["optimization"]}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../transforms/base"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../visit"}
|
||||
tracing = "0.1.28"
|
||||
unicode-xid = "0.2.2"
|
||||
|
@ -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.62.0"
|
||||
version = "0.63.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -22,8 +22,8 @@ string_enum = {version = "0.3.1", path = "../../macros/string_enum"}
|
||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../ast"}
|
||||
swc_ecma_transforms = {version = "0.91.0", path = "../transforms", features = ["compat", "proposal"]}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../utils"}
|
||||
swc_ecma_transforms = {version = "0.92.0", path = "../transforms", features = ["compat", "proposal"]}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../visit"}
|
||||
walkdir = "2"
|
||||
|
||||
|
@ -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.91.0"
|
||||
version = "0.92.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
@ -26,14 +26,14 @@ swc_atoms = {version = "0.2.0", path = "../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "./base"}
|
||||
swc_ecma_transforms_compat = {version = "0.48.0", path = "./compat", optional = true}
|
||||
swc_ecma_transforms_module = {version = "0.54.0", path = "./module", optional = true}
|
||||
swc_ecma_transforms_optimization = {version = "0.61.0", path = "./optimization", optional = true}
|
||||
swc_ecma_transforms_proposal = {version = "0.54.0", path = "./proposal", optional = true}
|
||||
swc_ecma_transforms_react = {version = "0.56.0", path = "./react", optional = true}
|
||||
swc_ecma_transforms_typescript = {version = "0.57.0", path = "./typescript", optional = true}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "./base"}
|
||||
swc_ecma_transforms_compat = {version = "0.49.0", path = "./compat", optional = true}
|
||||
swc_ecma_transforms_module = {version = "0.55.0", path = "./module", optional = true}
|
||||
swc_ecma_transforms_optimization = {version = "0.62.0", path = "./optimization", optional = true}
|
||||
swc_ecma_transforms_proposal = {version = "0.55.0", path = "./proposal", optional = true}
|
||||
swc_ecma_transforms_react = {version = "0.57.0", path = "./react", optional = true}
|
||||
swc_ecma_transforms_typescript = {version = "0.58.0", path = "./typescript", optional = true}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../visit"}
|
||||
unicode-xid = "0.2"
|
||||
|
||||
@ -41,7 +41,7 @@ unicode-xid = "0.2"
|
||||
pretty_assertions = "0.6"
|
||||
sourcemap = "6"
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../codegen"}
|
||||
swc_ecma_transforms_testing = {version = "0.42.0", path = "./testing"}
|
||||
swc_ecma_transforms_testing = {version = "0.43.0", path = "./testing"}
|
||||
tempfile = "3"
|
||||
testing = {version = "0.15.0", path = "../../testing"}
|
||||
walkdir = "2"
|
||||
|
@ -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.41.3"
|
||||
version = "0.42.0"
|
||||
|
||||
[features]
|
||||
concurrent = [
|
||||
@ -24,11 +24,11 @@ swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
tracing = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../../codegen"}
|
||||
swc_ecma_transforms_macros = {version = "0.2.3", path = "../macros"}
|
||||
swc_ecma_transforms_macros = {version = "0.3.0", path = "../macros"}
|
||||
testing = {version = "0.15.0", path = "../../../testing"}
|
||||
|
@ -1,6 +1,9 @@
|
||||
use crate::{fixer::fixer, helpers::HELPERS, hygiene::hygiene_with_config};
|
||||
use swc_common::{
|
||||
comments::SingleThreadedComments, errors::Handler, sync::Lrc, FileName, SourceMap,
|
||||
comments::SingleThreadedComments,
|
||||
errors::{Handler, HANDLER},
|
||||
sync::Lrc,
|
||||
FileName, SourceMap,
|
||||
};
|
||||
use swc_ecma_ast::{Pat, *};
|
||||
use swc_ecma_codegen::Emitter;
|
||||
@ -20,7 +23,7 @@ impl<'a> Tester<'a> {
|
||||
F: FnOnce(&mut Tester<'_>) -> Result<(), ()>,
|
||||
{
|
||||
let out = ::testing::run_test(false, |cm, handler| {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
HELPERS.set(&Default::default(), || {
|
||||
op(&mut Tester {
|
||||
cm,
|
||||
|
@ -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.27.0"
|
||||
version = "0.28.0"
|
||||
|
||||
[dependencies]
|
||||
swc_atoms = {version = "0.2.6", path = "../../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
|
@ -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.48.1"
|
||||
version = "0.49.0"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
@ -29,14 +29,14 @@ smallvec = "1.6.0"
|
||||
swc_atoms = {version = "0.2.5", path = "../../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.27.0", path = "../classes"}
|
||||
swc_ecma_transforms_macros = {version = "0.2.3", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.28.0", path = "../classes"}
|
||||
swc_ecma_transforms_macros = {version = "0.3.0", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0.66"
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_transforms_testing = {version = "0.42.0", path = "../testing"}
|
||||
swc_ecma_transforms_testing = {version = "0.43.0", path = "../testing"}
|
||||
testing = {version = "0.15.0", path = "../../../testing"}
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_transforms_macros"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.2.3"
|
||||
version = "0.3.0"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
@ -105,6 +105,7 @@ fn make_par_visit_method(
|
||||
},
|
||||
{
|
||||
fn method_name(&mut self, mut nodes: Vec<NodeType>) -> Vec<NodeType> {
|
||||
use swc_common::errors::HANDLER;
|
||||
use swc_ecma_transforms_base::perf::{ParExplode, Parallel};
|
||||
use swc_ecma_visit::FoldWith;
|
||||
|
||||
@ -114,7 +115,7 @@ fn make_par_visit_method(
|
||||
|
||||
let (visitor, mut nodes) = ::swc_common::GLOBALS.with(|globals| {
|
||||
swc_ecma_transforms_base::helpers::HELPERS.with(|helpers| {
|
||||
swc_ecma_utils::HANDLER.with(|handler| {
|
||||
HANDLER.with(|handler| {
|
||||
nodes
|
||||
.into_par_iter()
|
||||
.map(|node| {
|
||||
@ -122,7 +123,7 @@ fn make_par_visit_method(
|
||||
swc_ecma_transforms_base::helpers::HELPERS.set(
|
||||
helpers,
|
||||
|| {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
let mut visitor =
|
||||
Parallel::create(&*self);
|
||||
let node = node.fold_with(&mut visitor);
|
||||
@ -193,6 +194,7 @@ fn make_par_visit_method(
|
||||
},
|
||||
{
|
||||
fn method_name(&mut self, nodes: Vec<NodeType>) -> Vec<NodeType> {
|
||||
use swc_common::errors::HANDLER;
|
||||
use swc_ecma_transforms_base::perf::Parallel;
|
||||
use swc_ecma_visit::FoldWith;
|
||||
|
||||
@ -202,7 +204,7 @@ fn make_par_visit_method(
|
||||
|
||||
let (visitor, mut nodes) = ::swc_common::GLOBALS.with(|globals| {
|
||||
swc_ecma_transforms_base::helpers::HELPERS.with(|helpers| {
|
||||
swc_ecma_utils::HANDLER.with(|handler| {
|
||||
HANDLER.with(|handler| {
|
||||
nodes
|
||||
.into_par_iter()
|
||||
.map(|node| {
|
||||
@ -210,7 +212,7 @@ fn make_par_visit_method(
|
||||
swc_ecma_transforms_base::helpers::HELPERS.set(
|
||||
helpers,
|
||||
|| {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
let mut visitor =
|
||||
Parallel::create(&*self);
|
||||
let node = node.fold_with(&mut visitor);
|
||||
@ -276,6 +278,7 @@ fn make_par_visit_method(
|
||||
{
|
||||
fn method_name(&mut self, nodes: &mut Vec<NodeType>) {
|
||||
use std::mem::take;
|
||||
use swc_common::errors::HANDLER;
|
||||
use swc_ecma_transforms_base::perf::{ParExplode, Parallel};
|
||||
use swc_ecma_visit::VisitMutWith;
|
||||
|
||||
@ -283,7 +286,7 @@ fn make_par_visit_method(
|
||||
if nodes.len() >= threshold {
|
||||
::swc_common::GLOBALS.with(|globals| {
|
||||
swc_ecma_transforms_base::helpers::HELPERS.with(|helpers| {
|
||||
swc_ecma_utils::HANDLER.with(|handler| {
|
||||
HANDLER.with(|handler| {
|
||||
use rayon::prelude::*;
|
||||
|
||||
let (visitor, new_nodes) = take(nodes)
|
||||
@ -293,7 +296,7 @@ fn make_par_visit_method(
|
||||
swc_ecma_transforms_base::helpers::HELPERS.set(
|
||||
helpers,
|
||||
|| {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
let mut visitor =
|
||||
Parallel::create(&*self);
|
||||
node.visit_mut_with(&mut visitor);
|
||||
@ -366,6 +369,7 @@ fn make_par_visit_method(
|
||||
},
|
||||
{
|
||||
fn method_name(&mut self, nodes: &mut Vec<NodeType>) {
|
||||
use swc_common::errors::HANDLER;
|
||||
use swc_ecma_transforms_base::perf::Parallel;
|
||||
use swc_ecma_visit::VisitMutWith;
|
||||
|
||||
@ -373,7 +377,7 @@ fn make_par_visit_method(
|
||||
if nodes.len() >= threshold {
|
||||
::swc_common::GLOBALS.with(|globals| {
|
||||
swc_ecma_transforms_base::helpers::HELPERS.with(|helpers| {
|
||||
swc_ecma_utils::HANDLER.with(|handler| {
|
||||
HANDLER.with(|handler| {
|
||||
use rayon::prelude::*;
|
||||
|
||||
let visitor = nodes
|
||||
@ -383,7 +387,7 @@ fn make_par_visit_method(
|
||||
swc_ecma_transforms_base::helpers::HELPERS.set(
|
||||
helpers,
|
||||
|| {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
let mut visitor =
|
||||
Parallel::create(&*self);
|
||||
node.visit_mut_with(&mut visitor);
|
||||
|
@ -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.54.1"
|
||||
version = "0.55.0"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
@ -21,11 +21,11 @@ swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_loader = {version = "0.23.0", path = "../../loader", features = ["node"]}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_transforms_compat = {version = "0.48.0", path = "../compat"}
|
||||
swc_ecma_transforms_testing = {version = "0.42.0", path = "../testing/"}
|
||||
swc_ecma_transforms_compat = {version = "0.49.0", path = "../compat"}
|
||||
swc_ecma_transforms_testing = {version = "0.43.0", path = "../testing/"}
|
||||
testing = {version = "0.15.0", path = "../../../testing/"}
|
||||
|
@ -3,10 +3,10 @@ use inflector::Inflector;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{sync::Lrc, FileName, SourceMap};
|
||||
use swc_common::{errors::HANDLER, sync::Lrc, FileName, SourceMap};
|
||||
use swc_ecma_ast::Expr;
|
||||
use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax};
|
||||
use swc_ecma_utils::{quote_ident, HANDLER};
|
||||
use swc_ecma_utils::quote_ident;
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields, rename_all = "camelCase")]
|
||||
|
@ -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.61.0"
|
||||
version = "0.62.0"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
@ -30,17 +30,17 @@ swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_transforms_macros = {version = "0.2.3", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_transforms_macros = {version = "0.3.0", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
tracing = "0.1.28"
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_transforms_compat = {version = "0.48.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.54.0", path = "../module"}
|
||||
swc_ecma_transforms_proposal = {version = "0.54.0", path = "../proposal"}
|
||||
swc_ecma_transforms_react = {version = "0.56.0", path = "../react"}
|
||||
swc_ecma_transforms_testing = {version = "0.42.0", path = "../testing"}
|
||||
swc_ecma_transforms_typescript = {version = "0.57.0", path = "../typescript"}
|
||||
swc_ecma_transforms_compat = {version = "0.49.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.55.0", path = "../module"}
|
||||
swc_ecma_transforms_proposal = {version = "0.55.0", path = "../proposal"}
|
||||
swc_ecma_transforms_react = {version = "0.57.0", path = "../react"}
|
||||
swc_ecma_transforms_testing = {version = "0.43.0", path = "../testing"}
|
||||
swc_ecma_transforms_typescript = {version = "0.58.0", path = "../typescript"}
|
||||
testing = {version = "0.15.0", path = "../../../testing"}
|
||||
|
@ -2,10 +2,10 @@ use dashmap::DashMap;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{sync::Lrc, util::move_map::MoveMap, FileName, SourceMap};
|
||||
use swc_common::{errors::HANDLER, sync::Lrc, util::move_map::MoveMap, FileName, SourceMap};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_parser::{lexer::Lexer, Parser, StringInput};
|
||||
use swc_ecma_utils::{drop_span, HANDLER};
|
||||
use swc_ecma_utils::drop_span;
|
||||
use swc_ecma_visit::{noop_fold_type, Fold, FoldWith};
|
||||
|
||||
pub fn const_modules(
|
||||
|
@ -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.54.0"
|
||||
version = "0.55.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -23,15 +23,15 @@ swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_loader = {version = "0.23.0", path = "../../loader", optional = true}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.27.0", path = "../classes"}
|
||||
swc_ecma_transforms_macros = {version = "0.2.3", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.28.0", path = "../classes"}
|
||||
swc_ecma_transforms_macros = {version = "0.3.0", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0.66"
|
||||
swc_ecma_transforms_compat = {version = "0.48.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.54.0", path = "../module"}
|
||||
swc_ecma_transforms_testing = {version = "0.42.0", path = "../testing"}
|
||||
swc_ecma_transforms_compat = {version = "0.49.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.55.0", path = "../module"}
|
||||
swc_ecma_transforms_testing = {version = "0.43.0", path = "../testing"}
|
||||
testing = {version = "0.15.0", path = "../../../testing"}
|
||||
|
@ -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.56.1"
|
||||
version = "0.57.0"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
@ -24,14 +24,14 @@ swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_transforms_macros = {version = "0.2.3", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_transforms_macros = {version = "0.3.0", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../../codegen/"}
|
||||
swc_ecma_transforms_compat = {version = "0.48.0", path = "../compat/"}
|
||||
swc_ecma_transforms_module = {version = "0.54.0", path = "../module"}
|
||||
swc_ecma_transforms_testing = {version = "0.42.0", path = "../testing/"}
|
||||
swc_ecma_transforms_compat = {version = "0.49.0", path = "../compat/"}
|
||||
swc_ecma_transforms_module = {version = "0.55.0", path = "../module"}
|
||||
swc_ecma_transforms_testing = {version = "0.43.0", path = "../testing/"}
|
||||
testing = {version = "0.15.0", path = "../../../testing"}
|
||||
|
@ -9,6 +9,7 @@ use string_enum::StringEnum;
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{
|
||||
comments::{Comment, CommentKind, Comments},
|
||||
errors::HANDLER,
|
||||
iter::IdentifyLast,
|
||||
sync::Lrc,
|
||||
util::take::Take,
|
||||
@ -17,9 +18,7 @@ use swc_common::{
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_parser::{Parser, StringInput, Syntax};
|
||||
use swc_ecma_transforms_base::helper;
|
||||
use swc_ecma_utils::{
|
||||
drop_span, member_expr, prepend, private_ident, quote_ident, ExprFactory, HANDLER,
|
||||
};
|
||||
use swc_ecma_utils::{drop_span, member_expr, prepend, private_ident, quote_ident, ExprFactory};
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
|
||||
|
||||
mod static_check;
|
||||
|
@ -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.42.1"
|
||||
version = "0.43.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -21,8 +21,8 @@ swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../../codegen"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
tempfile = "3.1.0"
|
||||
testing = {version = "0.15.0", path = "../../../testing"}
|
||||
|
@ -13,8 +13,11 @@ use std::{
|
||||
sync::{Arc, RwLock},
|
||||
};
|
||||
use swc_common::{
|
||||
chain, comments::SingleThreadedComments, errors::Handler, sync::Lrc, FileName, SourceMap,
|
||||
DUMMY_SP,
|
||||
chain,
|
||||
comments::SingleThreadedComments,
|
||||
errors::{Handler, HANDLER},
|
||||
sync::Lrc,
|
||||
FileName, SourceMap, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::{Pat, *};
|
||||
use swc_ecma_codegen::Emitter;
|
||||
@ -24,7 +27,7 @@ use swc_ecma_transforms_base::{
|
||||
helpers::{inject_helpers, HELPERS},
|
||||
hygiene,
|
||||
};
|
||||
use swc_ecma_utils::{quote_ident, quote_str, DropSpan, ExprFactory, HANDLER};
|
||||
use swc_ecma_utils::{quote_ident, quote_str, DropSpan, ExprFactory};
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, FoldWith, VisitMut, VisitMutWith};
|
||||
use tempfile::tempdir_in;
|
||||
use testing::{assert_eq, find_executable, NormalizedOutput};
|
||||
@ -41,7 +44,7 @@ impl<'a> Tester<'a> {
|
||||
F: FnOnce(&mut Tester<'_>) -> Result<Ret, ()>,
|
||||
{
|
||||
let out = ::testing::run_test(false, |cm, handler| {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
HELPERS.set(&Default::default(), || {
|
||||
op(&mut Tester {
|
||||
cm,
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_transforms_typescript"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.57.0"
|
||||
version = "0.58.0"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
@ -15,16 +15,16 @@ swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.76.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.41.0", path = "../base"}
|
||||
swc_ecma_transforms_react = {version = "0.56.0", path = "../react"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../utils"}
|
||||
swc_ecma_transforms_base = {version = "0.42.0", path = "../base"}
|
||||
swc_ecma_transforms_react = {version = "0.57.0", path = "../react"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../../codegen"}
|
||||
swc_ecma_transforms_compat = {version = "0.48.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.54.0", path = "../module"}
|
||||
swc_ecma_transforms_proposal = {version = "0.54.0", path = "../proposal/"}
|
||||
swc_ecma_transforms_testing = {version = "0.42.0", path = "../testing"}
|
||||
swc_ecma_transforms_compat = {version = "0.49.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.55.0", path = "../module"}
|
||||
swc_ecma_transforms_proposal = {version = "0.55.0", path = "../proposal/"}
|
||||
swc_ecma_transforms_testing = {version = "0.43.0", path = "../testing"}
|
||||
testing = {version = "0.15.0", path = "../../../testing"}
|
||||
walkdir = "2.3.1"
|
||||
|
@ -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.49.0"
|
||||
version = "0.50.0"
|
||||
|
||||
[features]
|
||||
# Process in parallel.
|
||||
@ -18,9 +18,8 @@ concurrent = [
|
||||
[dependencies]
|
||||
once_cell = "1"
|
||||
rayon = {version = "1.5.1", optional = true}
|
||||
scoped-tls = "1"
|
||||
swc_atoms = {version = "0.2.0", path = "../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../common"}
|
||||
swc_common = {version = "0.14.3", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../visit"}
|
||||
unicode-xid = "0.2"
|
||||
|
@ -14,7 +14,6 @@ pub use self::{
|
||||
Purity::{MayBeImpure, Pure},
|
||||
};
|
||||
use crate::ident::IdentLike;
|
||||
use scoped_tls::scoped_thread_local;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
f64::{INFINITY, NAN},
|
||||
@ -23,9 +22,9 @@ use std::{
|
||||
ops::Add,
|
||||
};
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{
|
||||
collections::AHashSet, errors::Handler, Mark, Span, Spanned, SyntaxContext, DUMMY_SP,
|
||||
};
|
||||
#[deprecated(since = "0.50", note = "Use `swc_common::errors::HANDLER` directly")]
|
||||
pub use swc_common::errors::HANDLER;
|
||||
use swc_common::{collections::AHashSet, Mark, Span, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_visit::{
|
||||
noop_visit_mut_type, noop_visit_type, Node, Visit, VisitMut, VisitMutWith, VisitWith,
|
||||
@ -212,7 +211,7 @@ pub trait ModuleItemLike: StmtLike {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait StmtLike: Sized + 'static {
|
||||
pub trait StmtLike: Sized + 'static + Send + Sync {
|
||||
fn try_into_stmt(self) -> Result<Stmt, Self>;
|
||||
fn as_stmt(&self) -> Option<&Stmt>;
|
||||
fn from_stmt(stmt: Stmt) -> Self;
|
||||
@ -1894,11 +1893,6 @@ impl<'a> UsageFinder<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
scoped_thread_local!(
|
||||
/// Used for error reporting in transform.
|
||||
pub static HANDLER: Handler
|
||||
);
|
||||
|
||||
/// make a new expression which evaluates `val` preserving side effects, if any.
|
||||
pub fn preserve_effects<I>(span: Span, val: Expr, exprs: I) -> Expr
|
||||
where
|
||||
|
@ -8,7 +8,12 @@ use swc::{
|
||||
};
|
||||
use swc_atoms::JsWord;
|
||||
use swc_bundler::{Load, ModuleData};
|
||||
use swc_common::{collections::AHashMap, errors::Handler, sync::Lrc, FileName, DUMMY_SP};
|
||||
use swc_common::{
|
||||
collections::AHashMap,
|
||||
errors::{Handler, HANDLER},
|
||||
sync::Lrc,
|
||||
FileName, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::{Expr, Lit, Module, Program, Str};
|
||||
use swc_ecma_parser::{lexer::Lexer, JscTarget, Parser, StringInput, Syntax};
|
||||
use swc_ecma_transforms::{
|
||||
@ -158,7 +163,7 @@ impl SwcLoader {
|
||||
true,
|
||||
)?;
|
||||
let program = helpers::HELPERS.set(&helpers, || {
|
||||
swc_ecma_utils::HANDLER.set(&handler, || {
|
||||
HANDLER.set(&handler, || {
|
||||
let program = program.fold_with(&mut inline_globals(
|
||||
self.env_map(),
|
||||
Default::default(),
|
||||
@ -255,7 +260,7 @@ impl SwcLoader {
|
||||
// Fold module
|
||||
let program = if let Some(mut config) = config {
|
||||
helpers::HELPERS.set(&helpers, || {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
let program = program.fold_with(&mut inline_globals(
|
||||
self.env_map(),
|
||||
Default::default(),
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_plugin_testing"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -16,6 +16,6 @@ swc_atoms = {version = "0.2.7", path = "../../atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.56.0", path = "../../ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.78.0", path = "../../ecmascript/codegen"}
|
||||
swc_ecma_utils = {version = "0.49.0", path = "../../ecmascript/utils"}
|
||||
swc_ecma_utils = {version = "0.50.0", path = "../../ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.42.0", path = "../../ecmascript/visit"}
|
||||
swc_plugin = {version = "0.9.0", path = "../"}
|
||||
|
11
src/lib.rs
11
src/lib.rs
@ -117,7 +117,10 @@ use crate::config::{
|
||||
};
|
||||
use anyhow::{bail, Context, Error};
|
||||
use atoms::JsWord;
|
||||
use common::{collections::AHashMap, errors::EmitterWriter};
|
||||
use common::{
|
||||
collections::AHashMap,
|
||||
errors::{EmitterWriter, HANDLER},
|
||||
};
|
||||
use config::{util::BoolOrObject, JsMinifyCommentOption, JsMinifyOptions};
|
||||
use dashmap::DashMap;
|
||||
use once_cell::sync::Lazy;
|
||||
@ -224,7 +227,7 @@ where
|
||||
EmitterWriter::new(wr.clone(), Some(cm.clone()), false, true).skip_filename(skip_filename);
|
||||
let handler = Handler::with_emitter(true, false, Box::new(e_wr));
|
||||
|
||||
let ret = swc_ecma_utils::HANDLER.set(&handler, || op(&handler));
|
||||
let ret = HANDLER.set(&handler, || op(&handler));
|
||||
|
||||
if handler.has_errors() {
|
||||
let mut lock =
|
||||
@ -815,7 +818,7 @@ impl Compiler {
|
||||
{
|
||||
self.run(|| {
|
||||
helpers::HELPERS.set(&Helpers::new(external_helpers), || {
|
||||
swc_ecma_utils::HANDLER.set(handler, || op())
|
||||
HANDLER.set(handler, || op())
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -1078,7 +1081,7 @@ impl Compiler {
|
||||
|
||||
let mut pass = config.pass;
|
||||
let program = helpers::HELPERS.set(&Helpers::new(config.external_helpers), || {
|
||||
swc_ecma_utils::HANDLER.set(handler, || {
|
||||
HANDLER.set(handler, || {
|
||||
// Fold module
|
||||
program.fold_with(&mut pass)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user