Skip to content

Commit

Permalink
feat(es/ast): Add utils (#2657)
Browse files Browse the repository at this point in the history
swc_ecma_ast:
 - Add `as_ident` to `PatOrExpr`.
 - Add `as_ident_mut` to `PatOrExpr`.
 - Replace `Is` macro for `ParOrExpr` with custom impl.
  • Loading branch information
kdy1 authored Nov 5, 2021
1 parent 224972f commit 994c965
Show file tree
Hide file tree
Showing 39 changed files with 357 additions and 280 deletions.
56 changes: 28 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT"
name = "swc"
repository = "https://github.com/swc-project/swc.git"
version = "0.81.1"
version = "0.82.0"

[lib]
name = "swc"
Expand Down Expand Up @@ -61,27 +61,27 @@ serde_json = "1"
sourcemap = "6"
swc_atoms = {version = "0.2", path = "./atoms"}
swc_common = {version = "0.14.0", path = "./common", features = ["sourcemap", "concurrent"]}
swc_ecma_ast = {version = "0.56.0", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.78.1", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.36.1", path = "./ecmascript/ext-transforms"}
swc_ecma_loader = {version = "0.23.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
swc_ecma_minifier = {version = "0.48.1", path = "./ecmascript/minifier"}
swc_ecma_parser = {version = "0.76.3", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.63.1", path = "./ecmascript/preset-env"}
swc_ecma_transforms = {version = "0.92.1", path = "./ecmascript/transforms", features = [
swc_ecma_ast = {version = "0.57.0", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.79.0", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.37.0", path = "./ecmascript/ext-transforms"}
swc_ecma_loader = {version = "0.24.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
swc_ecma_minifier = {version = "0.49.0", path = "./ecmascript/minifier"}
swc_ecma_parser = {version = "0.77.0", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.64.0", path = "./ecmascript/preset-env"}
swc_ecma_transforms = {version = "0.93.0", path = "./ecmascript/transforms", features = [
"compat",
"module",
"optimization",
"proposal",
"react",
"typescript",
]}
swc_ecma_transforms_base = {version = "0.42.1", path = "./ecmascript/transforms/base"}
swc_ecma_transforms_compat = {version = "0.49.1", path = "./ecmascript/transforms/compat"}
swc_ecma_transforms_optimization = {version = "0.62.1", path = "./ecmascript/transforms/optimization"}
swc_ecma_utils = {version = "0.50.0", path = "./ecmascript/utils"}
swc_ecma_visit = {version = "0.42.0", path = "./ecmascript/visit"}
swc_ecmascript = {version = "0.84.1", path = "./ecmascript"}
swc_ecma_transforms_base = {version = "0.43.0", path = "./ecmascript/transforms/base"}
swc_ecma_transforms_compat = {version = "0.50.0", path = "./ecmascript/transforms/compat"}
swc_ecma_transforms_optimization = {version = "0.63.0", path = "./ecmascript/transforms/optimization"}
swc_ecma_utils = {version = "0.51.0", path = "./ecmascript/utils"}
swc_ecma_visit = {version = "0.43.0", path = "./ecmascript/visit"}
swc_ecmascript = {version = "0.85.0", path = "./ecmascript"}
swc_visit = {version = "0.2.3", path = "./visit"}
tracing = "0.1.28"

Expand Down
26 changes: 13 additions & 13 deletions bundler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
license = "Apache-2.0/MIT"
name = "swc_bundler"
repository = "https://github.com/swc-project/swc.git"
version = "0.78.1"
version = "0.80.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
Expand Down Expand Up @@ -38,14 +38,14 @@ relative-path = "1.2"
retain_mut = "0.1.2"
swc_atoms = {version = "0.2.4", path = "../atoms"}
swc_common = {version = "0.14.0", path = "../common"}
swc_ecma_ast = {version = "0.56.0", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.78.1", path = "../ecmascript/codegen"}
swc_ecma_loader = {version = "0.23.0", path = "../ecmascript/loader"}
swc_ecma_parser = {version = "0.76.3", path = "../ecmascript/parser"}
swc_ecma_transforms_base = {version = "0.42.1", path = "../ecmascript/transforms/base"}
swc_ecma_transforms_optimization = {version = "0.62.1", path = "../ecmascript/transforms/optimization"}
swc_ecma_utils = {version = "0.50.0", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.42.0", path = "../ecmascript/visit"}
swc_ecma_ast = {version = "0.57.0", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.79.0", path = "../ecmascript/codegen"}
swc_ecma_loader = {version = "0.24.0", path = "../ecmascript/loader"}
swc_ecma_parser = {version = "0.77.0", path = "../ecmascript/parser"}
swc_ecma_transforms_base = {version = "0.43.0", path = "../ecmascript/transforms/base"}
swc_ecma_transforms_optimization = {version = "0.63.0", path = "../ecmascript/transforms/optimization"}
swc_ecma_utils = {version = "0.51.0", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.43.0", path = "../ecmascript/visit"}
tracing = "0.1.28"

[dev-dependencies]
Expand All @@ -54,10 +54,10 @@ ntest = "0.7.2"
path-clean = "=0.1.0"
reqwest = {version = "0.11.4", features = ["blocking"]}
sha-1 = "0.9"
swc_ecma_loader = {version = "0.23.0", path = "../ecmascript/loader", features = ["node", "lru"]}
swc_ecma_minifier = {version = "0.48.1", path = "../ecmascript/minifier"}
swc_ecma_transforms_react = {version = "0.57.1", path = "../ecmascript/transforms/react"}
swc_ecma_transforms_typescript = {version = "0.58.1", path = "../ecmascript/transforms/typescript"}
swc_ecma_loader = {version = "0.24.0", path = "../ecmascript/loader", features = ["node", "lru"]}
swc_ecma_minifier = {version = "0.49.0", path = "../ecmascript/minifier"}
swc_ecma_transforms_react = {version = "0.58.0", path = "../ecmascript/transforms/react"}
swc_ecma_transforms_typescript = {version = "0.59.0", path = "../ecmascript/transforms/typescript"}
swc_node_base = {version = "0.5.0", path = "../node/base"}
tempfile = "3.1.0"
testing = {version = "0.15.0", path = "../testing"}
Expand Down
20 changes: 10 additions & 10 deletions ecmascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecmascript"
repository = "https://github.com/swc-project/swc.git"
version = "0.84.1"
version = "0.85.0"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -32,14 +32,14 @@ react = ["swc_ecma_transforms/react"]
typescript = ["typescript-parser", "swc_ecma_transforms/typescript"]

[dependencies]
swc_ecma_ast = {version = "0.56.0", path = "./ast"}
swc_ecma_codegen = {version = "0.78.1", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.45.1", path = "./dep-graph", optional = true}
swc_ecma_minifier = {version = "0.48.1", path = "./minifier", optional = true}
swc_ecma_parser = {version = "0.76.3", path = "./parser", optional = true, default-features = false}
swc_ecma_preset_env = {version = "0.63.1", path = "./preset-env", optional = true}
swc_ecma_transforms = {version = "0.92.1", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.50.0", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.42.0", path = "./visit", optional = true}
swc_ecma_ast = {version = "0.57.0", path = "./ast"}
swc_ecma_codegen = {version = "0.79.0", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.46.0", path = "./dep-graph", optional = true}
swc_ecma_minifier = {version = "0.49.0", path = "./minifier", optional = true}
swc_ecma_parser = {version = "0.77.0", path = "./parser", optional = true, default-features = false}
swc_ecma_preset_env = {version = "0.64.0", path = "./preset-env", optional = true}
swc_ecma_transforms = {version = "0.93.0", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.51.0", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.43.0", path = "./visit", optional = true}

[dev-dependencies]
2 changes: 1 addition & 1 deletion ecmascript/ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.56.1"
version = "0.57.0"

[features]
default = []
Expand Down
Loading

1 comment on commit 994c965

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 994c965 Previous: 224972f Ratio
base_tr_fixer 28620 ns/iter (± 4240) 30625 ns/iter (± 4023) 0.93
base_tr_resolver_and_hygiene 160466 ns/iter (± 7133) 173661 ns/iter (± 35650) 0.92
codegen_es2015 63958 ns/iter (± 344) 59041 ns/iter (± 9484) 1.08
codegen_es2016 64089 ns/iter (± 418) 61116 ns/iter (± 11034) 1.05
codegen_es2017 63880 ns/iter (± 344) 60545 ns/iter (± 13408) 1.06
codegen_es2018 63960 ns/iter (± 401) 60679 ns/iter (± 11909) 1.05
codegen_es2019 63858 ns/iter (± 869) 59264 ns/iter (± 8075) 1.08
codegen_es2020 63983 ns/iter (± 376) 60488 ns/iter (± 10879) 1.06
codegen_es3 64122 ns/iter (± 386) 60214 ns/iter (± 10528) 1.06
codegen_es5 64362 ns/iter (± 346) 62508 ns/iter (± 11649) 1.03
config_for_file 15831 ns/iter (± 3484) 18816 ns/iter (± 3231) 0.84
full_es2015 216210491 ns/iter (± 9590487) 213897981 ns/iter (± 19058735) 1.01
full_es2016 166820058 ns/iter (± 8772027) 163205998 ns/iter (± 16431806) 1.02
full_es2017 174315362 ns/iter (± 12621050) 170770846 ns/iter (± 13196135) 1.02
full_es2018 174521450 ns/iter (± 9031413) 169895018 ns/iter (± 13916289) 1.03
full_es2019 170354073 ns/iter (± 13257697) 169327777 ns/iter (± 11063795) 1.01
full_es2020 173109018 ns/iter (± 12205232) 168715712 ns/iter (± 13891491) 1.03
full_es3 252249902 ns/iter (± 22308953) 251049623 ns/iter (± 26756452) 1.00
full_es5 234943262 ns/iter (± 16315611) 237717123 ns/iter (± 24926112) 0.99
parser 780321 ns/iter (± 22204) 762844 ns/iter (± 161535) 1.02
transforms_es2015 1262628 ns/iter (± 79474) 1442889 ns/iter (± 376474) 0.88
transforms_es2016 745144 ns/iter (± 122875) 802631 ns/iter (± 250144) 0.93
transforms_es2017 710420 ns/iter (± 31982) 799006 ns/iter (± 220336) 0.89
transforms_es2018 705015 ns/iter (± 257007) 788354 ns/iter (± 208634) 0.89
transforms_es2019 698323 ns/iter (± 132852) 797517 ns/iter (± 219057) 0.88
transforms_es2020 659309 ns/iter (± 22663) 759517 ns/iter (± 241588) 0.87
transforms_es3 1421797 ns/iter (± 76738) 1437500 ns/iter (± 405683) 0.99
transforms_es5 1279358 ns/iter (± 83812) 1361619 ns/iter (± 381837) 0.94
ser_ast_node 188 ns/iter (± 1) 185 ns/iter (± 40) 1.02
ser_serde 198 ns/iter (± 3) 207 ns/iter (± 32) 0.96
emit_colors 20218130 ns/iter (± 26171932) 21429864 ns/iter (± 27121268) 0.94
emit_large 108562633 ns/iter (± 166383191) 103784218 ns/iter (± 158568891) 1.05
base_clone 2649247 ns/iter (± 34731) 2833992 ns/iter (± 491023) 0.93
fold_span 4500067 ns/iter (± 135672) 4849065 ns/iter (± 705591) 0.93
fold_span_panic 4755825 ns/iter (± 89071) 5332172 ns/iter (± 1103006) 0.89
visit_mut_span 3235734 ns/iter (± 50340) 3452368 ns/iter (± 721796) 0.94
visit_mut_span_panic 3293875 ns/iter (± 45553) 3421008 ns/iter (± 551106) 0.96
boxing_boxed 178 ns/iter (± 1) 190 ns/iter (± 42) 0.94
boxing_boxed_clone 85 ns/iter (± 0) 80 ns/iter (± 11) 1.06
boxing_unboxed 161 ns/iter (± 0) 156 ns/iter (± 22) 1.03
boxing_unboxed_clone 80 ns/iter (± 0) 79 ns/iter (± 15) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.