mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
feat: Expose .take()
(#2190)
swc_common: - Add `Take`. (#2189) swc_ecma_ast: - Implement `Take` for ast nodes. swc_ecma_transforms_base: - Remove `MapWithMut`.
This commit is contained in:
parent
99c35ff980
commit
a8cb554be5
50
Cargo.lock
generated
50
Cargo.lock
generated
@ -939,7 +939,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "jsdoc"
|
||||
version = "0.37.0"
|
||||
version = "0.37.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dashmap",
|
||||
@ -2429,7 +2429,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_common"
|
||||
version = "0.11.8"
|
||||
version = "0.11.9"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"arbitrary",
|
||||
@ -2458,7 +2458,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_css"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"swc_css_ast",
|
||||
"swc_css_codegen",
|
||||
@ -2469,7 +2469,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_css_ast"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"is-macro",
|
||||
"serde",
|
||||
@ -2480,7 +2480,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_css_codegen"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"bitflags",
|
||||
@ -2506,7 +2506,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_css_parser"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"lexical",
|
||||
@ -2522,7 +2522,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_css_utils"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"swc_atoms 0.2.7",
|
||||
"swc_common",
|
||||
@ -2532,7 +2532,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_css_visit"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"swc_atoms 0.2.7",
|
||||
"swc_common",
|
||||
@ -2542,7 +2542,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_ast"
|
||||
version = "0.51.0"
|
||||
version = "0.51.1"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"is-macro",
|
||||
@ -2556,7 +2556,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_codegen"
|
||||
version = "0.69.0"
|
||||
version = "0.69.1"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"num-bigint",
|
||||
@ -2582,7 +2582,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_dep_graph"
|
||||
version = "0.38.0"
|
||||
version = "0.38.1"
|
||||
dependencies = [
|
||||
"swc_atoms 0.2.7",
|
||||
"swc_common",
|
||||
@ -2594,7 +2594,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_ext_transforms"
|
||||
version = "0.27.0"
|
||||
version = "0.27.1"
|
||||
dependencies = [
|
||||
"phf",
|
||||
"swc_atoms 0.2.7",
|
||||
@ -2607,7 +2607,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_loader"
|
||||
version = "0.17.0"
|
||||
version = "0.17.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dashmap",
|
||||
@ -2660,7 +2660,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_parser"
|
||||
version = "0.69.0"
|
||||
version = "0.69.1"
|
||||
dependencies = [
|
||||
"either",
|
||||
"enum_kind",
|
||||
@ -2737,7 +2737,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_base"
|
||||
version = "0.29.0"
|
||||
version = "0.30.0"
|
||||
dependencies = [
|
||||
"fxhash",
|
||||
"once_cell",
|
||||
@ -2756,7 +2756,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_classes"
|
||||
version = "0.15.0"
|
||||
version = "0.16.0"
|
||||
dependencies = [
|
||||
"swc_atoms 0.2.7",
|
||||
"swc_common",
|
||||
@ -2902,7 +2902,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_testing"
|
||||
version = "0.29.0"
|
||||
version = "0.30.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"anyhow",
|
||||
@ -2943,7 +2943,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_utils"
|
||||
version = "0.43.0"
|
||||
version = "0.43.1"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"scoped-tls",
|
||||
@ -2957,7 +2957,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_visit"
|
||||
version = "0.37.0"
|
||||
version = "0.37.1"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"swc_atoms 0.2.7",
|
||||
@ -3003,7 +3003,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_node_base"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"dashmap",
|
||||
"mimalloc-rust",
|
||||
@ -3045,7 +3045,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_plugin"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"abi_stable",
|
||||
"anyhow",
|
||||
@ -3060,7 +3060,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_plugin_runner"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"abi_stable",
|
||||
"anyhow",
|
||||
@ -3078,7 +3078,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_plugin_testing"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"swc_atoms 0.2.7",
|
||||
@ -3092,7 +3092,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_stylis"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"swc_atoms 0.2.7",
|
||||
"swc_common",
|
||||
@ -3160,7 +3160,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "testing"
|
||||
version = "0.12.2"
|
||||
version = "0.12.3"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"difference",
|
||||
|
22
Cargo.toml
22
Cargo.toml
@ -47,13 +47,13 @@ serde_json = "1"
|
||||
sourcemap = "6"
|
||||
swc_atoms = {version = "0.2", path = "./atoms"}
|
||||
swc_bundler = {version = "0.56.0", path = "./bundler"}
|
||||
swc_common = {version = "0.11.6", path = "./common", features = ["sourcemap", "concurrent"]}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "./ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "./ecmascript/codegen"}
|
||||
swc_ecma_ext_transforms = {version = "0.27.0", path = "./ecmascript/ext-transforms"}
|
||||
swc_ecma_loader = {version = "0.17.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
|
||||
swc_common = {version = "0.11.9", path = "./common", features = ["sourcemap", "concurrent"]}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "./ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "./ecmascript/codegen"}
|
||||
swc_ecma_ext_transforms = {version = "0.27.1", path = "./ecmascript/ext-transforms"}
|
||||
swc_ecma_loader = {version = "0.17.1", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
|
||||
swc_ecma_minifier = {version = "0.24.0", path = "./ecmascript/minifier"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "./ecmascript/parser"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "./ecmascript/parser"}
|
||||
swc_ecma_preset_env = {version = "0.40.0", path = "./ecmascript/preset-env"}
|
||||
swc_ecma_transforms = {version = "0.69.0", path = "./ecmascript/transforms", features = [
|
||||
"compat",
|
||||
@ -63,16 +63,16 @@ swc_ecma_transforms = {version = "0.69.0", path = "./ecmascript/transforms", fea
|
||||
"react",
|
||||
"typescript",
|
||||
]}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "./ecmascript/transforms/base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "./ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "./ecmascript/visit"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "./ecmascript/transforms/base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "./ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "./ecmascript/visit"}
|
||||
swc_ecmascript = {version = "0.60.0", path = "./ecmascript"}
|
||||
swc_node_base = {version = "0.2.2", path = "./node/base"}
|
||||
swc_node_base = {version = "0.2.3", path = "./node/base"}
|
||||
swc_visit = {version = "0.2.3", path = "./visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
rayon = "1"
|
||||
testing = {version = "0.12.2", path = "./testing"}
|
||||
testing = {version = "0.12.3", path = "./testing"}
|
||||
walkdir = "2"
|
||||
|
||||
[[example]]
|
||||
|
@ -32,14 +32,14 @@ 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.6", path = "../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../ecmascript/codegen"}
|
||||
swc_ecma_loader = {version = "0.17.0", path = "../ecmascript/loader"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../ecmascript/parser"}
|
||||
swc_common = {version = "0.11.9", path = "../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../ecmascript/codegen"}
|
||||
swc_ecma_loader = {version = "0.17.1", path = "../ecmascript/loader"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../ecmascript/parser"}
|
||||
swc_ecma_transforms = {version = "0.69.0", path = "../ecmascript/transforms", features = ["optimization"]}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../ecmascript/visit"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../ecmascript/visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
hex = "0.4"
|
||||
@ -48,6 +48,6 @@ reqwest = {version = "0.11.4", features = ["blocking"]}
|
||||
sha-1 = "0.9"
|
||||
swc_ecma_transforms = {version = "0.69.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
|
||||
tempfile = "3.1.0"
|
||||
testing = {version = "0.12.2", path = "../testing"}
|
||||
testing = {version = "0.12.3", path = "../testing"}
|
||||
url = "2.1.1"
|
||||
walkdir = "2"
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::{id::Id, util::MapWithMut};
|
||||
use crate::id::Id;
|
||||
use fxhash::FxHashMap;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::private_ident;
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
|
||||
|
@ -1,11 +1,11 @@
|
||||
use super::graph::Required;
|
||||
use crate::{id::Id, modules::sort::graph::StmtDepGraph, util::MapWithMut};
|
||||
use crate::{id::Id, modules::sort::graph::StmtDepGraph};
|
||||
use fxhash::{FxHashMap, FxHashSet};
|
||||
use indexmap::IndexSet;
|
||||
use petgraph::EdgeDirection::{Incoming as Dependants, Outgoing as Dependancies};
|
||||
use std::{collections::VecDeque, iter::from_fn, ops::Range};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{sync::Lrc, SourceMap, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_common::{sync::Lrc, util::take::Take, SourceMap, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::find_ids;
|
||||
use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith};
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::{clone::Clone, cmp::Eq, hash::Hash, mem::replace};
|
||||
use swc_atoms::js_word;
|
||||
use std::{clone::Clone, cmp::Eq, hash::Hash};
|
||||
use swc_common::{Span, SyntaxContext, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::ident::IdentLike;
|
||||
@ -64,148 +63,6 @@ pub(crate) trait ExprExt: Into<Expr> {
|
||||
|
||||
impl<T> ExprExt for T where T: Into<Expr> {}
|
||||
|
||||
/// Helper for migration from [Fold] to [VisitMut]
|
||||
pub(crate) trait MapWithMut: Sized {
|
||||
fn dummy() -> Self;
|
||||
|
||||
fn take(&mut self) -> Self {
|
||||
replace(self, Self::dummy())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn map_with_mut<F>(&mut self, op: F)
|
||||
where
|
||||
F: FnOnce(Self) -> Self,
|
||||
{
|
||||
let dummy = Self::dummy();
|
||||
let v = replace(self, dummy);
|
||||
let v = op(v);
|
||||
let _dummy = replace(self, v);
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ModuleItem {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }))
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Stmt {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Stmt::Empty(EmptyStmt { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Expr {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Expr::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Pat {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Pat::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Option<T> {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Vec<T> {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Box<T>
|
||||
where
|
||||
T: MapWithMut,
|
||||
{
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Box::new(T::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Ident {
|
||||
fn dummy() -> Self {
|
||||
Ident::new(js_word!(""), DUMMY_SP)
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ObjectPatProp {
|
||||
fn dummy() -> Self {
|
||||
ObjectPatProp::Assign(AssignPatProp {
|
||||
span: DUMMY_SP,
|
||||
key: Ident::dummy(),
|
||||
value: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for PatOrExpr {
|
||||
fn dummy() -> Self {
|
||||
PatOrExpr::Pat(Box::new(Pat::Ident(Ident::dummy().into())))
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ClassExpr {
|
||||
fn dummy() -> Self {
|
||||
ClassExpr {
|
||||
ident: None,
|
||||
class: MapWithMut::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for FnExpr {
|
||||
fn dummy() -> Self {
|
||||
FnExpr {
|
||||
ident: None,
|
||||
function: MapWithMut::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Class {
|
||||
fn dummy() -> Self {
|
||||
Class {
|
||||
span: Default::default(),
|
||||
decorators: Default::default(),
|
||||
body: Default::default(),
|
||||
super_class: Default::default(),
|
||||
is_abstract: Default::default(),
|
||||
type_params: Default::default(),
|
||||
super_type_params: Default::default(),
|
||||
implements: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Function {
|
||||
fn dummy() -> Self {
|
||||
Function {
|
||||
params: Default::default(),
|
||||
decorators: Default::default(),
|
||||
span: Default::default(),
|
||||
body: Default::default(),
|
||||
is_generator: Default::default(),
|
||||
is_async: Default::default(),
|
||||
type_params: Default::default(),
|
||||
return_type: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct CHashSet<V>
|
||||
where
|
||||
|
@ -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.8"
|
||||
version = "0.11.9"
|
||||
|
||||
[features]
|
||||
concurrent = ["parking_lot"]
|
||||
|
@ -1,3 +1,4 @@
|
||||
pub mod iter;
|
||||
pub mod map;
|
||||
pub mod move_map;
|
||||
pub mod take;
|
55
common/src/util/take.rs
Normal file
55
common/src/util/take.rs
Normal file
@ -0,0 +1,55 @@
|
||||
use crate::{Span, DUMMY_SP};
|
||||
use std::mem::replace;
|
||||
|
||||
/// Helper for people who are working on `VisitMut`.
|
||||
///
|
||||
///
|
||||
/// This trait is implemented for ast nodes. If not and you need it, please file
|
||||
/// an issue.
|
||||
pub trait Take: Sized {
|
||||
fn take(&mut self) -> Self {
|
||||
replace(self, Self::dummy())
|
||||
}
|
||||
|
||||
/// Create a dummy value of this type.
|
||||
fn dummy() -> Self;
|
||||
|
||||
/// Mutate `self` using `op`, which accepts owned data.
|
||||
#[inline]
|
||||
fn map_with_mut<F>(&mut self, op: F)
|
||||
where
|
||||
F: FnOnce(Self) -> Self,
|
||||
{
|
||||
let dummy = Self::dummy();
|
||||
let cur_val = replace(self, dummy);
|
||||
let new_val = op(cur_val);
|
||||
let _dummy = replace(self, new_val);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Take for Option<T> {
|
||||
fn dummy() -> Self {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Take for Box<T>
|
||||
where
|
||||
T: Take,
|
||||
{
|
||||
fn dummy() -> Self {
|
||||
Box::new(T::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Take for Vec<T> {
|
||||
fn dummy() -> Self {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
impl Take for Span {
|
||||
fn dummy() -> Self {
|
||||
DUMMY_SP
|
||||
}
|
||||
}
|
@ -6,11 +6,11 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_css"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
|
||||
[dependencies]
|
||||
swc_css_ast = {version = "0.4.0", path = "./ast"}
|
||||
swc_css_codegen = {version = "0.2.0", path = "./codegen"}
|
||||
swc_css_parser = {version = "0.4.0", path = "./parser"}
|
||||
swc_css_utils = {version = "0.1.0", path = "./utils/"}
|
||||
swc_css_visit = {version = "0.3.0", path = "./visit"}
|
||||
swc_css_ast = {version = "0.4.1", path = "./ast"}
|
||||
swc_css_codegen = {version = "0.2.1", path = "./codegen"}
|
||||
swc_css_parser = {version = "0.4.2", path = "./parser"}
|
||||
swc_css_utils = {version = "0.1.1", path = "./utils/"}
|
||||
swc_css_visit = {version = "0.3.1", path = "./visit"}
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_css_ast"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -15,4 +15,4 @@ is-macro = "0.1.9"
|
||||
serde = {version = "1.0.127", features = ["derive"]}
|
||||
string_enum = {version = "0.3.1", path = "../../macros/string_enum/"}
|
||||
swc_atoms = {version = "0.2.7", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
|
@ -6,17 +6,17 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_css_codegen"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
|
||||
[dependencies]
|
||||
auto_impl = "0.4.1"
|
||||
bitflags = "1.3.2"
|
||||
swc_atoms = {version = "0.2.7", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.0", path = "../ast/"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.1", path = "../ast/"}
|
||||
swc_css_codegen_macros = {version = "0.2.0", path = "macros/"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_css_parser = {version = "0.4.0", path = "../parser"}
|
||||
swc_css_visit = {version = "0.3.0", path = "../visit"}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_css_parser = {version = "0.4.2", path = "../parser"}
|
||||
swc_css_visit = {version = "0.3.1", path = "../visit"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_css_parser"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
@ -16,12 +16,12 @@ debug = []
|
||||
bitflags = "1.2.1"
|
||||
lexical = "5.2.2"
|
||||
swc_atoms = {version = "0.2.7", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.0", path = "../ast"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.1", path = "../ast"}
|
||||
unicode-xid = "0.2.2"
|
||||
|
||||
[dev-dependencies]
|
||||
serde = "1.0.127"
|
||||
serde_json = "1.0.66"
|
||||
swc_css_visit = {version = "0.3.0", path = "../visit"}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_css_visit = {version = "0.3.1", path = "../visit"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
@ -6,18 +6,18 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_stylis"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
swc_atoms = {version = "0.2.7", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.0", path = "../ast"}
|
||||
swc_css_utils = {version = "0.1.0", path = "../utils/"}
|
||||
swc_css_visit = {version = "0.3.0", path = "../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.1", path = "../ast"}
|
||||
swc_css_utils = {version = "0.1.1", path = "../utils/"}
|
||||
swc_css_visit = {version = "0.3.1", path = "../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_css_codegen = {version = "0.2.0", path = "../codegen"}
|
||||
swc_css_parser = {version = "0.4.0", path = "../parser"}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_css_codegen = {version = "0.2.1", path = "../codegen"}
|
||||
swc_css_parser = {version = "0.4.2", path = "../parser"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
@ -6,11 +6,11 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_css_utils"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
swc_atoms = {version = "0.2.7", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.0", path = "../ast"}
|
||||
swc_css_visit = {version = "0.3.0", path = "../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.1", path = "../ast"}
|
||||
swc_css_visit = {version = "0.3.1", path = "../visit"}
|
||||
|
@ -6,12 +6,12 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_css_visit"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
swc_atoms = {version = "0.2.7", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.0", path = "../ast/"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_css_ast = {version = "0.4.1", path = "../ast/"}
|
||||
swc_visit = {version = "0.2.6", path = "../../visit"}
|
||||
|
@ -32,14 +32,14 @@ react = ["swc_ecma_transforms/react"]
|
||||
typescript = ["typescript-parser", "swc_ecma_transforms/typescript"]
|
||||
|
||||
[dependencies]
|
||||
swc_ecma_ast = {version = "0.51.0", path = "./ast"}
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "./codegen", optional = true}
|
||||
swc_ecma_dep_graph = {version = "0.38.0", path = "./dep-graph", optional = true}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "./ast"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "./codegen", optional = true}
|
||||
swc_ecma_dep_graph = {version = "0.38.1", path = "./dep-graph", optional = true}
|
||||
swc_ecma_minifier = {version = "0.24.0", path = "./minifier", optional = true}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "./parser", optional = true, default-features = false}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "./parser", optional = true, default-features = false}
|
||||
swc_ecma_preset_env = {version = "0.40.0", path = "./preset-env", optional = true}
|
||||
swc_ecma_transforms = {version = "0.69.0", path = "./transforms", optional = true}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "./utils", optional = true}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "./visit", optional = true}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "./utils", optional = true}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "./visit", optional = true}
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -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.51.0"
|
||||
version = "0.51.1"
|
||||
|
||||
[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.6", path = "../../common"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1"
|
||||
|
@ -12,7 +12,7 @@ use crate::{
|
||||
};
|
||||
use is_macro::Is;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
@ -43,6 +43,21 @@ pub struct Class {
|
||||
pub implements: Vec<TsExprWithTypeArgs>,
|
||||
}
|
||||
|
||||
impl Take for Class {
|
||||
fn dummy() -> Self {
|
||||
Class {
|
||||
span: DUMMY_SP,
|
||||
decorators: Default::default(),
|
||||
body: Default::default(),
|
||||
super_class: Default::default(),
|
||||
is_abstract: Default::default(),
|
||||
type_params: Default::default(),
|
||||
super_type_params: Default::default(),
|
||||
implements: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -69,6 +84,12 @@ pub enum ClassMember {
|
||||
StaticBlock(StaticBlock),
|
||||
}
|
||||
|
||||
impl Take for ClassMember {
|
||||
fn dummy() -> Self {
|
||||
ClassMember::Empty(EmptyStmt { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("ClassProperty")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
|
@ -8,7 +8,7 @@ use crate::{
|
||||
};
|
||||
use is_macro::Is;
|
||||
use string_enum::StringEnum;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
@ -31,6 +31,12 @@ pub enum Decl {
|
||||
TsModule(TsModuleDecl),
|
||||
}
|
||||
|
||||
impl Take for Decl {
|
||||
fn dummy() -> Self {
|
||||
Decl::Var(Take::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("FunctionDeclaration")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -76,6 +82,17 @@ pub struct VarDecl {
|
||||
pub decls: Vec<VarDeclarator>,
|
||||
}
|
||||
|
||||
impl Take for VarDecl {
|
||||
fn dummy() -> Self {
|
||||
VarDecl {
|
||||
span: DUMMY_SP,
|
||||
kind: VarDeclKind::Var,
|
||||
declare: Default::default(),
|
||||
decls: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
pub enum VarDeclKind {
|
||||
@ -103,3 +120,14 @@ pub struct VarDeclarator {
|
||||
#[serde(default)]
|
||||
pub definite: bool,
|
||||
}
|
||||
|
||||
impl Take for VarDeclarator {
|
||||
fn dummy() -> Self {
|
||||
VarDeclarator {
|
||||
span: DUMMY_SP,
|
||||
name: Take::dummy(),
|
||||
init: Take::dummy(),
|
||||
definite: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ use crate::{
|
||||
};
|
||||
use is_macro::Is;
|
||||
use serde::{self, Deserialize, Serialize};
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span, Spanned, DUMMY_SP};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, Spanned, DUMMY_SP};
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
@ -152,6 +152,12 @@ pub enum Expr {
|
||||
Invalid(Invalid),
|
||||
}
|
||||
|
||||
impl Take for Expr {
|
||||
fn dummy() -> Self {
|
||||
Expr::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("ThisExpression")]
|
||||
#[derive(Eq, Hash, Copy, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -334,6 +340,17 @@ pub struct CallExpr {
|
||||
// pub type_params: Option<TsTypeParamInstantiation>,
|
||||
}
|
||||
|
||||
impl Take for CallExpr {
|
||||
fn dummy() -> Self {
|
||||
CallExpr {
|
||||
span: DUMMY_SP,
|
||||
callee: Take::dummy(),
|
||||
args: Take::dummy(),
|
||||
type_args: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("NewExpression")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -455,6 +472,17 @@ pub struct TplElement {
|
||||
pub raw: Str,
|
||||
}
|
||||
|
||||
impl Take for TplElement {
|
||||
fn dummy() -> Self {
|
||||
TplElement {
|
||||
span: DUMMY_SP,
|
||||
tail: Default::default(),
|
||||
cooked: Take::dummy(),
|
||||
raw: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("ParenthesisExpression")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -478,6 +506,12 @@ pub enum ExprOrSuper {
|
||||
Expr(Box<Expr>),
|
||||
}
|
||||
|
||||
impl Take for ExprOrSuper {
|
||||
fn dummy() -> Self {
|
||||
ExprOrSuper::Super(Take::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("Super")]
|
||||
#[derive(Eq, Hash, Copy, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -485,6 +519,12 @@ pub struct Super {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl Take for Super {
|
||||
fn dummy() -> Self {
|
||||
Super { span: DUMMY_SP }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
pub struct ExprOrSpread {
|
||||
@ -516,6 +556,12 @@ pub enum BlockStmtOrExpr {
|
||||
Expr(Box<Expr>),
|
||||
}
|
||||
|
||||
impl Take for BlockStmtOrExpr {
|
||||
fn dummy() -> Self {
|
||||
BlockStmtOrExpr::Expr(Take::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -562,6 +608,12 @@ pub enum PatOrExpr {
|
||||
Pat(Box<Pat>),
|
||||
}
|
||||
|
||||
impl Take for PatOrExpr {
|
||||
fn dummy() -> Self {
|
||||
PatOrExpr::Pat(Take::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bool> for Expr {
|
||||
fn from(value: bool) -> Self {
|
||||
Expr::Lit(Lit::Bool(Bool {
|
||||
|
@ -1,9 +1,8 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::typescript::TsTypeAnn;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span, Spanned};
|
||||
use std::fmt::Display;
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, Spanned, DUMMY_SP};
|
||||
|
||||
/// Identifer used as a pattern.
|
||||
#[derive(Spanned, Clone, Debug, PartialEq, Eq, Hash, EqIgnoreSpan, Serialize, Deserialize)]
|
||||
@ -35,6 +34,12 @@ pub struct Ident {
|
||||
pub optional: bool,
|
||||
}
|
||||
|
||||
impl Take for Ident {
|
||||
fn dummy() -> Self {
|
||||
Ident::new(js_word!(""), DUMMY_SP)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Ident {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}{:?}", self.sym, self.span.ctxt)
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
use is_macro::Is;
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
/// Used for `obj` property of `JSXMemberExpr`.
|
||||
#[ast_node]
|
||||
@ -93,6 +93,12 @@ pub enum JSXElementName {
|
||||
JSXNamespacedName(JSXNamespacedName),
|
||||
}
|
||||
|
||||
impl Take for JSXElementName {
|
||||
fn dummy() -> Self {
|
||||
JSXElementName::Ident(Take::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("JSXOpeningElement")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -113,6 +119,18 @@ pub struct JSXOpeningElement {
|
||||
pub type_args: Option<TsTypeParamInstantiation>,
|
||||
}
|
||||
|
||||
impl Take for JSXOpeningElement {
|
||||
fn dummy() -> Self {
|
||||
JSXOpeningElement {
|
||||
name: Take::dummy(),
|
||||
span: DUMMY_SP,
|
||||
attrs: Take::dummy(),
|
||||
self_closing: Default::default(),
|
||||
type_args: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[allow(variant_size_differences)]
|
||||
@ -203,6 +221,17 @@ pub struct JSXElement {
|
||||
pub closing: Option<JSXClosingElement>,
|
||||
}
|
||||
|
||||
impl Take for JSXElement {
|
||||
fn dummy() -> Self {
|
||||
JSXElement {
|
||||
span: DUMMY_SP,
|
||||
opening: Take::dummy(),
|
||||
children: Take::dummy(),
|
||||
closing: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -237,6 +266,17 @@ pub struct JSXFragment {
|
||||
pub closing: JSXClosingFragment,
|
||||
}
|
||||
|
||||
impl Take for JSXFragment {
|
||||
fn dummy() -> Self {
|
||||
JSXFragment {
|
||||
span: DUMMY_SP,
|
||||
opening: Take::dummy(),
|
||||
children: Take::dummy(),
|
||||
closing: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("JSXOpeningFragment")]
|
||||
#[derive(Eq, Hash, Copy, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -244,9 +284,21 @@ pub struct JSXOpeningFragment {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl Take for JSXOpeningFragment {
|
||||
fn dummy() -> Self {
|
||||
JSXOpeningFragment { span: DUMMY_SP }
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("JSXClosingFragment")]
|
||||
#[derive(Eq, Hash, Copy, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
pub struct JSXClosingFragment {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl Take for JSXClosingFragment {
|
||||
fn dummy() -> Self {
|
||||
JSXClosingFragment { span: DUMMY_SP }
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ use std::{
|
||||
hash::{Hash, Hasher},
|
||||
mem,
|
||||
};
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
@ -67,6 +67,17 @@ pub struct Str {
|
||||
pub kind: StrKind,
|
||||
}
|
||||
|
||||
impl Take for Str {
|
||||
fn dummy() -> Self {
|
||||
Str {
|
||||
span: DUMMY_SP,
|
||||
value: js_word!(""),
|
||||
has_escape: Default::default(),
|
||||
kind: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// THis enum determines how string literal should be printed.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{module_decl::ModuleDecl, stmt::Stmt};
|
||||
use is_macro::Is;
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
@ -37,6 +37,16 @@ impl<'a> arbitrary::Arbitrary<'a> for Module {
|
||||
}
|
||||
}
|
||||
|
||||
impl Take for Module {
|
||||
fn dummy() -> Self {
|
||||
Module {
|
||||
span: DUMMY_SP,
|
||||
body: Take::dummy(),
|
||||
shebang: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("Script")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
pub struct Script {
|
||||
@ -61,6 +71,16 @@ impl<'a> arbitrary::Arbitrary<'a> for Script {
|
||||
}
|
||||
}
|
||||
|
||||
impl Take for Script {
|
||||
fn dummy() -> Self {
|
||||
Script {
|
||||
span: DUMMY_SP,
|
||||
body: Take::dummy(),
|
||||
shebang: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -78,3 +98,9 @@ pub enum ModuleItem {
|
||||
#[tag("*")]
|
||||
Stmt(Stmt),
|
||||
}
|
||||
|
||||
impl Take for ModuleItem {
|
||||
fn dummy() -> Self {
|
||||
ModuleItem::Stmt(Take::dummy())
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use crate::{
|
||||
ObjectLit,
|
||||
};
|
||||
use is_macro::Is;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
@ -41,6 +41,12 @@ pub enum ModuleDecl {
|
||||
TsNamespaceExport(TsNamespaceExportDecl),
|
||||
}
|
||||
|
||||
impl Take for ModuleDecl {
|
||||
fn dummy() -> Self {
|
||||
ModuleDecl::Import(ImportDecl::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("ExportDefaultExpression")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -80,6 +86,18 @@ pub struct ImportDecl {
|
||||
pub asserts: Option<ObjectLit>,
|
||||
}
|
||||
|
||||
impl Take for ImportDecl {
|
||||
fn dummy() -> Self {
|
||||
ImportDecl {
|
||||
span: DUMMY_SP,
|
||||
specifiers: Take::dummy(),
|
||||
src: Take::dummy(),
|
||||
type_only: Default::default(),
|
||||
asserts: Take::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `export * from 'mod'`
|
||||
#[ast_node("ExportAllDeclaration")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
Invalid,
|
||||
};
|
||||
use is_macro::Is;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
impl From<Ident> for Pat {
|
||||
fn from(i: Ident) -> Self {
|
||||
@ -41,6 +41,12 @@ pub enum Pat {
|
||||
Expr(Box<Expr>),
|
||||
}
|
||||
|
||||
impl Take for Pat {
|
||||
fn dummy() -> Self {
|
||||
Pat::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("ArrayPattern")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
|
@ -8,7 +8,7 @@ use crate::{
|
||||
typescript::TsTypeAnn,
|
||||
};
|
||||
use is_macro::Is;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span};
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
@ -107,6 +107,12 @@ pub enum PropName {
|
||||
BigInt(BigInt),
|
||||
}
|
||||
|
||||
impl Take for PropName {
|
||||
fn dummy() -> Self {
|
||||
PropName::Ident(Take::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("Computed")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
pat::Pat,
|
||||
};
|
||||
use is_macro::Is;
|
||||
use swc_common::{ast_node, EqIgnoreSpan, Span};
|
||||
use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP};
|
||||
|
||||
/// Use when only block statements are allowed.
|
||||
#[ast_node("BlockStatement")]
|
||||
@ -18,6 +18,15 @@ pub struct BlockStmt {
|
||||
pub stmts: Vec<Stmt>,
|
||||
}
|
||||
|
||||
impl Take for BlockStmt {
|
||||
fn dummy() -> Self {
|
||||
BlockStmt {
|
||||
span: DUMMY_SP,
|
||||
stmts: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node]
|
||||
#[derive(Eq, Hash, Is, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
@ -94,6 +103,12 @@ pub enum Stmt {
|
||||
Expr(ExprStmt),
|
||||
}
|
||||
|
||||
impl Take for Stmt {
|
||||
fn dummy() -> Self {
|
||||
Self::Empty(EmptyStmt { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
#[ast_node("ExpressionStatement")]
|
||||
#[derive(Eq, Hash, EqIgnoreSpan)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
|
@ -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.69.0"
|
||||
version = "0.69.1"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1"
|
||||
num-bigint = {version = "0.2", features = ["serde"]}
|
||||
sourcemap = "6"
|
||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../parser"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../parser"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_common = {version = "0.11.6", path = "../../common", features = ["sourcemap"]}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_common = {version = "0.11.9", path = "../../common", features = ["sourcemap"]}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
@ -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.38.0"
|
||||
version = "0.38.1"
|
||||
|
||||
[dependencies]
|
||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../parser"}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../parser"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
@ -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.27.0"
|
||||
version = "0.27.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.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../parser"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../parser"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../visit"}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::util::MapWithMut;
|
||||
use phf::phf_set;
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::{prepend_stmts, StmtLike};
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
|
||||
|
@ -1,2 +1 @@
|
||||
pub mod jest;
|
||||
mod util;
|
||||
|
@ -1,91 +0,0 @@
|
||||
use std::mem::replace;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_ecma_ast::*;
|
||||
/// Helper for migration from [Fold] to [VisitMut]
|
||||
pub(crate) trait MapWithMut: Sized {
|
||||
fn dummy() -> Self;
|
||||
|
||||
fn take(&mut self) -> Self {
|
||||
replace(self, Self::dummy())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn map_with_mut<F>(&mut self, op: F)
|
||||
where
|
||||
F: FnOnce(Self) -> Self,
|
||||
{
|
||||
let dummy = Self::dummy();
|
||||
let v = replace(self, dummy);
|
||||
let v = op(v);
|
||||
let _dummy = replace(self, v);
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ModuleItem {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }))
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Stmt {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Stmt::Empty(EmptyStmt { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Expr {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Expr::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Pat {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Pat::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Option<T> {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Vec<T> {
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Box<T>
|
||||
where
|
||||
T: MapWithMut,
|
||||
{
|
||||
#[inline(always)]
|
||||
fn dummy() -> Self {
|
||||
Box::new(T::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Ident {
|
||||
fn dummy() -> Self {
|
||||
Ident::new(js_word!(""), DUMMY_SP)
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ObjectPatProp {
|
||||
fn dummy() -> Self {
|
||||
ObjectPatProp::Assign(AssignPatProp {
|
||||
span: DUMMY_SP,
|
||||
key: Ident::dummy(),
|
||||
value: None,
|
||||
})
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/jsdoc/"
|
||||
edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "jsdoc"
|
||||
version = "0.37.0"
|
||||
version = "0.37.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -13,12 +13,12 @@ version = "0.37.0"
|
||||
nom = "5.1.2"
|
||||
serde = {version = "1", features = ["derive"]}
|
||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1"
|
||||
dashmap = "4.0.2"
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../parser"}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../parser"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
walkdir = "2"
|
||||
|
@ -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.17.0"
|
||||
version = "0.17.1"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
@ -30,12 +30,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.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
normpath = {version = "0.2", optional = true}
|
||||
|
@ -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.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../codegen"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../parser"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../codegen"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../parser"}
|
||||
swc_ecma_transforms = {version = "0.69.0", path = "../transforms/", features = ["optimization"]}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../transforms/base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../transforms/base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", 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.2", path = "../../node/base"}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_node_base = {version = "0.2.3", path = "../../node/base"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
walkdir = "2.3.1"
|
||||
|
@ -3,9 +3,8 @@ use crate::{
|
||||
util::{is_hoisted_var_decl_without_init, sort::is_sorted_by_key, IsModuleItem},
|
||||
};
|
||||
use fxhash::FxHashSet;
|
||||
use swc_common::{pass::Repeated, DUMMY_SP};
|
||||
use swc_common::{pass::Repeated, util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{find_ids, ident::IdentLike, Id, StmtLike};
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith};
|
||||
|
||||
|
@ -5,9 +5,8 @@ use crate::{
|
||||
mode::Mode,
|
||||
};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::Spanned;
|
||||
use swc_common::{util::take::Take, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, undefined, ExprExt, Type, Value::Known};
|
||||
|
||||
/// Methods related to the options `bools` and `bool_as_ints`.
|
||||
|
@ -9,9 +9,9 @@ use crate::{
|
||||
DISABLE_BUGGY_PASSES,
|
||||
};
|
||||
use std::mem::swap;
|
||||
use swc_common::{EqIgnoreSpan, Spanned, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::{AsOptExpr, ExprRefExt, MapWithMut};
|
||||
use swc_ecma_transforms_base::ext::{AsOptExpr, ExprRefExt};
|
||||
use swc_ecma_utils::{ident::IdentLike, ExprExt, ExprFactory, StmtLike};
|
||||
|
||||
/// Methods related to the option `conditionals`. All methods are noop if
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::Optimizer;
|
||||
use crate::mode::Mode;
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::ident::IdentLike;
|
||||
|
||||
/// Methods related to option `dead_code`.
|
||||
|
@ -2,9 +2,8 @@ use super::Optimizer;
|
||||
use crate::{compress::util::eval_as_number, mode::Mode, DISABLE_BUGGY_PASSES};
|
||||
use std::num::FpCategory;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, undefined, ExprExt, Value::Known};
|
||||
|
||||
/// Methods related to the option `evaludate`.
|
||||
|
@ -6,8 +6,8 @@ use crate::{
|
||||
DISABLE_BUGGY_PASSES,
|
||||
};
|
||||
use std::cmp::Ordering;
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
|
||||
impl<M> Optimizer<'_, M>
|
||||
where
|
||||
|
@ -5,9 +5,8 @@ use crate::{
|
||||
mode::Mode,
|
||||
util::ExprOptExt,
|
||||
};
|
||||
use swc_common::{Spanned, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{prepend, undefined, StmtLike};
|
||||
use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith};
|
||||
|
||||
|
@ -10,9 +10,8 @@ use std::{
|
||||
mem::{replace, swap},
|
||||
};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{pass::Either, Spanned, DUMMY_SP};
|
||||
use swc_common::{pass::Either, util::take::Take, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, undefined, ExprFactory, Id};
|
||||
use swc_ecma_visit::VisitMutWith;
|
||||
|
||||
|
@ -6,9 +6,8 @@ use crate::{
|
||||
util::idents_used_by,
|
||||
};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{Spanned, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, ExprExt, UsageFinder};
|
||||
|
||||
/// Methods related to option `inline`.
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::Optimizer;
|
||||
use crate::{compress::util::is_directive, mode::Mode};
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::StmtLike;
|
||||
|
||||
/// Methods related to option `join_vars`.
|
||||
|
@ -2,9 +2,8 @@ use crate::{
|
||||
compress::optimize::{unused::UnreachableHandler, Optimizer},
|
||||
mode::Mode,
|
||||
};
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, Value::Known};
|
||||
|
||||
/// Methods related to the option `loops`.
|
||||
|
@ -12,9 +12,10 @@ use fxhash::FxHashMap;
|
||||
use retain_mut::RetainMut;
|
||||
use std::{fmt::Write, mem::take};
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{iter::IdentifyLast, pass::Repeated, Mark, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_common::{
|
||||
iter::IdentifyLast, pass::Repeated, util::take::Take, Mark, Spanned, SyntaxContext, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{
|
||||
ident::IdentLike, undefined, ExprExt, ExprFactory, Id, IsEmpty, ModuleItemLike, StmtLike, Type,
|
||||
Value,
|
||||
|
@ -5,9 +5,8 @@ use crate::{
|
||||
util::{make_bool, ValueExt},
|
||||
};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::EqIgnoreSpan;
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, ExprExt, Type, Value};
|
||||
use Value::Known;
|
||||
|
||||
|
@ -12,9 +12,8 @@ use crate::{
|
||||
use retain_mut::RetainMut;
|
||||
use std::mem::take;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{Spanned, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{contains_this_expr, ident::IdentLike, undefined, ExprExt, Id, StmtLike};
|
||||
use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith};
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
use super::Optimizer;
|
||||
use crate::mode::Mode;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::Spanned;
|
||||
use swc_common::{util::take::Take, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, ExprExt, Value::Known};
|
||||
|
||||
impl<M> Optimizer<'_, M>
|
||||
|
@ -1,9 +1,8 @@
|
||||
use super::Optimizer;
|
||||
use crate::{mode::Mode, util::ExprOptExt};
|
||||
use std::mem::take;
|
||||
use swc_common::{EqIgnoreSpan, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, prepend, ExprExt, StmtExt, Type, Value::Known};
|
||||
use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith};
|
||||
|
||||
|
@ -4,9 +4,8 @@ use crate::{
|
||||
option::PureGetterOption,
|
||||
};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{Span, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, Span, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{contains_ident_ref, ident::IdentLike};
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
use super::Pure;
|
||||
use crate::mode::Mode;
|
||||
use swc_common::Spanned;
|
||||
use swc_common::{util::take::Take, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::contains_this_expr;
|
||||
|
||||
/// Methods related to the option `arrows`.
|
||||
|
@ -6,9 +6,8 @@ use crate::{
|
||||
};
|
||||
use std::mem::swap;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{EqIgnoreSpan, Span, Spanned, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, Span, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, Type, Value};
|
||||
|
||||
impl<M> Pure<'_, M>
|
||||
|
@ -1,9 +1,8 @@
|
||||
use super::Pure;
|
||||
use crate::{compress::util::negate_cost, debug::dump, mode::Mode, util::make_bool};
|
||||
use std::mem::swap;
|
||||
use swc_common::{EqIgnoreSpan, Spanned};
|
||||
use swc_common::{util::take::Take, EqIgnoreSpan, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, Type, Value};
|
||||
|
||||
impl<M> Pure<'_, M>
|
||||
|
@ -1,9 +1,8 @@
|
||||
use super::Pure;
|
||||
use crate::{compress::util::always_terminates, mode::Mode};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, StmtLike, Value};
|
||||
|
||||
/// Methods related to option `dead_code`.
|
||||
|
@ -4,9 +4,8 @@ use crate::{
|
||||
mode::Mode,
|
||||
};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{Spanned, SyntaxContext};
|
||||
use swc_common::{util::take::Take, Spanned, SyntaxContext};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{undefined, ExprExt, Value};
|
||||
|
||||
impl<M> Pure<'_, M>
|
||||
|
@ -1,8 +1,7 @@
|
||||
use super::Pure;
|
||||
use crate::mode::Mode;
|
||||
use swc_common::Spanned;
|
||||
use swc_common::{util::take::Take, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, Value};
|
||||
|
||||
impl<M> Pure<'_, M>
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::Pure;
|
||||
use crate::mode::Mode;
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
|
||||
impl<M> Pure<'_, M>
|
||||
where
|
||||
|
@ -1,8 +1,7 @@
|
||||
use super::Pure;
|
||||
use crate::{compress::util::get_lhs_ident, mode::Mode};
|
||||
use swc_common::{SyntaxContext, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, SyntaxContext, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, ExprFactory};
|
||||
|
||||
impl<M> Pure<'_, M>
|
||||
|
@ -2,9 +2,8 @@ use super::Pure;
|
||||
use crate::mode::Mode;
|
||||
use std::mem::take;
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, Type, Value};
|
||||
|
||||
impl<M> Pure<'_, M>
|
||||
|
@ -1,8 +1,7 @@
|
||||
use super::Pure;
|
||||
use crate::mode::Mode;
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{prepend, StmtLike};
|
||||
use swc_ecma_visit::{
|
||||
noop_visit_mut_type, noop_visit_type, Node, Visit, VisitMut, VisitMutWith, VisitWith,
|
||||
|
@ -1,9 +1,8 @@
|
||||
use crate::debug::dump;
|
||||
use std::f64;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ExprExt, Id, UsageFinder, Value};
|
||||
use swc_ecma_visit::VisitWith;
|
||||
use unicode_xid::UnicodeXID;
|
||||
|
@ -6,10 +6,9 @@ use crate::{
|
||||
use fxhash::FxHashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms::optimization::simplify::expr_simplifier;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, undefined, ExprExt, ExprFactory, Id};
|
||||
use swc_ecma_visit::{FoldWith, VisitMutWith};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{option::CompressOptions, DISABLE_BUGGY_PASSES};
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
|
||||
|
||||
pub fn postcompress_optimizer<'a>(options: &'a CompressOptions) -> impl 'a + VisitMut {
|
||||
|
@ -6,8 +6,8 @@ use crate::{
|
||||
};
|
||||
use fxhash::FxHashMap;
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, Id};
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith};
|
||||
|
||||
|
@ -2,10 +2,10 @@ use fxhash::FxHashSet;
|
||||
use std::time::Instant;
|
||||
use swc_common::{
|
||||
pass::{CompilerPass, Repeated},
|
||||
util::take::Take,
|
||||
Mark, Span, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, Id, ModuleItemLike, StmtLike, Value};
|
||||
use swc_ecma_visit::{noop_visit_type, Fold, FoldWith, Node, Visit, VisitWith};
|
||||
|
||||
|
@ -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.69.0"
|
||||
version = "0.69.1"
|
||||
|
||||
[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.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../visit"}
|
||||
unicode-xid = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.7"
|
||||
pretty_assertions = "0.6"
|
||||
serde_json = "1"
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
walkdir = "2"
|
||||
|
||||
[[example]]
|
||||
|
@ -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.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_transforms = {version = "0.69.0", path = "../transforms", features = ["compat", "proposal"]}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../visit"}
|
||||
walkdir = "2"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "0.6"
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../codegen"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../parser"}
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../codegen"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../parser"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
@ -22,25 +22,25 @@ typescript = ["swc_ecma_transforms_typescript"]
|
||||
|
||||
[dependencies]
|
||||
swc_atoms = {version = "0.2.0", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "./base"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "./base"}
|
||||
swc_ecma_transforms_compat = {version = "0.32.0", path = "./compat", optional = true}
|
||||
swc_ecma_transforms_module = {version = "0.36.0", path = "./module", optional = true}
|
||||
swc_ecma_transforms_optimization = {version = "0.39.0", path = "./optimization", optional = true}
|
||||
swc_ecma_transforms_proposal = {version = "0.36.0", path = "./proposal", optional = true}
|
||||
swc_ecma_transforms_react = {version = "0.37.0", path = "./react", optional = true}
|
||||
swc_ecma_transforms_typescript = {version = "0.38.0", path = "./typescript", optional = true}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../visit"}
|
||||
unicode-xid = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "0.6"
|
||||
sourcemap = "6"
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../codegen"}
|
||||
swc_ecma_transforms_testing = {version = "0.29.0", path = "./testing"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../codegen"}
|
||||
swc_ecma_transforms_testing = {version = "0.30.0", path = "./testing"}
|
||||
tempfile = "3"
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
testing = {version = "0.12.3", 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.29.0"
|
||||
version = "0.30.0"
|
||||
|
||||
[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.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../../codegen"}
|
||||
testing = {version = "0.12.2", path = "../../../testing"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../../codegen"}
|
||||
testing = {version = "0.12.3", path = "../../../testing"}
|
||||
|
@ -1,293 +1,10 @@
|
||||
//! Do not use: This is not a public api and it can be changed without a version
|
||||
//! bump.
|
||||
|
||||
use std::{mem::replace, ops::DerefMut};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::DUMMY_SP;
|
||||
use std::ops::DerefMut;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::ExprExt;
|
||||
|
||||
/// Do not use: This is not a public api and it can be changed without a version
|
||||
/// bump.
|
||||
///
|
||||
/// Helper for migration from [Fold] to [VisitMut]
|
||||
#[doc(hidden)]
|
||||
pub trait MapWithMut: Sized {
|
||||
fn dummy() -> Self;
|
||||
|
||||
fn take(&mut self) -> Self {
|
||||
replace(self, Self::dummy())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn map_with_mut<F>(&mut self, op: F)
|
||||
where
|
||||
F: FnOnce(Self) -> Self,
|
||||
{
|
||||
let dummy = Self::dummy();
|
||||
let v = replace(self, dummy);
|
||||
let v = op(v);
|
||||
let _dummy = replace(self, v);
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Program {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
Program::Module(Module::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ModuleItem {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }))
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Stmt {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
Stmt::Empty(EmptyStmt { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Expr {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
Expr::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Pat {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
Pat::Invalid(Invalid { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Option<T> {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Vec<T> {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MapWithMut for Box<T>
|
||||
where
|
||||
T: MapWithMut,
|
||||
{
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
Box::new(T::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Ident {
|
||||
fn dummy() -> Self {
|
||||
Ident::new(js_word!(""), DUMMY_SP)
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for BindingIdent {
|
||||
fn dummy() -> Self {
|
||||
Ident::dummy().into()
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ObjectPatProp {
|
||||
fn dummy() -> Self {
|
||||
ObjectPatProp::Assign(AssignPatProp {
|
||||
span: DUMMY_SP,
|
||||
key: Ident::dummy(),
|
||||
value: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for PatOrExpr {
|
||||
fn dummy() -> Self {
|
||||
PatOrExpr::Pat(Box::new(Pat::Ident(BindingIdent::dummy())))
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Module {
|
||||
fn dummy() -> Self {
|
||||
Module {
|
||||
span: DUMMY_SP,
|
||||
body: vec![],
|
||||
shebang: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for JSXElement {
|
||||
fn dummy() -> Self {
|
||||
JSXElement {
|
||||
span: DUMMY_SP,
|
||||
opening: MapWithMut::dummy(),
|
||||
children: MapWithMut::dummy(),
|
||||
closing: MapWithMut::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for ExprOrSuper {
|
||||
fn dummy() -> Self {
|
||||
ExprOrSuper::Super(Super { span: DUMMY_SP })
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for CallExpr {
|
||||
fn dummy() -> Self {
|
||||
CallExpr {
|
||||
span: DUMMY_SP,
|
||||
callee: MapWithMut::dummy(),
|
||||
args: MapWithMut::dummy(),
|
||||
type_args: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl MapWithMut for JSXOpeningElement {
|
||||
fn dummy() -> Self {
|
||||
JSXOpeningElement {
|
||||
span: DUMMY_SP,
|
||||
name: MapWithMut::dummy(),
|
||||
attrs: MapWithMut::dummy(),
|
||||
self_closing: false,
|
||||
type_args: MapWithMut::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for NewExpr {
|
||||
fn dummy() -> Self {
|
||||
NewExpr {
|
||||
span: DUMMY_SP,
|
||||
callee: MapWithMut::dummy(),
|
||||
args: MapWithMut::dummy(),
|
||||
type_args: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl MapWithMut for JSXClosingElement {
|
||||
fn dummy() -> Self {
|
||||
JSXClosingElement {
|
||||
span: DUMMY_SP,
|
||||
name: MapWithMut::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Decl {
|
||||
fn dummy() -> Self {
|
||||
Decl::Var(MapWithMut::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for VarDecl {
|
||||
fn dummy() -> Self {
|
||||
VarDecl {
|
||||
span: DUMMY_SP,
|
||||
kind: VarDeclKind::Var,
|
||||
declare: false,
|
||||
decls: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
impl MapWithMut for JSXElementName {
|
||||
fn dummy() -> Self {
|
||||
JSXElementName::Ident(Ident::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for JSXFragment {
|
||||
fn dummy() -> Self {
|
||||
JSXFragment {
|
||||
span: DUMMY_SP,
|
||||
opening: MapWithMut::dummy(),
|
||||
children: MapWithMut::dummy(),
|
||||
closing: MapWithMut::dummy(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for PropName {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
PropName::Ident(Ident::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for BlockStmtOrExpr {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
BlockStmtOrExpr::Expr(MapWithMut::dummy())
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for VarDeclarator {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
VarDeclarator {
|
||||
span: DUMMY_SP,
|
||||
name: Pat::dummy(),
|
||||
init: None,
|
||||
definite: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for TplElement {
|
||||
#[inline]
|
||||
fn dummy() -> Self {
|
||||
TplElement {
|
||||
span: DUMMY_SP,
|
||||
tail: false,
|
||||
cooked: None,
|
||||
raw: Str {
|
||||
span: DUMMY_SP,
|
||||
value: "".into(),
|
||||
has_escape: false,
|
||||
kind: Default::default(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
impl MapWithMut for JSXOpeningFragment {
|
||||
fn dummy() -> Self {
|
||||
JSXOpeningFragment { span: DUMMY_SP }
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for JSXClosingFragment {
|
||||
fn dummy() -> Self {
|
||||
JSXClosingFragment { span: DUMMY_SP }
|
||||
}
|
||||
}
|
||||
|
||||
impl MapWithMut for Class {
|
||||
fn dummy() -> Self {
|
||||
Class {
|
||||
span: DUMMY_SP,
|
||||
decorators: Default::default(),
|
||||
body: Default::default(),
|
||||
super_class: Default::default(),
|
||||
is_abstract: Default::default(),
|
||||
type_params: Default::default(),
|
||||
super_type_params: Default::default(),
|
||||
implements: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Do not use: This is not a public api and it can be changed without a version
|
||||
/// bump.
|
||||
pub trait PatOrExprExt: AsOptExpr {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::ext::{AsOptExpr, MapWithMut, PatOrExprExt};
|
||||
use crate::ext::{AsOptExpr, PatOrExprExt};
|
||||
use fxhash::FxHashMap;
|
||||
use swc_common::{comments::Comments, Span, Spanned};
|
||||
use swc_common::{comments::Comments, util::take::Take, Span, Spanned};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
use self::ops::{Operations, Operator};
|
||||
use crate::{
|
||||
ext::MapWithMut,
|
||||
native::{is_native, is_native_word},
|
||||
scope::{IdentType, ScopeKind},
|
||||
};
|
||||
@ -8,7 +7,7 @@ use fxhash::{FxHashMap, FxHashSet};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use std::{cell::RefCell, collections::HashMap};
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{chain, SyntaxContext};
|
||||
use swc_common::{chain, util::take::Take, SyntaxContext};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::ident::IdentLike;
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
|
||||
|
@ -1,7 +1,9 @@
|
||||
use crate::ext::MapWithMut;
|
||||
use fxhash::FxHashMap;
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{util::move_map::MoveMap, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_common::{
|
||||
util::{move_map::MoveMap, take::Take},
|
||||
Spanned, SyntaxContext, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::{ident::IdentLike, Id};
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
|
||||
|
@ -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.15.0"
|
||||
version = "0.16.0"
|
||||
|
||||
[dependencies]
|
||||
swc_atoms = {version = "0.2.6", path = "../../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
@ -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.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.15.0", path = "../classes"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.16.0", path = "../classes"}
|
||||
swc_ecma_transforms_macros = {version = "0.2.1", path = "../macros"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"}
|
||||
testing = {version = "0.12.2", path = "../../../testing"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"}
|
||||
testing = {version = "0.12.3", path = "../../../testing"}
|
||||
|
@ -1,7 +1,6 @@
|
||||
use arrayvec::ArrayVec;
|
||||
use swc_common::{Mark, Spanned, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, Mark, Spanned, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{
|
||||
contains_this_expr, member_expr, prepend, prepend_stmts, private_ident, quote_ident,
|
||||
ExprFactory,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::{ext::MapWithMut, helper, perf::Check};
|
||||
use swc_ecma_transforms_base::{helper, perf::Check};
|
||||
use swc_ecma_transforms_macros::fast_path;
|
||||
use swc_ecma_utils::{quote_str, ExprFactory};
|
||||
use swc_ecma_visit::{
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::mem::replace;
|
||||
use swc_common::{Span, DUMMY_SP};
|
||||
use swc_common::{util::take::Take, Span, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::{ext::MapWithMut, perf::Check};
|
||||
use swc_ecma_transforms_base::perf::Check;
|
||||
use swc_ecma_transforms_macros::fast_path;
|
||||
use swc_ecma_utils::{alias_if_required, undefined, StmtLike};
|
||||
use swc_ecma_visit::{noop_fold_type, noop_visit_type, Fold, FoldWith, Node, Visit, VisitWith};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use swc_common::DUMMY_SP;
|
||||
use swc_common::{util::take::Take, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::{ext::MapWithMut, perf::Check};
|
||||
use swc_ecma_transforms_base::perf::Check;
|
||||
use swc_ecma_transforms_macros::fast_path;
|
||||
use swc_ecma_utils::{alias_ident_for, prepend, ExprFactory};
|
||||
use swc_ecma_visit::{
|
||||
|
@ -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.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_loader = {version = "0.17.0", path = "../../loader", features = ["node"]}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_loader = {version = "0.17.1", path = "../../loader", features = ["node"]}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"}
|
||||
swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing/"}
|
||||
testing = {version = "0.12.2", path = "../../../testing/"}
|
||||
swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing/"}
|
||||
testing = {version = "0.12.3", path = "../../../testing/"}
|
||||
|
@ -12,10 +12,10 @@ use std::{
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{
|
||||
collections::{AHashMap, AHashSet},
|
||||
util::take::Take,
|
||||
FileName, Mark, Span, SyntaxContext, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{
|
||||
ident::IdentLike, member_expr, private_ident, quote_ident, quote_str, undefined,
|
||||
DestructuringFinder, ExprFactory,
|
||||
|
@ -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.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.36.0", path = "../module"}
|
||||
swc_ecma_transforms_proposal = {version = "0.36.0", path = "../proposal"}
|
||||
swc_ecma_transforms_react = {version = "0.37.0", path = "../react"}
|
||||
swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"}
|
||||
swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"}
|
||||
swc_ecma_transforms_typescript = {version = "0.38.0", path = "../typescript"}
|
||||
testing = {version = "0.12.2", path = "../../../testing"}
|
||||
testing = {version = "0.12.3", path = "../../../testing"}
|
||||
|
@ -2,11 +2,11 @@ use std::{borrow::Cow, cmp::min, iter::once, mem::take};
|
||||
use swc_atoms::js_word;
|
||||
use swc_common::{
|
||||
pass::{CompilerPass, Repeated},
|
||||
util::move_map::MoveMap,
|
||||
util::{move_map::MoveMap, take::Take},
|
||||
Spanned, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::{ext::MapWithMut, pass::RepeatedJsPass};
|
||||
use swc_ecma_transforms_base::pass::RepeatedJsPass;
|
||||
use swc_ecma_utils::{
|
||||
extract_var_ids, is_literal, prepend, preserve_effects, undefined, ExprExt, ExprFactory,
|
||||
Hoister, IsEmpty, StmtExt, StmtLike, Value::Known,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use fxhash::FxHashMap;
|
||||
use swc_common::util::take::Take;
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{ident::IdentLike, Id};
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
|
||||
|
||||
|
@ -2,13 +2,11 @@ use std::{borrow::Cow, iter, iter::once};
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{
|
||||
pass::{CompilerPass, Repeated},
|
||||
util::take::Take,
|
||||
Span, Spanned, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::{Ident, Lit, *};
|
||||
use swc_ecma_transforms_base::{
|
||||
ext::{ExprRefExt, MapWithMut},
|
||||
pass::RepeatedJsPass,
|
||||
};
|
||||
use swc_ecma_transforms_base::{ext::ExprRefExt, pass::RepeatedJsPass};
|
||||
use swc_ecma_utils::{
|
||||
alias_ident_for, extract_side_effects_to, ident::IdentLike, is_literal, prepend,
|
||||
preserve_effects, prop_name_eq, to_int32, undefined, BoolType, ExprExt, NullType, NumberType,
|
||||
|
@ -2,14 +2,11 @@ use self::scope::{Scope, ScopeKind, VarType};
|
||||
use std::borrow::Cow;
|
||||
use swc_common::{
|
||||
pass::{CompilerPass, Repeated},
|
||||
util::take::Take,
|
||||
DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::{
|
||||
ext::{MapWithMut, PatOrExprExt},
|
||||
pass::RepeatedJsPass,
|
||||
scope::IdentType,
|
||||
};
|
||||
use swc_ecma_transforms_base::{ext::PatOrExprExt, pass::RepeatedJsPass, scope::IdentType};
|
||||
use swc_ecma_utils::{contains_this_expr, find_ids, ident::IdentLike, undefined, Id};
|
||||
use swc_ecma_visit::{
|
||||
as_folder, noop_visit_mut_type, noop_visit_type, Node, Visit, VisitMut, VisitMutWith, VisitWith,
|
||||
|
@ -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.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_loader = {version = "0.17.0", path = "../../loader", optional = true}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.15.0", path = "../classes"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_loader = {version = "0.17.1", path = "../../loader", optional = true}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_transforms_classes = {version = "0.16.0", path = "../classes"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.36.0", path = "../module"}
|
||||
swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"}
|
||||
swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"}
|
||||
|
@ -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.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../../codegen/"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../../codegen/"}
|
||||
swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat/"}
|
||||
swc_ecma_transforms_module = {version = "0.36.0", path = "../module"}
|
||||
swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing/"}
|
||||
testing = {version = "0.12.2", path = "../../../testing"}
|
||||
swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing/"}
|
||||
testing = {version = "0.12.3", path = "../../../testing"}
|
||||
|
@ -10,11 +10,12 @@ use swc_common::{
|
||||
comments::{CommentKind, Comments},
|
||||
iter::IdentifyLast,
|
||||
sync::Lrc,
|
||||
util::take::Take,
|
||||
FileName, SourceMap, Spanned, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_parser::{Parser, StringInput, Syntax};
|
||||
use swc_ecma_transforms_base::{ext::MapWithMut, helper};
|
||||
use swc_ecma_transforms_base::helper;
|
||||
use swc_ecma_utils::{
|
||||
drop_span, member_expr, prepend, private_ident, quote_ident, ExprFactory, HANDLER,
|
||||
};
|
||||
|
@ -14,10 +14,10 @@ use swc_common::{
|
||||
collections::{AHashMap, AHashSet},
|
||||
comments::{Comments, CommentsExt},
|
||||
sync::Lrc,
|
||||
util::take::Take,
|
||||
BytePos, SourceMap, Span, Spanned, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{private_ident, quote_ident, quote_str};
|
||||
use swc_ecma_visit::{Fold, FoldWith, Node, Visit};
|
||||
use util::{
|
||||
|
@ -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.29.0"
|
||||
version = "0.30.0"
|
||||
|
||||
# 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.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../../codegen"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../../codegen"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
tempfile = "3.1.0"
|
||||
testing = {version = "0.12.2", path = "../../../testing"}
|
||||
testing = {version = "0.12.3", path = "../../../testing"}
|
||||
|
@ -13,18 +13,18 @@ version = "0.38.0"
|
||||
fxhash = "0.2.1"
|
||||
serde = {version = "1.0.118", features = ["derive"]}
|
||||
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.0", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.29.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.0", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../../ast"}
|
||||
swc_ecma_parser = {version = "0.69.1", path = "../../parser"}
|
||||
swc_ecma_transforms_base = {version = "0.30.0", path = "../base"}
|
||||
swc_ecma_utils = {version = "0.43.1", path = "../../utils"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../../visit"}
|
||||
|
||||
[dev-dependencies]
|
||||
swc_ecma_codegen = {version = "0.69.0", path = "../../codegen"}
|
||||
swc_ecma_codegen = {version = "0.69.1", path = "../../codegen"}
|
||||
swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"}
|
||||
swc_ecma_transforms_module = {version = "0.36.0", path = "../module"}
|
||||
swc_ecma_transforms_proposal = {version = "0.36.0", path = "../proposal/"}
|
||||
swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"}
|
||||
testing = {version = "0.12.2", path = "../../../testing"}
|
||||
swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"}
|
||||
testing = {version = "0.12.3", path = "../../../testing"}
|
||||
walkdir = "2.3.1"
|
||||
|
@ -2,9 +2,11 @@ use fxhash::{FxHashMap, FxHashSet};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{borrow::Borrow, mem::take};
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_common::{util::move_map::MoveMap, Span, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_common::{
|
||||
util::{move_map::MoveMap, take::Take},
|
||||
Span, Spanned, SyntaxContext, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::ext::MapWithMut;
|
||||
use swc_ecma_utils::{
|
||||
constructor::inject_after_super, default_constructor, ident::IdentLike, member_expr, prepend,
|
||||
private_ident, quote_ident, replace_ident, var::VarCollector, ExprFactory, Id, ModuleItemLike,
|
||||
|
@ -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.43.0"
|
||||
version = "0.43.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -14,10 +14,10 @@ version = "0.43.0"
|
||||
once_cell = "1"
|
||||
scoped-tls = "1"
|
||||
swc_atoms = {version = "0.2.0", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.0", path = "../visit"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_ecma_visit = {version = "0.37.1", path = "../visit"}
|
||||
unicode-xid = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
testing = {version = "0.12.2", path = "../../testing"}
|
||||
testing = {version = "0.12.3", path = "../../testing"}
|
||||
|
@ -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.37.0"
|
||||
version = "0.37.1"
|
||||
|
||||
[dependencies]
|
||||
num-bigint = {version = "0.2", features = ["serde"]}
|
||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||
swc_common = {version = "0.11.6", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.0", path = "../ast"}
|
||||
swc_common = {version = "0.11.9", path = "../../common"}
|
||||
swc_ecma_ast = {version = "0.51.1", path = "../ast"}
|
||||
swc_visit = {version = "0.2.3", path = "../../visit"}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user