diff --git a/Cargo.lock b/Cargo.lock index ba91efc..65a27cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -219,9 +219,9 @@ dependencies = [ [[package]] name = "browserslist-rs" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33066f72a558361eeb1077b0aff0f1dce1ac75bdc20b38a642f155f767b2824" +checksum = "4f2557836820eed97f79071bb3294b2640e71e0bc4301336a210a1b8b4947c15" dependencies = [ "ahash", "anyhow", @@ -273,9 +273,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.17" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80932e03c33999b9235edb8655bc9df3204adc9887c2f95b50cb1deb9fd54253" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -283,9 +283,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.17" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c0db58c659eef1c73e444d298c27322a1b52f6927d2ad470c0c0f96fa7b8fa" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -625,9 +625,9 @@ checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" dependencies = [ "either", ] @@ -975,9 +975,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "preset_env_base" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff96707a8ddcf6230b2249554d5dc78bbe93cfe28af5ef880174a0f2e63d0d53" +checksum = "d4e9bedef66806cb32828719aa5cad298e363ad50d190538db40b5631b89d456" dependencies = [ "ahash", "anyhow", @@ -1109,9 +1109,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -1121,9 +1121,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick", "memchr", @@ -1424,9 +1424,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.270.23" +version = "0.272.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748cdbde112e921fb1ad7ebf7e9969190ebea1b6eaec8c1ace9073b6c1579e1b" +checksum = "c7a3f13725f06e0a889de3a74ab3eb0102cd21ffd456f1ff2660c218029ff39b" dependencies = [ "anyhow", "base64", @@ -1484,9 +1484,9 @@ dependencies = [ [[package]] name = "swc_cached" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b357b80879f6c4f4f34879d02eeae63aafc7730293e6eda3686f990d160486" +checksum = "630c761c74ac8021490b78578cc2223aa4a568241e26505c27bf0e4fd4ad8ec2" dependencies = [ "ahash", "anyhow", @@ -1498,9 +1498,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.33.12" +version = "0.33.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3ae36feceded27f0178dc9dabb49399830847ffb7f866af01798844de8f973" +checksum = "3792c10fa5d3e93a705b31f13fdea4a6e68c3c20d4351e84ed1741b7864399cd" dependencies = [ "ahash", "ast_node", @@ -1526,12 +1526,13 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "0.4.21" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8efb9de5372be0e973016ce7aa2f151af54f9d0d84f514dfeeb95bd7ca477aa3" +checksum = "acf4a9fcd82f924e8693be713a56a33f9ac8504931b4843c3ec41853a1f373b6" dependencies = [ "anyhow", "base64", + "once_cell", "pathdiff", "serde", "sourcemap", @@ -1548,13 +1549,16 @@ dependencies = [ [[package]] name = "swc_config" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112884e66b60e614c0f416138b91b8b82b7fea6ed0ecc5e26bad4726c57a6c99" +checksum = "c29e3b76a63111ef318f161bc413dfc093f21da1afca9ba5cdd6442b7069d65b" dependencies = [ + "anyhow", "indexmap", "serde", "serde_json", + "sourcemap", + "swc_cached", "swc_config_macro", ] @@ -1572,9 +1576,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.110.17" +version = "0.111.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79401a45da704f4fb2552c5bf86ee2198e8636b121cb81f8036848a300edd53b" +checksum = "e12b4d0f3b31d293dac16fc13a50f8a282a3bdb658f2a000ffe09b1b638f45c9" dependencies = [ "bitflags 2.4.1", "is-macro", @@ -1590,9 +1594,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.146.54" +version = "0.147.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b61ca275e3663238b71c4b5da8e6fb745bde9989ef37d94984dfc81fc6d009" +checksum = "71cf965b2cda4683eaf37ef4e238c0ca14a509ee76948638d815ccffb85bcd8b" dependencies = [ "memchr", "num-bigint", @@ -1621,9 +1625,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "0.2.16" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0337067ede6103a274191a20c4de238ded32bb8b3d3e99561ca3e7811e089b21" +checksum = "da6853a4c19b5d71bffb3f41c7494f4be556e026614f8b9fe473281fa4e286e5" dependencies = [ "swc_atoms", "swc_common", @@ -1638,9 +1642,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_common" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0a57bd134c03dd545263ee41824a8cb06af1553016dccf8ac1ad8cbbb940c3" +checksum = "f9a41339c6306d8e569c33c48ab8d586146757ab217583b73d9c725b229e6913" dependencies = [ "swc_common", "swc_ecma_ast", @@ -1651,9 +1655,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "0.2.16" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6912d92bcfc313d7b05d1da0ae8d283bce24baf4e1fd09541acd52f32ab1e32" +checksum = "ccb9e19ab3ec1e2ec9f752e06f18a95ce5228fbaa7dea3c3d5613f23236ccfe5" dependencies = [ "arrayvec", "indexmap", @@ -1677,9 +1681,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2016" -version = "0.2.11" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f4824f2bd45b02b70bc85824daa35c9c07477589f008f888748c115d4b0b97" +checksum = "f70d0854d74205a8c9cdf9a614a935a5204259ae0a2dbb595614111df4e3ee57" dependencies = [ "swc_atoms", "swc_common", @@ -1694,9 +1698,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2017" -version = "0.2.12" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85bcb454c2d69e38777fd739864938fbc18ed45b6ee4dd314b9fc0a463a63c1" +checksum = "226d0342e624a8c9a090968978b6b855894eb87b0666d12dbbfaacf463e00484" dependencies = [ "serde", "swc_atoms", @@ -1712,9 +1716,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2018" -version = "0.2.13" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d47d63860994814c49e8ad5996d182d1d7804e96d6f7bdab0bf1282716d9884" +checksum = "04c2dfd594215aba9bb6376dddb8f98f2ad5a55ec4b65562242bb2a53a1becea" dependencies = [ "serde", "swc_atoms", @@ -1731,9 +1735,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2019" -version = "0.2.12" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f20b2d70b26e48926bba3b7629b6bc10de724a8f076fdf4eb9267fe12a1db17b" +checksum = "3ff30a4f95ac263b5006c5883123c1d0658565df98ef9364a9f9b83b381b3bb2" dependencies = [ "swc_atoms", "swc_common", @@ -1747,9 +1751,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2020" -version = "0.2.13" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973a0bca6c9e85869d62b38937b80e13ee5e105df4eb18576177c4ebb41e5bb9" +checksum = "abc0da73b918cea136f2fe5e0eb6a2ff8fdf71a2473c611c4923f18ac7346c65" dependencies = [ "serde", "swc_atoms", @@ -1765,9 +1769,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2021" -version = "0.2.11" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a33089b3b121acadc052ca636905c1dd465db3cc94fa456c26eacc65d5074db" +checksum = "f1cfa09a6e3d916ea6e7c116cafbea5c37cae67045a6e205c447168faa62e67f" dependencies = [ "swc_atoms", "swc_common", @@ -1781,9 +1785,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2022" -version = "0.2.12" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe2a334c1ed213b0a58adb09518c63c63229afad705e5ab027e2fd0f3ff20bd" +checksum = "01a150a7cf16861d17973a70088a7b173da15e9ae2d74063d1ba47d2c88ad732" dependencies = [ "swc_atoms", "swc_common", @@ -1800,9 +1804,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es3" -version = "0.2.11" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce5624a8b906965af30484a0b8e2ed9b0d68675a1b8bdba6a242882f38e3270e" +checksum = "e1ec402b2125bbca532f0d7fb50536c54259d5b76f21b2ac47ce541661693732" dependencies = [ "swc_common", "swc_ecma_ast", @@ -1815,9 +1819,9 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.111.4" +version = "0.112.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e728d14119048a95e023c3c5c0ad5ddddb1f405bfef3bd55f81dc5fc3c9e95a" +checksum = "8847cdc48901afa16204bfde6ed3de668b53c4ca41df55bd6254aac4d2452fda" dependencies = [ "phf", "swc_atoms", @@ -1829,9 +1833,9 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.90.10" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5afe579c82fe80a24e8c815fa19e7f1126c8114db0985f211c985d5b4db4137e" +checksum = "6b6a5cef803cc7140788a23caeb70ad0b503d32e72f74e11927da04f6347dcb8" dependencies = [ "auto_impl", "dashmap", @@ -1849,9 +1853,9 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.45.13" +version = "0.45.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5713ab3429530c10bdf167170ebbde75b046c8003558459e4de5aaec62ce0f1" +checksum = "53d557b6a53b0db00e36cd24359adcf52f4c6d4446c83ecaad3e2b8195696f7b" dependencies = [ "anyhow", "dashmap", @@ -1863,6 +1867,7 @@ dependencies = [ "pathdiff", "serde", "serde_json", + "swc_atoms", "swc_cached", "swc_common", "tracing", @@ -1870,9 +1875,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.190.20" +version = "0.191.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "675d4e7296593506ce790ba38e61fe175e6613bac5a80715fc5eaf57ff9c4792" +checksum = "d7ed693be413eb44171ce48d794a3124477d8bb9de6af3740c4def6e8b02a216" dependencies = [ "arrayvec", "indexmap", @@ -1887,7 +1892,6 @@ dependencies = [ "serde", "serde_json", "swc_atoms", - "swc_cached", "swc_common", "swc_config", "swc_ecma_ast", @@ -1904,9 +1908,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.141.37" +version = "0.142.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d17401dd95048a6a62b777d533c0999dabdd531ef9d667e22f8ae2a2a0d294" +checksum = "5c3eedda441af51ca25caebb88837649a40e2a39b763344a53cfedd869740c71" dependencies = [ "either", "new_debug_unreachable", @@ -1926,9 +1930,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.204.18" +version = "0.205.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83101b23a76bf32b592193be46d6a3f109385450f459bda481b9175570d769dd" +checksum = "6445a30a5ad1569df582c75b867e3e74f1900eade38d8ad4d2227c6dfd875543" dependencies = [ "anyhow", "dashmap", @@ -1951,9 +1955,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.227.18" +version = "0.228.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ca294ecda1e74ac2218e17e1fc77ffa9742195f3fead022fe8103321ed12d4" +checksum = "6d7b37d02a0b2a70834588cb46b40c53d0154cf9970d27a12f65f87fe68c3f50" dependencies = [ "swc_atoms", "swc_common", @@ -1971,9 +1975,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.135.11" +version = "0.136.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d4ab26ec124b03e47f54d4daade8e9a9dcd66d3a4ca3cd47045f138d267a60e" +checksum = "db269d6b55688960fc214cac4c31026dff482e9355afa3c7417316b86c685452" dependencies = [ "better_scoped_tls", "bitflags 2.4.1", @@ -1994,9 +1998,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.124.11" +version = "0.125.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fe4376c024fa04394cafb8faecafb4623722b92dbbe46532258cc0a6b569d9c" +checksum = "a86a29952848e12bcdd788fa6922d3a9c79603c26a38278effd63c98c532d069" dependencies = [ "swc_atoms", "swc_common", @@ -2008,9 +2012,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.161.16" +version = "0.162.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46cfe232648c0994922d136d686c0a598c73a30334d92b14ba5a61e768bb4e7" +checksum = "c1824310b8b2c6918153c9866353ad0e7887a1a395e8fc85d90280669bdc6362" dependencies = [ "arrayvec", "indexmap", @@ -2056,9 +2060,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.178.18" +version = "0.179.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e51136811754dcbd7400cdd62da7117deabd029c8049a6740cff75934e3f40" +checksum = "2a1cd0b9482c098d26e9743ece8ad01811d00cfed8f0646d49359f9e4c78bf27" dependencies = [ "Inflector", "anyhow", @@ -2083,9 +2087,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.196.17" +version = "0.197.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fec185cf4d18e90b7c8b18b0d1f04a5707e6f4c7b57c1bfd5086392cd07b75a9" +checksum = "45400b4e4ba30142b0a8f5b498b000d6b5687ffc5e449f49d9253005549c430c" dependencies = [ "dashmap", "indexmap", @@ -2107,9 +2111,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.169.16" +version = "0.170.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed89d6ff74f60de490fb56e1cc505b057905e36c13d405d7d61dd5c9f6ee8fc9" +checksum = "424819468d5198d42034c3b5659aff91ad854c035cb0342e6e7f10916422de1f" dependencies = [ "either", "rustc-hash", @@ -2127,9 +2131,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.181.18" +version = "0.182.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31a2f879fd21d18080b6c42e633e0ae8c6f3d54b83c1de876767d82b458c999" +checksum = "52069f1ff08f6efe9d88ebbaa4974a33892e791fd00c70fc3f025053693d00ae" dependencies = [ "base64", "dashmap", @@ -2151,9 +2155,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.186.17" +version = "0.187.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4263372cc7cd1a3b4570ccf7438f3c1e1575f134fd05cdf074edb322480a5b" +checksum = "801c4f46b872b22aed626d28457440774decade9773d40064118e5842d9dc94b" dependencies = [ "ryu-js", "serde", @@ -2168,9 +2172,9 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "0.21.5" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf6ae5dd022ac6f39034896dd94eaeb590bf1fc6ab6e4f302fc9cdd8569e9b7" +checksum = "ffb8472c2bad83d26db456b6b0f933669aea6549271eb8bea683ed0dab326d13" dependencies = [ "indexmap", "rustc-hash", @@ -2185,9 +2189,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.125.4" +version = "0.126.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cead1083e46b0f072a82938f16d366014468f7510350957765bb4d013496890" +checksum = "f44fc2b597f6429631231b083a6019b8400c9d524eff4b82ece4b7dfffdbe787" dependencies = [ "indexmap", "num_cpus", @@ -2203,9 +2207,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.96.17" +version = "0.97.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d0100c383fb08b6f34911ab6f925950416a5d14404c1cd520d59fb8dfbb3bf" +checksum = "26ecefeec816318f1d449b4bac2e28a4243a167cc16620e15c3c1f2d91085770" dependencies = [ "num-bigint", "swc_atoms", @@ -2228,9 +2232,9 @@ dependencies = [ [[package]] name = "swc_error_reporters" -version = "0.17.12" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e00fa7c3009268d8ab2ca69d22ac3c3fe777297215fa128bc0ef42dcdf230ab" +checksum = "be42e786ee9bda3f72f7d7de791e1d7b49ab7f86ed54fdc5808681ae04406080" dependencies = [ "anyhow", "miette", @@ -2241,9 +2245,9 @@ dependencies = [ [[package]] name = "swc_fast_graph" -version = "0.21.13" +version = "0.21.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acfc056067a0fbfe26a4763c1eb246e813fdbe6b376415d07915e96e15481b6" +checksum = "0c9c9e567014e157af520f74b1a5bc151fece681136754b80b3fec6b908e26a0" dependencies = [ "indexmap", "petgraph", @@ -2264,9 +2268,9 @@ dependencies = [ [[package]] name = "swc_node_comments" -version = "0.20.12" +version = "0.20.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86a67c8fb9735b17b2cdf7b5dd539dc1625f73d05c794566b98e65be39cee5b1" +checksum = "a8058148241150b482cbe8f690f1005663994dc22c9f8f9a651c7aeca9263f35" dependencies = [ "dashmap", "swc_atoms", @@ -2275,9 +2279,9 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.21.14" +version = "0.21.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b37010da5874d241c9e11ef020b8e4473f3af4e5d2e19219e92d99c04f12e0c6" +checksum = "9d15ec9bca22690ba9a373af069e366c9f43e48dd4d328aea6ba138f93ff0276" dependencies = [ "tracing", ] diff --git a/Cargo.toml b/Cargo.toml index bb1bd64..75d9d26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,14 +7,14 @@ edition = "2021" [dependencies] anyhow = "^1.0.79" -clap = { version = "4.4.16", features = ["derive"] } +clap = { version = "^4.4.18", features = ["derive"] } env_logger = "~0.11.0" glob = "~0.3.1" log = "~0.4.20" -regex = "^1.10.2" +regex = "^1.10.3" serde = { version = "^1.0.195", features = ["derive"] } serde_json = "^1.0.111" -swc = "~0.270.21" -swc_common = "~0.33.12" -swc_ecma_ast = "~0.110.17" -swc_ecma_parser = "~0.141.37" +swc = "~0.272.0" +swc_common = "~0.33.15" +swc_ecma_ast = "~0.111.1" +swc_ecma_parser = "~0.142.1" diff --git a/src/ast_browser.rs b/src/ast_browser.rs index 61b15e3..46d63d8 100644 --- a/src/ast_browser.rs +++ b/src/ast_browser.rs @@ -62,11 +62,14 @@ fn process_typescript_file(path: String, actual_imports: &mut HashMap { - let name = utils::remove_first_and_last_chars(src.to_string()); + let name = + utils::remove_first_and_last_chars(src.to_string()); let actual_import = ImportStatement { name: name.clone(), file: path.clone(), - line: source_map.lookup_char_pos(import_declaration.span.lo).line, + line: source_map + .lookup_char_pos(import_declaration.span.lo) + .line, }; file_imports.insert(name, actual_import); } @@ -102,7 +105,10 @@ fn process_typescript_file(path: String, actual_imports: &mut HashMap HashMap { +pub fn resolve_actual_imports( + project_root: PathBuf, + pattern: String, +) -> HashMap { let mut actual_imports: HashMap = HashMap::new(); let absolute_pattern = Path::new(&project_root).join(pattern); for entry in glob(&absolute_pattern.display().to_string()).expect("Failed to read glob pattern") diff --git a/src/main.rs b/src/main.rs index cf3e3cf..8799830 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,11 +18,11 @@ mod ast_browser; mod manifest; mod write_report; +use env_logger::{Builder, Target}; +use log::{error, info}; use std::env; use std::io::Write; use std::string::String; -use log::{info, error}; -use env_logger::{Builder, Target}; fn main() { let args = Args::parse(); @@ -37,6 +37,7 @@ fn main() { let actual_imports_map = ast_browser::resolve_actual_imports(project_root, pattern); let actual_imports = actual_imports_map.keys().cloned().collect(); + match declared_dependencies { Ok(declared) => { let mut extraneous: Vec<_> = declared.difference(&actual_imports).collect(); @@ -64,9 +65,7 @@ fn main() { fn configure_logging(args: &Args) { let mut logging_builder = Builder::from_default_env(); - logging_builder.format(|buf, record| { - writeln!(buf, "{}", record.args()) - }); + logging_builder.format(|buf, record| writeln!(buf, "{}", record.args())); if args.verbose { logging_builder.filter_level(log::LevelFilter::Debug); diff --git a/src/manifest.rs b/src/manifest.rs index 7079402..9a6ae00 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -1,10 +1,10 @@ +use log::info; use std::collections::HashMap; use std::collections::HashSet; use std::env; use std::fs; use std::option::Option; use std::path::{Path, PathBuf}; -use log::{info}; use anyhow::{bail, Ok, Result}; use serde::{Deserialize, Serialize}; diff --git a/src/utils.rs b/src/utils.rs index 95d4bbc..7b34ce4 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,7 @@ +use crate::ast_browser::ImportStatement; use regex::Regex; use std::cmp::Ordering; use std::collections::HashMap; -use crate::ast_browser::ImportStatement; const BUILT_IN: [&str; 41] = [ "assert", @@ -86,16 +86,16 @@ pub fn crop_dep_only(dependency: String) -> String { Ordering::Equal => String::from(split_dep[0]), Ordering::Greater => { if organization_dependency.is_match(split_dep[0]) { - return split_dep[0].to_owned() + "/" + split_dep[1]; + split_dep[0].to_owned() + "/" + split_dep[1] } else { - return split_dep[0].to_owned(); + split_dep[0].to_owned() } } Ordering::Less => String::new(), } } -pub fn filtered_and_cropped_deps(dependencies: &mut HashMap) -> () { +pub fn filtered_and_cropped_deps(dependencies: &mut HashMap) { let mut keys_to_remove = Vec::new(); let mut items_to_add: HashMap = HashMap::new(); @@ -220,8 +220,8 @@ mod crop_dep_only_tests { #[cfg(test)] mod filtered_and_cropped_deps_tests { use crate::ast_browser::utils::filtered_and_cropped_deps; - use std::collections::HashMap; use crate::ast_browser::ImportStatement; + use std::collections::HashMap; fn fake_dep(name: String) -> ImportStatement { ImportStatement { @@ -282,7 +282,10 @@ mod filtered_and_cropped_deps_tests { base_deps.insert(simple_external_dep.clone(), fake_dep(simple_external_dep)); base_deps.insert(nested_external_dep.clone(), fake_dep(nested_external_dep)); base_deps.insert(internal_dep.clone(), fake_dep(internal_dep)); - base_deps.insert(namespace_external_dep.clone(), fake_dep(namespace_external_dep)); + base_deps.insert( + namespace_external_dep.clone(), + fake_dep(namespace_external_dep), + ); filtered_and_cropped_deps(&mut base_deps); @@ -291,6 +294,5 @@ mod filtered_and_cropped_deps_tests { assert!(base_deps.contains_key("node")); assert!(base_deps.contains_key("@angular/core")); assert!(base_deps.contains_key("@something/utils")); - } }