diff --git a/Cargo.lock b/Cargo.lock index 4817eb91d0..06d1074ea6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,7 +93,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -118,7 +118,7 @@ checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -141,7 +141,7 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -373,7 +373,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", "strsim 0.9.3", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -384,7 +384,7 @@ checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ "darling_core", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -585,7 +585,7 @@ checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -628,25 +628,43 @@ dependencies = [ [[package]] name = "dprint-core" -version = "0.33.1" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d70460b1d4bb4e2f347ab8c3ea714f1ac72d4804e84da0d075473ef41b3205" +checksum = "c7fc292281fc3ec69dfbd36c3c5c73886469a6630e1747ff452b46f5deed208d" dependencies = [ + "bumpalo", + "fnv", "serde", ] [[package]] name = "dprint-plugin-typescript" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8344f63ab5f12f9f8cffa78c90e0aad001361cdddfa12bb733e2d5f0424c36d6" +checksum = "9f3317ee009e4c09da0500289f6c36c172a4eec14617de13d63f369da135428d" dependencies = [ "dprint-core", + "dprint-swc-ecma-ast-view", + "fnv", "serde", "swc_common", "swc_ecmascript", ] +[[package]] +name = "dprint-swc-ecma-ast-view" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b7823760fa355f812a031026f69656ba30de0a943f7d252dc5fece03e4f66c" +dependencies = [ + "bumpalo", + "fnv", + "num-bigint", + "swc_atoms", + "swc_common", + "swc_ecmascript", +] + [[package]] name = "dtoa" version = "0.4.6" @@ -677,7 +695,7 @@ dependencies = [ "pmutil", "proc-macro2 1.0.24", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -790,7 +808,7 @@ dependencies = [ "pmutil", "proc-macro2 1.0.24", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -905,7 +923,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -1210,7 +1228,7 @@ dependencies = [ "pmutil", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -1350,7 +1368,7 @@ dependencies = [ "heck", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -1710,7 +1728,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -1748,7 +1766,7 @@ checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -1759,7 +1777,7 @@ checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -1788,7 +1806,7 @@ checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -1812,7 +1830,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", "version_check", ] @@ -2108,7 +2126,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db9dfbf470021de34cfaf6983067f460ea19164934a7c2d4b92eec0968eb95f1" dependencies = [ "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2186,7 +2204,7 @@ checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2209,7 +2227,7 @@ checksum = "2dc6b7951b17b051f3210b063f12cc17320e2fe30ae05b0fe2a3abb068551c76" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2319,9 +2337,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_cache" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2940c75beb4e3bf3a494cef919a747a2cb81e52571e212bfbd185074add7208a" +checksum = "8ddb1139b5353f96e429e1a5e19fbaf663bddedaa06d1dbd49f82e352601209a" dependencies = [ "lazy_static", "new_debug_unreachable", @@ -2352,7 +2370,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2379,9 +2397,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.18.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fac08904af807442e8f08c50f46a95d346a09db69a94f83670f5ae7e5945ec" +checksum = "c74f70f2803b7ea5cbe9ad4ec7e1679f8d661fd713b9d0d39f76dae41383bd56" dependencies = [ "anyhow", "crc", @@ -2405,9 +2423,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d63837c3d3d226ec338338a8fc32c6c8aabefd0c4d32e6b0bcd1ed991c6963" +checksum = "ae0750e2b492550c8b90e7547bc060d10bc2c5476f36cce039fe8fad71aa086d" dependencies = [ "ast_node", "cfg-if 0.1.10", @@ -2415,11 +2433,14 @@ dependencies = [ "from_variant", "fxhash", "log", + "num-bigint", "once_cell", "owning_ref", "scoped-tls", "serde", "sourcemap", + "string_cache", + "swc_eq_ignore_macros", "swc_visit", "unicode-width", ] @@ -2465,7 +2486,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2511,7 +2532,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2559,7 +2580,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2592,9 +2613,9 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a63164105d73e729bc426f6982571d800f3e14770c848a7ee0f6e8a8d821a8" +checksum = "3a0a8550d9af74d8c9a61a31ffa0efa709f14335fe80f5c51bc747f0265a1756" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", @@ -2605,6 +2626,18 @@ dependencies = [ "swc_ecma_visit", ] +[[package]] +name = "swc_eq_ignore_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c8f200a2eaed938e7c1a685faaa66e6d42fa9e17da5f62572d3cbc335898f5e" +dependencies = [ + "pmutil", + "proc-macro2 1.0.24", + "quote 1.0.7", + "syn 1.0.56", +] + [[package]] name = "swc_macros_common" version = "0.3.1" @@ -2614,7 +2647,7 @@ dependencies = [ "pmutil", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2638,7 +2671,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", "swc_macros_common", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2654,9 +2687,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.48" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" +checksum = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", @@ -2748,7 +2781,7 @@ checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2831,7 +2864,7 @@ checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -2842,7 +2875,7 @@ checksum = "21d30fdbb5dc2d8f91049691aa1a9d4d4ae422a21c334ce8936e5886d30c5c45" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", ] [[package]] @@ -3140,7 +3173,7 @@ dependencies = [ "log", "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", "wasm-bindgen-shared", ] @@ -3174,7 +3207,7 @@ checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.7", - "syn 1.0.48", + "syn 1.0.56", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0e56c61265..f4f3e23402 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -41,7 +41,7 @@ base64 = "0.12.3" byteorder = "1.3.4" clap = "2.33.3" dissimilar = "1.0.2" -dprint-plugin-typescript = "0.36.0" +dprint-plugin-typescript = "0.37.0" encoding_rs = "0.8.24" env_logger = "0.7.1" filetime = "0.2.12" @@ -62,9 +62,9 @@ semver-parser = "0.9.0" serde = { version = "1.0.116", features = ["derive"] } shell-escape = "0.1.5" sourcemap = "6.0.1" -swc_bundler = "0.18.0" -swc_common = { version = "0.10.7", features = ["sourcemap"] } -swc_ecmascript = { version = "0.16.0", features = ["codegen", "dep_graph", "parser", "react", "transforms", "visit"] } +swc_bundler = "0.18.2" +swc_common = { version = "0.10.8", features = ["sourcemap"] } +swc_ecmascript = { version = "0.16.1", features = ["codegen", "dep_graph", "parser", "react", "transforms", "visit"] } tempfile = "3.1.0" termcolor = "1.1.0" tokio = { version = "0.2.22", features = ["full"] } diff --git a/cli/tests/bundle/fixture02.out b/cli/tests/bundle/fixture02.out index bd3e349bdf..aad359fce2 100644 --- a/cli/tests/bundle/fixture02.out +++ b/cli/tests/bundle/fixture02.out @@ -1,15 +1,15 @@ +const b = "b"; +console.log(b); const mod = function() { const c = "c"; - const c1 = c; class C { } const __default = C; + const c1 = c; return { c, default: C }; }(); const c = mod; -const b = "b"; -console.log(b); console.log(mod); diff --git a/cli/tests/bundle/fixture11.out b/cli/tests/bundle/fixture11.out index c09f0cac91..3dc1a454b7 100644 --- a/cli/tests/bundle/fixture11.out +++ b/cli/tests/bundle/fixture11.out @@ -8,6 +8,8 @@ var O2; O1[O1["C"] = 2] = "C"; })(O2 || (O2 = { })); +const O1 = O2; +export { O1 as O }; class A { #a; #c; @@ -27,5 +29,3 @@ class A { const a2 = new A(); a2.a(); a2.c(); -const O1 = O2; -export { O1 as O }; diff --git a/cli/tests/bundle/fixture14.out b/cli/tests/bundle/fixture14.out index cb0b4834f0..80532a1ddc 100644 --- a/cli/tests/bundle/fixture14.out +++ b/cli/tests/bundle/fixture14.out @@ -1,31 +1,31 @@ const mod = function() { + const mod1 = []; + return { + mod: mod1 + }; +}(); +console.log(mod); +const mod1 = function() { const a = []; const a1 = a; return { a }; }(); -const a = mod; -const mod1 = function() { +const a = mod1; +const mod2 = function() { const b = []; const b1 = b; return { b }; }(); -const b = mod1; -const mod2 = function() { +const b = mod2; +const mod3 = function() { const c = []; const c1 = c; return { c }; }(); -const c = mod2; -const mod3 = function() { - const mod4 = []; - return { - mod: mod4 - }; -}(); -console.log(mod3); +const c = mod3;