feat(next-swc): Update crates (#35133)

This PR updates crates related to ecmascript to d62ef6498d

I'll update css crates separately.


This PR also reduces the size of binary.
This commit is contained in:
Donny/강동윤 2022-03-11 13:58:01 +09:00 committed by GitHub
parent f14f62838a
commit e57d621fb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 200 additions and 149 deletions

View file

@ -59,9 +59,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.51"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
[[package]]
name = "arrayvec"
@ -77,9 +77,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "ast_node"
version = "0.7.6"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b2dd56b7c509b3a0bb47a97a066cba459983470d3b8a3c20428737270f70bd"
checksum = "bc4c00309ed1c8104732df4a5fa9acc3b796b6f8531dfbd5ce0078c86f997244"
dependencies = [
"darling",
"pmutil",
@ -386,6 +386,17 @@ dependencies = [
"num_cpus",
]
[[package]]
name = "dashmap"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0834a35a3fce649144119e18da2a4d8ed12ef3862f47183fd46f625d072d96c"
dependencies = [
"cfg-if 1.0.0",
"num_cpus",
"parking_lot 0.12.0",
]
[[package]]
name = "debug_unreachable"
version = "0.1.1"
@ -576,9 +587,9 @@ checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed"
[[package]]
name = "indexmap"
version = "1.7.0"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
"autocfg",
"hashbrown",
@ -821,7 +832,7 @@ dependencies = [
"swc_css",
"swc_ecma_loader",
"swc_ecma_transforms_testing",
"swc_ecmascript",
"swc_ecmascript 0.130.0",
"swc_node_base",
"swc_stylis",
"testing",
@ -848,7 +859,7 @@ dependencies = [
"swc_bundler",
"swc_common",
"swc_ecma_loader",
"swc_ecmascript",
"swc_ecmascript 0.130.0",
"swc_node_base",
]
@ -905,9 +916,9 @@ dependencies = [
[[package]]
name = "num_cpus"
version = "1.13.0"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [
"hermit-abi",
"libc",
@ -1120,7 +1131,7 @@ dependencies = [
"ahash",
"anyhow",
"browserslist-rs",
"dashmap",
"dashmap 4.0.2",
"from_variant",
"once_cell",
"semver 1.0.4",
@ -1446,9 +1457,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.133"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
dependencies = [
"serde_derive",
]
@ -1467,9 +1478,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.133"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537"
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [
"proc-macro2",
"quote",
@ -1487,16 +1498,6 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_regex"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8136f1a4ea815d7eac4101cfd0b16dc0cb5e1fe1b8609dfd728058656b7badf"
dependencies = [
"regex",
"serde",
]
[[package]]
name = "sha-1"
version = "0.9.8"
@ -1622,9 +1623,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
[[package]]
name = "styled_components"
version = "0.17.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e824357a52655bd0977b40a11072669ed9e9c16eff78d6eaf54cc7d822d2585"
checksum = "a044adff2fd2ddb9832589b87a934beefa68644511ca4d3629d334c2890fa413"
dependencies = [
"Inflector",
"once_cell",
@ -1632,30 +1633,32 @@ dependencies = [
"serde",
"swc_atoms",
"swc_common",
"swc_ecmascript",
"swc_ecmascript 0.129.0",
"tracing",
]
[[package]]
name = "swc"
version = "0.138.0"
version = "0.146.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "170a6c528c1b2052c7bdc388b12b6dd82bc51535c10f25298a46577e7183965b"
checksum = "72cd61a211feaace10912e2cab2e41a4c3037944cf09fc5fc4484476cfb8a38d"
dependencies = [
"ahash",
"anyhow",
"base64 0.13.0",
"dashmap",
"dashmap 4.0.2",
"either",
"indexmap",
"lru",
"once_cell",
"parking_lot 0.12.0",
"pathdiff",
"regex",
"serde",
"serde_json",
"sourcemap",
"swc_atoms",
"swc_cached",
"swc_common",
"swc_ecma_ast",
"swc_ecma_codegen",
@ -1671,7 +1674,7 @@ dependencies = [
"swc_ecma_transforms_optimization",
"swc_ecma_utils",
"swc_ecma_visit",
"swc_ecmascript",
"swc_ecmascript 0.130.0",
"swc_node_comments",
"swc_visit",
"tracing",
@ -1689,14 +1692,14 @@ dependencies = [
[[package]]
name = "swc_bundler"
version = "0.114.0"
version = "0.120.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7072dba1e14f946f10cb5127f4e8afb8875f5c8a6a29ab6029ffb884342d3684"
checksum = "b34f7fb2af1d7ea4a5711f080de1f89b3e7cc60878129ca05a87dcb03806252d"
dependencies = [
"ahash",
"anyhow",
"crc",
"dashmap",
"dashmap 4.0.2",
"indexmap",
"is-macro",
"once_cell",
@ -1722,10 +1725,25 @@ dependencies = [
]
[[package]]
name = "swc_common"
version = "0.17.9"
name = "swc_cached"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffd694004c48af55237f1e471ccefdb76f88da8d8ac4726612ea11c525d02425"
checksum = "84fed4a980e12c737171a7b17c5e0a2f4272899266fa0632ea4e31264ebdfdb5"
dependencies = [
"ahash",
"anyhow",
"dashmap 5.1.0",
"once_cell",
"regex",
"serde",
"swc_atoms",
]
[[package]]
name = "swc_common"
version = "0.17.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a36a065c7083df5ffd6fce81183cce8eb3dd60e04bf43a02b13fd2ca82735194"
dependencies = [
"ahash",
"ast_node",
@ -1753,9 +1771,9 @@ dependencies = [
[[package]]
name = "swc_css"
version = "0.94.0"
version = "0.98.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55d52d595da541b1626e3c9f89441607042cda81d2047dbdc7bec44449b73925"
checksum = "8a981201fee6030b632b61e232344e57b88646487e890fe40c2f52df6e61dad8"
dependencies = [
"swc_css_ast",
"swc_css_codegen",
@ -1766,9 +1784,9 @@ dependencies = [
[[package]]
name = "swc_css_ast"
version = "0.86.0"
version = "0.89.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c933063972e7d8d810e893935b10f66b3be1eb9f33685ecb2416cf80e337759"
checksum = "60b8d5dd8d45e8d26e1c0f15d04d830bf9489205dd39f6a2867bf2f1e521ebb5"
dependencies = [
"is-macro",
"serde",
@ -1779,9 +1797,9 @@ dependencies = [
[[package]]
name = "swc_css_codegen"
version = "0.91.0"
version = "0.95.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59995589f6579069f2aadb1b73b38d53c9d2798e4c6379dc3e8245954ad5cb9e"
checksum = "55ca0ec88711d6af0cfa4465ac117ad808c64b978de406c6d7049c9f837876cc"
dependencies = [
"auto_impl",
"bitflags",
@ -1806,9 +1824,9 @@ dependencies = [
[[package]]
name = "swc_css_parser"
version = "0.92.0"
version = "0.96.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a918661b5fe9192f2608ee6b7aca44c80026b1e08c6058dd9fb6df0eb587a69b"
checksum = "2dc44fabca5685b2af81cd401cb03ef69633d8e8b718283237e3bf9331755e55"
dependencies = [
"bitflags",
"lexical",
@ -1819,9 +1837,9 @@ dependencies = [
[[package]]
name = "swc_css_utils"
version = "0.83.0"
version = "0.86.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b33f951f0bb3f5c4310030cf5ad03ada3fff541010dada65436d00be86e07c1"
checksum = "56fb5413c7525a34b20bc4d8adc388f6b62ed7013d77aa997ab9607fb02183f3"
dependencies = [
"swc_atoms",
"swc_common",
@ -1831,9 +1849,9 @@ dependencies = [
[[package]]
name = "swc_css_visit"
version = "0.85.0"
version = "0.88.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1be861b1f6ceab4f68a3e770910605b2ff0c7aafae7f078bdaa503c8302e6ce3"
checksum = "93e147d6cac704199e68d008e5db562741c74e3d57aac859d0a015a25a90a036"
dependencies = [
"swc_atoms",
"swc_common",
@ -1843,9 +1861,9 @@ dependencies = [
[[package]]
name = "swc_ecma_ast"
version = "0.68.3"
version = "0.69.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d465460177dcdf076f7c32b75cc0adede3c70506b4c7a859440001310e78e71f"
checksum = "d4b2e9a1a9e3f71557971dd096aa3fff7487f2c419d2f93c0d71445352a36dc8"
dependencies = [
"is-macro",
"num-bigint",
@ -1853,14 +1871,14 @@ dependencies = [
"string_enum",
"swc_atoms",
"swc_common",
"unicode-xid",
"unicode-id",
]
[[package]]
name = "swc_ecma_codegen"
version = "0.93.4"
version = "0.94.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa81be3ef5a662291f5b387681d497b8c73fabb846459fb3a84097cfe7e127c3"
checksum = "c7cc54ecbaa80a5900189cf37825b221670b249ed192ac978095ec2a742cc503"
dependencies = [
"bitflags",
"memchr",
@ -1889,9 +1907,9 @@ dependencies = [
[[package]]
name = "swc_ecma_ext_transforms"
version = "0.55.0"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ed2bbd721290b19b26ece0e7f536dce4375c3cd5f5722b838ec1c985b432916"
checksum = "29ee604a45d78d367cddc3b7cb3eca11142a48c2eff99c8703606ba40598a29f"
dependencies = [
"phf",
"swc_atoms",
@ -1903,13 +1921,13 @@ dependencies = [
[[package]]
name = "swc_ecma_lints"
version = "0.19.0"
version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d097f0e4f44ea808b6533ddc2983573030e4e267a503e78f7ab64290ff8a52ab"
checksum = "fba8df0f6b301d77497cabb32245497e779501fcc51a74b9cd262a639881434f"
dependencies = [
"ahash",
"auto_impl",
"dashmap",
"dashmap 4.0.2",
"parking_lot 0.12.0",
"rayon",
"regex",
@ -1923,40 +1941,42 @@ dependencies = [
[[package]]
name = "swc_ecma_loader"
version = "0.28.0"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be60d3b599557e0b49d06e9cad351ec196e2ab9e9a369a0780f000a47ab58404"
checksum = "f9ab69df5d4de425833e02de111f14b5544b39ad9c9b82c97e4835fc55c8f1b6"
dependencies = [
"ahash",
"anyhow",
"dashmap",
"dashmap 4.0.2",
"lru",
"normpath",
"once_cell",
"parking_lot 0.12.0",
"path-clean",
"regex",
"serde",
"serde_json",
"swc_cached",
"swc_common",
"tracing",
]
[[package]]
name = "swc_ecma_minifier"
version = "0.81.1"
version = "0.88.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7f6648dc44b95432c4253f03bce4c1a5c73a7a8adefe9be11c78c048d925dc0"
checksum = "795c58670d843f62f1e349fe537a8ec65dac21c78fd527db5b83ae0952cf78bd"
dependencies = [
"ahash",
"indexmap",
"once_cell",
"parking_lot 0.12.0",
"rayon",
"regex",
"retain_mut",
"serde",
"serde_json",
"serde_regex",
"swc_atoms",
"swc_cached",
"swc_common",
"swc_ecma_ast",
"swc_ecma_codegen",
@ -1967,14 +1987,14 @@ dependencies = [
"swc_ecma_visit",
"swc_timer",
"tracing",
"unicode-xid",
"unicode-id",
]
[[package]]
name = "swc_ecma_parser"
version = "0.91.11"
version = "0.92.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58b099ab64a9e667ffcacbbf043710eabccd910f5664a82c997b4a1ff8bc9ed6"
checksum = "1251aed8d38997c1ce928019fa64708c284cf19377f2e9eca6f43cb2f4202186"
dependencies = [
"either",
"enum_kind",
@ -1987,18 +2007,18 @@ dependencies = [
"swc_ecma_ast",
"tracing",
"typed-arena",
"unicode-xid",
"unicode-id",
]
[[package]]
name = "swc_ecma_preset_env"
version = "0.98.0"
version = "0.104.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16954dd8ff0ad4ef4046a8aee5a31122413242d520efef38bea3c13f350e9a54"
checksum = "65ed547302d317c6e629b80747f5a75d06d6887ba2e4434f2e81411f33e05f00"
dependencies = [
"ahash",
"anyhow",
"dashmap",
"dashmap 4.0.2",
"indexmap",
"once_cell",
"preset_env_base",
@ -2017,9 +2037,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms"
version = "0.124.0"
version = "0.130.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e56c345bb62ac1494ef2d97eabe08ec0d0fc2ec46e029bdb4cb714c34fd15cc8"
checksum = "1a9333d80deef03e37cfbf0a396d1604fbec8a6d72ad6cb27138367c1d19fc94"
dependencies = [
"swc_atoms",
"swc_common",
@ -2033,14 +2053,13 @@ dependencies = [
"swc_ecma_transforms_typescript",
"swc_ecma_utils",
"swc_ecma_visit",
"unicode-xid",
]
[[package]]
name = "swc_ecma_transforms_base"
version = "0.63.0"
version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49cfcab3966f8dc8c82604a50ccf54541dcc4101bff72ff70bbd6e73a37a1af7"
checksum = "306d0e08bcbfc887744e7affbe00c2b5b753cfe7d7fc2a8ffc77b05ca46cb1bf"
dependencies = [
"better_scoped_tls",
"once_cell",
@ -2059,9 +2078,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_classes"
version = "0.51.0"
version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d15131c3944964e290102ddc180251f01b1264e8873f5565fb3f3c097962f800"
checksum = "d4314241d66c22a6015e87c563ab7e0ac2519712822dc81c91c56575fe1de613"
dependencies = [
"swc_atoms",
"swc_common",
@ -2073,9 +2092,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_compat"
version = "0.75.2"
version = "0.79.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b1939156171fe03940e5918efb8b3058d6ef06bae23990d361233951b8f8db3"
checksum = "b2d07603599624024734fe85961cd48a3eace1a72f316d3d0232187a594f29f5"
dependencies = [
"ahash",
"arrayvec 0.7.2",
@ -2112,9 +2131,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_module"
version = "0.84.1"
version = "0.90.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da2c5960939be80ad54842bdb42b205d3cf17fd3c2955c693a6fd7f678e70ef3"
checksum = "60762763c4c5ec8f9f8a86408fd0cfa01802d5a274f8ecdb4327ba6292fff52a"
dependencies = [
"Inflector",
"ahash",
@ -2123,6 +2142,7 @@ dependencies = [
"pathdiff",
"serde",
"swc_atoms",
"swc_cached",
"swc_common",
"swc_ecma_ast",
"swc_ecma_loader",
@ -2130,16 +2150,17 @@ dependencies = [
"swc_ecma_transforms_base",
"swc_ecma_utils",
"swc_ecma_visit",
"tracing",
]
[[package]]
name = "swc_ecma_transforms_optimization"
version = "0.94.0"
version = "0.100.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4103b2ba1f24dd7ff735d2fa33d86be5eefad4316d046e09509c11dba4f9bb5f"
checksum = "98ce53a1efa05e9bbeb2f8a16a1e153801708d7bea692776442bf43576f1921b"
dependencies = [
"ahash",
"dashmap",
"dashmap 4.0.2",
"indexmap",
"once_cell",
"rayon",
@ -2157,9 +2178,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_proposal"
version = "0.82.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41bca77e95bdebfd9df234e707416bd57015808371010f5f1527314df86fc1e7"
checksum = "3cb5290bb79e3112c2124167c3b4a6e1225afcd576fd769912ed691f5bf46029"
dependencies = [
"either",
"serde",
@ -2176,13 +2197,13 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_react"
version = "0.86.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb79114c706cad8b83bee288cdfd55156558c74075059bc58558ab84275c3ba1"
checksum = "6b618bfc4d3a99df1081bfe0b833d14572ab36dd2c245d1ab51c581b2d74b843"
dependencies = [
"ahash",
"base64 0.13.0",
"dashmap",
"dashmap 4.0.2",
"indexmap",
"once_cell",
"regex",
@ -2201,9 +2222,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_testing"
version = "0.65.0"
version = "0.68.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d3bf6537f7fac515dd1bb9f718b3af2c2413aad315704bdbb8b8ebd11b8a0a2"
checksum = "9c1f27182dcd914db8705424b0c6d32bc1198a49f4a551c13fdf7c9025769286"
dependencies = [
"ansi_term",
"anyhow",
@ -2224,9 +2245,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_typescript"
version = "0.89.2"
version = "0.95.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e5d6a8cd797383193a8138615a3f78de5da910fdd9b3f3543f02bcced603008"
checksum = "6b126d9e2545e975d2ae09277c2f16bb682b0111f03e643e3b59e56831a7f6b4"
dependencies = [
"serde",
"swc_atoms",
@ -2240,9 +2261,9 @@ dependencies = [
[[package]]
name = "swc_ecma_utils"
version = "0.69.0"
version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b289ad92ab2c2b5c55c7b2a8e3395b68b42a8145186549191786af5d44998d3"
checksum = "ee41829a14f59d6f93a5f5721f08797b214caa4d037913b51ab61a9d31e10576"
dependencies = [
"indexmap",
"once_cell",
@ -2256,9 +2277,9 @@ dependencies = [
[[package]]
name = "swc_ecma_visit"
version = "0.54.0"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "768c7cb86162cb2538a188586909b5499740da73b2eb80b258210cf147652c84"
checksum = "b359c0ddd3f474dcc379d3c011670be3b855229bcb523e6571897c5beae42957"
dependencies = [
"num-bigint",
"swc_atoms",
@ -2270,9 +2291,21 @@ dependencies = [
[[package]]
name = "swc_ecmascript"
version = "0.123.0"
version = "0.129.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "643e8b16370a73258bfb162a1b1bf27888b4ed65d05c3962083fed7cae26bf6d"
checksum = "471e05cfdcafc429376d7d2fd8b8e043e4a007945b87d445fbdb2d6f742df194"
dependencies = [
"swc_ecma_ast",
"swc_ecma_parser",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecmascript"
version = "0.130.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cde3469465d772bf49b29b735e2f1cd0f1124064b15fd8ccfa0ab4ab75fab997"
dependencies = [
"swc_ecma_ast",
"swc_ecma_codegen",
@ -2348,15 +2381,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb940728fcaa85b619ae43c23110a2e88c1cd90e9a873bebb0f9f80e5ecd7e6"
dependencies = [
"ahash",
"dashmap",
"dashmap 4.0.2",
"swc_common",
]
[[package]]
name = "swc_stylis"
version = "0.90.0"
version = "0.94.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b453e3b964b9aaa96b81ff04c2a38ae64d2b1c55bd0a88b3f9fc478f6a61a1fe"
checksum = "1986382e96dc65958c447e795657d0d87594d93085505ff80943d53e7cfb5369"
dependencies = [
"swc_atoms",
"swc_common",
@ -2533,9 +2566,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tracing"
version = "0.1.31"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6c650a8ef0cd2dd93736f033d21cbd1224c5a967aa0c258d00fcf7dafef9b9f"
checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f"
dependencies = [
"cfg-if 1.0.0",
"pin-project-lite",
@ -2545,9 +2578,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
version = "0.1.19"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8276d9a4a3a558d7b7ad5303ad50b53d58264641b82914b7ada36bd762e7a716"
checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b"
dependencies = [
"proc-macro2",
"quote",
@ -2611,6 +2644,12 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
[[package]]
name = "unicode-id"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4285d92be83dfbc8950a2601178b89ed36f979ebf51bfcf7b272b17001184e6c"
[[package]]
name = "unicode-normalization"
version = "0.1.19"
@ -2708,7 +2747,7 @@ dependencies = [
"serde_json",
"swc",
"swc_common",
"swc_ecmascript",
"swc_ecmascript 0.130.0",
"tracing",
"wasm-bindgen",
"wasm-bindgen-futures",

View file

@ -15,19 +15,19 @@ fxhash = "0.2.1"
pathdiff = "0.2.0"
serde = "1"
serde_json = "1"
styled_components = "0.17.0"
swc = "0.138.0"
styled_components = "0.18.0"
swc = "0.146.0"
swc_atoms = "0.2.7"
swc_common = { version = "0.17.9", features = ["concurrent", "sourcemap"] }
swc_css = "0.94.0"
swc_ecma_loader = { version = "0.28.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.123.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_common = { version = "0.17.11", features = ["concurrent", "sourcemap"] }
swc_css = "0.98.0"
swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.130.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_node_base = "0.5.1"
swc_stylis = "0.90.0"
swc_stylis = "0.94.3"
tracing = {version = "0.1.28", features = ["release_max_level_off"]}
regex = "1.5"
[dev-dependencies]
swc_ecma_transforms_testing = "0.65.0"
swc_ecma_transforms_testing = "0.68.0"
testing = "0.18.1"
walkdir = "2.3.2"

View file

@ -39,11 +39,9 @@ use swc::config::ModuleConfig;
use swc_common::{self, chain, pass::Optional};
use swc_common::{SourceFile, SourceMap};
use swc_ecmascript::ast::EsVersion;
use swc_ecmascript::parser::parse_file_as_module;
use swc_ecmascript::transforms::pass::noop;
use swc_ecmascript::{
parser::{lexer::Lexer, Parser, StringInput},
visit::Fold,
};
use swc_ecmascript::visit::Fold;
pub mod amp_attributes;
mod auto_cjs;
@ -178,9 +176,8 @@ impl TransformOptions {
self.swc.config.module.is_none() && fm.src.contains("module.exports") && {
let syntax = self.swc.config.jsc.syntax.unwrap_or_default();
let target = self.swc.config.jsc.target.unwrap_or_else(EsVersion::latest);
let lexer = Lexer::new(syntax, target, StringInput::from(&*fm), None);
let mut p = Parser::new_from(lexer);
p.parse_module()
parse_file_as_module(fm, syntax, target, None, &mut vec![])
.map(|m| contains_cjs(&m))
.unwrap_or_default()
};

View file

@ -1,6 +1,7 @@
import _JSXStyle from "styled-jsx/style";
import styles from "./styles";
const styles2 = require("./styles2");
// external only
export const Test1 = ()=><div className={`jsx-${styles2.__hash} jsx-${styles.__hash}`}>
<p className={`jsx-${styles2.__hash} jsx-${styles.__hash}`}>external only</p>
@ -11,6 +12,7 @@ export const Test1 = ()=><div className={`jsx-${styles2.__hash} jsx-${styles.__h
</div>
;
// external and static
export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles.__hash}`}>
<p className={"jsx-81a68341e430a972 " + `jsx-${styles.__hash}`}>external and static</p>
@ -21,6 +23,7 @@ export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles
</div>
;
// external and dynamic
export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[
"332b21af86b0ec6",
@ -47,6 +50,7 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " "
</div>
;
// external, static and dynamic
export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"ec8f36d08fa7aa2c",
@ -75,6 +79,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js
</div>
;
// static only
export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}>
<p className={"jsx-df0159ebd3f9fb6f"}>static only</p>
@ -85,6 +90,7 @@ export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}>
</div>
;
// static and dynamic
export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"ec8f36d08fa7aa2c",
@ -111,6 +117,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
</div>
;
// dynamic only
export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
[
"332b21af86b0ec6",
@ -135,6 +142,7 @@ export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
</div>
;
// dynamic with scoped compound variable
export const Test8 = ({ color })=>{
if (color) {
const innerProps = {
@ -165,6 +173,7 @@ export const Test8 = ({ color })=>{
</div>;
}
};
// dynamic with compound variable
export const Test9 = ({ color })=>{
const innerProps = {
color
@ -194,6 +203,7 @@ export const Test9 = ({ color })=>{
</div>;
};
const foo = "red";
// dynamic with constant variable
export const Test10 = ()=><div className={"jsx-64eb0b4e09da0dd3"}>
<p className={"jsx-64eb0b4e09da0dd3"}>dynamic with constant variable</p>
@ -202,6 +212,7 @@ export const Test10 = ()=><div className={"jsx-64eb0b4e09da0dd3"}>
</div>
;
// dynamic with complex scope
export const Test11 = ({ color })=>{
const items = Array.from({
length: 5

View file

@ -1,5 +1,5 @@
import _JSXStyle from "styled-jsx/style";
function NavigationItem({ active , className }) {
function NavigationItem({ active , className , }) {
return <span className={"jsx-2342aae4628612c6" + " " + (cn({
active
}, className, "navigation-item") || "")}>

View file

@ -75,9 +75,9 @@ export default (({ display })=><div className={"jsx-1ada4ad4dab7822f " + _JSXSt
<_JSXStyle id={"4e4be2da62837c76"}>{`@media(min-width:${mediumScreen}){p.jsx-1ada4ad4dab7822f{color:green}p.jsx-1ada4ad4dab7822f{color:${`red`}}}p.jsx-1ada4ad4dab7822f{color:red}`}</_JSXStyle>
<_JSXStyle id={"27040f0829fb73d4"}>{`p.jsx-1ada4ad4dab7822f{-webkit-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"27040f0829fb73d4"}>{`p.jsx-1ada4ad4dab7822f{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"3e72d735e703a530"}>{`p.jsx-1ada4ad4dab7822f{-webkit-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-1ada4ad4dab7822f{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"3e72d735e703a530"}>{`p.jsx-1ada4ad4dab7822f{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-1ada4ad4dab7822f{background:${color}}`}</_JSXStyle>

View file

@ -1,7 +1,7 @@
import _JSXStyle from "styled-jsx/style";
const Test = ()=><div className={"jsx-d47d6adadf14e957"}>
<_JSXStyle id={"d47d6adadf14e957"}>{"body{color:red}:hover{color:red;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-animation:foo 1s ease-out;animation:foo 1s ease-out}div a{display:none}[data-test]>div{color:red}"}</_JSXStyle>
<_JSXStyle id={"d47d6adadf14e957"}>{"body{color:red}:hover{color:red;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-animation:foo 1s ease-out;-moz-animation:foo 1s ease-out;-o-animation:foo 1s ease-out;animation:foo 1s ease-out}div a{display:none}[data-test]>div{color:red}"}</_JSXStyle>
</div>
;

View file

@ -1,5 +1,5 @@
import _JSXStyle from "styled-jsx/style";
export const Red = ({ Component ="button" })=>{
export const Red = ({ Component ="button" , })=>{
return <Component className={_JSXStyle.dynamic([
[
"ca900d186ad0e495",

View file

@ -3,7 +3,7 @@ export default (()=><div className={"jsx-713499aa363d6373"}>
<p className={"jsx-713499aa363d6373"}>test</p>
<_JSXStyle id={"713499aa363d6373"}>{"p.jsx-713499aa363d6373 a.jsx-713499aa363d6373 span.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373 span{background:blue}p.jsx-713499aa363d6373 a[title=\"'w ' ' t'\"].jsx-713499aa363d6373{margin:auto}p.jsx-713499aa363d6373 span:not(.test){color:green}p.jsx-713499aa363d6373,h1.jsx-713499aa363d6373{color:blue;-webkit-animation:hahaha 3s ease forwards infinite;animation:hahaha 3s ease forwards infinite;-webkit-animation-name:hahaha;animation-name:hahaha;animation-delay:100ms}p.jsx-713499aa363d6373{-webkit-animation:hahaha 1s,hehehe 2s;animation:hahaha 1s,hehehe 2s}p.jsx-713499aa363d6373:hover{color:red}p.jsx-713499aa363d6373::before{color:red}.jsx-713499aa363d6373:hover{color:red}.jsx-713499aa363d6373::before{color:red}.jsx-713499aa363d6373:hover p.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373+a.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373~a.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373>a.jsx-713499aa363d6373{color:red}@keyframes hahaha{from{top:0}to{top:100}}@keyframes hehehe{from{left:0}to{left:100}}@media(min-width:500px){.test.jsx-713499aa363d6373{color:red}}.test.jsx-713499aa363d6373{display:block}.inline-flex.jsx-713499aa363d6373{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex}.flex.jsx-713499aa363d6373{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.test.jsx-713499aa363d6373{box-shadow:0 0 10px black,inset 0 0 5px black}.test[title=\",\"].jsx-713499aa363d6373{display:inline-block}.test.is-status.jsx-713499aa363d6373 .test.jsx-713499aa363d6373{color:red}.a-selector.jsx-713499aa363d6373:hover,.a-selector.jsx-713499aa363d6373:focus{outline:none}"}</_JSXStyle>
<_JSXStyle id={"713499aa363d6373"}>{"p.jsx-713499aa363d6373 a.jsx-713499aa363d6373 span.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373 span{background:blue}p.jsx-713499aa363d6373 a[title=\"'w ' ' t'\"].jsx-713499aa363d6373{margin:auto}p.jsx-713499aa363d6373 span:not(.test){color:green}p.jsx-713499aa363d6373,h1.jsx-713499aa363d6373{color:blue;-webkit-animation:hahaha 3s ease forwards infinite;-moz-animation:hahaha 3s ease forwards infinite;-o-animation:hahaha 3s ease forwards infinite;animation:hahaha 3s ease forwards infinite;-webkit-animation-name:hahaha;-moz-animation-name:hahaha;-o-animation-name:hahaha;animation-name:hahaha;-webkit-animation-delay:100ms;-moz-animation-delay:100ms;-o-animation-delay:100ms;animation-delay:100ms}p.jsx-713499aa363d6373{-webkit-animation:hahaha 1s,hehehe 2s;-moz-animation:hahaha 1s,hehehe 2s;-o-animation:hahaha 1s,hehehe 2s;animation:hahaha 1s,hehehe 2s}p.jsx-713499aa363d6373:hover{color:red}p.jsx-713499aa363d6373::before{color:red}.jsx-713499aa363d6373:hover{color:red}.jsx-713499aa363d6373::before{color:red}.jsx-713499aa363d6373:hover p.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373+a.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373~a.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373>a.jsx-713499aa363d6373{color:red}@keyframes hahaha{from{top:0}to{top:100}}@keyframes hehehe{from{left:0}to{left:100}}@media(min-width:500px){.test.jsx-713499aa363d6373{color:red}}.test.jsx-713499aa363d6373{display:block}.inline-flex.jsx-713499aa363d6373{display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex}.flex.jsx-713499aa363d6373{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.test.jsx-713499aa363d6373{box-shadow:0 0 10px black,inset 0 0 5px black}.test[title=\",\"].jsx-713499aa363d6373{display:inline-block}.test.is-status.jsx-713499aa363d6373 .test.jsx-713499aa363d6373{color:red}.a-selector.jsx-713499aa363d6373:hover,.a-selector.jsx-713499aa363d6373:focus{outline:none}"}</_JSXStyle>
</div>
);

View file

@ -3,7 +3,7 @@ export default (()=><div className={"jsx-768337a97aceabd1"}>
<p className={"jsx-768337a97aceabd1"}>test</p>
<_JSXStyle id={"768337a97aceabd1"}>{"html.jsx-768337a97aceabd1{background-image:linear-gradient(0deg,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg)}p{color:blue}p{color:blue}p,a.jsx-768337a97aceabd1{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Helvetica,Arial,sans-serif}p.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1{color:red}*.jsx-768337a97aceabd1{color:blue}[href=\"woot\"].jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1 a.jsx-768337a97aceabd1 span.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1 span{background:blue}p.jsx-768337a97aceabd1 a[title=\"'w ' ' t'\"].jsx-768337a97aceabd1{margin:auto}p.jsx-768337a97aceabd1 span:not(.test){color:green}p.jsx-768337a97aceabd1,h1.jsx-768337a97aceabd1{color:blue;-webkit-animation:hahaha 3s ease forwards infinite;animation:hahaha 3s ease forwards infinite;-webkit-animation-name:hahaha;animation-name:hahaha;animation-delay:100ms}p.jsx-768337a97aceabd1{-webkit-animation:hahaha 1s,hehehe 2s;animation:hahaha 1s,hehehe 2s}p.jsx-768337a97aceabd1:hover{color:red}p.jsx-768337a97aceabd1::before{color:red}.jsx-768337a97aceabd1:hover{color:red}.jsx-768337a97aceabd1::before{color:red}.jsx-768337a97aceabd1:hover p.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1+a.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1~a.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1>a.jsx-768337a97aceabd1{color:red}@keyframes hahaha{from{top:0}to{top:100}}@keyframes hehehe{from{left:0}to{left:100}}@media(min-width:500px){.test.jsx-768337a97aceabd1{color:red}}.test.jsx-768337a97aceabd1{display:block}.inline-flex.jsx-768337a97aceabd1{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex}.flex.jsx-768337a97aceabd1{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.test.jsx-768337a97aceabd1{box-shadow:0 0 10px black,inset 0 0 5px black}.test[title=\",\"].jsx-768337a97aceabd1{display:inline-block}.test.is-status.jsx-768337a97aceabd1 .test.jsx-768337a97aceabd1{color:red}.a-selector.jsx-768337a97aceabd1:hover,.a-selector.jsx-768337a97aceabd1:focus{outline:none}@media(min-width:1px)and (max-width:768px){[class*=\"grid__col--\"].jsx-768337a97aceabd1{margin-top:12px;margin-bottom:12px}}@media(max-width:64em){.test.jsx-768337a97aceabd1{margin-bottom:1em}@supports(-moz-appearance:none)and (display:contents){.test.jsx-768337a97aceabd1{margin-bottom:2rem}}}"}</_JSXStyle>
<_JSXStyle id={"768337a97aceabd1"}>{"html.jsx-768337a97aceabd1{background-image:linear-gradient(0deg,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg)}p{color:blue}p{color:blue}p,a.jsx-768337a97aceabd1{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Helvetica,Arial,sans-serif}p.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1{color:red}*.jsx-768337a97aceabd1{color:blue}[href=\"woot\"].jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1 a.jsx-768337a97aceabd1 span.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1 span{background:blue}p.jsx-768337a97aceabd1 a[title=\"'w ' ' t'\"].jsx-768337a97aceabd1{margin:auto}p.jsx-768337a97aceabd1 span:not(.test){color:green}p.jsx-768337a97aceabd1,h1.jsx-768337a97aceabd1{color:blue;-webkit-animation:hahaha 3s ease forwards infinite;-moz-animation:hahaha 3s ease forwards infinite;-o-animation:hahaha 3s ease forwards infinite;animation:hahaha 3s ease forwards infinite;-webkit-animation-name:hahaha;-moz-animation-name:hahaha;-o-animation-name:hahaha;animation-name:hahaha;-webkit-animation-delay:100ms;-moz-animation-delay:100ms;-o-animation-delay:100ms;animation-delay:100ms}p.jsx-768337a97aceabd1{-webkit-animation:hahaha 1s,hehehe 2s;-moz-animation:hahaha 1s,hehehe 2s;-o-animation:hahaha 1s,hehehe 2s;animation:hahaha 1s,hehehe 2s}p.jsx-768337a97aceabd1:hover{color:red}p.jsx-768337a97aceabd1::before{color:red}.jsx-768337a97aceabd1:hover{color:red}.jsx-768337a97aceabd1::before{color:red}.jsx-768337a97aceabd1:hover p.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1+a.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1~a.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1>a.jsx-768337a97aceabd1{color:red}@keyframes hahaha{from{top:0}to{top:100}}@keyframes hehehe{from{left:0}to{left:100}}@media(min-width:500px){.test.jsx-768337a97aceabd1{color:red}}.test.jsx-768337a97aceabd1{display:block}.inline-flex.jsx-768337a97aceabd1{display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex}.flex.jsx-768337a97aceabd1{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.test.jsx-768337a97aceabd1{box-shadow:0 0 10px black,inset 0 0 5px black}.test[title=\",\"].jsx-768337a97aceabd1{display:inline-block}.test.is-status.jsx-768337a97aceabd1 .test.jsx-768337a97aceabd1{color:red}.a-selector.jsx-768337a97aceabd1:hover,.a-selector.jsx-768337a97aceabd1:focus{outline:none}@media(min-width:1px)and (max-width:768px){[class*=\"grid__col--\"].jsx-768337a97aceabd1{margin-top:12px;margin-bottom:12px}}@media(max-width:64em){.test.jsx-768337a97aceabd1{margin-bottom:1em}@supports(-moz-appearance:none)and (display:contents){.test.jsx-768337a97aceabd1{margin-bottom:2rem}}}"}</_JSXStyle>
</div>
);

View file

@ -2,7 +2,7 @@ import _JSXStyle from "styled-jsx/style";
export default function Foo() {
return(/*#__PURE__*/ React.createElement("div", {
render: function(v) {
/*#__PURE__*/ return(React.createElement("form", {
return(/*#__PURE__*/ React.createElement("form", {
className: "jsx-eb368961fd3b0a99"
}));
},

View file

@ -16,12 +16,12 @@ once_cell = "1.8.0"
serde = "1"
serde_json = "1"
next-swc = { version = "0.0.0", path = "../core" }
swc = "0.138.0"
swc = "0.146.0"
swc_atoms = "0.2.7"
swc_bundler = { version = "0.114.0", features = ["concurrent"] }
swc_common = { version = "0.17.9", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.28.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.123.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_bundler = { version = "0.120.0", features = ["concurrent"] }
swc_common = { version = "0.17.11", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.130.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_node_base = "0.5.1"
[build-dependencies]

View file

@ -7,10 +7,7 @@ use napi::{CallContext, JsObject, Task};
use once_cell::sync::Lazy;
use serde::Deserialize;
use std::{collections::HashMap, path::PathBuf, sync::Arc};
use swc::{
config::{util::BoolOrObject, SourceMapsConfig},
try_with_handler, TransformOutput,
};
use swc::{config::SourceMapsConfig, try_with_handler, TransformOutput};
use swc_atoms::JsWord;
use swc_bundler::{Bundler, ModuleData, ModuleRecord};
use swc_common::{collections::AHashMap, errors::Handler, BytePos, FileName, SourceMap, Span};
@ -62,6 +59,7 @@ impl Task for BundleTask {
.map(JsWord::from)
.collect::<Vec<_>>();
let comments = self.c.comments().clone();
//
let mut bundler = Bundler::new(
self.c.globals(),
@ -114,7 +112,7 @@ impl Task for BundleTask {
&source_map_names,
None,
false,
Some(BoolOrObject::Bool(true)),
Some(&comments),
)?;
Ok(code)

View file

@ -3,7 +3,7 @@ use anyhow::Context as _;
use napi::{CallContext, Either, Env, JsObject, JsString, JsUndefined, Task};
use std::sync::Arc;
use swc::{config::ParseOptions, try_with_handler};
use swc_common::{FileName, FilePathMapping, SourceMap};
use swc_common::{comments::Comments, FileName, FilePathMapping, SourceMap};
pub struct ParseTask {
pub filename: FileName,
@ -23,6 +23,12 @@ impl Task for ParseTask {
let c = swc::Compiler::new(Arc::new(SourceMap::new(FilePathMapping::empty())));
let options: ParseOptions = deserialize_json(&self.options).convert_err()?;
let comments = c.comments().clone();
let comments: Option<&dyn Comments> = if options.comments {
Some(&comments)
} else {
None
};
let fm =
c.cm.new_source_file(self.filename.clone(), self.src.clone());
let program = try_with_handler(c.cm.clone(), false, |handler| {
@ -32,7 +38,7 @@ impl Task for ParseTask {
options.target,
options.syntax,
options.is_module,
options.comments,
comments,
)
})
.convert_err()?;

View file

@ -16,9 +16,9 @@ path-clean = "0.1"
serde = {version = "1", features = ["derive"]}
serde_json = "1"
next-swc = { version = "0.0.0", path = "../core" }
swc = "0.138.0"
swc_common = { version = "0.17.9", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.123.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc = "0.146.0"
swc_common = { version = "0.17.11", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.130.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
tracing = {version = "0.1.28", features = ["release_max_level_off"]}
wasm-bindgen = {version = "0.2", features = ["serde-serialize"]}
wasm-bindgen-futures = "0.4.8"