feat(next-swc): Update swc (#39055)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
This commit is contained in:
Donny/강동윤 2022-07-29 01:04:02 +09:00 committed by GitHub
parent 377fddfaa9
commit 4eac75bbc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 576 additions and 393 deletions

View file

@ -248,9 +248,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]]
name = "bytecheck"
version = "0.6.8"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a31f923c2db9513e4298b72df143e6e655a759b3d6a0966df18f81223fff54f"
checksum = "d11cac2c12b5adc6570dad2ee1b87eff4955dac476fe12d81e5fdd352e52406f"
dependencies = [
"bytecheck_derive",
"ptr_meta",
@ -258,9 +258,9 @@ dependencies = [
[[package]]
name = "bytecheck_derive"
version = "0.6.8"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb17c862a905d912174daa27ae002326fff56dc8b8ada50a0a5f0976cb174f0"
checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf"
dependencies = [
"proc-macro2",
"quote",
@ -1475,7 +1475,7 @@ dependencies = [
[[package]]
name = "modularize_imports"
version = "0.11.0"
version = "0.14.0"
dependencies = [
"handlebars",
"once_cell",
@ -1483,7 +1483,7 @@ dependencies = [
"serde",
"swc_cached",
"swc_ecma_transforms_testing",
"swc_ecmascript 0.180.0",
"swc_ecmascript",
"testing",
]
@ -1574,7 +1574,7 @@ dependencies = [
"swc_common",
"swc_ecma_loader",
"swc_ecma_transforms_testing",
"swc_ecmascript 0.180.0",
"swc_ecmascript",
"swc_emotion",
"swc_plugin_runner",
"testing",
@ -1604,7 +1604,7 @@ dependencies = [
"swc_bundler",
"swc_common",
"swc_ecma_loader",
"swc_ecmascript 0.180.0",
"swc_ecmascript",
"swc_node_base",
"swc_plugin_runner",
"tracing",
@ -2892,7 +2892,7 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "styled_components"
version = "0.36.0"
version = "0.39.0"
dependencies = [
"Inflector",
"once_cell",
@ -2902,21 +2902,21 @@ dependencies = [
"swc_atoms",
"swc_common",
"swc_ecma_transforms_testing",
"swc_ecmascript 0.180.0",
"swc_ecmascript",
"testing",
"tracing",
]
[[package]]
name = "styled_jsx"
version = "0.11.0"
version = "0.14.0"
dependencies = [
"easy-error",
"swc_common",
"swc_css",
"swc_css_prefixer",
"swc_ecma_transforms_testing",
"swc_ecmascript 0.180.0",
"swc_ecmascript",
"testing",
"tracing",
]
@ -2957,9 +2957,9 @@ dependencies = [
[[package]]
name = "swc"
version = "0.205.0"
version = "0.212.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4195b25dda45f4e2baf7cecab6455bada2fbccc8884e377ebf75cb7da591f976"
checksum = "6860819497adc7ffbda33061e0d6a36672212c6e623257927a088aa74116490a"
dependencies = [
"ahash",
"anyhow",
@ -2986,16 +2986,16 @@ dependencies = [
"swc_ecma_ext_transforms",
"swc_ecma_lints",
"swc_ecma_loader",
"swc_ecma_minifier 0.135.0",
"swc_ecma_minifier",
"swc_ecma_parser",
"swc_ecma_preset_env",
"swc_ecma_transforms 0.174.0",
"swc_ecma_transforms",
"swc_ecma_transforms_base",
"swc_ecma_transforms_compat",
"swc_ecma_transforms_optimization 0.143.0",
"swc_ecma_transforms_optimization",
"swc_ecma_utils",
"swc_ecma_visit",
"swc_ecmascript 0.179.0",
"swc_ecmascript",
"swc_error_reporters",
"swc_node_comments",
"swc_plugin_proxy",
@ -3007,9 +3007,9 @@ dependencies = [
[[package]]
name = "swc_atoms"
version = "0.2.13"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d99c0ac33707dd1162a3665d6ca1a28b2f6594e9c37c4703e417fc5e1ce532e"
checksum = "66e252fe697709a0fc8710b5b9dee2d72fd9852d3f5fd1a057ce808b6987ccba"
dependencies = [
"bytecheck",
"once_cell",
@ -3022,9 +3022,9 @@ dependencies = [
[[package]]
name = "swc_bundler"
version = "0.169.0"
version = "0.175.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fd675a730040ce147232e7021aebebfbe16098079824763578cd6b597632ccc"
checksum = "181676693d25b6e1b3992f1a13cf4e5bca78bf5482d4f2ee7333796dd9ca21b2"
dependencies = [
"ahash",
"anyhow",
@ -3046,7 +3046,7 @@ dependencies = [
"swc_ecma_loader",
"swc_ecma_parser",
"swc_ecma_transforms_base",
"swc_ecma_transforms_optimization 0.144.0",
"swc_ecma_transforms_optimization",
"swc_ecma_utils",
"swc_ecma_visit",
"swc_fast_graph",
@ -3056,9 +3056,9 @@ dependencies = [
[[package]]
name = "swc_cached"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84fed4a980e12c737171a7b17c5e0a2f4272899266fa0632ea4e31264ebdfdb5"
checksum = "91448e2c3ee24c65d51c0956b62f94420c9d19e7fa9e990010072d5e05a81a51"
dependencies = [
"ahash",
"anyhow",
@ -3071,9 +3071,9 @@ dependencies = [
[[package]]
name = "swc_common"
version = "0.23.0"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68e76a324fa0d7240e790c78914f39fdecfa9d87ef4efed591124b58607a4a4a"
checksum = "f7b3ce2fcc4e51ffb3e0556f04bf50e6cdeaaab9b019282f68acb2311c4b75f8"
dependencies = [
"ahash",
"anyhow",
@ -3131,9 +3131,9 @@ dependencies = [
[[package]]
name = "swc_css"
version = "0.111.0"
version = "0.116.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "846d9d0f8f7c0850d771a6ad59cb71812d2bbbf36d0e6f5fed1fc95bed1a2943"
checksum = "d3aeaff3b0bc11139757bf67bf3bb1afacec05ee58d5b316f1d957b3a78db452"
dependencies = [
"swc_css_ast",
"swc_css_codegen",
@ -3144,9 +3144,9 @@ dependencies = [
[[package]]
name = "swc_css_ast"
version = "0.98.0"
version = "0.103.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc70b5ccb766255af46b6891062ab919d32a891bc5169ba638998ef7495b24a5"
checksum = "543026fef8a5f4147d944072eac313f5dd4633086a3b26b2e2b1f08384d369bd"
dependencies = [
"is-macro",
"serde",
@ -3157,12 +3157,14 @@ dependencies = [
[[package]]
name = "swc_css_codegen"
version = "0.108.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56840a824cd5f23766657b4f3140d06cf3c3925b5d9218b5b12b3667ba5d069f"
checksum = "a932c9750eed830a0e4c8b64a8e084c0adfc23356846e8fcc66a302bf3ead27e"
dependencies = [
"auto_impl",
"bitflags",
"rustc-hash",
"serde",
"swc_atoms",
"swc_common",
"swc_css_ast",
@ -3184,12 +3186,13 @@ dependencies = [
[[package]]
name = "swc_css_parser"
version = "0.107.0"
version = "0.112.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55c03bfad51ae4d97888deafad14108cc195620e54d562ce86bbc7765e1fa86d"
checksum = "d36dc5fba19a61d395cddb6fe2f9736f1a192c45fbced6f37c6a3ad3593db0b8"
dependencies = [
"bitflags",
"lexical",
"serde",
"swc_atoms",
"swc_common",
"swc_css_ast",
@ -3197,10 +3200,14 @@ dependencies = [
[[package]]
name = "swc_css_prefixer"
version = "0.107.0"
version = "0.113.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f352e03d4b39cdd201a6a48360cd4c71b830987f3e573fbf26879f4253a65ea"
checksum = "3393413633e283959aad05d8943c896729cc0d9cf31a37b213460748d1eff4c4"
dependencies = [
"once_cell",
"preset_env_base",
"serde",
"serde_json",
"swc_atoms",
"swc_common",
"swc_css_ast",
@ -3210,9 +3217,9 @@ dependencies = [
[[package]]
name = "swc_css_utils"
version = "0.95.0"
version = "0.100.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e85a0dc84117c44f4e14f015c527a04ce97bfbd009404a02c732023afea65b5a"
checksum = "b3625a87b24e56d84fa87d993d560fb68867d07c2ded754c45135f4cd02dbdd4"
dependencies = [
"once_cell",
"serde",
@ -3225,10 +3232,11 @@ dependencies = [
[[package]]
name = "swc_css_visit"
version = "0.97.0"
version = "0.102.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8320cb496efeb4c8409ae85e808a2256043464e2d592e7a77f2abafb62eb13d"
checksum = "99f41381173f2371013e79304dadfd42c1b90f5bbc05129e85314a301890cc93"
dependencies = [
"serde",
"swc_atoms",
"swc_common",
"swc_css_ast",
@ -3237,9 +3245,9 @@ dependencies = [
[[package]]
name = "swc_ecma_ast"
version = "0.84.0"
version = "0.89.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cce1fb31e3a100feb31f94647fe27e457bc13b17a8931204fdc9bc58a15c936a"
checksum = "dce996d6d808785508fd33c252de3fa403cb1c7dd8716898d65eabeb7bfe341f"
dependencies = [
"bitflags",
"bytecheck",
@ -3256,14 +3264,15 @@ dependencies = [
[[package]]
name = "swc_ecma_codegen"
version = "0.115.0"
version = "0.120.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d09abf1639f76d3d174225fdb608805f9c21d4c455f4dd2ef6ab156701f1f82a"
checksum = "7a1b0c1a7325b011e2873de47dc862a805d39b975efa117a9f6c196e30a0d99b"
dependencies = [
"memchr",
"num-bigint",
"once_cell",
"rustc-hash",
"serde",
"sourcemap",
"swc_atoms",
"swc_common",
@ -3287,9 +3296,9 @@ dependencies = [
[[package]]
name = "swc_ecma_ext_transforms"
version = "0.79.0"
version = "0.84.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54352547664f85f8c418adadfecf9292459f77b442e41b162c4415421b01273b"
checksum = "8a2d13bef6e69fe871b780cc44dc6802bb098d6503b1e9873c04e8baec6e87a0"
dependencies = [
"phf",
"swc_atoms",
@ -3301,9 +3310,9 @@ dependencies = [
[[package]]
name = "swc_ecma_lints"
version = "0.52.0"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34303f7c81d31629d504c01481ad5241edc5198d3f3e340e59b17b10ff489594"
checksum = "eb20430ce0773f680eaa758317298ad927587bb3c204a0921aa4ddabee2fe9f4"
dependencies = [
"ahash",
"auto_impl",
@ -3322,9 +3331,9 @@ dependencies = [
[[package]]
name = "swc_ecma_loader"
version = "0.35.0"
version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "710c86eb2b253160d4a02fa77057f1c493b3932d1b83430cbbc1e7823eb47e8c"
checksum = "ca95a8ebe9f6f815c35002523f0157367fec9856dcec868c7d3e27c3142954e9"
dependencies = [
"ahash",
"anyhow",
@ -3344,13 +3353,14 @@ dependencies = [
[[package]]
name = "swc_ecma_minifier"
version = "0.135.0"
version = "0.142.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "674790b5bd78c092542be60627c506632ea1fdea300e13b36ec71ae86be00b95"
checksum = "69c6129d9b01595218fe0a132ca8982ff87999736b4a2b1ab802900368f3da4f"
dependencies = [
"ahash",
"arrayvec",
"indexmap",
"num-bigint",
"num_cpus",
"once_cell",
"parking_lot",
@ -3368,41 +3378,7 @@ dependencies = [
"swc_ecma_codegen",
"swc_ecma_parser",
"swc_ecma_transforms_base",
"swc_ecma_transforms_optimization 0.143.0",
"swc_ecma_utils",
"swc_ecma_visit",
"swc_timer",
"tracing",
"unicode-id",
]
[[package]]
name = "swc_ecma_minifier"
version = "0.136.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13d66a95e4d19a742f38db0907b55eeb0e89928b345eb5186fae5a9f66370a0e"
dependencies = [
"ahash",
"arrayvec",
"indexmap",
"num_cpus",
"once_cell",
"parking_lot",
"rayon",
"regex",
"retain_mut",
"rustc-hash",
"serde",
"serde_json",
"swc_atoms",
"swc_cached",
"swc_common",
"swc_config",
"swc_ecma_ast",
"swc_ecma_codegen",
"swc_ecma_parser",
"swc_ecma_transforms_base",
"swc_ecma_transforms_optimization 0.144.0",
"swc_ecma_transforms_optimization",
"swc_ecma_utils",
"swc_ecma_visit",
"swc_timer",
@ -3412,9 +3388,9 @@ dependencies = [
[[package]]
name = "swc_ecma_parser"
version = "0.111.0"
version = "0.116.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc1766e5b969c59e51a5dfe9337755d7380a891e579dd6b0eb7816587c7ea7aa"
checksum = "12740be040fa5635ac73bb38fd7340887d6b5f36e0daf4eaec662838398dd4eb"
dependencies = [
"either",
"enum_kind",
@ -3431,9 +3407,9 @@ dependencies = [
[[package]]
name = "swc_ecma_preset_env"
version = "0.149.0"
version = "0.156.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d27c37e693b1deda42bc2f70254234d79d2c10797701f261cbb7797b8f37bb2d"
checksum = "979e15b5b236e4a06da25cbf8b40723a709c45f9d9a70c0460ee7ae5658eec1d"
dependencies = [
"ahash",
"anyhow",
@ -3449,16 +3425,16 @@ dependencies = [
"swc_atoms",
"swc_common",
"swc_ecma_ast",
"swc_ecma_transforms 0.174.0",
"swc_ecma_transforms",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecma_testing"
version = "0.8.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9b7feb84eeec46d1772bcb10c04c2a6e68f504913896d80ac19bfd0ebb45c35"
checksum = "4531ecf7055a35aff99b4c668cd6e02d35e688bdb0c0c80a21805a8f0d25a636"
dependencies = [
"anyhow",
"hex",
@ -3472,9 +3448,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms"
version = "0.174.0"
version = "0.181.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a30f3386dbaa8490ac3ed65240c057ea3a3b20d37c4dba50c876adce5201f673"
checksum = "2d0332a16280d0c0c37745fc85714d878867d490ee6747bfdfdcb6bebe80181f"
dependencies = [
"swc_atoms",
"swc_common",
@ -3482,36 +3458,19 @@ dependencies = [
"swc_ecma_transforms_base",
"swc_ecma_transforms_compat",
"swc_ecma_transforms_module",
"swc_ecma_transforms_optimization 0.143.0",
"swc_ecma_transforms_optimization",
"swc_ecma_transforms_proposal",
"swc_ecma_transforms_react 0.132.0",
"swc_ecma_transforms_typescript 0.136.0",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecma_transforms"
version = "0.175.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6881a9a87fd851c4ee452ab7b305551a23b9a1af429b5b988dbe6709a313d8d5"
dependencies = [
"swc_atoms",
"swc_common",
"swc_ecma_ast",
"swc_ecma_transforms_base",
"swc_ecma_transforms_optimization 0.144.0",
"swc_ecma_transforms_react 0.133.0",
"swc_ecma_transforms_typescript 0.137.0",
"swc_ecma_transforms_react",
"swc_ecma_transforms_typescript",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecma_transforms_base"
version = "0.97.0"
version = "0.102.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66b316a99dde0ef85f1878aaa9f4bf9b15f16e999c56ed31a1433928c754ae4e"
checksum = "4f8438e5cb7da4e6983117294b9d5dc911163ab221e12c8066a7a713a90c5734"
dependencies = [
"better_scoped_tls",
"bitflags",
@ -3533,9 +3492,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_classes"
version = "0.85.0"
version = "0.90.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c853c4366e81092d38b746e71adffc1150c694f02c1068c9fa24abbdc373a65f"
checksum = "f3866400fe3f3959d7992ee5a37117b81def64f05db5e3f69b16ca4427c12ab6"
dependencies = [
"swc_atoms",
"swc_common",
@ -3547,9 +3506,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_compat"
version = "0.114.0"
version = "0.120.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace2890c492568b47abb6eecbbb2dcb8f2218adcf0d8a3b73d84b88fddc7d87f"
checksum = "e96534f3661295f3ffdb64408a1f734c6d653f3ebf832ca0e12bdefae960c564"
dependencies = [
"ahash",
"arrayvec",
@ -3587,9 +3546,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_module"
version = "0.130.1"
version = "0.137.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb92de6bc25bf1f9af2e70b744dae53a21ec2d2fbec8da2b2f67ef14d63e8a36"
checksum = "ad4178bac22920d57cd5734171ab50f30a609731f9a53b6e8c16730e7ff19c7d"
dependencies = [
"Inflector",
"ahash",
@ -3615,32 +3574,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_optimization"
version = "0.143.0"
version = "0.150.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9def3dc7a6afe6b44cacd61c200181507396ee3c21a3751299718fecebce51d"
dependencies = [
"ahash",
"dashmap",
"indexmap",
"once_cell",
"rustc-hash",
"serde_json",
"swc_atoms",
"swc_common",
"swc_ecma_ast",
"swc_ecma_parser",
"swc_ecma_transforms_base",
"swc_ecma_transforms_macros",
"swc_ecma_utils",
"swc_ecma_visit",
"tracing",
]
[[package]]
name = "swc_ecma_transforms_optimization"
version = "0.144.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9413ed145b0c3e693d18760a72c72bb7ac3e522edbb88bfe0c6c161a7b148281"
checksum = "6c0267c4a9f9e7183f0411e1cbd16034dc5598e4ece5110c9a71b3b8565afac8"
dependencies = [
"ahash",
"dashmap",
@ -3661,9 +3597,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_proposal"
version = "0.122.0"
version = "0.128.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ebc6e03a51f9adcbc40ec144c9bbe78de872bf6f8f581f3abd51187ec6e648"
checksum = "5edd3b87166df9cb23d2a393d565b886575f1808245b8791d5b5a1bddf36e4cb"
dependencies = [
"either",
"serde",
@ -3680,35 +3616,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_react"
version = "0.132.0"
version = "0.139.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "438ffd11b17c3c6565e44a9a0d596687459de9f13b9ea302f5baf8e20c07a860"
dependencies = [
"ahash",
"base64 0.13.0",
"dashmap",
"indexmap",
"once_cell",
"regex",
"serde",
"sha-1 0.10.0",
"string_enum",
"swc_atoms",
"swc_common",
"swc_config",
"swc_ecma_ast",
"swc_ecma_parser",
"swc_ecma_transforms_base",
"swc_ecma_transforms_macros",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecma_transforms_react"
version = "0.133.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6b0516e231008722175bc0841bf4f3fdcfd3276ca0bf4878d6e87af5c50f324"
checksum = "bcfba7f0dcf32d4e82c89759bd1ff851e1bfa32493271e93d34ae7fbb583ff4d"
dependencies = [
"ahash",
"base64 0.13.0",
@ -3732,9 +3642,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_testing"
version = "0.99.0"
version = "0.104.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0829603243a7b6c127c110bf752bd59c3bffc118d23ef11498a1c6fb310ef35"
checksum = "b2db2a705493547cce9c2d8b14ab6041409eb995e19604f42c6fa44ef1852ccb"
dependencies = [
"ansi_term",
"anyhow",
@ -3756,41 +3666,25 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_typescript"
version = "0.136.0"
version = "0.143.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d8c061e8ad8a3f47e9d49f85cea3ab1edca0a6585354ea23923d18e75368eb4"
checksum = "fdb5faef5ccddd09093faee514d65f6c24fe6c8ec9da184299f9c9780c4c7308"
dependencies = [
"serde",
"swc_atoms",
"swc_common",
"swc_ecma_ast",
"swc_ecma_transforms_base",
"swc_ecma_transforms_react 0.132.0",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecma_transforms_typescript"
version = "0.137.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6716a73401b5d717d6fd20159385ce09adbdd3afc765c3890859d84ada8af729"
dependencies = [
"serde",
"swc_atoms",
"swc_common",
"swc_ecma_ast",
"swc_ecma_transforms_base",
"swc_ecma_transforms_react 0.133.0",
"swc_ecma_transforms_react",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecma_utils"
version = "0.93.0"
version = "0.98.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70981d5ef10c0ff0a002e21decbca9dde5b40c2fc0d0bc6eaebb219a8e0a5f7d"
checksum = "996ae04dfb093db26874e1fbb82a5194e3cef562737c93b9674bdef539a7fba3"
dependencies = [
"indexmap",
"once_cell",
@ -3804,9 +3698,9 @@ dependencies = [
[[package]]
name = "swc_ecma_visit"
version = "0.70.0"
version = "0.75.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcd081250d664808fcd23110202728811236c87f527656ffc1db7f00ac1a06dd"
checksum = "5e1efa6716523365a6b947388cca7e4b3b59da046fd1d0200efc02bc3395e7f4"
dependencies = [
"num-bigint",
"swc_atoms",
@ -3818,32 +3712,22 @@ dependencies = [
[[package]]
name = "swc_ecmascript"
version = "0.179.0"
version = "0.186.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44e4fa994e933838459cfbfce2913f34b054ff3ecc4988e6f1eb993d7bb1a7ef"
dependencies = [
"swc_ecma_ast",
"swc_ecma_parser",
]
[[package]]
name = "swc_ecmascript"
version = "0.180.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1059b3c228636812089e7a3d662c49d1378c943a75b142a02c93708b9b49c9ec"
checksum = "c96e447b71b8d44d2100c9a07a116c2337e4ed66691e096b7c5fe0a6c72c8ba0"
dependencies = [
"swc_ecma_ast",
"swc_ecma_codegen",
"swc_ecma_minifier 0.136.1",
"swc_ecma_minifier",
"swc_ecma_parser",
"swc_ecma_transforms 0.175.0",
"swc_ecma_transforms",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_emotion"
version = "0.12.0"
version = "0.16.0"
dependencies = [
"base64 0.13.0",
"byteorder",
@ -3852,11 +3736,12 @@ dependencies = [
"radix_fmt",
"regex",
"serde",
"serde_json",
"sourcemap",
"swc_atoms",
"swc_common",
"swc_ecma_transforms_testing",
"swc_ecmascript 0.180.0",
"swc_ecmascript",
"swc_trace_macro",
"testing",
"tracing",
@ -3876,9 +3761,9 @@ dependencies = [
[[package]]
name = "swc_error_reporters"
version = "0.7.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72971d433142768c6364e5a99ba520c70fe61c7fd92492f10a9f2ee513a9cf5b"
checksum = "b592b6f61697db23879762715d9e7699408e07568cae15429e608569aaed4e28"
dependencies = [
"anyhow",
"miette",
@ -3889,9 +3774,9 @@ dependencies = [
[[package]]
name = "swc_fast_graph"
version = "0.11.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9260826bb82481fb946ca653d10196f2653beba1b566b72f42ba7046e4ad0c8f"
checksum = "da66c4b023903dd2eb060f7544bfff04d7a468151fca56762911700c58c20b92"
dependencies = [
"ahash",
"indexmap",
@ -3901,9 +3786,9 @@ dependencies = [
[[package]]
name = "swc_graph_analyzer"
version = "0.12.0"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9b192a3b556cf0a81b4dcb8fa35374d306cd46f806dce937599b40e2d945e51"
checksum = "2c06279ebbfca0cc18be7748bd891e8b3efabfe7863727dd69d678797d8e317d"
dependencies = [
"ahash",
"auto_impl",
@ -3914,9 +3799,9 @@ dependencies = [
[[package]]
name = "swc_macros_common"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5dca3f08d02da4684c3373150f7c045128f81ea00f0c434b1b012bc65a6cce3"
checksum = "a4be988307882648d9bc7c71a6a73322b7520ef0211e920489a98f8391d8caa2"
dependencies = [
"pmutil",
"proc-macro2",
@ -3936,20 +3821,21 @@ dependencies = [
[[package]]
name = "swc_node_comments"
version = "0.10.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ee4d9f6ae1f863eee49b5336190b9292174c81fe76f6b05e673ee7f68aad7d"
checksum = "65544576b5610816f4e3725319d090296362d3ff6bd441f02efe3c4958f5e9e4"
dependencies = [
"ahash",
"dashmap",
"swc_atoms",
"swc_common",
]
[[package]]
name = "swc_plugin_proxy"
version = "0.11.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93b79b1fc945e653bf7d8d37636bb6b26ae335d6f5901647108fae27f88b69e2"
checksum = "74358e4bdd1624ecce3f70274eecd3d87a7bfe4ef840a72e5a6e3f3c7c623bdc"
dependencies = [
"better_scoped_tls",
"bytecheck",
@ -3960,9 +3846,9 @@ dependencies = [
[[package]]
name = "swc_plugin_runner"
version = "0.64.0"
version = "0.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46039074c4e3934754daffddd4883757c8521da643df49b8b7177c00a1b8919d"
checksum = "c909b1dc1dc0121027a1f252e6541c0158ae38218d2d889dbc9d4d0549312da9"
dependencies = [
"anyhow",
"once_cell",
@ -3980,9 +3866,9 @@ dependencies = [
[[package]]
name = "swc_timer"
version = "0.11.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75c07b738c3a6ab390fcb29b60377e33358945879387009097e1d5f504384c08"
checksum = "c47e4765a73706d163039811df0d946b85219585305295b8c44df6987a1093f9"
dependencies = [
"tracing",
]
@ -4000,9 +3886,9 @@ dependencies = [
[[package]]
name = "swc_visit"
version = "0.4.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fafa6c946bdbe601f5511140776d59e82a03f52a5e5039192b4b96f3ca639d88"
checksum = "ce1b826c9d4c0416bbed55d245c853bc1a60da55bf92f8b00dd22b37baf72080"
dependencies = [
"either",
"swc_visit_macros",
@ -4010,9 +3896,9 @@ dependencies = [
[[package]]
name = "swc_visit_macros"
version = "0.4.0"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cad1b8e0b2d48660bc454f70495e9bb583f9bf501f28165568569946e62f44a2"
checksum = "9fda2daf67d99e8bc63d61b12818994863f65b7bcf52d4faab338154c7058546"
dependencies = [
"Inflector",
"pmutil",
@ -4074,9 +3960,9 @@ dependencies = [
[[package]]
name = "testing"
version = "0.25.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdc6de80b7854362068e93c64c6e672257a5cbd1485af8f17b8b2ef98cb63c75"
checksum = "7613b9cfb9d4f348bba45bb9425b5d5ea35165fdb79e131e8cdb5119f13c7fde"
dependencies = [
"ansi_term",
"difference",
@ -4569,7 +4455,7 @@ dependencies = [
"serde_json",
"swc",
"swc_common",
"swc_ecmascript 0.180.0",
"swc_ecmascript",
"swc_plugin_runner",
"tracing",
"wasm-bindgen",

View file

@ -26,18 +26,18 @@ swc_emotion = {path="../emotion"}
styled_components = {path="../styled_components"}
styled_jsx = {path="../styled_jsx"}
modularize_imports = {path="../modularize_imports"}
swc = "0.205.0"
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.35.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", optional = true, default-features = false }
swc_cached = "0.1.1"
swc = "0.212.1"
swc_atoms = "0.3.1"
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap", "plugin_transform_schema_v1"] }
swc_ecma_loader = { version = "0.38.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.70.0", optional = true, default-features = false, features = ["plugin_transform_schema_v1"] }
swc_cached = "0.2.0"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
wasmer = { version = "2.3.0", optional = true, default-features = false }
wasmer-wasi = { version = "2.3.0", optional = true, default-features = false }
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"
walkdir = "2.3.2"

View file

@ -5,7 +5,7 @@ description = "AST Transforms for emotion"
license = "Apache-2.0"
name = "swc_emotion"
repository = "https://github.com/vercel/next.js.git"
version = "0.12.0"
version = "0.16.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -18,12 +18,13 @@ radix_fmt = "1"
regex = "1.5"
serde = "1"
sourcemap = "6.0.1"
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "utils", "visit"] }
swc_atoms = "0.3.1"
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "utils", "visit"] }
swc_trace_macro = "0.1.1"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"
serde_json = "1"

View file

@ -0,0 +1,81 @@
use serde::{Deserialize, Serialize};
use swc_atoms::JsWord;
use swc_common::collections::AHashMap;
use crate::{EmotionModuleConfig, ExportItem};
/// key: `importSource`
pub type ImportMap = AHashMap<JsWord, ImportMapValue>;
/// key: `localExportName`
pub type ImportMapValue = AHashMap<JsWord, Config>;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Config {
canonical_import: ImportItem,
}
/// `(packageName, exportName)`
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ImportItem(JsWord, JsWord);
pub(crate) fn expand_import_map(
map: Option<&ImportMap>,
mut imports: Vec<EmotionModuleConfig>,
) -> Vec<EmotionModuleConfig> {
if let Some(map) = map {
map.iter().for_each(|(import_source, value)| {
value
.iter()
.for_each(|(local_export_name, Config { canonical_import })| {
let ImportItem(package_name, export_name) = canonical_import;
if &*package_name == "@emotion/react" && &*export_name == "jsx" {
return;
}
let package_transformers = imports
.iter()
.find(|v| v.module_name == *package_name)
.unwrap_or_else(|| {
panic!(
"There is no transformer for the export '{}' in '{}'",
export_name, package_name
)
})
.clone();
let kind = package_transformers
.exported_names
.iter()
.find(|v| v.name == **export_name)
.map(|v| v.kind)
.or_else(|| {
if export_name == "default" {
package_transformers.default_export
} else {
None
}
})
.unwrap_or_else(|| {
panic!(
"failed to find export '{}' from package '{}'",
export_name, package_name
)
});
imports.push(EmotionModuleConfig {
module_name: import_source.clone(),
exported_names: vec![ExportItem {
name: local_export_name.to_string(),
kind,
}],
default_export: package_transformers.default_export,
});
})
});
}
imports
}

View file

@ -3,6 +3,7 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use fxhash::FxHashMap;
use import_map::ImportMap;
use once_cell::sync::Lazy;
use regex::Regex;
use serde::{Deserialize, Serialize};
@ -10,10 +11,10 @@ use sourcemap::{RawToken, SourceMap as RawSourcemap};
use swc_atoms::JsWord;
use swc_common::comments::Comments;
use swc_common::util::take::Take;
use swc_common::{BytePos, SourceMap, DUMMY_SP};
use swc_common::{BytePos, SourceMapperDyn, DUMMY_SP};
use swc_ecmascript::ast::{
ArrayLit, CallExpr, JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXElementName,
JSXExpr, JSXExprContainer, JSXObject, SourceMapperExt,
JSXExpr, JSXExprContainer, JSXObject, ModuleExportName, SourceMapperExt,
};
use swc_ecmascript::utils::ExprFactory;
use swc_ecmascript::{
@ -26,9 +27,18 @@ use swc_ecmascript::{
use swc_trace_macro::swc_trace;
mod hash;
mod import_map;
static EMOTION_OFFICIAL_LIBRARIES: Lazy<Vec<EmotionModuleConfig>> = Lazy::new(|| {
vec![
EmotionModuleConfig {
module_name: "@emotion/css".into(),
exported_names: vec![ExportItem {
name: "css".to_owned(),
kind: ExprKind::Css,
}],
default_export: Some(ExprKind::Css),
},
EmotionModuleConfig {
module_name: "@emotion/styled".into(),
exported_names: vec![],
@ -81,6 +91,7 @@ pub struct EmotionOptions {
pub sourcemap: Option<bool>,
pub auto_label: Option<bool>,
pub label_format: Option<String>,
pub import_map: Option<ImportMap>,
}
impl Default for EmotionOptions {
@ -90,6 +101,7 @@ impl Default for EmotionOptions {
sourcemap: Some(true),
auto_label: Some(true),
label_format: Some("[local]".to_owned()),
import_map: None,
}
}
}
@ -142,7 +154,7 @@ enum PackageMeta {
pub fn emotion<C: Comments>(
emotion_options: EmotionOptions,
path: &Path,
cm: Arc<SourceMap>,
cm: Arc<SourceMapperDyn>,
comments: C,
) -> impl Fold {
EmotionTransformer::new(emotion_options, path, cm, comments)
@ -154,18 +166,30 @@ pub struct EmotionTransformer<C: Comments> {
filepath: PathBuf,
dir: Option<String>,
filename: Option<String>,
cm: Arc<SourceMap>,
cm: Arc<SourceMapperDyn>,
comments: C,
import_packages: FxHashMap<Id, PackageMeta>,
emotion_target_class_name_count: usize,
current_context: Option<String>,
// skip `css` transformation if it in JSX Element/Attribute
in_jsx_element: bool,
registered_imports: Vec<EmotionModuleConfig>,
}
#[swc_trace]
impl<C: Comments> EmotionTransformer<C> {
pub fn new(options: EmotionOptions, path: &Path, cm: Arc<SourceMap>, comments: C) -> Self {
pub fn new(
options: EmotionOptions,
path: &Path,
cm: Arc<SourceMapperDyn>,
comments: C,
) -> Self {
let registered_imports = self::import_map::expand_import_map(
options.import_map.as_ref(),
EMOTION_OFFICIAL_LIBRARIES.to_vec(),
);
EmotionTransformer {
options,
filepath_hash: None,
@ -181,6 +205,7 @@ impl<C: Comments> EmotionTransformer<C> {
emotion_target_class_name_count: 0,
current_context: None,
in_jsx_element: false,
registered_imports,
}
}
@ -255,13 +280,20 @@ impl<C: Comments> EmotionTransformer<C> {
// import { css } from '@emotion/react'
// import * as emotionCss from '@emotion/react'
fn generate_import_info(&mut self, expr: &ImportDecl) {
for c in EMOTION_OFFICIAL_LIBRARIES.iter() {
for c in self.registered_imports.iter() {
if expr.src.value == c.module_name {
for specifier in expr.specifiers.iter() {
match specifier {
ImportSpecifier::Named(named) => {
for exported in c.exported_names.iter() {
if named.local.as_ref() == exported.name {
let matched = match &named.imported {
Some(imported) => match imported {
ModuleExportName::Ident(v) => v.sym == exported.name,
ModuleExportName::Str(v) => v.value == exported.name,
},
_ => named.local.as_ref() == exported.name,
};
if matched {
self.import_packages.insert(
named.local.to_id(),
PackageMeta::Named(exported.kind),

View file

@ -16,7 +16,7 @@ fn ts_syntax() -> Syntax {
})
}
#[fixture("tests/fixture/*/input.tsx")]
#[fixture("tests/fixture/**/input.tsx")]
fn next_emotion_fixture(input: PathBuf) {
let output = input.parent().unwrap().join("output.ts");
test_fixture(
@ -37,12 +37,17 @@ fn next_emotion_fixture(input: PathBuf) {
},
top_level_mark,
);
let test_import_map =
serde_json::from_str(include_str!("./testImportMap.json")).unwrap();
chain!(
swc_emotion::emotion(
EmotionOptions {
enabled: Some(true),
sourcemap: Some(true),
auto_label: Some(true),
import_map: Some(test_import_map),
..Default::default()
},
&PathBuf::from("input.ts"),

View file

@ -0,0 +1,8 @@
import * as React from 'react'
import { SomeGlobalFromCore } from 'package-two'
const getBgColor = () => ({ backgroundColor: '#fff' })
export default () => (
<SomeGlobalFromCore styles={{ color: 'hotpink', ...getBgColor() }} />
)

View file

@ -0,0 +1,15 @@
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { SomeGlobalFromCore } from 'package-two';
const getBgColor = ()=>({
backgroundColor: '#fff'
});
export default (()=>/*#__PURE__*/ _jsx(SomeGlobalFromCore, {
styles: [
{
color: 'hotpink',
...getBgColor()
},
"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsgU29tZUdsb2JhbEZyb21Db3JlIH0gZnJvbSAncGFja2FnZS10d28nXG5cbmNvbnN0IGdldEJnQ29sb3IgPSAoKSA9PiAoeyBiYWNrZ3JvdW5kQ29sb3I6ICcjZmZmJyB9KVxuXG5leHBvcnQgZGVmYXVsdCAoKSA9PiAoXG4gIDxTb21lR2xvYmFsRnJvbUNvcmUgc3R5bGVzPXt7IGNvbG9yOiAnaG90cGluaycsIC4uLmdldEJnQ29sb3IoKSB9fSAvPlxuKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1HIn0= */"
]
}));

View file

@ -0,0 +1,4 @@
import * as React from 'react'
import { SomeGlobalFromCore } from 'package-two'
export default () => <SomeGlobalFromCore styles={{ color: 'hotpink' }} />

View file

@ -0,0 +1,11 @@
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { SomeGlobalFromCore } from 'package-two';
export default (()=>/*#__PURE__*/ _jsx(SomeGlobalFromCore, {
styles: [
{
color: 'hotpink'
},
"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsgU29tZUdsb2JhbEZyb21Db3JlIH0gZnJvbSAncGFja2FnZS10d28nXG5cbmV4cG9ydCBkZWZhdWx0ICgpID0+IDxTb21lR2xvYmFsRnJvbUNvcmUgc3R5bGVzPXt7IGNvbG9yOiAnaG90cGluaycgfX0gLz5cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHc0IifQ== */"
]
}));

View file

@ -0,0 +1,3 @@
import { nonDefaultStyled as someAlias } from 'package-one'
let SomeComp = someAlias.div({ color: 'hotpink' })

View file

@ -0,0 +1,7 @@
import { nonDefaultStyled as someAlias } from 'package-one';
let SomeComp = /*#__PURE__*/ someAlias("div", {
target: "ekie5mj0",
label: "SomeComp"
})({
color: 'hotpink'
}, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IG5vbkRlZmF1bHRTdHlsZWQgYXMgc29tZUFsaWFzIH0gZnJvbSAncGFja2FnZS1vbmUnXG5cbmxldCBTb21lQ29tcCA9IHNvbWVBbGlhcy5kaXYoeyBjb2xvcjogJ2hvdHBpbmsnIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRWUifQ== */");

View file

@ -0,0 +1,3 @@
import { nonDefaultStyled } from 'package-one'
let SomeComp = nonDefaultStyled.div({ color: 'hotpink' })

View file

@ -0,0 +1,7 @@
import { nonDefaultStyled } from 'package-one';
let SomeComp = /*#__PURE__*/ nonDefaultStyled("div", {
target: "ekie5mj0",
label: "SomeComp"
})({
color: 'hotpink'
}, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IG5vbkRlZmF1bHRTdHlsZWQgfSBmcm9tICdwYWNrYWdlLW9uZSdcblxubGV0IFNvbWVDb21wID0gbm9uRGVmYXVsdFN0eWxlZC5kaXYoeyBjb2xvcjogJ2hvdHBpbmsnIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRWUifQ== */");

View file

@ -0,0 +1,3 @@
import { nonDefaultStyled } from 'package-four'
let SomeComp = nonDefaultStyled.div({ color: 'hotpink' })

View file

@ -0,0 +1,7 @@
import { nonDefaultStyled } from 'package-four';
let SomeComp = /*#__PURE__*/ nonDefaultStyled("div", {
target: "ekie5mj0",
label: "SomeComp"
})({
color: 'hotpink'
}, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IG5vbkRlZmF1bHRTdHlsZWQgfSBmcm9tICdwYWNrYWdlLWZvdXInXG5cbmxldCBTb21lQ29tcCA9IG5vbkRlZmF1bHRTdHlsZWQuZGl2KHsgY29sb3I6ICdob3RwaW5rJyB9KVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVlIn0= */");

View file

@ -0,0 +1,3 @@
import { something } from 'package-three'
something({ color: 'green' })

View file

@ -0,0 +1,4 @@
import { something } from 'package-three';
/*#__PURE__*/ something({
color: 'green'
}, "label:[local]", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHNvbWV0aGluZyB9IGZyb20gJ3BhY2thZ2UtdGhyZWUnXG5cbnNvbWV0aGluZyh7IGNvbG9yOiAnZ3JlZW4nIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEifQ== */");

View file

@ -0,0 +1,19 @@
{
"package-one": {
"nonDefaultStyled": { "canonicalImport": ["@emotion/styled", "default"] }
},
"package-two": {
"someJsx": { "canonicalImport": ["@emotion/react", "jsx"] },
"someCssFromCore": { "canonicalImport": ["@emotion/react", "css"] },
"SomeGlobalFromCore": { "canonicalImport": ["@emotion/react", "Global"] }
},
"package-three": {
"something": { "canonicalImport": ["@emotion/css", "css"] }
},
"package-four": {
"nonDefaultStyled": {
"canonicalImport": ["@emotion/styled", "default"],
"styledBaseImport": ["package-four/base", "something"]
}
}
}

View file

@ -5,7 +5,7 @@ edition = "2018"
license = "Apache-2.0"
name = "modularize_imports"
repository = "https://github.com/vercel/next.js.git"
version = "0.11.0"
version = "0.14.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -14,9 +14,9 @@ handlebars = "4.2.1"
once_cell = "1.13.0"
regex = "1.5"
serde = "1"
swc_cached = "0.1.1"
swc_ecmascript = { version = "0.180.0", features = ["visit"] }
swc_cached = "0.2.0"
swc_ecmascript = { version = "0.186.0", features = ["visit"] }
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"

View file

@ -33,13 +33,13 @@ next-swc = {version = "0.0.0", path = "../core"}
once_cell = "1.13.0"
serde = "1"
serde_json = "1"
swc = "0.205.0"
swc_atoms = "0.2.13"
swc_bundler = { version = "0.169.0", features = ["concurrent"] }
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.35.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", optional = true }
swc = "0.212.1"
swc_atoms = "0.3.1"
swc_bundler = { version = "0.175.0", features = ["concurrent"] }
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_ecma_loader = { version = "0.38.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.70.0", optional = true }
swc_node_base = "0.5.5"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
tracing-futures = "0.2.5"

View file

@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0"
name = "styled_components"
repository = "https://github.com/vercel/next.js.git"
version = "0.36.0"
version = "0.39.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -15,13 +15,13 @@ Inflector = "0.11.4"
once_cell = "1.13.0"
regex = {version = "1.5.4", features = ["std", "perf"], default-features = false}
serde = {version = "1.0.130", features = ["derive"]}
swc_atoms = "0.2.13"
swc_common = { version = "0.23.0", features = ["concurrent"] }
swc_ecmascript = { version = "0.180.0", features = ["utils", "visit"] }
swc_atoms = "0.3.1"
swc_common = { version = "0.26.0", features = ["concurrent"] }
swc_ecmascript = { version = "0.186.0", features = ["utils", "visit"] }
tracing = "0.1.32"
[dev-dependencies]
serde_json = "1"
swc_ecma_transforms_testing = "0.99.0"
swc_ecmascript = { version = "0.180.0", features = ["parser", "transforms"] }
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
swc_ecmascript = { version = "0.186.0", features = ["parser", "transforms"] }
testing = "0.28.0"

View file

@ -148,7 +148,7 @@ impl VisitMut for TranspileCssProp {
span: DUMMY_SP,
tail: true,
cooked: None,
raw: v.value.clone(),
raw: (&*v.value).into(),
}],
}),
JSXAttrValue::JSXExprContainer(JSXExprContainer {

View file

@ -1,5 +1,5 @@
import _styled from "styled-components";
// @flow
import _styled from "styled-components";
import React from 'react';
import Card from '../../shared/components/Card';
import config from '../../../config';

View file

@ -1,8 +1,7 @@
import _styled from "styled-components";
// @flow
import _styled from "styled-components";
import React from 'react';
export default (()=><_StyledDiv />
);
export default (()=><_StyledDiv />);
var _StyledDiv = _styled("div")`
width: 35em;
`;

View file

@ -1,7 +1,7 @@
import _styled from "styled-components";
/*
* Basic fixtures
*/ const StaticString = (p)=><_StyledP >A</_StyledP>;
*/ import _styled from "styled-components";
const StaticString = (p)=><_StyledP >A</_StyledP>;
const StaticTemplate = (p)=><_StyledP2 >
A

View file

@ -5,18 +5,18 @@ edition = "2018"
license = "Apache-2.0"
name = "styled_jsx"
repository = "https://github.com/vercel/next.js.git"
version = "0.11.0"
version = "0.14.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
easy-error = "1.0.0"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_css = "0.111.0"
swc_css_prefixer = "0.107.0"
swc_ecmascript = { version = "0.180.0", features = ["parser", "minifier", "utils", "visit"] }
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_css = "0.116.0"
swc_css_prefixer = "0.113.3"
swc_ecmascript = { version = "0.186.0", features = ["parser", "minifier", "utils", "visit"] }
tracing = "0.1.32"
[dev-dependencies]
swc_ecma_transforms_testing = "0.99.0"
testing = "0.25.0"
swc_ecma_transforms_testing = "0.104.0"
testing = "0.28.0"

View file

@ -59,7 +59,7 @@ pub fn transform_css(
}
};
// ? Do we need to support optionally prefixing?
ss.visit_mut_with(&mut prefixer());
ss.visit_mut_with(&mut prefixer(Default::default()));
ss.visit_mut_with(&mut Namespacer {
class_name: match class_name {
Some(s) => s.clone(),
@ -343,7 +343,7 @@ impl Namespacer {
SubclassSelector::Class(ClassSelector {
span: DUMMY_SP,
text: Ident {
raw: subclass_selector.into(),
raw: Some(subclass_selector.into()),
value: subclass_selector.into(),
span: DUMMY_SP,
},

View file

@ -24,7 +24,7 @@ export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles
// external and dynamic
export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
@ -33,14 +33,14 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " "
<p className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
]
])}>external and dynamic</p>
<_JSXStyle id={"accb2339a5faf0f2"} dynamic={[
<_JSXStyle id={"e7486f61219e66af"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
@ -50,7 +50,7 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " "
// external, static and dynamic
export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
@ -59,7 +59,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js
<p className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
@ -68,7 +68,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"8e6465b81c401982"} dynamic={[
<_JSXStyle id={"9ef7fdf2e339f135"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
@ -88,7 +88,7 @@ export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}>
// static and dynamic
export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
@ -97,7 +97,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
<p className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"8e6465b81c401982",
"9ef7fdf2e339f135",
[
color
]
@ -106,7 +106,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"8e6465b81c401982"} dynamic={[
<_JSXStyle id={"9ef7fdf2e339f135"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
@ -114,7 +114,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
// dynamic only
export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
@ -123,14 +123,14 @@ export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
<p className={_JSXStyle.dynamic([
[
"accb2339a5faf0f2",
"e7486f61219e66af",
[
color
]
]
])}>dynamic only</p>
<_JSXStyle id={"accb2339a5faf0f2"} dynamic={[
<_JSXStyle id={"e7486f61219e66af"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
@ -143,7 +143,7 @@ export const Test8 = ({ color })=>{
};
return <div className={_JSXStyle.dynamic([
[
"3b89706ab84e735b",
"1f1fbf7e754ca7cb",
[
innerProps.color
]
@ -152,14 +152,14 @@ export const Test8 = ({ color })=>{
<p className={_JSXStyle.dynamic([
[
"3b89706ab84e735b",
"1f1fbf7e754ca7cb",
[
innerProps.color
]
]
])}>dynamic with scoped compound variable</p>
<_JSXStyle id={"3b89706ab84e735b"} dynamic={[
<_JSXStyle id={"1f1fbf7e754ca7cb"} dynamic={[
innerProps.color
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
@ -173,7 +173,7 @@ export const Test9 = ({ color })=>{
};
return <div className={_JSXStyle.dynamic([
[
"65329f5bf03a1958",
"460abeb3d95fb60d",
[
innerProps.color
]
@ -182,14 +182,14 @@ export const Test9 = ({ color })=>{
<p className={_JSXStyle.dynamic([
[
"65329f5bf03a1958",
"460abeb3d95fb60d",
[
innerProps.color
]
]
])}>dynamic with compound variable</p>
<_JSXStyle id={"65329f5bf03a1958"} dynamic={[
<_JSXStyle id={"460abeb3d95fb60d"} dynamic={[
innerProps.color
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
@ -197,11 +197,11 @@ export const Test9 = ({ color })=>{
};
const foo = 'red';
// dynamic with constant variable
export const Test10 = ()=><div className={"jsx-cbdf2f44af4108bd"}>
export const Test10 = ()=><div className={"jsx-f849b7a02be96503"}>
<p className={"jsx-cbdf2f44af4108bd"}>dynamic with constant variable</p>
<p className={"jsx-f849b7a02be96503"}>dynamic with constant variable</p>
<_JSXStyle id={"cbdf2f44af4108bd"}>{`p.jsx-cbdf2f44af4108bd{color:${foo}}`}</_JSXStyle>
<_JSXStyle id={"f849b7a02be96503"}>{`p.jsx-f849b7a02be96503{color:${foo}}`}</_JSXStyle>
</div>;
// dynamic with complex scope
@ -210,14 +210,14 @@ export const Test11 = ({ color })=>{
length: 5
}).map((item, i)=><li key={i} className={_JSXStyle.dynamic([
[
"79c618068313f86e",
"307a31332e39b502",
[
color
]
]
]) + " " + "item"}>
<_JSXStyle id={"79c618068313f86e"} dynamic={[
<_JSXStyle id={"307a31332e39b502"} dynamic={[
color
]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>

View file

@ -0,0 +1,14 @@
// TODO
// export const _JSXStyle = '_JSXStyle-literal'
// export default function() {
// return (
// <div>
// <p>test</p>
// <style jsx>{`
// p {
// color: red;
// }
// `}</style>
// </div>
// )
// }

View file

@ -1,18 +1,18 @@
import _JSXStyle from "next/dist/shared/lib/styled-jsx";
const color = 'red';
const otherColor = 'green';
const A = ()=><div className={"jsx-498d4e86e548e679"}>
const A = ()=><div className={"jsx-551210e97e875d0e"}>
<p className={"jsx-498d4e86e548e679"}>test</p>
<p className={"jsx-551210e97e875d0e"}>test</p>
<_JSXStyle id={"498d4e86e548e679"}>{`p.jsx-498d4e86e548e679{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"551210e97e875d0e"}>{`p.jsx-551210e97e875d0e{color:${color}}`}</_JSXStyle>
</div>;
const B = ()=><div className={"jsx-d051a1c8140076ed"}>
const B = ()=><div className={"jsx-d1ed441bb35f699d"}>
<p className={"jsx-d051a1c8140076ed"}>test</p>
<p className={"jsx-d1ed441bb35f699d"}>test</p>
<_JSXStyle id={"d051a1c8140076ed"}>{`p.jsx-d051a1c8140076ed{color:${otherColor}}`}</_JSXStyle>
<_JSXStyle id={"d1ed441bb35f699d"}>{`p.jsx-d1ed441bb35f699d{color:${otherColor}}`}</_JSXStyle>
</div>;
export default (()=><div >

View file

@ -0,0 +1,39 @@
// TODO
// import React, { Component } from 'react'
// export default class Index extends Component {
// static getInitialProps() {
// return { color: 'aquamarine' }
// }
// render() {
// return (
// <div>
// {[1, 2].map(idx => (
// <div key={idx}>
// {[3, 4].map(idx2 => (
// <div key={idx2}>{this.props.color}</div>
// ))}
// </div>
// ))}
// {[1, 2].map(idx => (
// <div key={idx}>
// <div>
// {this.props.color}
// <div className="something">
// <React.Fragment>
// <div>
// <div>{this.props.color} hello there</div>
// </div>
// </React.Fragment>
// </div>
// </div>
// </div>
// ))}
// <style jsx>{`
// div {
// background: ${this.props.color};
// }
// `}</style>
// </div>
// )
// }
// }

View file

@ -0,0 +1 @@
// module.exports = () => <p><style jsx>{`p { color:red; }`}</style></p>

View file

@ -0,0 +1 @@
// module.exports = () => <p><style>{`p { color:red; }`}</style></p>

View file

@ -8,79 +8,79 @@ const animationName = 'my-cool-animation';
const obj = {
display: 'block'
};
export default (({ display })=><div className={"jsx-ee922fe7eac00c5e " + _JSXStyle.dynamic([
export default (({ display })=><div className={"jsx-9f11e5fc71d05085 " + _JSXStyle.dynamic([
[
"374046f7d83960f0",
"e4db21be651d572a",
[
display ? 'block' : 'none'
]
],
[
"f297f0e8b24d55b4",
"1f060869c7312fe5",
[
darken(color) + 2
]
],
[
"f03bb8922a3e69b1",
"e0c373c6551675e4",
[
darken(color)
]
]
])}>
<p className={"jsx-ee922fe7eac00c5e " + _JSXStyle.dynamic([
<p className={"jsx-9f11e5fc71d05085 " + _JSXStyle.dynamic([
[
"374046f7d83960f0",
"e4db21be651d572a",
[
display ? 'block' : 'none'
]
],
[
"f297f0e8b24d55b4",
"1f060869c7312fe5",
[
darken(color) + 2
]
],
[
"f03bb8922a3e69b1",
"e0c373c6551675e4",
[
darken(color)
]
]
])}>test</p>
<_JSXStyle id={"a8107430c6c528d0"}>{`p.${color}.jsx-ee922fe7eac00c5e{color:${otherColor};display:${obj.display}}`}</_JSXStyle>
<_JSXStyle id={"13bce568d963e978"}>{`p.${color}.jsx-9f11e5fc71d05085{color:${otherColor};display:${obj.display}}`}</_JSXStyle>
<_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-ee922fe7eac00c5e{color:red}"}</_JSXStyle>
<_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-9f11e5fc71d05085{color:red}"}</_JSXStyle>
<_JSXStyle id={"f0a3b803e45f3568"}>{`body{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"ecd8dfc6d11e2c5e"}>{`body{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"f0a3b803e45f3568"}>{`body{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"ecd8dfc6d11e2c5e"}>{`body{background:${color}}`}</_JSXStyle>
// TODO: the next two should have the same hash
<_JSXStyle id={"accb2339a5faf0f2"}>{`p.jsx-ee922fe7eac00c5e{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"e7486f61219e66af"}>{`p.jsx-9f11e5fc71d05085{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"accb2339a5faf0f2"}>{`p.jsx-ee922fe7eac00c5e{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"e7486f61219e66af"}>{`p.jsx-9f11e5fc71d05085{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"f03bb8922a3e69b1"} dynamic={[
<_JSXStyle id={"e0c373c6551675e4"} dynamic={[
darken(color)
]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`}</_JSXStyle>
<_JSXStyle id={"f297f0e8b24d55b4"} dynamic={[
<_JSXStyle id={"1f060869c7312fe5"} dynamic={[
darken(color) + 2
]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`}</_JSXStyle>
<_JSXStyle id={"d7df5b0be4ac2e3b"}>{`@media(min-width:${mediumScreen}){p.jsx-ee922fe7eac00c5e{color:green}p.jsx-ee922fe7eac00c5e{color:${`red`}}}p.jsx-ee922fe7eac00c5e{color:red}`}</_JSXStyle>
<_JSXStyle id={"7c5c5bde49d6c65d"}>{`@media(min-width:${mediumScreen}){p.jsx-9f11e5fc71d05085{color:green}p.jsx-9f11e5fc71d05085{color:${`red`}}}p.jsx-9f11e5fc71d05085{color:red}`}</_JSXStyle>
<_JSXStyle id={"ff76c479bb5bf1a9"}>{`p.jsx-ee922fe7eac00c5e{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"c5506be0b4762e0b"}>{`p.jsx-9f11e5fc71d05085{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"f4ba3ad133457656"}>{`p.jsx-ee922fe7eac00c5e{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-ee922fe7eac00c5e{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"82f0f2f07692d2e2"}>{`p.jsx-9f11e5fc71d05085{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-9f11e5fc71d05085{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"374046f7d83960f0"} dynamic={[
<_JSXStyle id={"e4db21be651d572a"} dynamic={[
display ? 'block' : 'none'
]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`}</_JSXStyle>

View file

@ -1,14 +1,14 @@
import _JSXStyle from "next/dist/shared/lib/styled-jsx";
export default (({ breakPoint })=><div className={_JSXStyle.dynamic([
[
"1568e0a11702cf40",
"5d2a0e645566ce9c",
[
breakPoint
]
]
])}>
<_JSXStyle id={"1568e0a11702cf40"} dynamic={[
<_JSXStyle id={"5d2a0e645566ce9c"} dynamic={[
breakPoint
]}>{`@media(${breakPoint}){}`}</_JSXStyle>

View file

@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"ac0c5daa02b1aeac",
"23846d0356326bee",
[
Typography.base.size.default,
Typography.base.lineHeight,
@ -17,7 +17,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"ac0c5daa02b1aeac",
"23846d0356326bee",
[
Typography.base.size.default,
Typography.base.lineHeight,
@ -29,7 +29,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"ac0c5daa02b1aeac"} dynamic={[
<_JSXStyle id={"23846d0356326bee"} dynamic={[
Typography.base.size.default,
Typography.base.lineHeight,
Target.mediumPlus,

View file

@ -1,17 +1,17 @@
import _JSXStyle from "next/dist/shared/lib/styled-jsx";
import Link from "next/link";
export default function IndexPage() {
return <div className={"jsx-2339e3d61ab4470c"}>
return <div className={"jsx-9a4b3442d519aae9"}>
Hello World.{" "}
<Link href="/about">
<a className={"jsx-2339e3d61ab4470c"}>Abound</a>
<a className={"jsx-9a4b3442d519aae9"}>Abound</a>
</Link>
<_JSXStyle id={"2339e3d61ab4470c"}>{`a.jsx-2339e3d61ab4470c{color:${"#abcdef"}12}`}</_JSXStyle>
<_JSXStyle id={"9a4b3442d519aae9"}>{`a.jsx-9a4b3442d519aae9{color:${"#abcdef"}12}`}</_JSXStyle>
</div>;
};

View file

@ -0,0 +1,8 @@
// TODO: needs sourcemaps
// export default () => (
// <div>
// <p>test</p>
// <p>woot</p>
// <style jsx>{'p { color: red }'}</style>
// </div>
// )

View file

@ -0,0 +1,9 @@
// TODO
// import css from 'styled-jsx/css'
// const color = 'red'
// export const foo = css`div { color: ${color}}`
// const props = { color: 'red ' }
// export default css`
// div { font-size: 3em; color: ${props.color} }
// p { color: ${this.props.color};}
// `

View file

@ -0,0 +1,8 @@
// TODO
// import css from 'styled-jsx/css'
// const color = 'red'
// export const foo = css`div { color: ${color}}`
// export default css`
// div { font-size: 3em }
// p { color: ${props.color};}
// `

View file

@ -6,26 +6,26 @@ bar.__hash = "aaed0341accea8f";
const baz = new String("div{font-size:3em}");
baz.__hash = "aaed0341accea8f";
const a = new String(`div{font-size:${size}em}`);
a.__hash = "3066b487d298d78f";
a.__hash = "b6966e11ccb637f2";
export const uh = bar;
export const foo = new String(`div.jsx-67354fc16554bdab{color:${color}}`);
foo.__hash = "67354fc16554bdab";
export const foo = new String(`div.jsx-dbfc29cedbb5f49b{color:${color}}`);
foo.__hash = "dbfc29cedbb5f49b";
({
styles: <_JSXStyle id={"ef44b0e76b4e59a2"}>{`div.jsx-ef44b0e76b4e59a2{color:${colors.green.light}}a.jsx-ef44b0e76b4e59a2{color:red}`}</_JSXStyle>,
className: "jsx-ef44b0e76b4e59a2"
styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>,
className: "jsx-38ae14c4ec5e0907"
});
const b = {
styles: <_JSXStyle id={"ef44b0e76b4e59a2"}>{`div.jsx-ef44b0e76b4e59a2{color:${colors.green.light}}a.jsx-ef44b0e76b4e59a2{color:red}`}</_JSXStyle>,
className: "jsx-ef44b0e76b4e59a2"
styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>,
className: "jsx-38ae14c4ec5e0907"
};
const dynamic = (colors)=>{
const b = {
styles: <_JSXStyle id={"d1249fb76dde6727"} dynamic={[
styles: <_JSXStyle id={"b68d3b38146e2a7d"} dynamic={[
colors.green.light
]}>{`div.__jsx-style-dynamic-selector{color:${colors.green.light}}a.__jsx-style-dynamic-selector{color:red}`}</_JSXStyle>,
className: _JSXStyle.dynamic([
[
"d1249fb76dde6727",
"b68d3b38146e2a7d",
[
colors.green.light
]
@ -34,6 +34,6 @@ const dynamic = (colors)=>{
};
};
export default {
styles: <_JSXStyle id={"d85f88350ca31aae"}>{`div.jsx-d85f88350ca31aae{font-size:3em}p.jsx-d85f88350ca31aae{color:${color}}`}</_JSXStyle>,
className: "jsx-d85f88350ca31aae"
styles: <_JSXStyle id={"a300397bb1f6c7cd"}>{`div.jsx-a300397bb1f6c7cd{font-size:3em}p.jsx-a300397bb1f6c7cd{color:${color}}`}</_JSXStyle>,
className: "jsx-a300397bb1f6c7cd"
};

View file

@ -0,0 +1,5 @@
// TODO: support common js
// import css from 'styled-jsx/css'
// module.exports = css`
// div { font-size: 3em }
// `

View file

@ -2,7 +2,7 @@ import _JSXStyle from "next/dist/shared/lib/styled-jsx";
export const Red = ({ Component ='button' , })=>{
return <Component className={_JSXStyle.dynamic([
[
"6c7c8cee856673a7",
"1a9f9e2fa701f7ec",
[
e1,
e2,
@ -27,7 +27,7 @@ export const Red = ({ Component ='button' , })=>{
{}
<_JSXStyle id={"6c7c8cee856673a7"} dynamic={[
<_JSXStyle id={"1a9f9e2fa701f7ec"} dynamic={[
e1,
e2,
e3,

View file

@ -2,14 +2,14 @@ import _JSXStyle from "next/dist/shared/lib/styled-jsx";
export default function Home({ fontFamily }) {
return <div className={_JSXStyle.dynamic([
[
"ae6b96ca586fe51a",
"3892513b52a23034",
[
fontFamily
]
]
])}>
<_JSXStyle id={"ae6b96ca586fe51a"} dynamic={[
<_JSXStyle id={"3892513b52a23034"} dynamic={[
fontFamily
]}>{`body{font-family:${fontFamily}}code:before,code:after{content:"\`"}`}</_JSXStyle>

View file

@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"e1b0d3df4c8dcbf0",
"fc144a5ba38f1ea7",
[
inputSize ? 'height: calc(2 * var(--a)) !important;' : ''
]
@ -12,14 +12,14 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"e1b0d3df4c8dcbf0",
"fc144a5ba38f1ea7",
[
inputSize ? 'height: calc(2 * var(--a)) !important;' : ''
]
]
])}>test</p>
<_JSXStyle id={"e1b0d3df4c8dcbf0"} dynamic={[
<_JSXStyle id={"fc144a5ba38f1ea7"} dynamic={[
inputSize ? 'height: calc(2 * var(--a)) !important;' : ''
]}>{`@media only screen{a.__jsx-style-dynamic-selector{${inputSize ? 'height: calc(2 * var(--a)) !important;' : ''}
}}`}</_JSXStyle>

View file

@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"5fd7f2008eca3a62",
"3316de46318b70d2",
[
a[b],
-1 * (c || 0),
@ -14,7 +14,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"5fd7f2008eca3a62",
"3316de46318b70d2",
[
a[b],
-1 * (c || 0),
@ -23,7 +23,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"5fd7f2008eca3a62"} dynamic={[
<_JSXStyle id={"3316de46318b70d2"} dynamic={[
a[b],
-1 * (c || 0),
d

View file

@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"b249ec2f79615bbf",
"10afbaef094d6ad4",
[
a
]
@ -12,14 +12,14 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"b249ec2f79615bbf",
"10afbaef094d6ad4",
[
a
]
]
])}>test</p>
<_JSXStyle id={"b249ec2f79615bbf"} dynamic={[
<_JSXStyle id={"10afbaef094d6ad4"} dynamic={[
a
]}>{`@media only screen{a.__jsx-style-dynamic-selector{color:${a}}}`}</_JSXStyle>

View file

@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"6021be0687550489",
"30707b6ee2bc231f",
[
a || 'var(--c)',
b || 'inherit'
@ -13,7 +13,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"6021be0687550489",
"30707b6ee2bc231f",
[
a || 'var(--c)',
b || 'inherit'
@ -21,7 +21,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"6021be0687550489"} dynamic={[
<_JSXStyle id={"30707b6ee2bc231f"} dynamic={[
a || 'var(--c)',
b || 'inherit'
]}>{`.a:hover .b.__jsx-style-dynamic-selector{display:inline-block;padding:0 ${a || 'var(--c)'};color:${b || 'inherit'}}`}</_JSXStyle>

View file

@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"e2cf1d088389269b",
"3f66f111bff09281",
[
a ? '100%' : '200px',
b ? '0' : '8px 20px'
@ -13,7 +13,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"e2cf1d088389269b",
"3f66f111bff09281",
[
a ? '100%' : '200px',
b ? '0' : '8px 20px'
@ -21,7 +21,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"e2cf1d088389269b"} dynamic={[
<_JSXStyle id={"3f66f111bff09281"} dynamic={[
a ? '100%' : '200px',
b ? '0' : '8px 20px'
]}>{`.item.__jsx-style-dynamic-selector{max-width:${a ? '100%' : '200px'};padding:${b ? '0' : '8px 20px'}}`}</_JSXStyle>

View file

@ -25,10 +25,10 @@ parking_lot_core = "=0.8.0"
path-clean = "0.1"
serde = {version = "1", features = ["derive"]}
serde_json = "1"
swc = "0.205.0"
swc_common = { version = "0.23.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.180.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.64.0", default-features = false, optional = true }
swc = "0.212.1"
swc_common = { version = "0.26.0", features = ["concurrent", "sourcemap"] }
swc_ecmascript = { version = "0.186.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_plugin_runner = { version = "0.70.0", default-features = false, optional = true }
tracing = { version = "0.1.32", features = ["release_max_level_off"] }
wasm-bindgen = {version = "0.2", features = ["serde-serialize"]}
wasm-bindgen-futures = "0.4.8"