From c6b82aa492ed2b243617833b572e519abd1ccb95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 17 Mar 2022 19:38:23 +0900 Subject: [PATCH 01/24] Update crates --- packages/next-swc/Cargo.lock | 428 +++++++++++++++++------ packages/next-swc/crates/core/Cargo.toml | 12 +- packages/next-swc/crates/napi/Cargo.toml | 10 +- packages/next-swc/crates/wasm/Cargo.toml | 6 +- 4 files changed, 326 insertions(+), 130 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 68ff4a132b49b1a..25e7f108ee0cd76 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -704,6 +704,12 @@ dependencies = [ "syn", ] +[[package]] +name = "is_ci" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" + [[package]] name = "itertools" version = "0.10.3" @@ -876,6 +882,37 @@ dependencies = [ "autocfg", ] +[[package]] +name = "miette" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ea7314b2a8dd373c2f2d2322e866ddea5d62ffd3d6cd7f2bb8c1467e56529f" +dependencies = [ + "atty", + "backtrace", + "miette-derive", + "once_cell", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c547b28d4f52cae473fb5a30ca087ed7fc5d1bac150bd6dfd9ec0a4562303aa3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "mimalloc-rust" version = "0.1.1" @@ -978,7 +1015,7 @@ dependencies = [ "swc_css", "swc_ecma_loader", "swc_ecma_transforms_testing", - "swc_ecmascript", + "swc_ecmascript 0.136.0", "swc_node_base", "swc_stylis", "testing", @@ -1005,7 +1042,7 @@ dependencies = [ "swc_bundler", "swc_common", "swc_ecma_loader", - "swc_ecmascript", + "swc_ecmascript 0.136.0", "swc_node_base", ] @@ -1109,6 +1146,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "owo-colors" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20448fd678ec04e6ea15bbe0476874af65e98a01515d667aa49f1434dc44ebf4" + [[package]] name = "parking_lot" version = "0.11.1" @@ -1340,9 +1383,9 @@ dependencies = [ [[package]] name = "pretty_assertions" -version = "0.7.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cab0e7c02cf376875e9335e0ba1da535775beb5450d21e1dffca068818ed98b" +checksum = "57c038cb5319b9c704bf9c227c261d275bfec0ad438118a2787ce47944fb228b" dependencies = [ "ansi_term", "ctor", @@ -1737,6 +1780,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +[[package]] +name = "smawk" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" + [[package]] name = "sourcemap" version = "6.0.1" @@ -1838,15 +1887,43 @@ dependencies = [ "serde", "swc_atoms", "swc_common", - "swc_ecmascript", + "swc_ecmascript 0.132.1", "tracing", ] +[[package]] +name = "supports-color" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4872ced36b91d47bae8a214a683fe54e7078875b399dfa251df346c9b547d1f9" +dependencies = [ + "atty", + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406" +dependencies = [ + "atty", +] + +[[package]] +name = "supports-unicode" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2" +dependencies = [ + "atty", +] + [[package]] name = "swc" -version = "0.150.2" +version = "0.157.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4797acf688dd8a83ed4dc2d2d1bd19bf0009aa5a365e23fe2be5092b4e4c954f" +checksum = "8319b77cca3192abcdf30b4079cd6f4b7c7f38977338c2201a82f600a4ae61da" dependencies = [ "ahash", "anyhow", @@ -1865,21 +1942,22 @@ dependencies = [ "swc_atoms", "swc_cached", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_codegen", "swc_ecma_ext_transforms", "swc_ecma_lints", "swc_ecma_loader", "swc_ecma_minifier", - "swc_ecma_parser", + "swc_ecma_parser 0.95.1", "swc_ecma_preset_env", "swc_ecma_transforms", "swc_ecma_transforms_base", "swc_ecma_transforms_compat", "swc_ecma_transforms_optimization", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_ecmascript", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", + "swc_ecmascript 0.136.0", + "swc_error_reporters", "swc_node_comments", "swc_visit", "tracing", @@ -1897,9 +1975,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.122.0" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f20988c95a6e660f28c741b81688ffabd012709ef8e663dad37bcffaa23dc2d6" +checksum = "2ea74e5ef114af5122544d39e5f93637c0c43cee39fe473376932f9a25a5d19d" dependencies = [ "ahash", "anyhow", @@ -1916,14 +1994,14 @@ dependencies = [ "retain_mut", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_codegen", "swc_ecma_loader", - "swc_ecma_parser", + "swc_ecma_parser 0.95.1", "swc_ecma_transforms_base", "swc_ecma_transforms_optimization", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", "swc_fast_graph", "swc_graph_analyzer", "tracing", @@ -1946,9 +2024,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.17.15" +version = "0.17.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af06472bfc423fb7b75c483eccfb9b6790db9de0fb2d6ff1ef8369a2551a3707" +checksum = "7935aededdf361eb17ba3ddde021ad0df4774c5b5d902e7b0f6faae7c76d748a" dependencies = [ "ahash", "ast_node", @@ -2079,29 +2157,45 @@ dependencies = [ "unicode-id", ] +[[package]] +name = "swc_ecma_ast" +version = "0.71.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae7b943caae6d3fbae0534ce2df9866efa3d0415199ce7d20c6ef7e4e0b233d" +dependencies = [ + "is-macro", + "num-bigint", + "serde", + "string_enum", + "swc_atoms", + "swc_common", + "unicode-id", +] + [[package]] name = "swc_ecma_codegen" -version = "0.95.0" +version = "0.98.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fa4a2b82e2bab5bea6472e23b14bd96c462ae9e1e29d9af2ea8ea6d58dcc406" +checksum = "ef9691af1a41fbde638594f2b8593560670adab5c2cc0fd3587481040312797d" dependencies = [ "bitflags", "memchr", "num-bigint", "once_cell", + "rustc-hash", "sourcemap", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_codegen_macros", "tracing", ] [[package]] name = "swc_ecma_codegen_macros" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbf826c739281cdb3b3c23883fd1a7586ea1c15b1287530e7123a7fad8f0e25" +checksum = "59949619b2ef45eedb6c399d05f2c3c7bc678b5074b3103bb670f9e05bb99042" dependencies = [ "pmutil", "proc-macro2", @@ -2112,23 +2206,23 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.58.0" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9abffab30a8d23ebbead8d5c119e8ef10ab0bd9006eb6ff695d0a092583511b" +checksum = "9f7a436ad852546283700342874e1ea7a07c61a970d718b208a0f9382d057658" dependencies = [ "phf", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_ast 0.71.0", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] name = "swc_ecma_lints" -version = "0.23.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedc1fdd035c4eeecb33af1f3e9d398e09dc181e97a8e86f1f55acc557918bc8" +checksum = "5dc6b352c12aa6a62aeff792785894516e67c1d2d32a7b3f8f654b8bbdd2fb56" dependencies = [ "ahash", "auto_impl", @@ -2139,9 +2233,9 @@ dependencies = [ "serde", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_ast 0.71.0", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] @@ -2167,9 +2261,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.89.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6d504a13e728ba34cda8046620e004aa279af8b6ce1701d434840b6d396f1e" +checksum = "8f58bc0fcbf58ed233084cf2e23da55924686c3c231fd2a6574949de6cdbe9e0" dependencies = [ "ahash", "indexmap", @@ -2184,13 +2278,13 @@ dependencies = [ "swc_atoms", "swc_cached", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_codegen", - "swc_ecma_parser", + "swc_ecma_parser 0.95.1", "swc_ecma_transforms", "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", "swc_timer", "tracing", "unicode-id", @@ -2210,7 +2304,27 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.70.0", + "tracing", + "typed-arena", + "unicode-id", +] + +[[package]] +name = "swc_ecma_parser" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bbca18d756dddd0a87e101dd07157cd466a22787e9b5447ab85da2faa352bd8" +dependencies = [ + "either", + "enum_kind", + "lexical", + "num-bigint", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.71.0", "tracing", "typed-arena", "unicode-id", @@ -2218,9 +2332,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.106.2" +version = "0.110.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c76924d65625afb0536c433d59a6f63fee0388e0ab7f121bda9ec92a84b4678" +checksum = "13d8929f9552fd9c324a8b22765dfa50b789f0e0069757f3480ececfb11b5136" dependencies = [ "ahash", "anyhow", @@ -2235,21 +2349,21 @@ dependencies = [ "string_enum", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_transforms", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] name = "swc_ecma_transforms" -version = "0.131.0" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "484ab8024a62c8f35a408898d0b8aa664e03a992c2f262cda6173274f48d955e" +checksum = "7e19aa898a63dbee9ae4abb505716bc146c55d6ad9e627d617b16bfc827dd36f" dependencies = [ "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_transforms_base", "swc_ecma_transforms_compat", "swc_ecma_transforms_module", @@ -2257,15 +2371,15 @@ dependencies = [ "swc_ecma_transforms_proposal", "swc_ecma_transforms_react", "swc_ecma_transforms_typescript", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] name = "swc_ecma_transforms_base" -version = "0.67.0" +version = "0.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6786157670709b3c9e2a81aee7aef8042b582b4b599f233025b28ca5353a29d9" +checksum = "0e0e50e1414e15cc7b909fb8c79c8b2d9988b83aabe8114fa09a730123c2558c" dependencies = [ "better_scoped_tls", "once_cell", @@ -2275,32 +2389,32 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_ast 0.71.0", + "swc_ecma_parser 0.95.1", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", "tracing", ] [[package]] name = "swc_ecma_transforms_classes" -version = "0.55.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd06b4fa72cd85640fcab59c210c34c8e63f6ea5e547c856febcf18000c0bda" +checksum = "3c16df5d4468e8f54b89eccf0876337c4c672b6434092ec83e71e7c678d1fdd3" dependencies = [ "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] name = "swc_ecma_transforms_compat" -version = "0.80.0" +version = "0.83.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f622788e39755b4a0b9902e37314fbc59f163d5e9e24c121a95c8352fb00e1e0" +checksum = "12cb92c67a689037b6320bb2e0a421b5c74bfd297f59cfd7c71c0128ff23de02" dependencies = [ "ahash", "arrayvec 0.7.2", @@ -2312,12 +2426,12 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_transforms_base", "swc_ecma_transforms_classes", "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", "swc_trace_macro", "tracing", ] @@ -2337,9 +2451,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.91.0" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b050435473be3392bdc665682cf3637c006ea5fe57f6f58cf3be08ae597fab9" +checksum = "a40c273cd4344955105824da8de90e0dfb4e41f4059c3a9accc0292b6b2590b6" dependencies = [ "Inflector", "ahash", @@ -2350,20 +2464,20 @@ dependencies = [ "swc_atoms", "swc_cached", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_loader", - "swc_ecma_parser", + "swc_ecma_parser 0.95.1", "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", "tracing", ] [[package]] name = "swc_ecma_transforms_optimization" -version = "0.101.0" +version = "0.105.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0638979a3445e49125ab28a30dc734c272e66406db5583d9095f459543056ac" +checksum = "1b4c4832545ccd8a62050629f0bea25a8968af107149d01bf60e5b87c9305136" dependencies = [ "ahash", "dashmap 5.1.0", @@ -2373,39 +2487,39 @@ dependencies = [ "serde_json", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", + "swc_ecma_ast 0.71.0", + "swc_ecma_parser 0.95.1", "swc_ecma_transforms_base", "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", "tracing", ] [[package]] name = "swc_ecma_transforms_proposal" -version = "0.88.0" +version = "0.91.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bf987316b088789266b108b9ad87f8479402a76233565ef31807103766bc079" +checksum = "2d5ff5321ecdd0a3e620878e02452a6475b9ffdcaf75a2cf9636c2d31bb85fe0" dependencies = [ "either", "serde", "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_transforms_base", "swc_ecma_transforms_classes", "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] name = "swc_ecma_transforms_react" -version = "0.93.0" +version = "0.97.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd2d009bb8be4149a1b3bb8ea2e4c59c5a26ed5b5ae797563026887480ed9141" +checksum = "2e34910d493b1edca2dc1a4ce86bf0e704c8aca3ccfaee6d8217063779b3df22" dependencies = [ "ahash", "base64 0.13.0", @@ -2418,19 +2532,19 @@ dependencies = [ "string_enum", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", + "swc_ecma_ast 0.71.0", + "swc_ecma_parser 0.95.1", "swc_ecma_transforms_base", "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] name = "swc_ecma_transforms_testing" -version = "0.69.0" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46059181bdb2006c3f5ff67d8e19a6a0f9a6f226edb0fbafdfbd314fabaebe92" +checksum = "34d8d6775aa4da996306fe0f334e644576527fc646727402142e7026ce4f3a76" dependencies = [ "ansi_term", "anyhow", @@ -2439,30 +2553,30 @@ dependencies = [ "serde_json", "sha-1 0.10.0", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_codegen", - "swc_ecma_parser", + "swc_ecma_parser 0.95.1", "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", "tempfile", "testing", ] [[package]] name = "swc_ecma_transforms_typescript" -version = "0.96.0" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2e388f0b424de694aac45aaad513e7ccb03aeb87ed42781ce353e1346b3d86" +checksum = "5c553fe85a8bcb0fcc6c8929770d556d567991f8061f7a47dc6e962b6b87dbf9" dependencies = [ "serde", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.71.0", "swc_ecma_transforms_base", "swc_ecma_transforms_react", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] @@ -2470,14 +2584,29 @@ name = "swc_ecma_utils" version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43689c9f051b48c4ea9eb86b236b27277594a9c4311d3ee88d7007f5d65b1ff5" +dependencies = [ + "indexmap", + "once_cell", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.70.0", + "swc_ecma_visit 0.56.0", + "tracing", +] + +[[package]] +name = "swc_ecma_utils" +version = "0.74.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daa3ba57f53fc15882d2ea288f9a4b6c3a6e97c015d7b9603035be424bc19007" dependencies = [ "indexmap", "once_cell", "rayon", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_visit", + "swc_ecma_ast 0.71.0", + "swc_ecma_visit 0.57.0", "tracing", ] @@ -2490,7 +2619,21 @@ dependencies = [ "num-bigint", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.70.0", + "swc_visit", + "tracing", +] + +[[package]] +name = "swc_ecma_visit" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7588bf6b02705a25356a130acdfec125b6a1dcd5390a5718082ae4f2ede85ee3" +dependencies = [ + "num-bigint", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.71.0", "swc_visit", "tracing", ] @@ -2501,13 +2644,25 @@ version = "0.132.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fa1f0e2b8bcb94f30b276c633743e6d2cf06e5ceb0561fe1bb55d47d020921e" dependencies = [ - "swc_ecma_ast", + "swc_ecma_ast 0.70.0", + "swc_ecma_parser 0.93.0", + "swc_ecma_utils 0.72.0", + "swc_ecma_visit 0.56.0", +] + +[[package]] +name = "swc_ecmascript" +version = "0.136.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb75ac51d44c811e4527ce30873a8ef1bd8f2435e33ec6a5dc62936dbfdc451" +dependencies = [ + "swc_ecma_ast 0.71.0", "swc_ecma_codegen", "swc_ecma_minifier", - "swc_ecma_parser", + "swc_ecma_parser 0.95.1", "swc_ecma_transforms", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_utils 0.74.0", + "swc_ecma_visit 0.57.0", ] [[package]] @@ -2522,6 +2677,16 @@ dependencies = [ "syn", ] +[[package]] +name = "swc_error_reporters" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03cb606be4544bae11412d1ff32663de9607aec86d003d21ac1695b432fe40c8" +dependencies = [ + "miette", + "swc_common", +] + [[package]] name = "swc_fast_graph" version = "0.5.0" @@ -2536,9 +2701,9 @@ dependencies = [ [[package]] name = "swc_graph_analyzer" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf3d51c57b19a2c1eb0519f8ef789eb386fe98700e7fa73fb78d27ef99bd00d" +checksum = "67696e05cdf3efc1daded3b4803639da25fd9254ca6bae16539058197a411de8" dependencies = [ "ahash", "auto_impl", @@ -2594,9 +2759,9 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1371a950402552de1a2bf7beeb619b7fff9e4ab7e50f516db9a791869a4f731f" +checksum = "da20626dc319879e74f01c26c5fb79548142f8bc4a558953c55b9e71a89ea96c" dependencies = [ "tracing", ] @@ -2670,11 +2835,21 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "testing" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27fb20163feffc42ee490fc7ef113b187ab09fa4e632e2cec649bce76cd40662" +checksum = "41a90d2d2c743fc9b81b9632fdf31ad0fa110d8b7c4c548811d22863126d9c61" dependencies = [ "ansi_term", "difference", @@ -2683,6 +2858,7 @@ dependencies = [ "regex", "serde_json", "swc_common", + "swc_error_reporters", "testing_macros", "tracing", "tracing-subscriber", @@ -2704,6 +2880,17 @@ dependencies = [ "syn", ] +[[package]] +name = "textwrap" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.30" @@ -2850,6 +3037,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4285d92be83dfbc8950a2601178b89ed36f979ebf51bfcf7b272b17001184e6c" +[[package]] +name = "unicode-linebreak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f" +dependencies = [ + "regex", +] + [[package]] name = "unicode-normalization" version = "0.1.19" @@ -2947,7 +3143,7 @@ dependencies = [ "serde_json", "swc", "swc_common", - "swc_ecmascript", + "swc_ecmascript 0.136.0", "tracing", "wasm-bindgen", "wasm-bindgen-futures", diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 4e5e5be3b190c9d..7e87b0651960c46 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -20,12 +20,12 @@ regex = "1.5" serde = "1" serde_json = "1" styled_components = "0.19.0" -swc = "0.150.1" +swc = "0.157.0" swc_atoms = "0.2.9" -swc_common = {version = "0.17.15", features = ["concurrent", "sourcemap"]} +swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } swc_css = "0.100.0" -swc_ecma_loader = {version = "0.29.0", features = ["node", "lru"]} -swc_ecmascript = {version = "0.132.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"]} +swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } +swc_ecmascript = { version = "0.136.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" swc_stylis = "0.96.1" swc_cached = "0.1.1" @@ -33,6 +33,6 @@ tracing = {version = "0.1.28", features = ["release_max_level_off"]} handlebars = "4.2.1" [dev-dependencies] -swc_ecma_transforms_testing = "0.69.0" -testing = "0.18.1" +swc_ecma_transforms_testing = "0.72.0" +testing = "0.19.1" walkdir = "2.3.2" diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index 49df284fbfab9e7..26f1f872e2914cf 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -16,12 +16,12 @@ next-swc = {version = "0.0.0", path = "../core"} once_cell = "1.8.0" serde = "1" serde_json = "1" -swc = "0.150.1" +swc = "0.157.0" swc_atoms = "0.2.9" -swc_bundler = {version = "0.122.0", features = ["concurrent"]} -swc_common = {version = "0.17.15", features = ["concurrent", "sourcemap"]} -swc_ecma_loader = {version = "0.29.0", features = ["node", "lru"]} -swc_ecmascript = {version = "0.132.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"]} +swc_bundler = { version = "0.126.0", features = ["concurrent"] } +swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } +swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } +swc_ecmascript = { version = "0.136.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" [build-dependencies] diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index 2cbe0ad7f150729..bada069b2fd0c82 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -16,9 +16,9 @@ parking_lot_core = "=0.8.0" path-clean = "0.1" serde = {version = "1", features = ["derive"]} serde_json = "1" -swc = "0.150.1" -swc_common = {version = "0.17.14", features = ["concurrent", "sourcemap"]} -swc_ecmascript = {version = "0.132.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"]} +swc = "0.157.0" +swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } +swc_ecmascript = { version = "0.136.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" From 00885c161869887ab742b9e9a9b2cc6d0d33d136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 17 Mar 2022 19:38:42 +0900 Subject: [PATCH 02/24] fixup --- packages/next-swc/Cargo.lock | 220 ++++++++--------------- packages/next-swc/crates/core/Cargo.toml | 2 +- 2 files changed, 73 insertions(+), 149 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 25e7f108ee0cd76..bb1e0d2a2830f8f 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -1015,7 +1015,7 @@ dependencies = [ "swc_css", "swc_ecma_loader", "swc_ecma_transforms_testing", - "swc_ecmascript 0.136.0", + "swc_ecmascript", "swc_node_base", "swc_stylis", "testing", @@ -1042,7 +1042,7 @@ dependencies = [ "swc_bundler", "swc_common", "swc_ecma_loader", - "swc_ecmascript 0.136.0", + "swc_ecmascript", "swc_node_base", ] @@ -1877,9 +1877,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "styled_components" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0b885062c11468ffdb110b837f0cab89d34e3cbb5dade150ad1f4ce1ba04d" +checksum = "0ef6179aa31d83e43dcaec697bf076d4cc33e6567f51b1bdd4dd56d3a1e8922b" dependencies = [ "Inflector", "once_cell", @@ -1887,7 +1887,7 @@ dependencies = [ "serde", "swc_atoms", "swc_common", - "swc_ecmascript 0.132.1", + "swc_ecmascript", "tracing", ] @@ -1942,21 +1942,21 @@ dependencies = [ "swc_atoms", "swc_cached", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_ext_transforms", "swc_ecma_lints", "swc_ecma_loader", "swc_ecma_minifier", - "swc_ecma_parser 0.95.1", + "swc_ecma_parser", "swc_ecma_preset_env", "swc_ecma_transforms", "swc_ecma_transforms_base", "swc_ecma_transforms_compat", "swc_ecma_transforms_optimization", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", - "swc_ecmascript 0.136.0", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_ecmascript", "swc_error_reporters", "swc_node_comments", "swc_visit", @@ -1994,14 +1994,14 @@ dependencies = [ "retain_mut", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_loader", - "swc_ecma_parser 0.95.1", + "swc_ecma_parser", "swc_ecma_transforms_base", "swc_ecma_transforms_optimization", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", "swc_fast_graph", "swc_graph_analyzer", "tracing", @@ -2142,21 +2142,6 @@ dependencies = [ "swc_visit", ] -[[package]] -name = "swc_ecma_ast" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35d736b61d3dceb5a4e18a86d69bfc352aa7136fd3c5a6c2f3353231cd9d839" -dependencies = [ - "is-macro", - "num-bigint", - "serde", - "string_enum", - "swc_atoms", - "swc_common", - "unicode-id", -] - [[package]] name = "swc_ecma_ast" version = "0.71.0" @@ -2186,7 +2171,7 @@ dependencies = [ "sourcemap", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_codegen_macros", "tracing", ] @@ -2213,9 +2198,9 @@ dependencies = [ "phf", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2233,9 +2218,9 @@ dependencies = [ "serde", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2278,38 +2263,18 @@ dependencies = [ "swc_atoms", "swc_cached", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_codegen", - "swc_ecma_parser 0.95.1", + "swc_ecma_parser", "swc_ecma_transforms", "swc_ecma_transforms_base", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", "swc_timer", "tracing", "unicode-id", ] -[[package]] -name = "swc_ecma_parser" -version = "0.93.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bcc4ebfd0c5f7c9e5fd03b3dff680d61e997e51147e6f4738ee3274be5ad382" -dependencies = [ - "either", - "enum_kind", - "lexical", - "num-bigint", - "serde", - "smallvec", - "swc_atoms", - "swc_common", - "swc_ecma_ast 0.70.0", - "tracing", - "typed-arena", - "unicode-id", -] - [[package]] name = "swc_ecma_parser" version = "0.95.1" @@ -2324,7 +2289,7 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "tracing", "typed-arena", "unicode-id", @@ -2349,10 +2314,10 @@ dependencies = [ "string_enum", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_transforms", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2363,7 +2328,7 @@ checksum = "7e19aa898a63dbee9ae4abb505716bc146c55d6ad9e627d617b16bfc827dd36f" dependencies = [ "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_transforms_base", "swc_ecma_transforms_compat", "swc_ecma_transforms_module", @@ -2371,8 +2336,8 @@ dependencies = [ "swc_ecma_transforms_proposal", "swc_ecma_transforms_react", "swc_ecma_transforms_typescript", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2389,10 +2354,10 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", - "swc_ecma_parser 0.95.1", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_utils", + "swc_ecma_visit", "tracing", ] @@ -2404,10 +2369,10 @@ checksum = "3c16df5d4468e8f54b89eccf0876337c4c672b6434092ec83e71e7c678d1fdd3" dependencies = [ "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_transforms_base", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2426,12 +2391,12 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_transforms_base", "swc_ecma_transforms_classes", "swc_ecma_transforms_macros", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", "swc_trace_macro", "tracing", ] @@ -2464,12 +2429,12 @@ dependencies = [ "swc_atoms", "swc_cached", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_loader", - "swc_ecma_parser 0.95.1", + "swc_ecma_parser", "swc_ecma_transforms_base", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", "tracing", ] @@ -2487,12 +2452,12 @@ dependencies = [ "serde_json", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", - "swc_ecma_parser 0.95.1", + "swc_ecma_ast", + "swc_ecma_parser", "swc_ecma_transforms_base", "swc_ecma_transforms_macros", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", "tracing", ] @@ -2507,12 +2472,12 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_transforms_base", "swc_ecma_transforms_classes", "swc_ecma_transforms_macros", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2532,12 +2497,12 @@ dependencies = [ "string_enum", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", - "swc_ecma_parser 0.95.1", + "swc_ecma_ast", + "swc_ecma_parser", "swc_ecma_transforms_base", "swc_ecma_transforms_macros", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2553,12 +2518,12 @@ dependencies = [ "serde_json", "sha-1 0.10.0", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_codegen", - "swc_ecma_parser 0.95.1", + "swc_ecma_parser", "swc_ecma_transforms_base", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", "tempfile", "testing", ] @@ -2572,26 +2537,11 @@ dependencies = [ "serde", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_transforms_base", "swc_ecma_transforms_react", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", -] - -[[package]] -name = "swc_ecma_utils" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43689c9f051b48c4ea9eb86b236b27277594a9c4311d3ee88d7007f5d65b1ff5" -dependencies = [ - "indexmap", - "once_cell", - "swc_atoms", - "swc_common", - "swc_ecma_ast 0.70.0", - "swc_ecma_visit 0.56.0", - "tracing", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -2605,22 +2555,8 @@ dependencies = [ "rayon", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", - "swc_ecma_visit 0.57.0", - "tracing", -] - -[[package]] -name = "swc_ecma_visit" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b70316301b54ead435ae2660824ba3049de1854710b73395e1b8e615dc0bca6" -dependencies = [ - "num-bigint", - "swc_atoms", - "swc_common", - "swc_ecma_ast 0.70.0", - "swc_visit", + "swc_ecma_ast", + "swc_ecma_visit", "tracing", ] @@ -2633,36 +2569,24 @@ dependencies = [ "num-bigint", "swc_atoms", "swc_common", - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_visit", "tracing", ] -[[package]] -name = "swc_ecmascript" -version = "0.132.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa1f0e2b8bcb94f30b276c633743e6d2cf06e5ceb0561fe1bb55d47d020921e" -dependencies = [ - "swc_ecma_ast 0.70.0", - "swc_ecma_parser 0.93.0", - "swc_ecma_utils 0.72.0", - "swc_ecma_visit 0.56.0", -] - [[package]] name = "swc_ecmascript" version = "0.136.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eb75ac51d44c811e4527ce30873a8ef1bd8f2435e33ec6a5dc62936dbfdc451" dependencies = [ - "swc_ecma_ast 0.71.0", + "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_minifier", - "swc_ecma_parser 0.95.1", + "swc_ecma_parser", "swc_ecma_transforms", - "swc_ecma_utils 0.74.0", - "swc_ecma_visit 0.57.0", + "swc_ecma_utils", + "swc_ecma_visit", ] [[package]] @@ -3143,7 +3067,7 @@ dependencies = [ "serde_json", "swc", "swc_common", - "swc_ecmascript 0.136.0", + "swc_ecmascript", "tracing", "wasm-bindgen", "wasm-bindgen-futures", diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 7e87b0651960c46..b7ece2eeb880789 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -19,7 +19,7 @@ radix_fmt = "1" regex = "1.5" serde = "1" serde_json = "1" -styled_components = "0.19.0" +styled_components = "0.20.0" swc = "0.157.0" swc_atoms = "0.2.9" swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } From dff8eaa831febecb3400522104e2f59023c8a6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 17 Mar 2022 19:42:31 +0900 Subject: [PATCH 03/24] fix type --- .../next-swc/crates/napi/src/bundle/mod.rs | 139 ++++++++++-------- packages/next-swc/crates/napi/src/minify.rs | 30 +++- packages/next-swc/crates/napi/src/parse.rs | 29 ++-- .../next-swc/crates/napi/src/transform.rs | 124 +++++++++------- packages/next-swc/crates/wasm/src/lib.rs | 80 +++++----- 5 files changed, 231 insertions(+), 171 deletions(-) diff --git a/packages/next-swc/crates/napi/src/bundle/mod.rs b/packages/next-swc/crates/napi/src/bundle/mod.rs index 9599693d94a1629..b89f8df3a243135 100644 --- a/packages/next-swc/crates/napi/src/bundle/mod.rs +++ b/packages/next-swc/crates/napi/src/bundle/mod.rs @@ -10,7 +10,11 @@ use std::{collections::HashMap, path::PathBuf, sync::Arc}; 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}; +use swc_common::{ + collections::AHashMap, + errors::{ColorConfig, Handler}, + BytePos, FileName, SourceMap, Span, +}; use swc_ecma_loader::{ resolvers::{lru::CachingResolver, node::NodeModulesResolver}, TargetEnv, NODE_BUILTINS, @@ -52,71 +56,78 @@ impl Task for BundleTask { fn compute(&mut self) -> napi::Result { let option: BundleOption = crate::util::deserialize_json(&self.config).convert_err()?; - try_with_handler(self.c.cm.clone(), true, |handler| { - let builtins = NODE_BUILTINS - .iter() - .copied() - .map(JsWord::from) - .collect::>(); - - let comments = self.c.comments().clone(); - // - let mut bundler = Bundler::new( - self.c.globals(), - self.c.cm.clone(), - CustomLoader { - cm: self.c.cm.clone(), - handler, - }, - make_resolver(), - swc_bundler::Config { - require: true, - disable_inliner: false, - external_modules: builtins, - module: swc_bundler::ModuleType::Es, - ..Default::default() - }, - Box::new(CustomHook), - ); - - let mut entries = HashMap::default(); - let path: PathBuf = option.entry; - let path = path - .canonicalize() - .context("failed to canonicalize entry file")?; - entries.insert("main".to_string(), FileName::Real(path)); - let outputs = bundler.bundle(entries)?; - - let output = outputs - .into_iter() - .next() - .ok_or_else(|| anyhow!("swc_bundler::Bundle::bundle returned empty result"))?; - - let source_map_names = { - let mut v = SourceMapIdentCollector { - names: Default::default(), + try_with_handler( + self.c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: true, + }, + |handler| { + let builtins = NODE_BUILTINS + .iter() + .copied() + .map(JsWord::from) + .collect::>(); + + let comments = self.c.comments().clone(); + // + let mut bundler = Bundler::new( + self.c.globals(), + self.c.cm.clone(), + CustomLoader { + cm: self.c.cm.clone(), + handler, + }, + make_resolver(), + swc_bundler::Config { + require: true, + disable_inliner: false, + external_modules: builtins, + module: swc_bundler::ModuleType::Es, + ..Default::default() + }, + Box::new(CustomHook), + ); + + let mut entries = HashMap::default(); + let path: PathBuf = option.entry; + let path = path + .canonicalize() + .context("failed to canonicalize entry file")?; + entries.insert("main".to_string(), FileName::Real(path)); + let outputs = bundler.bundle(entries)?; + + let output = outputs + .into_iter() + .next() + .ok_or_else(|| anyhow!("swc_bundler::Bundle::bundle returned empty result"))?; + + let source_map_names = { + let mut v = SourceMapIdentCollector { + names: Default::default(), + }; + + output.module.visit_with(&mut v); + + v.names }; - output.module.visit_with(&mut v); - - v.names - }; - - let code = self.c.print( - &output.module, - None, - None, - true, - EsVersion::Es5, - SourceMapsConfig::Bool(true), - &source_map_names, - None, - false, - Some(&comments), - )?; - - Ok(code) - }) + let code = self.c.print( + &output.module, + None, + None, + true, + EsVersion::Es5, + SourceMapsConfig::Bool(true), + &source_map_names, + None, + false, + Some(&comments), + )?; + + Ok(code) + }, + ) .convert_err() } diff --git a/packages/next-swc/crates/napi/src/minify.rs b/packages/next-swc/crates/napi/src/minify.rs index 32098fbb7352db3..56f4790b762f447 100644 --- a/packages/next-swc/crates/napi/src/minify.rs +++ b/packages/next-swc/crates/napi/src/minify.rs @@ -34,7 +34,7 @@ use napi::{CallContext, JsObject, Task}; use serde::Deserialize; use std::sync::Arc; use swc::{try_with_handler, TransformOutput}; -use swc_common::{sync::Lrc, FileName, SourceFile, SourceMap}; +use swc_common::{errors::ColorConfig, sync::Lrc, FileName, SourceFile, SourceMap}; struct MinifyTask { c: Arc, @@ -76,11 +76,18 @@ impl Task for MinifyTask { type JsValue = JsObject; fn compute(&mut self) -> napi::Result { - try_with_handler(self.c.cm.clone(), true, |handler| { - let fm = self.code.to_file(self.c.cm.clone()); - - self.c.minify(fm, handler, &self.opts) - }) + try_with_handler( + self.c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: true, + }, + |handler| { + let fm = self.code.to_file(self.c.cm.clone()); + + self.c.minify(fm, handler, &self.opts) + }, + ) .convert_err() } @@ -110,8 +117,15 @@ pub fn minify_sync(cx: CallContext) -> napi::Result { let fm = code.to_file(c.cm.clone()); - let output = try_with_handler(c.cm.clone(), true, |handler| c.minify(fm, handler, &opts)) - .convert_err()?; + let output = try_with_handler( + c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: true, + }, + |handler| c.minify(fm, handler, &opts), + ) + .convert_err()?; complete_output(cx.env, output) } diff --git a/packages/next-swc/crates/napi/src/parse.rs b/packages/next-swc/crates/napi/src/parse.rs index 15f64ca04e0081a..3210443953e056d 100644 --- a/packages/next-swc/crates/napi/src/parse.rs +++ b/packages/next-swc/crates/napi/src/parse.rs @@ -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::{comments::Comments, FileName, FilePathMapping, SourceMap}; +use swc_common::{comments::Comments, errors::ColorConfig, FileName, FilePathMapping, SourceMap}; pub struct ParseTask { pub filename: FileName, @@ -31,16 +31,23 @@ impl Task for ParseTask { }; let fm = c.cm.new_source_file(self.filename.clone(), self.src.clone()); - let program = try_with_handler(c.cm.clone(), false, |handler| { - c.parse_js( - fm, - handler, - options.target, - options.syntax, - options.is_module, - comments, - ) - }) + let program = try_with_handler( + c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: false, + }, + |handler| { + c.parse_js( + fm, + handler, + options.target, + options.syntax, + options.is_module, + comments, + ) + }, + ) .convert_err()?; let ast_json = serde_json::to_string(&program) diff --git a/packages/next-swc/crates/napi/src/transform.rs b/packages/next-swc/crates/napi/src/transform.rs index 835392ae91d9a1c..5f5f46d255ce80f 100644 --- a/packages/next-swc/crates/napi/src/transform.rs +++ b/packages/next-swc/crates/napi/src/transform.rs @@ -40,7 +40,7 @@ use std::{ sync::Arc, }; use swc::{try_with_handler, Compiler, TransformOutput}; -use swc_common::{FileName, SourceFile}; +use swc_common::{errors::ColorConfig, FileName, SourceFile}; use swc_ecmascript::ast::Program; use swc_ecmascript::transforms::pass::noop; @@ -65,48 +65,55 @@ impl Task for TransformTask { fn compute(&mut self) -> napi::Result { let res = catch_unwind(AssertUnwindSafe(|| { - try_with_handler(self.c.cm.clone(), true, |handler| { - self.c.run(|| { - let options: TransformOptions = deserialize_json(&self.options)?; - let fm = match &self.input { - Input::Source { src } => { - let filename = if options.swc.filename.is_empty() { - FileName::Anon - } else { - FileName::Real(options.swc.filename.clone().into()) - }; - - self.c.cm.new_source_file(filename, src.to_string()) - } - Input::FromFilename => { - let filename = &options.swc.filename; - if filename.is_empty() { - bail!("no filename is provided via options"); + try_with_handler( + self.c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: true, + }, + |handler| { + self.c.run(|| { + let options: TransformOptions = deserialize_json(&self.options)?; + let fm = match &self.input { + Input::Source { src } => { + let filename = if options.swc.filename.is_empty() { + FileName::Anon + } else { + FileName::Real(options.swc.filename.clone().into()) + }; + + self.c.cm.new_source_file(filename, src.to_string()) } - - self.c.cm.new_source_file( - FileName::Real(filename.into()), - read_to_string(filename).with_context(|| { - format!("Failed to read source code from {}", filename) - })?, - ) - } - }; - let options = options.patch(&fm); - - let cm = self.c.cm.clone(); - let file = fm.clone(); - - self.c.process_js_with_custom_pass( - fm, - None, - handler, - &options.swc, - |_, comments| custom_before_pass(cm, file, &options, comments.clone()), - |_, _| noop(), - ) - }) - }) + Input::FromFilename => { + let filename = &options.swc.filename; + if filename.is_empty() { + bail!("no filename is provided via options"); + } + + self.c.cm.new_source_file( + FileName::Real(filename.into()), + read_to_string(filename).with_context(|| { + format!("Failed to read source code from {}", filename) + })?, + ) + } + }; + let options = options.patch(&fm); + + let cm = self.c.cm.clone(); + let file = fm.clone(); + + self.c.process_js_with_custom_pass( + fm, + None, + handler, + &options.swc, + |_, comments| custom_before_pass(cm, file, &options, comments.clone()), + |_, _| noop(), + ) + }) + }, + ) })) .map_err(|err| { if let Some(s) = err.downcast_ref::() { @@ -174,19 +181,26 @@ where let mut options: TransformOptions = cx.get_deserialized(2)?; options.swc.swcrc = false; - let output = try_with_handler(c.cm.clone(), true, |handler| { - c.run(|| { - if is_module.get_value()? { - let program: Program = - serde_json::from_str(s.as_str()?).context("failed to deserialize Program")?; - c.process_js(handler, program, &options.swc) - } else { - let fm = - op(&c, s.as_str()?.to_string(), &options).context("failed to load file")?; - c.process_js_file(fm, handler, &options.swc) - } - }) - }) + let output = try_with_handler( + c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: true, + }, + |handler| { + c.run(|| { + if is_module.get_value()? { + let program: Program = serde_json::from_str(s.as_str()?) + .context("failed to deserialize Program")?; + c.process_js(handler, program, &options.swc) + } else { + let fm = + op(&c, s.as_str()?.to_string(), &options).context("failed to load file")?; + c.process_js_file(fm, handler, &options.swc) + } + }) + }, + ) .convert_err()?; complete_output(cx.env, output) diff --git a/packages/next-swc/crates/wasm/src/lib.rs b/packages/next-swc/crates/wasm/src/lib.rs index 0383106c82eee1a..44803981a1fb1f1 100644 --- a/packages/next-swc/crates/wasm/src/lib.rs +++ b/packages/next-swc/crates/wasm/src/lib.rs @@ -3,7 +3,7 @@ use next_swc::{custom_before_pass, TransformOptions}; use once_cell::sync::Lazy; use std::sync::Arc; use swc::{config::JsMinifyOptions, try_with_handler, Compiler}; -use swc_common::{FileName, FilePathMapping, SourceMap}; +use swc_common::{errors::ColorConfig, FileName, FilePathMapping, SourceMap}; use swc_ecmascript::transforms::pass::noop; use wasm_bindgen::prelude::*; @@ -17,16 +17,23 @@ pub fn minify_sync(s: &str, opts: JsValue) -> Result { let c = compiler(); - try_with_handler(c.cm.clone(), false, |handler| { - let opts: JsMinifyOptions = opts.into_serde().context("failed to parse options")?; + try_with_handler( + c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: false, + }, + |handler| { + let opts: JsMinifyOptions = opts.into_serde().context("failed to parse options")?; - let fm = c.cm.new_source_file(FileName::Anon, s.into()); - let program = c - .minify(fm, handler, &opts) - .context("failed to minify file")?; + let fm = c.cm.new_source_file(FileName::Anon, s.into()); + let program = c + .minify(fm, handler, &opts) + .context("failed to minify file")?; - JsValue::from_serde(&program).context("failed to serialize json") - }) + JsValue::from_serde(&program).context("failed to serialize json") + }, + ) .map_err(convert_err) } @@ -36,32 +43,39 @@ pub fn transform_sync(s: &str, opts: JsValue) -> Result { let c = compiler(); - try_with_handler(c.cm.clone(), false, |handler| { - let opts: TransformOptions = opts.into_serde().context("failed to parse options")?; + try_with_handler( + c.cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: false, + }, + |handler| { + let opts: TransformOptions = opts.into_serde().context("failed to parse options")?; - let fm = c.cm.new_source_file( - if opts.swc.filename.is_empty() { - FileName::Anon - } else { - FileName::Real(opts.swc.filename.clone().into()) - }, - s.into(), - ); - let cm = c.cm.clone(); - let file = fm.clone(); - let out = c - .process_js_with_custom_pass( - fm, - None, - handler, - &opts.swc, - |_, comments| custom_before_pass(cm, file, &opts, comments.clone()), - |_, _| noop(), - ) - .context("failed to process js file")?; + let fm = c.cm.new_source_file( + if opts.swc.filename.is_empty() { + FileName::Anon + } else { + FileName::Real(opts.swc.filename.clone().into()) + }, + s.into(), + ); + let cm = c.cm.clone(); + let file = fm.clone(); + let out = c + .process_js_with_custom_pass( + fm, + None, + handler, + &opts.swc, + |_, comments| custom_before_pass(cm, file, &opts, comments.clone()), + |_, _| noop(), + ) + .context("failed to process js file")?; - JsValue::from_serde(&out).context("failed to serialize json") - }) + JsValue::from_serde(&out).context("failed to serialize json") + }, + ) .map_err(convert_err) } From 86cdd7303b67a11a2828ef156fd88fb88ea38dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 17 Mar 2022 19:44:14 +0900 Subject: [PATCH 04/24] Update test refs --- .../next-dynamic/no-arguments/output.stderr | 10 +++++----- .../options-as-variable/output.stderr | 12 ++++++------ .../too-many-arguments/output.stderr | 10 +++++----- .../output.stderr | 10 +++++----- .../output.stderr | 10 +++++----- .../output.stderr | 10 +++++----- .../output.stderr | 10 +++++----- .../re-export-all/output.stderr | 12 ++++++------ .../errors/styled-jsx/no-child/output.stderr | 13 ++++++------- .../ts-with-css-resolve/output.stderr | 2 +- .../styled-jsx/two-children/output.stderr | 17 ++++++++--------- .../styled-jsx/wrong-child-type/output.stderr | 15 +++++++-------- .../wrong-jsx-expression-type/output.stderr | 15 +++++++-------- .../css-selector-after-pseudo/output.js | 2 +- .../fixture/styled-jsx/tpl-escape-1/output.js | 2 +- .../styled-jsx/transform-css-global/output.js | 2 +- .../transform-css-media-query/output.js | 2 +- .../styled-jsx/transform-css-normal/output.js | 2 +- .../fixture/styled-jsx/transform-css/output.js | 2 +- 19 files changed, 77 insertions(+), 81 deletions(-) diff --git a/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr b/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr index b5d30ef53c63a25..a84b428c6441e4f 100644 --- a/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr @@ -1,6 +1,6 @@ -error: next/dynamic requires at least one argument - --> input.js:3:26 - | -3 | const DynamicComponent = dynamic() - | ^^^^^^^ + x next/dynamic requires at least one argument + ,-[input.js:4:1] + 4 | const DynamicComponent = dynamic() + : ^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr b/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr index bd5f7a7ac0691d6..81d8ce0d542f6a1 100644 --- a/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr @@ -1,7 +1,7 @@ -error: next/dynamic options must be an object literal. -Read more: https://nextjs.org/docs/messages/invalid-dynamic-options-type - --> input.js:4:43 - | -4 | const DynamicComponentWithCustomLoading = dynamic( - | ^^^^^^^ + x next/dynamic options must be an object literal. + | Read more: https://nextjs.org/docs/messages/invalid-dynamic-options-type + ,-[input.js:5:1] + 5 | const DynamicComponentWithCustomLoading = dynamic( + : ^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr b/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr index 08bd41dd777a666..3e428c720583a3f 100644 --- a/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr @@ -1,6 +1,6 @@ -error: next/dynamic only accepts 2 arguments - --> input.js:3:43 - | -3 | const DynamicComponentWithCustomLoading = dynamic( - | ^^^^^^^ + x next/dynamic only accepts 2 arguments + ,-[input.js:4:1] + 4 | const DynamicComponentWithCustomLoading = dynamic( + : ^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr index 4a25a83a2d9c8f0..3fb78077db1d3d4 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr @@ -1,6 +1,6 @@ -error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - --> input.js:2:14 - | -2 | export const getServerSideProps = function getServerSideProps() {} - | ^^^^^^^^^^^^^^^^^^ + x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps + ,-[input.js:3:1] + 3 | export const getServerSideProps = function getServerSideProps() {} + : ^^^^^^^^^^^^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr index bd20bf0f375c65c..e14c2069736734b 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr @@ -1,6 +1,6 @@ -error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - --> input.js:2:15 - | -2 | export { a as getServerSideProps } - | ^^^^^^^^^^^^^^^^^^ + x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps + ,-[input.js:3:1] + 3 | export { a as getServerSideProps } + : ^^^^^^^^^^^^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr index 1421011ac538bdd..eafac0e544a5b7b 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr @@ -1,6 +1,6 @@ -error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - --> input.js:2:10 - | -2 | export { getStaticPaths } from 'a' - | ^^^^^^^^^^^^^^ + x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps + ,-[input.js:3:1] + 3 | export { getStaticPaths } from 'a' + : ^^^^^^^^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr index fc47fa620d9819b..2bcc19898547b39 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr @@ -1,6 +1,6 @@ -error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - --> input.js:1:26 - | -1 | export { getStaticProps, getServerSideProps } - | ^^^^^^^^^^^^^^^^^^ + x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps + ,-[input.js:2:1] + 2 | export { getStaticProps, getServerSideProps } + : ^^^^^^^^^^^^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr b/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr index 70bda10dcbfcced..7e2a401874df182 100644 --- a/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr @@ -1,7 +1,7 @@ -error: Using `export * from '...'` in a page is disallowed. Please use `export { default } from '...'` instead. -Read more: https://nextjs.org/docs/messages/export-all-in-page - --> input.js:1:1 - | -1 | export * from './other-page' - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + x Using `export * from '...'` in a page is disallowed. Please use `export { default } from '...'` instead. + | Read more: https://nextjs.org/docs/messages/export-all-in-page + ,-[input.js:2:1] + 2 | export * from './other-page' + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr index 12d9b29530909dc..8b048525e4e07a4 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr @@ -1,8 +1,7 @@ -error: Expected one child under JSX style tag, but got 0. -Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - --> input.js:3:5 - | -3 | / - | |____________^ + x Expected one child under JSX style tag, but got 0. + | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children + ,-[input.js:4:5] + 4 | ,-> + `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/ts-with-css-resolve/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/ts-with-css-resolve/output.stderr index a385d7d634ad526..ad7185a0bc3debd 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/ts-with-css-resolve/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/ts-with-css-resolve/output.stderr @@ -1,2 +1,2 @@ -error: /some-project/src/some-file.ts uses `css.resolve`, but ends with `.ts`. The file extension needs to be `.tsx` so that the jsx injected by `css.resolve` will be transformed. + x /some-project/src/some-file.ts uses `css.resolve`, but ends with `.ts`. The file extension needs to be `.tsx` so that the jsx injected by `css.resolve` will be transformed. diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr index f3be75c7f701045..a4fb3b041a8a401 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr @@ -1,10 +1,9 @@ -error: Expected one child under JSX style tag, but got 2. -Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - --> input.js:3:5 - | -3 | / - | |____________^ + x Expected one child under JSX style tag, but got 2. + | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children + ,-[input.js:4:5] + 4 | ,-> + `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr index 99302a72a0969d3..efd0c72b2300cec 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr @@ -1,9 +1,8 @@ -error: Expected a single child of type JSXExpressionContainer under JSX Style tag. -Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - --> input.js:3:5 - | -3 | / - | |____________^ + x Expected a single child of type JSXExpressionContainer under JSX Style tag. + | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children + ,-[input.js:4:5] + 4 | ,-> + `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr index c67a7522cb7cbe5..4dd9e08f3efb50a 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr @@ -1,9 +1,8 @@ -error: Expected a template literal, string or identifier inside the JSXExpressionContainer. -Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - --> input.js:3:5 - | -3 | / - | |____________^ + x Expected a template literal, string or identifier inside the JSXExpressionContainer. + | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children + ,-[input.js:4:5] + 4 | ,-> + `---- diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js index f47634829c69da2..482c1150fd2b88e 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js @@ -4,7 +4,7 @@ function NavigationItem({ active , className , }) { active }, className, "navigation-item") || "")}> - <_JSXStyle id={"2342aae4628612c6"}>{".navigation-item.jsx-2342aae4628612c6 a::after{content:attr(data-text);content:attr(data-text)/\"\"}"} + <_JSXStyle id={"2342aae4628612c6"}>{'.navigation-item.jsx-2342aae4628612c6 a::after{content:attr(data-text);content:attr(data-text)/""}'} ; } diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-1/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-1/output.js index b12af6f02d53d18..dac32b1dded4e28 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-1/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-1/output.js @@ -5,7 +5,7 @@ export default class {

test

- <_JSXStyle id={"1f6cef12199c3a8f"}>{"p.jsx-1f6cef12199c3a8f{content:\"`\"}"} + <_JSXStyle id={"1f6cef12199c3a8f"}>{'p.jsx-1f6cef12199c3a8f{content:"`"}'} ; } diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js index b9405bfa115039c..588d5bab13cb475 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js @@ -3,7 +3,7 @@ export default (()=>

test

- <_JSXStyle id={"53fd644ab080300c"}>{"html.jsx-53fd644ab080300c{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-53fd644ab080300c{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Helvetica,Arial,sans-serif}"} + <_JSXStyle id={"53fd644ab080300c"}>{'html.jsx-53fd644ab080300c{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-53fd644ab080300c{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif}'}
); diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-media-query/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-media-query/output.js index c5a6b455fb26a8c..dd5be360a2b96d7 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-media-query/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-media-query/output.js @@ -3,7 +3,7 @@ export default (()=>

test

- <_JSXStyle id={"1f7963ae04c6466a"}>{"@media(min-width:1px)and (max-width:768px){[class*=\"grid__col--\"].jsx-1f7963ae04c6466a{margin-top:12px;margin-bottom:12px}}@media(max-width:64em){.test.jsx-1f7963ae04c6466a{margin-bottom:1em}@supports(-moz-appearance:none)and (display:contents){.test.jsx-1f7963ae04c6466a{margin-bottom:2rem}}}"} + <_JSXStyle id={"1f7963ae04c6466a"}>{'@media(min-width:1px)and (max-width:768px){[class*="grid__col--"].jsx-1f7963ae04c6466a{margin-top:12px;margin-bottom:12px}}@media(max-width:64em){.test.jsx-1f7963ae04c6466a{margin-bottom:1em}@supports(-moz-appearance:none)and (display:contents){.test.jsx-1f7963ae04c6466a{margin-bottom:2rem}}}'}
); diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-normal/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-normal/output.js index 98a03ea47b4ca77..ae45a6a15a55cfe 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-normal/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-normal/output.js @@ -3,7 +3,7 @@ export default (()=>

test

- <_JSXStyle id={"1a19bb4817c105dd"}>{"p.jsx-1a19bb4817c105dd{color:red}p.jsx-1a19bb4817c105dd{color:red}*.jsx-1a19bb4817c105dd{color:blue}[href=\"woot\"].jsx-1a19bb4817c105dd{color:red}"} + <_JSXStyle id={"1a19bb4817c105dd"}>{'p.jsx-1a19bb4817c105dd{color:red}p.jsx-1a19bb4817c105dd{color:red}*.jsx-1a19bb4817c105dd{color:blue}[href="woot"].jsx-1a19bb4817c105dd{color:red}'}
); diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js index 125cdf0c79534ab..aa8450ad2056fd7 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js @@ -3,7 +3,7 @@ export default (()=>

test

- <_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{-webkit-box-shadow:0 0 10px black,inset 0 0 5px black;-moz-box-shadow:0 0 10px black,inset 0 0 5px black;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 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{-webkit-box-shadow:0 0 10px black,inset 0 0 5px black;-moz-box-shadow:0 0 10px black,inset 0 0 5px black;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}}}'}
); From 77fa896d2d023845db4ba4696415730613bf0e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 17 Mar 2022 19:45:55 +0900 Subject: [PATCH 05/24] Update css crates --- packages/next-swc/Cargo.lock | 28 ++++++++++++------------ packages/next-swc/crates/core/Cargo.toml | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index bb1e0d2a2830f8f..c26461e13afc632 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -2054,9 +2054,9 @@ dependencies = [ [[package]] name = "swc_css" -version = "0.100.0" +version = "0.103.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd76b4fffe5f5615e167985283e5581d3bf87ab41e388d0c486719d52ce0f1b3" +checksum = "35b5f2bb2b2845da367ce7343e8c4821849694d4294fd54cdd8663bb08d04ac0" dependencies = [ "swc_css_ast", "swc_css_codegen", @@ -2067,9 +2067,9 @@ dependencies = [ [[package]] name = "swc_css_ast" -version = "0.90.0" +version = "0.91.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae602751d820bba386fb525d38f4bfdc5e5a5db8b02318c4742ab931d894f3" +checksum = "f124ebd2d7588bb68e7902485a497a7f0e7e9876f113cd3f9f366a7bbb5bf7b4" dependencies = [ "is-macro", "serde", @@ -2080,9 +2080,9 @@ dependencies = [ [[package]] name = "swc_css_codegen" -version = "0.97.0" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b975558fe80ad6246930d3bf027c58df9fdab5e112461805c03a2ea8db8279" +checksum = "895cfa7ee88d809ecefb9af9da2c1c8c2f45e58e303967cfe0aaa96d319064d7" dependencies = [ "auto_impl", "bitflags", @@ -2107,9 +2107,9 @@ dependencies = [ [[package]] name = "swc_css_parser" -version = "0.97.0" +version = "0.99.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44d90bcf8a6d8668c2d1e691a5101fa599a6fff0a82088e0b3f56214e1d9bae" +checksum = "c7b306eb9375370f47c252d4f41068e0ca9e8d3f0d365142ba44be95287db149" dependencies = [ "bitflags", "lexical", @@ -2120,9 +2120,9 @@ dependencies = [ [[package]] name = "swc_css_utils" -version = "0.87.0" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f039d24094d6d8a65347ef5004aa2adb7b11dffd463af5d5c8b87481ee94ee4d" +checksum = "e57af5708496f58a8777f1e23b82fcb8745404a480fb5588a9ed57baf48c5bbe" dependencies = [ "swc_atoms", "swc_common", @@ -2132,9 +2132,9 @@ dependencies = [ [[package]] name = "swc_css_visit" -version = "0.89.0" +version = "0.90.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5557d81524c4ff0ca3be95ba699802105d016b7f72f35b746c231acfb95cda72" +checksum = "c60ac83b8c5ffc8e3ff1c2fb60036f30d7a747534df55d2f05bb01c66ed83427" dependencies = [ "swc_atoms", "swc_common", @@ -2670,9 +2670,9 @@ dependencies = [ [[package]] name = "swc_stylis" -version = "0.96.1" +version = "0.99.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d340493d65755389290f669345d044eebfff59f3009b14e8d09e54806d7126" +checksum = "934358a12d57f2507a0a19bec13b573fe9236b01551417d0882d6364324527bf" dependencies = [ "swc_atoms", "swc_common", diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index b7ece2eeb880789..5b1915eccbe8834 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -23,12 +23,12 @@ styled_components = "0.20.0" swc = "0.157.0" swc_atoms = "0.2.9" swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } -swc_css = "0.100.0" +swc_css = "0.103.0" swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } swc_ecmascript = { version = "0.136.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" -swc_stylis = "0.96.1" swc_cached = "0.1.1" +swc_stylis = "0.99.1" tracing = {version = "0.1.28", features = ["release_max_level_off"]} handlebars = "4.2.1" From e929dabba6d652924c9fbdcbc551ff735bb025ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Fri, 18 Mar 2022 07:01:46 +0900 Subject: [PATCH 06/24] Update test refs --- .../ReactRefreshLogBox-app-doc.test.ts.snap | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap index e0801a44a5417bc..aadfe37aab9875e 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap @@ -2,17 +2,19 @@ exports[`ReactRefreshLogBox _app syntax error shows logbox 1`] = ` "./pages/_app.js -Error: error: Expression expected - - | -3 | return <; - | ^ +Error: + x Expression expected + ,---- + 4 | return <; + : ^ + \`---- -error: Unexpected token \`jsx name (Component)\`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, \` for template literal, (, or an identifier - - | -3 | return <; - | ^^^^^^^^^ + x Unexpected token \`jsx name (Component)\`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, + | string, regexp, \` for template literal, (, or an identifier + ,---- + 4 | return <; + : ^^^^^^^^^ + \`---- Caused by: 0: failed to process input file @@ -21,11 +23,12 @@ Caused by: exports[`ReactRefreshLogBox _document syntax error shows logbox 1`] = ` "./pages/_document.js -Error: error: Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key - - | -4 | class MyDocument extends Document {{ - | ^ +Error: + x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key + ,---- + 5 | class MyDocument extends Document {{ + : ^ + \`---- Caused by: 0: failed to process input file From 428f759bacc688860404fa3cca13a4933ea1844a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Fri, 18 Mar 2022 07:03:11 +0900 Subject: [PATCH 07/24] Update test refs --- test/integration/no-duplicate-compile-error/test/index.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/integration/no-duplicate-compile-error/test/index.test.js b/test/integration/no-duplicate-compile-error/test/index.test.js index ef82ce65e677753..bdd6715272a4b55 100644 --- a/test/integration/no-duplicate-compile-error/test/index.test.js +++ b/test/integration/no-duplicate-compile-error/test/index.test.js @@ -54,8 +54,7 @@ describe('no duplicate compile error output', () => { return (str.match(regex) || []).length } - const correctMessagesRegex = - /error - [^\r\n]+\r?\n[^\r\n]+Unexpected token/g + const correctMessagesRegex = /Caused by:/g const totalMessagesRegex = /Unexpected token/g const correctMessages = getRegexCount(stderr, correctMessagesRegex) From d4b3aef10cc35a147010d8416d0d17370dbaa2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Fri, 18 Mar 2022 07:30:32 +0900 Subject: [PATCH 08/24] Update test refs --- .../ReactRefreshLogBox.test.ts.snap | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap index 2e00658c9624f5d..7493fc0b501ecaa 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -68,11 +68,12 @@ exports[`ReactRefreshLogBox logbox: can recover from a event handler error 1`] = exports[`ReactRefreshLogBox logbox: can recover from a syntax error without losing state 1`] = ` "./index.js -Error: error: Unexpected eof - - | -1 | export default () =>
runtime error 1`] = ` exports[`ReactRefreshLogBox syntax > runtime error 2`] = ` "./index.js -Error: error: Unexpected eof - - | -8 | export default function FunctionNamed() { - | ^ +Error: + x Unexpected eof + ,---- + 9 | export default function FunctionNamed() { + : ^ + \`---- Caused by: 0: failed to process input file @@ -141,11 +143,12 @@ Caused by: exports[`ReactRefreshLogBox syntax > runtime error 3`] = ` "./index.js -Error: error: Unexpected eof - - | -8 | export default function FunctionNamed() { - | ^ +Error: + x Unexpected eof + ,---- + 9 | export default function FunctionNamed() { + : ^ + \`---- Caused by: 0: failed to process input file @@ -154,11 +157,12 @@ Caused by: exports[`ReactRefreshLogBox unterminated JSX 1`] = ` "./index.js -Error: error: Unexpected eof - - | -9 | - | ^ +Error: + x Unexpected eof + ,---- + 10 | + : ^ + \`---- Caused by: 0: failed to process input file From d29fdf98fb0da96418012a12b8793baa32707640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Fri, 18 Mar 2022 17:35:55 +0900 Subject: [PATCH 09/24] SourceMap --- packages/next-swc/Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index c26461e13afc632..dae141c5800c8e2 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -2159,9 +2159,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.98.0" +version = "0.98.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef9691af1a41fbde638594f2b8593560670adab5c2cc0fd3587481040312797d" +checksum = "a6382f90a3e5ea88e9fe73c1e0afcf31fe5687f78994b39246c2c2bc8bbe51d8" dependencies = [ "bitflags", "memchr", @@ -2416,9 +2416,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.95.0" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40c273cd4344955105824da8de90e0dfb4e41f4059c3a9accc0292b6b2590b6" +checksum = "3189f65f5fa907bce0651e0ef989f8ab6ec4e59f374a8b332ebced0d8b6346b2" dependencies = [ "Inflector", "ahash", From 027809fe1ec94e31970d987158fac1a31da5b49c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Fri, 18 Mar 2022 19:22:52 +0900 Subject: [PATCH 10/24] Fix? --- packages/next-swc/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/next-swc/Cargo.toml b/packages/next-swc/Cargo.toml index 3594053c8aafea8..c3a00dd13c63524 100644 --- a/packages/next-swc/Cargo.toml +++ b/packages/next-swc/Cargo.toml @@ -6,5 +6,8 @@ members = [ "crates/wasm" ] +[profile.dev.package.swc_stylis] +opt-level = 2 + [profile.release] lto = true \ No newline at end of file From e269dca15c5340513604e4ab05d2c352f6286b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 23 Mar 2022 18:08:32 +0900 Subject: [PATCH 11/24] Update crates --- packages/next-swc/Cargo.lock | 96 ++++++++++++------------ packages/next-swc/crates/core/Cargo.toml | 8 +- packages/next-swc/crates/napi/Cargo.toml | 6 +- packages/next-swc/crates/wasm/Cargo.toml | 4 +- 4 files changed, 57 insertions(+), 57 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index dae141c5800c8e2..36f4da67eadde98 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -1877,9 +1877,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "styled_components" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef6179aa31d83e43dcaec697bf076d4cc33e6567f51b1bdd4dd56d3a1e8922b" +checksum = "d6f1e263f5c528c1d99c0372528decab6eea1a79c03eabe9f9c54c4e40eaf743" dependencies = [ "Inflector", "once_cell", @@ -1921,9 +1921,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.157.0" +version = "0.159.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8319b77cca3192abcdf30b4079cd6f4b7c7f38977338c2201a82f600a4ae61da" +checksum = "5e1240ecb3c0844cd41f3004589acc0bba88bff7bff4b304059902dcbe2983a0" dependencies = [ "ahash", "anyhow", @@ -1975,9 +1975,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.126.0" +version = "0.128.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ea74e5ef114af5122544d39e5f93637c0c43cee39fe473376932f9a25a5d19d" +checksum = "c5b99c7e79fff6f6a2831632cf2863758ad9d9cb6c7a313d65f1cfa9af9b79f3" dependencies = [ "ahash", "anyhow", @@ -2024,9 +2024,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.17.17" +version = "0.17.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7935aededdf361eb17ba3ddde021ad0df4774c5b5d902e7b0f6faae7c76d748a" +checksum = "278ad1cbb3fb3b2686c86a7dd5f307ef791918d249a6da60fa6cd3388f4c6a78" dependencies = [ "ahash", "ast_node", @@ -2144,9 +2144,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.71.0" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae7b943caae6d3fbae0534ce2df9866efa3d0415199ce7d20c6ef7e4e0b233d" +checksum = "14d97203319ad53b587a1ca3166a8e7446ee3911eea67d836a279c982652c8b1" dependencies = [ "is-macro", "num-bigint", @@ -2159,9 +2159,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.98.1" +version = "0.99.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6382f90a3e5ea88e9fe73c1e0afcf31fe5687f78994b39246c2c2bc8bbe51d8" +checksum = "4db28818448161d5992e1d0d2b79653b4399459618756119e9a04c2dd787221f" dependencies = [ "bitflags", "memchr", @@ -2191,9 +2191,9 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.60.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7a436ad852546283700342874e1ea7a07c61a970d718b208a0f9382d057658" +checksum = "0c1e24dd6f333977b5f8208538ae97d6f10ef58a4750d5fe7838119389a51f45" dependencies = [ "phf", "swc_atoms", @@ -2205,9 +2205,9 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc6b352c12aa6a62aeff792785894516e67c1d2d32a7b3f8f654b8bbdd2fb56" +checksum = "af98897f867073ad7d3d551689bcd4d42bfd4fc2dbd0b83d240cc0a046449d46" dependencies = [ "ahash", "auto_impl", @@ -2246,9 +2246,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.93.0" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f58bc0fcbf58ed233084cf2e23da55924686c3c231fd2a6574949de6cdbe9e0" +checksum = "45e929f67238c6f3f2335c2a831c13e1156e22bbd7c1a9be7025cf2dfed1d585" dependencies = [ "ahash", "indexmap", @@ -2277,9 +2277,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.95.1" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bbca18d756dddd0a87e101dd07157cd466a22787e9b5447ab85da2faa352bd8" +checksum = "4df352b7979ad7fc29f216bdfa10727b2ecaa781e0e89a585acf51aec15ed9c4" dependencies = [ "either", "enum_kind", @@ -2297,9 +2297,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.110.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d8929f9552fd9c324a8b22765dfa50b789f0e0069757f3480ececfb11b5136" +checksum = "ae1d2d90d78983c1e5bdd71a3f22be851d06ca24157844d5ef5397375abe28d8" dependencies = [ "ahash", "anyhow", @@ -2322,9 +2322,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.135.0" +version = "0.137.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e19aa898a63dbee9ae4abb505716bc146c55d6ad9e627d617b16bfc827dd36f" +checksum = "199e27cf668cd13cb1e6ebff963f7353aa541f67f2ee48a2688ca65dd08e40ed" dependencies = [ "swc_atoms", "swc_common", @@ -2342,9 +2342,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.70.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0e50e1414e15cc7b909fb8c79c8b2d9988b83aabe8114fa09a730123c2558c" +checksum = "9167dd43047162d06251beb8a61cad09e87b27fb400f0753ce30f67920182ed1" dependencies = [ "better_scoped_tls", "once_cell", @@ -2363,9 +2363,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.58.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c16df5d4468e8f54b89eccf0876337c4c672b6434092ec83e71e7c678d1fdd3" +checksum = "d831b06b4c214a5edbcac97ef2c6a9b66827115dea1921f4fc3aeec91c03e50e" dependencies = [ "swc_atoms", "swc_common", @@ -2377,9 +2377,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.83.0" +version = "0.84.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cb92c67a689037b6320bb2e0a421b5c74bfd297f59cfd7c71c0128ff23de02" +checksum = "f4547883c1c5ff8fb742fe88e68bce30baa3f2f22be3beb94a5fcbb695565678" dependencies = [ "ahash", "arrayvec 0.7.2", @@ -2416,9 +2416,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.95.1" +version = "0.97.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3189f65f5fa907bce0651e0ef989f8ab6ec4e59f374a8b332ebced0d8b6346b2" +checksum = "754c1e49748efab7676891d4ba6134d7cebe9091434747f6cf2ad0816be15945" dependencies = [ "Inflector", "ahash", @@ -2440,9 +2440,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.105.0" +version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b4c4832545ccd8a62050629f0bea25a8968af107149d01bf60e5b87c9305136" +checksum = "c4ad791fb112a8a9416990d1907249ea6d9bd61b1f8f82b24f5705716ebeb895" dependencies = [ "ahash", "dashmap 5.1.0", @@ -2463,9 +2463,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.91.0" +version = "0.92.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5ff5321ecdd0a3e620878e02452a6475b9ffdcaf75a2cf9636c2d31bb85fe0" +checksum = "a88f7b76c0e068d4663c7eaa3e0f97135aee40c03f4a6d76aff6729ee8e4cc6a" dependencies = [ "either", "serde", @@ -2482,9 +2482,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.97.0" +version = "0.99.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e34910d493b1edca2dc1a4ce86bf0e704c8aca3ccfaee6d8217063779b3df22" +checksum = "e2ef957320606a96d14fc5361e4efaea1f2987d58f55fc77fda0443cc12fdf5c" dependencies = [ "ahash", "base64 0.13.0", @@ -2507,9 +2507,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.72.0" +version = "0.73.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d8d6775aa4da996306fe0f334e644576527fc646727402142e7026ce4f3a76" +checksum = "8785d08da5ecd24fa4125ed647967c666aa2e43e0bfbdfbe6039c570fecd1a20" dependencies = [ "ansi_term", "anyhow", @@ -2530,9 +2530,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.100.0" +version = "0.102.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c553fe85a8bcb0fcc6c8929770d556d567991f8061f7a47dc6e962b6b87dbf9" +checksum = "b523892d177298f224d6b9e030dbc60634869cd2dad5e0e4367007c2afede4df" dependencies = [ "serde", "swc_atoms", @@ -2546,9 +2546,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.74.0" +version = "0.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa3ba57f53fc15882d2ea288f9a4b6c3a6e97c015d7b9603035be424bc19007" +checksum = "56c96a2a3cd95edf5e0850d3682ba78b91aa52ecb80134ea28db77a9a3bc8f87" dependencies = [ "indexmap", "once_cell", @@ -2562,9 +2562,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.57.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7588bf6b02705a25356a130acdfec125b6a1dcd5390a5718082ae4f2ede85ee3" +checksum = "f5158e2be44e7ab8ada738aed23e6efbbbfd939bb0318633d72289a52209ab5f" dependencies = [ "num-bigint", "swc_atoms", @@ -2576,9 +2576,9 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.136.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb75ac51d44c811e4527ce30873a8ef1bd8f2435e33ec6a5dc62936dbfdc451" +checksum = "5c69d430199fa3e25c35022e187850c48cdbd53026380bf581366a6e76370ac4" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 5b1915eccbe8834..e61d88c94e0422f 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -19,13 +19,13 @@ radix_fmt = "1" regex = "1.5" serde = "1" serde_json = "1" -styled_components = "0.20.0" -swc = "0.157.0" +styled_components = "0.21.0" +swc = "0.159.0" swc_atoms = "0.2.9" swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } swc_css = "0.103.0" swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } -swc_ecmascript = { version = "0.136.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.138.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" swc_cached = "0.1.1" swc_stylis = "0.99.1" @@ -33,6 +33,6 @@ tracing = {version = "0.1.28", features = ["release_max_level_off"]} handlebars = "4.2.1" [dev-dependencies] -swc_ecma_transforms_testing = "0.72.0" +swc_ecma_transforms_testing = "0.73.0" testing = "0.19.1" walkdir = "2.3.2" diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index 26f1f872e2914cf..32ab32e5204e899 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -16,12 +16,12 @@ next-swc = {version = "0.0.0", path = "../core"} once_cell = "1.8.0" serde = "1" serde_json = "1" -swc = "0.157.0" +swc = "0.159.0" swc_atoms = "0.2.9" -swc_bundler = { version = "0.126.0", features = ["concurrent"] } +swc_bundler = { version = "0.128.0", features = ["concurrent"] } swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } -swc_ecmascript = { version = "0.136.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.138.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" [build-dependencies] diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index bada069b2fd0c82..fe33c62448efc65 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -16,9 +16,9 @@ parking_lot_core = "=0.8.0" path-clean = "0.1" serde = {version = "1", features = ["derive"]} serde_json = "1" -swc = "0.157.0" +swc = "0.159.0" swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } -swc_ecmascript = { version = "0.136.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.138.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" From 55d77445a90619e4770c5f96a922c15c58aac360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 23 Mar 2022 18:12:48 +0900 Subject: [PATCH 12/24] Fix --- packages/next-swc/crates/core/src/next_dynamic.rs | 13 ++++--------- packages/next-swc/crates/core/src/page_config.rs | 3 +-- packages/next-swc/crates/core/src/relay.rs | 5 ++--- packages/next-swc/crates/core/src/styled_jsx/mod.rs | 6 +++--- .../crates/core/src/styled_jsx/transform_css.rs | 9 ++------- .../next-swc/crates/core/src/styled_jsx/utils.rs | 13 +++---------- 6 files changed, 15 insertions(+), 34 deletions(-) diff --git a/packages/next-swc/crates/core/src/next_dynamic.rs b/packages/next-swc/crates/core/src/next_dynamic.rs index 87b30f968e5dbca..4d45798a20a6832 100644 --- a/packages/next-swc/crates/core/src/next_dynamic.rs +++ b/packages/next-swc/crates/core/src/next_dynamic.rs @@ -6,7 +6,7 @@ use swc_common::{FileName, DUMMY_SP}; use swc_ecmascript::ast::{ ArrayLit, ArrowExpr, BinExpr, BinaryOp, BlockStmtOrExpr, Bool, CallExpr, Callee, Expr, ExprOrSpread, Ident, ImportDecl, ImportSpecifier, KeyValueProp, Lit, MemberExpr, MemberProp, - Null, ObjectLit, Prop, PropName, PropOrSpread, Str, StrKind, + Null, ObjectLit, Prop, PropName, PropOrSpread, Str, }; use swc_ecmascript::utils::ExprFactory; use swc_ecmascript::utils::{ @@ -148,8 +148,7 @@ impl Fold for NextDynamicPatcher { ) .into(), span: DUMMY_SP, - kind: StrKind::Synthesized {}, - has_escape: false, + raw: None, }))), right: Box::new(Expr::Lit(Lit::Str(Str { value: self @@ -159,10 +158,7 @@ impl Fold for NextDynamicPatcher { .clone() .into(), span: DUMMY_SP, - kind: StrKind::Normal { - contains_quote: false, - }, - has_escape: false, + raw: None, }))), })), spread: None, @@ -202,8 +198,7 @@ impl Fold for NextDynamicPatcher { .clone() .into(), span: DUMMY_SP, - kind: StrKind::Synthesized {}, - has_escape: false, + raw: None, }))), spread: None, }], diff --git a/packages/next-swc/crates/core/src/page_config.rs b/packages/next-swc/crates/core/src/page_config.rs index 9175f4730ca83f1..eeb092ba6f1856c 100644 --- a/packages/next-swc/crates/core/src/page_config.rs +++ b/packages/next-swc/crates/core/src/page_config.rs @@ -54,8 +54,7 @@ impl Fold for PageConfig { init: Some(Box::new(Expr::Lit(Lit::Str(Str { value: format!("{} {}", STRING_LITERAL_DROP_BUNDLE, timestamp).into(), span: DUMMY_SP, - kind: StrKind::Synthesized {}, - has_escape: false, + raw: None, })))), span: DUMMY_SP, definite: false, diff --git a/packages/next-swc/crates/core/src/relay.rs b/packages/next-swc/crates/core/src/relay.rs index 680eceb4de2dbf7..1f3f693e36d38ab 100644 --- a/packages/next-swc/crates/core/src/relay.rs +++ b/packages/next-swc/crates/core/src/relay.rs @@ -43,7 +43,7 @@ fn pull_first_operation_name_from_tpl(tpl: &TaggedTpl) -> Option { static OPERATION_REGEX: Lazy = Lazy::new(|| Regex::new(r"(fragment|mutation|query|subscription) (\w+)").unwrap()); - let capture_group = OPERATION_REGEX.captures_iter(&quasis.raw.value).next(); + let capture_group = OPERATION_REGEX.captures_iter(&quasis.raw).next(); capture_group.map(|capture_group| capture_group[2].to_string()) }) @@ -56,8 +56,7 @@ fn build_require_expr_from_path(path: &str) -> Expr { args: vec![Lit::Str(Str { span: Default::default(), value: JsWord::from(path), - has_escape: false, - kind: Default::default(), + raw: None, }) .as_arg()], type_args: None, diff --git a/packages/next-swc/crates/core/src/styled_jsx/mod.rs b/packages/next-swc/crates/core/src/styled_jsx/mod.rs index 21062867cd30463..e272d7fa3f437f0 100644 --- a/packages/next-swc/crates/core/src/styled_jsx/mod.rs +++ b/packages/next-swc/crates/core/src/styled_jsx/mod.rs @@ -475,8 +475,8 @@ impl StyledJSXTransformer { expr, ) => { if exprs.is_empty() { - hasher.write(quasis[0].raw.value.as_bytes()); - css = quasis[0].raw.value.to_string(); + hasher.write(quasis[0].raw.as_bytes()); + css = quasis[0].raw.to_string(); css_span = *span; is_dynamic = false; } else { @@ -488,7 +488,7 @@ impl StyledJSXTransformer { } else { format!("__styled-jsx-placeholder-{}__", i) }; - s = format!("{}{}{}", s, quasis[i].raw.value, placeholder) + s = format!("{}{}{}", s, quasis[i].raw, placeholder) } css = s; css_span = *span; diff --git a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs index 78d18085bc64134..9607fc878f6aa15 100644 --- a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs +++ b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs @@ -12,7 +12,7 @@ use swc_css::codegen::{ use swc_css::parser::parser::input::ParserInput; use swc_css::parser::{parse_str, parse_tokens, parser::ParserConfig}; use swc_css::visit::{VisitMut, VisitMutWith}; -use swc_ecmascript::ast::{Expr, Str, StrKind, Tpl, TplElement}; +use swc_ecmascript::ast::{Expr, Tpl, TplElement}; use swc_ecmascript::parser::StringInput; use swc_ecmascript::utils::HANDLER; use swc_stylis::prefixer::prefixer; @@ -97,12 +97,7 @@ pub fn transform_css( .map(|quasi| { TplElement { cooked: None, // ? Do we need cooked as well - raw: Str { - value: (*quasi).into(), - span: DUMMY_SP, - has_escape: false, - kind: StrKind::Synthesized {}, - }, + raw: (*quasi).into(), span: DUMMY_SP, tail: false, } diff --git a/packages/next-swc/crates/core/src/styled_jsx/utils.rs b/packages/next-swc/crates/core/src/styled_jsx/utils.rs index c4369ca77cf64ed..bc720b16af38b01 100644 --- a/packages/next-swc/crates/core/src/styled_jsx/utils.rs +++ b/packages/next-swc/crates/core/src/styled_jsx/utils.rs @@ -7,12 +7,7 @@ use super::{ExternalStyle, JSXStyle, LocalStyle}; fn tpl_element(value: &str) -> TplElement { TplElement { - raw: Str { - value: value.into(), - span: DUMMY_SP, - kind: StrKind::Synthesized, - has_escape: false, - }, + raw: value.into(), cooked: None, span: DUMMY_SP, tail: false, @@ -314,10 +309,9 @@ pub fn styled_jsx_import_decl(style_import_name: &str) -> ModuleItem { span: DUMMY_SP, })], src: Str { - has_escape: false, - kind: StrKind::Synthesized {}, span: DUMMY_SP, value: "styled-jsx/style".into(), + raw: None, }, })) } @@ -335,8 +329,7 @@ pub fn string_literal_expr(str: &str) -> Expr { Expr::Lit(Lit::Str(Str { value: str.into(), span: DUMMY_SP, - has_escape: false, - kind: StrKind::Synthesized {}, + raw: None, })) } From 0c6628116f9cd536f2ad5b1ab659e866d8d7f9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 23 Mar 2022 18:16:42 +0900 Subject: [PATCH 13/24] Update test refs --- .../next-swc/crates/core/src/emotion/mod.rs | 3 +- .../re-export-default/output.js | 2 +- .../tests/fixture/emotion/compress/output.ts | 14 ++--- .../fixture/emotion/css-in-callback/output.ts | 28 ++++----- .../emotion/namespace-import/output.ts | 16 ++--- .../modularize-imports/regex/output.js | 8 +-- .../modularize-imports/simple/output.js | 4 +- .../duplicated-imports/output-dev.js | 30 +++++---- .../duplicated-imports/output-prod.js | 30 +++++---- .../duplicated-imports/output-server.js | 30 +++++---- .../member-with-same-name/output-dev.js | 19 +++--- .../member-with-same-name/output-prod.js | 19 +++--- .../member-with-same-name/output-server.js | 19 +++--- .../next-dynamic/no-options/output-dev.js | 15 +++-- .../next-dynamic/no-options/output-prod.js | 15 +++-- .../next-dynamic/no-options/output-server.js | 15 +++-- .../next-dynamic/with-options/output-dev.js | 8 +-- .../next-dynamic/with-options/output-prod.js | 8 +-- .../with-options/output-server.js | 28 +++++---- .../next-dynamic/wrapped-import/output-dev.js | 6 +- .../wrapped-import/output-prod.js | 6 +- .../wrapped-import/output-server.js | 4 +- .../fixture/page-config/amp-hybrid/output.js | 6 +- .../shake-exports/keep-default/output.js | 4 +- .../shake-exports/most-usecases/output.js | 12 ++-- .../destructuring-assignment-array/output.js | 4 +- .../destructuring-assignment-array/output.js | 10 +-- .../destructuring-assignment-object/output.js | 10 +-- .../output.js | 9 +-- .../output.js | 6 +- .../output.js | 8 +-- .../output.js | 18 +++--- .../output.js | 6 +- .../output.js | 8 +-- .../output.js | 6 +- .../output.js | 6 +- .../output.js | 6 +- .../output.js | 6 +- .../output.js | 16 ++--- .../output.js | 6 +- .../output.js | 8 +-- .../output.js | 6 +- .../output.js | 6 +- .../output.js | 6 +- .../should-support-class-exports-2/output.js | 10 +-- .../should-support-class-exports/output.js | 10 +-- .../output.js | 12 ++-- .../output.js | 8 +-- .../output.js | 6 +- .../tests/fixture/styled-jsx/absent/output.js | 7 ++- .../output.js | 62 +++++++++---------- .../attribute-generation-modes/output.js | 52 ++++++++-------- .../css-selector-after-pseudo/output.js | 2 +- .../styled-jsx/different-jsx-ids/output.js | 16 ++--- .../dynamic-element-class/output.js | 4 +- .../dynamic-element-external/output.js | 7 ++- .../styled-jsx/dynamic-element/output.js | 4 +- .../fixture/styled-jsx/expressions/output.js | 60 +++++++++--------- .../external-stylesheet-global/output.js | 13 +++- .../external-stylesheet-multi-line/output.js | 7 ++- .../styled-jsx/external-stylesheet/output.js | 6 +- .../fixture/styled-jsx/fragment/output.js | 2 +- .../fixture/styled-jsx/issue-30480/output.js | 4 +- .../output.js | 6 +- .../fixture/styled-jsx/multiple-jsx/output.js | 2 +- .../not-styled-jsx-tagged-templates/output.js | 6 +- .../number-after-placeholder/output.js | 6 +- .../tests/fixture/styled-jsx/styles/output.js | 26 ++++---- .../fixture/styled-jsx/too-many/output.js | 6 +- .../fixture/styled-jsx/tpl-escape-2/output.js | 4 +- .../tpl-placeholder-1-as-property/output.js | 14 ++--- .../output.js | 6 +- .../tpl-placeholder-3-as-value/output.js | 6 +- .../output.js | 20 +++--- .../output.js | 20 +++--- .../core/tests/loader/example/output.js | 2 +- .../core/tests/loader/issue-31627/output.js | 8 +-- .../core/tests/loader/issue-32553/output.js | 2 +- .../loader/styled-components/1/output.js | 2 +- 79 files changed, 491 insertions(+), 437 deletions(-) diff --git a/packages/next-swc/crates/core/src/emotion/mod.rs b/packages/next-swc/crates/core/src/emotion/mod.rs index 30f386bff97501c..24c701844d50809 100644 --- a/packages/next-swc/crates/core/src/emotion/mod.rs +++ b/packages/next-swc/crates/core/src/emotion/mod.rs @@ -307,8 +307,7 @@ impl EmotionTransformer { if index % 2 == 0 { if let Some(q) = tagged_tpl.quasis.get_mut(i) { let q = q.take(); - let minified = - minify_css_string(&q.raw.value, index == 0, index == args_len - 1); + let minified = minify_css_string(&q.raw, index == 0, index == args_len - 1); // Compress one more spaces into one space if minified.replace(' ', "").is_empty() { if index != 0 && index != args_len - 1 { diff --git a/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-default/output.js b/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-default/output.js index 8d8c17bdb9a62ff..c2bdfb70ddbc2c9 100644 --- a/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-default/output.js +++ b/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-default/output.js @@ -1 +1 @@ -export { default, getStaticProps, getStaticPaths } from "./other-page"; +export { default, getStaticProps, getStaticPaths } from './other-page'; diff --git a/packages/next-swc/crates/core/tests/fixture/emotion/compress/output.ts b/packages/next-swc/crates/core/tests/fixture/emotion/compress/output.ts index fc6e73b1fe20219..d6d0477be249117 100644 --- a/packages/next-swc/crates/core/tests/fixture/emotion/compress/output.ts +++ b/packages/next-swc/crates/core/tests/fixture/emotion/compress/output.ts @@ -1,7 +1,7 @@ -import { css } from "@emotion/react"; -import styled from "@emotion/styled"; -const unitNormal = "1rem"; -const unitLarge = "2rem"; +import { css } from '@emotion/react'; +import styled from '@emotion/styled'; +const unitNormal = '1rem'; +const unitLarge = '2rem'; const Example = /*#__PURE__*/ styled("div", { target: "ekie5mj0", label: "Example" @@ -11,12 +11,12 @@ export const Animated = /*#__PURE__*/ styled("div", { label: "Animated" })("& code{background-color:linen;}animation:", ({ animation })=>animation , " 0.2s infinite ease-in-out alternate;", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5cbmNvbnN0IHVuaXROb3JtYWwgPSAnMXJlbSdcbmNvbnN0IHVuaXRMYXJnZSA9ICcycmVtJ1xuXG5jb25zdCBFeGFtcGxlID0gc3R5bGVkLmRpdmBcbiAgbWFyZ2luOiAke3VuaXROb3JtYWx9ICR7dW5pdExhcmdlfTtcbmBcblxuZXhwb3J0IGNvbnN0IEFuaW1hdGVkID0gc3R5bGVkLmRpdmBcbiAgJiBjb2RlIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiBsaW5lbjtcbiAgfVxuICBhbmltYXRpb246ICR7KHsgYW5pbWF0aW9uIH0pID0+IGFuaW1hdGlvbn0gMC4ycyBpbmZpbml0ZSBlYXNlLWluLW91dCBhbHRlcm5hdGU7XG5gXG5cbmNvbnN0IHNoYWRvd0JvcmRlciA9ICh7IHdpZHRoID0gJzFweCcsIGNvbG9yIH0pID0+XG4gIGNzc2BcbiAgICBib3gtc2hhZG93OiBpbnNldCAwcHggMHB4IDBweCAke3dpZHRofSAke2NvbG9yfTtcbiAgYFxuXG5jb25zdCBTdHlsZWRJbnB1dCA9IHN0eWxlZC5pbnB1dGBcbiAgJHtzaGFkb3dCb3JkZXIoeyBjb2xvcjogJ3JlZCcsIHdpZHRoOiAnNHB4JyB9KX1cbmBcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFVd0IifQ== */"); -const shadowBorder = ({ width ="1px" , color })=>/*#__PURE__*/ css("box-shadow:inset 0px 0px 0px ", width, " ", color, ";", "shadowBorder", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5cbmNvbnN0IHVuaXROb3JtYWwgPSAnMXJlbSdcbmNvbnN0IHVuaXRMYXJnZSA9ICcycmVtJ1xuXG5jb25zdCBFeGFtcGxlID0gc3R5bGVkLmRpdmBcbiAgbWFyZ2luOiAke3VuaXROb3JtYWx9ICR7dW5pdExhcmdlfTtcbmBcblxuZXhwb3J0IGNvbnN0IEFuaW1hdGVkID0gc3R5bGVkLmRpdmBcbiAgJiBjb2RlIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiBsaW5lbjtcbiAgfVxuICBhbmltYXRpb246ICR7KHsgYW5pbWF0aW9uIH0pID0+IGFuaW1hdGlvbn0gMC4ycyBpbmZpbml0ZSBlYXNlLWluLW91dCBhbHRlcm5hdGU7XG5gXG5cbmNvbnN0IHNoYWRvd0JvcmRlciA9ICh7IHdpZHRoID0gJzFweCcsIGNvbG9yIH0pID0+XG4gIGNzc2BcbiAgICBib3gtc2hhZG93OiBpbnNldCAwcHggMHB4IDBweCAke3dpZHRofSAke2NvbG9yfTtcbiAgYFxuXG5jb25zdCBTdHlsZWRJbnB1dCA9IHN0eWxlZC5pbnB1dGBcbiAgJHtzaGFkb3dCb3JkZXIoeyBjb2xvcjogJ3JlZCcsIHdpZHRoOiAnNHB4JyB9KX1cbmBcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFrQkUifQ== */") +const shadowBorder = ({ width ='1px' , color })=>/*#__PURE__*/ css("box-shadow:inset 0px 0px 0px ", width, " ", color, ";", "shadowBorder", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5cbmNvbnN0IHVuaXROb3JtYWwgPSAnMXJlbSdcbmNvbnN0IHVuaXRMYXJnZSA9ICcycmVtJ1xuXG5jb25zdCBFeGFtcGxlID0gc3R5bGVkLmRpdmBcbiAgbWFyZ2luOiAke3VuaXROb3JtYWx9ICR7dW5pdExhcmdlfTtcbmBcblxuZXhwb3J0IGNvbnN0IEFuaW1hdGVkID0gc3R5bGVkLmRpdmBcbiAgJiBjb2RlIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiBsaW5lbjtcbiAgfVxuICBhbmltYXRpb246ICR7KHsgYW5pbWF0aW9uIH0pID0+IGFuaW1hdGlvbn0gMC4ycyBpbmZpbml0ZSBlYXNlLWluLW91dCBhbHRlcm5hdGU7XG5gXG5cbmNvbnN0IHNoYWRvd0JvcmRlciA9ICh7IHdpZHRoID0gJzFweCcsIGNvbG9yIH0pID0+XG4gIGNzc2BcbiAgICBib3gtc2hhZG93OiBpbnNldCAwcHggMHB4IDBweCAke3dpZHRofSAke2NvbG9yfTtcbiAgYFxuXG5jb25zdCBTdHlsZWRJbnB1dCA9IHN0eWxlZC5pbnB1dGBcbiAgJHtzaGFkb3dCb3JkZXIoeyBjb2xvcjogJ3JlZCcsIHdpZHRoOiAnNHB4JyB9KX1cbmBcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFrQkUifQ== */") ; const StyledInput = /*#__PURE__*/ styled("input", { target: "ekie5mj2", label: "StyledInput" })(shadowBorder({ - color: "red", - width: "4px" + color: 'red', + width: '4px' }), "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5cbmNvbnN0IHVuaXROb3JtYWwgPSAnMXJlbSdcbmNvbnN0IHVuaXRMYXJnZSA9ICcycmVtJ1xuXG5jb25zdCBFeGFtcGxlID0gc3R5bGVkLmRpdmBcbiAgbWFyZ2luOiAke3VuaXROb3JtYWx9ICR7dW5pdExhcmdlfTtcbmBcblxuZXhwb3J0IGNvbnN0IEFuaW1hdGVkID0gc3R5bGVkLmRpdmBcbiAgJiBjb2RlIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiBsaW5lbjtcbiAgfVxuICBhbmltYXRpb246ICR7KHsgYW5pbWF0aW9uIH0pID0+IGFuaW1hdGlvbn0gMC4ycyBpbmZpbml0ZSBlYXNlLWluLW91dCBhbHRlcm5hdGU7XG5gXG5cbmNvbnN0IHNoYWRvd0JvcmRlciA9ICh7IHdpZHRoID0gJzFweCcsIGNvbG9yIH0pID0+XG4gIGNzc2BcbiAgICBib3gtc2hhZG93OiBpbnNldCAwcHggMHB4IDBweCAke3dpZHRofSAke2NvbG9yfTtcbiAgYFxuXG5jb25zdCBTdHlsZWRJbnB1dCA9IHN0eWxlZC5pbnB1dGBcbiAgJHtzaGFkb3dCb3JkZXIoeyBjb2xvcjogJ3JlZCcsIHdpZHRoOiAnNHB4JyB9KX1cbmBcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFzQm9CIn0= */"); diff --git a/packages/next-swc/crates/core/tests/fixture/emotion/css-in-callback/output.ts b/packages/next-swc/crates/core/tests/fixture/emotion/css-in-callback/output.ts index ef1b5dcee7bf20b..361b6fee10e47c5 100644 --- a/packages/next-swc/crates/core/tests/fixture/emotion/css-in-callback/output.ts +++ b/packages/next-swc/crates/core/tests/fixture/emotion/css-in-callback/output.ts @@ -1,34 +1,34 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; -import { css, Global } from "@emotion/react"; -import styled from "@emotion/styled"; -import { PureComponent } from "react"; -import ReactDOM from "react-dom"; +import { css, Global } from '@emotion/react'; +import styled from '@emotion/styled'; +import { PureComponent } from 'react'; +import ReactDOM from 'react-dom'; const stylesInCallback = (props: any)=>/*#__PURE__*/ css({ - color: "red", - background: "yellow", + color: 'red', + background: 'yellow', width: `${props.scale * 100}px` }, "label:stylesInCallback", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1FIn0= */") ; const styles = /*#__PURE__*/ css({ - color: "red", - width: "20px" + color: 'red', + width: '20px' }, "label:styles", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVllIn0= */"); const styles2 = /*#__PURE__*/ css("color:red;width:20px;", "styles2", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlCZ0IifQ== */"); const DivContainer = /*#__PURE__*/ styled("div", { target: "ekie5mj0", label: "DivContainer" })({ - background: "red" + background: 'red' }, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXNCcUIifQ== */"); const DivContainer2 = /*#__PURE__*/ styled("div", { target: "ekie5mj1", label: "DivContainer2" })("background:red;", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTBCc0IifQ== */"); -const SpanContainer = /*#__PURE__*/ styled("span", { +const SpanContainer = /*#__PURE__*/ styled('span', { target: "ekie5mj2", label: "SpanContainer" })({ - background: "yellow" + background: 'yellow' }, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQThCc0IifQ== */"); export const DivContainerExtended = /*#__PURE__*/ styled(DivContainer, { target: "ekie5mj3", @@ -38,11 +38,11 @@ export const DivContainerExtended2 = /*#__PURE__*/ styled(DivContainer, { target: "ekie5mj4", label: "DivContainerExtended2" })({}, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1DcUMifQ== */"); -const Container = /*#__PURE__*/ styled("button", { +const Container = /*#__PURE__*/ styled('button', { target: "ekie5mj5", label: "Container" })("background:red;", stylesInCallback, " ", ()=>/*#__PURE__*/ css({ - background: "red" + background: 'red' }, "label:Container", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlDSSJ9 */") , " color:yellow;font-size:12px;", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IFNwYW5Db250YWluZXIgPSBzdHlsZWQoJ3NwYW4nKSh7XG4gIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxufSlcblxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkID0gc3R5bGVkKERpdkNvbnRhaW5lcilgYFxuZXhwb3J0IGNvbnN0IERpdkNvbnRhaW5lckV4dGVuZGVkMiA9IHN0eWxlZChEaXZDb250YWluZXIpKHt9KVxuXG5jb25zdCBDb250YWluZXIgPSBzdHlsZWQoJ2J1dHRvbicpYFxuICBiYWNrZ3JvdW5kOiByZWQ7XG4gICR7c3R5bGVzSW5DYWxsYmFja31cbiAgJHsoKSA9PlxuICAgIGNzcyh7XG4gICAgICBiYWNrZ3JvdW5kOiAncmVkJyxcbiAgICB9KX1cbiAgY29sb3I6IHllbGxvdztcbiAgZm9udC1zaXplOiAxMnB4O1xuYFxuXG5jb25zdCBDb250YWluZXIyID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZDogcmVkO1xuYFxuXG5leHBvcnQgY2xhc3MgU2ltcGxlQ29tcG9uZW50IGV4dGVuZHMgUHVyZUNvbXBvbmVudCB7XG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPENvbnRhaW5lclxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcbiAgICAgICAgYH1cbiAgICAgID5cbiAgICAgICAgPEdsb2JhbFxuICAgICAgICAgIHN0eWxlcz17Y3NzYFxuICAgICAgICAgICAgaHRtbCxcbiAgICAgICAgICAgIGJvZHkge1xuICAgICAgICAgICAgICBwYWRkaW5nOiAzcmVtIDFyZW07XG4gICAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgICAgYmFja2dyb3VuZDogcGFwYXlhd2hpcDtcbiAgICAgICAgICAgICAgbWluLWhlaWdodDogMTAwJTtcbiAgICAgICAgICAgICAgZm9udC1mYW1pbHk6IEhlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBgfVxuICAgICAgICAvPlxuICAgICAgICA8c3Bhbj5oZWxsbzwvc3Bhbj5cbiAgICAgIDwvQ29udGFpbmVyPlxuICAgIClcbiAgfVxufVxuXG5SZWFjdERPTS5yZW5kZXIoPFNpbXBsZUNvbXBvbmVudCAvPiwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI2FwcCcpKVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXFDa0IifQ== */"); const Container2 = /*#__PURE__*/ styled("div", { @@ -67,4 +67,4 @@ export class SimpleComponent extends PureComponent { }); } } -ReactDOM.render(/*#__PURE__*/ _jsx(SimpleComponent, {}), document.querySelector("#app")); +ReactDOM.render(/*#__PURE__*/ _jsx(SimpleComponent, {}), document.querySelector('#app')); diff --git a/packages/next-swc/crates/core/tests/fixture/emotion/namespace-import/output.ts b/packages/next-swc/crates/core/tests/fixture/emotion/namespace-import/output.ts index d73062e85ee6b13..9a840020f8aab27 100644 --- a/packages/next-swc/crates/core/tests/fixture/emotion/namespace-import/output.ts +++ b/packages/next-swc/crates/core/tests/fixture/emotion/namespace-import/output.ts @@ -1,16 +1,16 @@ import { jsx as _jsx } from "react/jsx-runtime"; -import * as emotionReact from "@emotion/react"; -import { PureComponent } from "react"; -import ReactDOM from "react-dom"; +import * as emotionReact from '@emotion/react'; +import { PureComponent } from 'react'; +import ReactDOM from 'react-dom'; const stylesInCallback = (props: any)=>/*#__PURE__*/ emotionReact.css({ - color: "red", - background: "yellow", + color: 'red', + background: 'yellow', width: `${props.scale * 100}px` }, "label:stylesInCallback", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGVtb3Rpb25SZWFjdCBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgZW1vdGlvblJlYWN0LmNzcyh7XG4gICAgY29sb3I6ICdyZWQnLFxuICAgIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxuICAgIHdpZHRoOiBgJHtwcm9wcy5zY2FsZSAqIDEwMH1weGAsXG4gIH0pXG5cbmNvbnN0IHN0eWxlcyA9IGVtb3Rpb25SZWFjdC5jc3Moe1xuICBjb2xvcjogJ3JlZCcsXG4gIHdpZHRoOiAnMjBweCcsXG59KVxuXG5jb25zdCBzdHlsZXMyID0gZW1vdGlvblJlYWN0LmNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmV4cG9ydCBjbGFzcyBTaW1wbGVDb21wb25lbnQgZXh0ZW5kcyBQdXJlQ29tcG9uZW50IHtcbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2IGNsYXNzTmFtZT17c3R5bGVzfT5cbiAgICAgICAgPHNwYW4+aGVsbG88L3NwYW4+XG4gICAgICA8L2Rpdj5cbiAgICApXG4gIH1cbn1cblxuUmVhY3RET00ucmVuZGVyKDxTaW1wbGVDb21wb25lbnQgLz4sIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNhcHAnKSlcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLRSJ9 */") ; const styles = /*#__PURE__*/ emotionReact.css({ - color: "red", - width: "20px" + color: 'red', + width: '20px' }, "label:styles", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGVtb3Rpb25SZWFjdCBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgZW1vdGlvblJlYWN0LmNzcyh7XG4gICAgY29sb3I6ICdyZWQnLFxuICAgIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxuICAgIHdpZHRoOiBgJHtwcm9wcy5zY2FsZSAqIDEwMH1weGAsXG4gIH0pXG5cbmNvbnN0IHN0eWxlcyA9IGVtb3Rpb25SZWFjdC5jc3Moe1xuICBjb2xvcjogJ3JlZCcsXG4gIHdpZHRoOiAnMjBweCcsXG59KVxuXG5jb25zdCBzdHlsZXMyID0gZW1vdGlvblJlYWN0LmNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmV4cG9ydCBjbGFzcyBTaW1wbGVDb21wb25lbnQgZXh0ZW5kcyBQdXJlQ29tcG9uZW50IHtcbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2IGNsYXNzTmFtZT17c3R5bGVzfT5cbiAgICAgICAgPHNwYW4+aGVsbG88L3NwYW4+XG4gICAgICA8L2Rpdj5cbiAgICApXG4gIH1cbn1cblxuUmVhY3RET00ucmVuZGVyKDxTaW1wbGVDb21wb25lbnQgLz4sIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNhcHAnKSlcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFXZSJ9 */"); const styles2 = /*#__PURE__*/ emotionReact.css("color:red;width:20px;", "label:styles2", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGVtb3Rpb25SZWFjdCBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgZW1vdGlvblJlYWN0LmNzcyh7XG4gICAgY29sb3I6ICdyZWQnLFxuICAgIGJhY2tncm91bmQ6ICd5ZWxsb3cnLFxuICAgIHdpZHRoOiBgJHtwcm9wcy5zY2FsZSAqIDEwMH1weGAsXG4gIH0pXG5cbmNvbnN0IHN0eWxlcyA9IGVtb3Rpb25SZWFjdC5jc3Moe1xuICBjb2xvcjogJ3JlZCcsXG4gIHdpZHRoOiAnMjBweCcsXG59KVxuXG5jb25zdCBzdHlsZXMyID0gZW1vdGlvblJlYWN0LmNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmV4cG9ydCBjbGFzcyBTaW1wbGVDb21wb25lbnQgZXh0ZW5kcyBQdXJlQ29tcG9uZW50IHtcbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2IGNsYXNzTmFtZT17c3R5bGVzfT5cbiAgICAgICAgPHNwYW4+aGVsbG88L3NwYW4+XG4gICAgICA8L2Rpdj5cbiAgICApXG4gIH1cbn1cblxuUmVhY3RET00ucmVuZGVyKDxTaW1wbGVDb21wb25lbnQgLz4sIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNhcHAnKSlcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQmdCIn0= */"); export class SimpleComponent extends PureComponent { @@ -23,4 +23,4 @@ export class SimpleComponent extends PureComponent { }); } } -ReactDOM.render(/*#__PURE__*/ _jsx(SimpleComponent, {}), document.querySelector("#app")); +ReactDOM.render(/*#__PURE__*/ _jsx(SimpleComponent, {}), document.querySelector('#app')); diff --git a/packages/next-swc/crates/core/tests/fixture/modularize-imports/regex/output.js b/packages/next-swc/crates/core/tests/fixture/modularize-imports/regex/output.js index c4b5cadfeeb67a0..d25be0a11cd58d1 100644 --- a/packages/next-swc/crates/core/tests/fixture/modularize-imports/regex/output.js +++ b/packages/next-swc/crates/core/tests/fixture/modularize-imports/regex/output.js @@ -1,4 +1,4 @@ -import MyModule from 'my-library/MyModule'; -import App from 'my-library/components/App'; -import Header from 'my-library/components/App/Header'; -import Footer from 'my-library/components/App/Footer'; +import MyModule from "my-library/MyModule"; +import App from "my-library/components/App"; +import Header from "my-library/components/App/Header"; +import Footer from "my-library/components/App/Footer"; diff --git a/packages/next-swc/crates/core/tests/fixture/modularize-imports/simple/output.js b/packages/next-swc/crates/core/tests/fixture/modularize-imports/simple/output.js index d3798eb0e9e4063..899d45bc9ec017e 100644 --- a/packages/next-swc/crates/core/tests/fixture/modularize-imports/simple/output.js +++ b/packages/next-swc/crates/core/tests/fixture/modularize-imports/simple/output.js @@ -1,5 +1,5 @@ import Grid from "react-bootstrap/lib/Grid"; import Row from "react-bootstrap/lib/Row"; import Col1 from "react-bootstrap/lib/Col"; -import { MyModule } from 'my-library-2/myModule'; -import { Widget } from 'my-library-2/widget'; +import { MyModule } from "my-library-2/myModule"; +import { Widget } from "my-library-2/widget"; diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-dev.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-dev.js index 871bf8fb3896749..baa31103eaaac26 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-dev.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-dev.js @@ -1,12 +1,18 @@ -import dynamic1 from 'next/dynamic' -import dynamic2 from 'next/dynamic' -const DynamicComponent1 = dynamic1(() => import('../components/hello1'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello1'], - }, -}) -const DynamicComponent2 = dynamic2(() => import('../components/hello2'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello2'], - }, -}) +import dynamic1 from 'next/dynamic'; +import dynamic2 from 'next/dynamic'; +const DynamicComponent1 = dynamic1(()=>import('../components/hello1') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello1" + ] + } +}); +const DynamicComponent2 = dynamic2(()=>import('../components/hello2') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello2" + ] + } +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-prod.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-prod.js index b39ea332cfc4bc2..32b27e4ad141107 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-prod.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-prod.js @@ -1,12 +1,18 @@ -import dynamic1 from 'next/dynamic' -import dynamic2 from 'next/dynamic' -const DynamicComponent1 = dynamic1(() => import('../components/hello1'), { - loadableGenerated: { - webpack: () => [require.resolveWeak('../components/hello1')], - }, -}) -const DynamicComponent2 = dynamic2(() => import('../components/hello2'), { - loadableGenerated: { - webpack: () => [require.resolveWeak('../components/hello2')], - }, -}) +import dynamic1 from 'next/dynamic'; +import dynamic2 from 'next/dynamic'; +const DynamicComponent1 = dynamic1(()=>import('../components/hello1') +, { + loadableGenerated: { + webpack: ()=>[ + require.resolveWeak("../components/hello1") + ] + } +}); +const DynamicComponent2 = dynamic2(()=>import('../components/hello2') +, { + loadableGenerated: { + webpack: ()=>[ + require.resolveWeak("../components/hello2") + ] + } +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-server.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-server.js index 871bf8fb3896749..baa31103eaaac26 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-server.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/duplicated-imports/output-server.js @@ -1,12 +1,18 @@ -import dynamic1 from 'next/dynamic' -import dynamic2 from 'next/dynamic' -const DynamicComponent1 = dynamic1(() => import('../components/hello1'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello1'], - }, -}) -const DynamicComponent2 = dynamic2(() => import('../components/hello2'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello2'], - }, -}) +import dynamic1 from 'next/dynamic'; +import dynamic2 from 'next/dynamic'; +const DynamicComponent1 = dynamic1(()=>import('../components/hello1') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello1" + ] + } +}); +const DynamicComponent2 = dynamic2(()=>import('../components/hello2') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello2" + ] + } +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-dev.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-dev.js index c3f5016f39f3782..d57f2d8cfe9f4c1 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-dev.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-dev.js @@ -1,8 +1,11 @@ -import dynamic from 'next/dynamic' -import somethingElse from 'something-else' -const DynamicComponent = dynamic(() => import('../components/hello'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello'], - }, -}) -somethingElse.dynamic('should not be transformed') +import dynamic from 'next/dynamic'; +import somethingElse from 'something-else'; +const DynamicComponent = dynamic(()=>import('../components/hello') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello" + ] + } +}); +somethingElse.dynamic('should not be transformed'); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-prod.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-prod.js index 57b44c9e010f99a..4d56b1f66c9ae49 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-prod.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-prod.js @@ -1,8 +1,11 @@ -import dynamic from 'next/dynamic' -import somethingElse from 'something-else' -const DynamicComponent = dynamic(() => import('../components/hello'), { - loadableGenerated: { - webpack: () => [require.resolveWeak('../components/hello')], - }, -}) -somethingElse.dynamic('should not be transformed') +import dynamic from 'next/dynamic'; +import somethingElse from 'something-else'; +const DynamicComponent = dynamic(()=>import('../components/hello') +, { + loadableGenerated: { + webpack: ()=>[ + require.resolveWeak("../components/hello") + ] + } +}); +somethingElse.dynamic('should not be transformed'); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-server.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-server.js index c3f5016f39f3782..d57f2d8cfe9f4c1 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-server.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/member-with-same-name/output-server.js @@ -1,8 +1,11 @@ -import dynamic from 'next/dynamic' -import somethingElse from 'something-else' -const DynamicComponent = dynamic(() => import('../components/hello'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello'], - }, -}) -somethingElse.dynamic('should not be transformed') +import dynamic from 'next/dynamic'; +import somethingElse from 'something-else'; +const DynamicComponent = dynamic(()=>import('../components/hello') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello" + ] + } +}); +somethingElse.dynamic('should not be transformed'); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-dev.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-dev.js index 21763e18aa102d0..c134b15124114b6 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-dev.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-dev.js @@ -1,6 +1,9 @@ -import dynamic from 'next/dynamic' -const DynamicComponent = dynamic(() => import('../components/hello'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello'], - }, -}) +import dynamic from 'next/dynamic'; +const DynamicComponent = dynamic(()=>import('../components/hello') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello" + ] + } +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-prod.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-prod.js index 345a3aa8aa80b97..19d0a75f9d16375 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-prod.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-prod.js @@ -1,6 +1,9 @@ -import dynamic from 'next/dynamic' -const DynamicComponent = dynamic(() => import('../components/hello'), { - loadableGenerated: { - webpack: () => [require.resolveWeak('../components/hello')], - }, -}) +import dynamic from 'next/dynamic'; +const DynamicComponent = dynamic(()=>import('../components/hello') +, { + loadableGenerated: { + webpack: ()=>[ + require.resolveWeak("../components/hello") + ] + } +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-server.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-server.js index 21763e18aa102d0..c134b15124114b6 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-server.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/no-options/output-server.js @@ -1,6 +1,9 @@ -import dynamic from 'next/dynamic' -const DynamicComponent = dynamic(() => import('../components/hello'), { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello'], - }, -}) +import dynamic from 'next/dynamic'; +const DynamicComponent = dynamic(()=>import('../components/hello') +, { + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello" + ] + } +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-dev.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-dev.js index e8ef64cab52ee1e..b0aba0caa23a02f 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-dev.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-dev.js @@ -1,5 +1,5 @@ -import dynamic from "next/dynamic"; -const DynamicComponentWithCustomLoading = dynamic(()=>import("../components/hello") +import dynamic from 'next/dynamic'; +const DynamicComponentWithCustomLoading = dynamic(()=>import('../components/hello') , { loadableGenerated: { modules: [ @@ -8,7 +8,7 @@ const DynamicComponentWithCustomLoading = dynamic(()=>import("../components/hell }, loading: ()=>

...

}); -const DynamicClientOnlyComponent = dynamic(()=>import("../components/hello") +const DynamicClientOnlyComponent = dynamic(()=>import('../components/hello') , { loadableGenerated: { modules: [ @@ -16,4 +16,4 @@ const DynamicClientOnlyComponent = dynamic(()=>import("../components/hello") ] }, ssr: false -}); \ No newline at end of file +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-prod.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-prod.js index f5350433fd80b7e..6ba8d24a9b45c16 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-prod.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-prod.js @@ -1,5 +1,5 @@ -import dynamic from "next/dynamic"; -const DynamicComponentWithCustomLoading = dynamic(()=>import("../components/hello") +import dynamic from 'next/dynamic'; +const DynamicComponentWithCustomLoading = dynamic(()=>import('../components/hello') , { loadableGenerated: { webpack: ()=>[ @@ -8,7 +8,7 @@ const DynamicComponentWithCustomLoading = dynamic(()=>import("../components/hell }, loading: ()=>

...

}); -const DynamicClientOnlyComponent = dynamic(()=>import("../components/hello") +const DynamicClientOnlyComponent = dynamic(()=>import('../components/hello') , { loadableGenerated: { webpack: ()=>[ @@ -16,4 +16,4 @@ const DynamicClientOnlyComponent = dynamic(()=>import("../components/hello") ] }, ssr: false -}); \ No newline at end of file +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-server.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-server.js index 0fb610435eb5254..453c19d3af2454d 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-server.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/with-options/output-server.js @@ -1,16 +1,18 @@ -import dynamic from 'next/dynamic' -const DynamicComponentWithCustomLoading = dynamic( - () => import('../components/hello'), - { +import dynamic from 'next/dynamic'; +const DynamicComponentWithCustomLoading = dynamic(()=>import('../components/hello') +, { loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello'], + modules: [ + "some-file.js -> " + "../components/hello" + ] }, - loading: () =>

...

, - } -) + loading: ()=>

...

+}); const DynamicClientOnlyComponent = dynamic(null, { - loadableGenerated: { - modules: ['some-file.js -> ' + '../components/hello'], - }, - ssr: false, -}) + loadableGenerated: { + modules: [ + "some-file.js -> " + "../components/hello" + ] + }, + ssr: false +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-dev.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-dev.js index 4bc3eae2c5ae283..73a93be3a5378af 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-dev.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-dev.js @@ -1,5 +1,5 @@ -import dynamic from "next/dynamic"; -const DynamicComponent = dynamic(()=>handleImport(import("./components/hello")) +import dynamic from 'next/dynamic'; +const DynamicComponent = dynamic(()=>handleImport(import('./components/hello')) , { loadableGenerated: { modules: [ @@ -9,4 +9,4 @@ const DynamicComponent = dynamic(()=>handleImport(import("./components/hello")) loading: ()=>null , ssr: false -}); \ No newline at end of file +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-prod.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-prod.js index f0c6a05c5433867..3d00065e4cd950c 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-prod.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-prod.js @@ -1,5 +1,5 @@ -import dynamic from "next/dynamic"; -const DynamicComponent = dynamic(()=>handleImport(import("./components/hello")) +import dynamic from 'next/dynamic'; +const DynamicComponent = dynamic(()=>handleImport(import('./components/hello')) , { loadableGenerated: { webpack: ()=>[ @@ -9,4 +9,4 @@ const DynamicComponent = dynamic(()=>handleImport(import("./components/hello")) loading: ()=>null , ssr: false -}); \ No newline at end of file +}); diff --git a/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-server.js b/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-server.js index dc2e6b9ecfa9f50..cd66983f6bb15b8 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-server.js +++ b/packages/next-swc/crates/core/tests/fixture/next-dynamic/wrapped-import/output-server.js @@ -1,4 +1,4 @@ -import dynamic from "next/dynamic"; +import dynamic from 'next/dynamic'; const DynamicComponent = dynamic(null, { loadableGenerated: { modules: [ @@ -8,4 +8,4 @@ const DynamicComponent = dynamic(null, { loading: ()=>null , ssr: false -}); \ No newline at end of file +}); diff --git a/packages/next-swc/crates/core/tests/fixture/page-config/amp-hybrid/output.js b/packages/next-swc/crates/core/tests/fixture/page-config/amp-hybrid/output.js index 25e72e99c3aaa92..f72661eee347f3d 100644 --- a/packages/next-swc/crates/core/tests/fixture/page-config/amp-hybrid/output.js +++ b/packages/next-swc/crates/core/tests/fixture/page-config/amp-hybrid/output.js @@ -1,7 +1,7 @@ export const config = { - amp: "hybrid" + amp: 'hybrid' }; function About(props) { - return

My AMP About Page!

; + return

My AMP About Page!

; } -export default About; \ No newline at end of file +export default About; diff --git a/packages/next-swc/crates/core/tests/fixture/shake-exports/keep-default/output.js b/packages/next-swc/crates/core/tests/fixture/shake-exports/keep-default/output.js index 8c9e39bc83c01a3..50668c9b81e7764 100644 --- a/packages/next-swc/crates/core/tests/fixture/shake-exports/keep-default/output.js +++ b/packages/next-swc/crates/core/tests/fixture/shake-exports/keep-default/output.js @@ -1,4 +1,4 @@ -let shouldBeKept = "should be kept"; +let shouldBeKept = 'should be kept'; export default function shouldBeKept() { console.log(shouldBeKept); -} \ No newline at end of file +}; diff --git a/packages/next-swc/crates/core/tests/fixture/shake-exports/most-usecases/output.js b/packages/next-swc/crates/core/tests/fixture/shake-exports/most-usecases/output.js index d8b78c16fecf8ab..e8efce7b27c2742 100644 --- a/packages/next-swc/crates/core/tests/fixture/shake-exports/most-usecases/output.js +++ b/packages/next-swc/crates/core/tests/fixture/shake-exports/most-usecases/output.js @@ -1,9 +1,9 @@ -let shouldBeKept = "should be kept"; +let shouldBeKept = 'should be kept'; export async function keep() { console.log(shouldBeKept); } -export let keep1 = "should be kept"; -export let keep2 = "should be kept"; -let keep3 = "should be kept"; -let asKeep = "should be kept"; -export { keep3, asKeep as keep4 }; \ No newline at end of file +export let keep1 = 'should be kept'; +export let keep2 = 'should be kept'; +let keep3 = 'should be kept'; +let asKeep = 'should be kept'; +export { keep3, asKeep as keep4 }; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getServerSideProps/destructuring-assignment-array/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getServerSideProps/destructuring-assignment-array/output.js index 18f31adf2cd7b42..12725201839bf56 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getServerSideProps/destructuring-assignment-array/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getServerSideProps/destructuring-assignment-array/output.js @@ -1,6 +1,6 @@ -import other from "other"; +import other from 'other'; const [foo] = other; export var __N_SSP = true; export default function Home() { return __jsx("div", null); -} +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-array/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-array/output.js index bd2fa7e2ca341f0..e174d867f8b3392 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-array/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-array/output.js @@ -1,6 +1,6 @@ -import other from 'other' -const [foo] = other -export var __N_SSG = true +import other from 'other'; +const [foo] = other; +export var __N_SSG = true; export default function Home() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-object/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-object/output.js index d9d0086bae97079..234841eb9de14c9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-object/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/destructuring-assignment-object/output.js @@ -1,6 +1,6 @@ -import other from 'other' -const { a, cat: bar } = other -export var __N_SSG = true +import other from 'other'; +const { a , cat: bar } = other; +export var __N_SSG = true; export default function Home() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-crash-for-class-declarations/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-crash-for-class-declarations/output.js index 3a6bd07759ab826..99165030bc3f846 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-crash-for-class-declarations/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-crash-for-class-declarations/output.js @@ -1,5 +1,6 @@ -export var __N_SSG = true -export class MyClass {} -export default function Test() { - return __jsx('div', null) +export var __N_SSG = true; +export class MyClass { } +export default function Test() { + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-function-declarations/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-function-declarations/output.js index 75349dd29642b7a..fed084393fb6ffe 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-function-declarations/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-function-declarations/output.js @@ -1,5 +1,5 @@ -export var __N_SSG = true +export var __N_SSG = true; export function Noop() {} export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-variable-declarations/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-variable-declarations/output.js index 582269c79a14045..7fe64a101c453c9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-variable-declarations/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-extra-named-export-variable-declarations/output.js @@ -1,5 +1,5 @@ -export var __N_SSG = true -export const foo = 2 +export var __N_SSG = true; +export const foo = 2; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-import-used-in-render/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-import-used-in-render/output.js index 06e38e50c3b907c..9da12e3468f4361 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-import-used-in-render/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-not-remove-import-used-in-render/output.js @@ -1,15 +1,15 @@ -import { useState, useEffect } from "react"; -import { Root, Children, JSXMemberExpression, AttributeValue, AttributeJSX, ValueInRender, ValueInEffect } from "../"; +import { useState, useEffect } from 'react'; +import { Root, Children, JSXMemberExpression, AttributeValue, AttributeJSX, ValueInRender, ValueInEffect } from '../'; export var __N_SSG = true; export default function Test() { const [x, setX] = useState(ValueInRender.value); - useEffect(() => { + useEffect(()=>{ setX(ValueInEffect.value); - }, []) + }, []); return __jsx(Root, { - x: x - }, __jsx('div', null, __jsx(Children, { - attr: AttributeValue, - jsx: __jsx(AttributeJSX, null) + x: x + }, __jsx("div", null, __jsx(Children, { + attr: AttributeValue, + jsx: __jsx(AttributeJSX, null) }), __jsx(JSXMemberExpression.Deep.Property, null))); -} +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-combined-named-export-specifiers/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-combined-named-export-specifiers/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-combined-named-export-specifiers/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-combined-named-export-specifiers/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-extra-named-export-speicifers/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-extra-named-export-speicifers/output.js index 442a2f2ff0dbbab..a4dde2b6819d043 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-extra-named-export-speicifers/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-extra-named-export-speicifers/output.js @@ -1,5 +1,5 @@ -export var __N_SSG = true -export { foo, bar as baz } from '.' +export var __N_SSG = true; +export { foo, bar as baz } from '.'; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations-async/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations-async/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations-async/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations-async/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-function-declarations/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations-async/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations-async/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations-async/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations-async/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-named-export-variable-declarations/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations-dependents-variables-functions-imports/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations-dependents-variables-functions-imports/output.js index 6a9308b537bf9d1..5a1e0ed963445ed 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations-dependents-variables-functions-imports/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations-dependents-variables-functions-imports/output.js @@ -1,10 +1,10 @@ -import keep_me from 'hello' -import { keep_me2 } from 'hello2' -import * as keep_me3 from 'hello3' -import { but_not_me } from 'bar' -var leave_me_alone = 1 +import keep_me from 'hello'; +import { keep_me2 } from 'hello2'; +import * as keep_me3 from 'hello3'; +import { but_not_me } from 'bar'; +var leave_me_alone = 1; function dont_bug_me_either() {} -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-function-declarations/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations-safe/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations-safe/output.js index 007e0fd05c4b125..6b31060edfbdcab 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations-safe/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations-safe/output.js @@ -1,5 +1,5 @@ -const a = 2 -export var __N_SSG = true +const a = 2; +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-re-exported-variable-declarations/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-separate-named-export-specifiers/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-separate-named-export-specifiers/output.js index 495a40db45d9839..f482a74d7de8eb9 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-separate-named-export-specifiers/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-remove-separate-named-export-specifiers/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Test() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-babel-style-memoized-function/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-babel-style-memoized-function/output.js index 2f0d20d71d760f2..b16cc0f70a37bb8 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-babel-style-memoized-function/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-babel-style-memoized-function/output.js @@ -1,4 +1,4 @@ -export var __N_SSG = true +export var __N_SSG = true; export default function Home() { - return __jsx('div', null) -} + return __jsx("div", null); +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports-2/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports-2/output.js index ff86dad98b11585..0a75d90e07570f6 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports-2/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports-2/output.js @@ -1,7 +1,7 @@ class Test extends React.Component { - render() { - return __jsx('div', null) - } + render() { + return __jsx("div", null); + } } -export var __N_SSG = true -export default Test +export var __N_SSG = true; +export default Test; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports/output.js index c3cf72d42bf0911..d4890fc72fc59be 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-class-exports/output.js @@ -1,6 +1,6 @@ -export var __N_SSG = true +export var __N_SSG = true; export default class Test extends React.Component { - render() { - return __jsx('div', null) - } -} + render() { + return __jsx("div", null); + } +}; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-a-class/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-a-class/output.js index 9bae7762b35bead..e54e5c11cb04fc1 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-a-class/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-a-class/output.js @@ -1,8 +1,8 @@ class El extends React.Component { - render() { - return __jsx('div', null) - } + render() { + return __jsx("div", null); + } } -const a = 5 -export var __N_SSG = true -export { El as default, a } +const a = 5; +export var __N_SSG = true; +export { El as default, a }; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-other-specifiers/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-other-specifiers/output.js index 97da95c03840e23..6898e60a7bf2d5f 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-other-specifiers/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-export-named-as-default-with-other-specifiers/output.js @@ -1,6 +1,6 @@ function El() { - return __jsx('div', null) + return __jsx("div", null); } -const a = 5 -export var __N_SSG = true -export { El as default, a } +const a = 5; +export var __N_SSG = true; +export { El as default, a }; diff --git a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-named-export-as-default/output.js b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-named-export-as-default/output.js index 0e5f256d739c2fa..80e0ba2e76e2c45 100644 --- a/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-named-export-as-default/output.js +++ b/packages/next-swc/crates/core/tests/fixture/ssg/getStaticProps/should-support-named-export-as-default/output.js @@ -1,5 +1,5 @@ function El() { - return __jsx('div', null) + return __jsx("div", null); } -export var __N_SSG = true -export { El as default } +export var __N_SSG = true; +export { El as default }; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/absent/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/absent/output.js index 83bfa96d461e2fe..629521ff72be64d 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/absent/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/absent/output.js @@ -1,5 +1,8 @@ const a = ()=>
+

hi

- + + +
-; \ No newline at end of file +; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-classname-rewriting/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-classname-rewriting/output.js index f66e9a9e9a85a7f..939e06090f38d01 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-classname-rewriting/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-classname-rewriting/output.js @@ -1,6 +1,6 @@ import _JSXStyle from "styled-jsx/style"; export default (()=>{ - const Element = "div"; + const Element = 'div'; return
@@ -11,28 +11,28 @@ export default (()=>{
-
+
-
+
-
+
+ 'test', + 'test2' + ].join(' ') || "")}/> -
+
-
+
-
+
-
+
@@ -40,29 +40,29 @@ export default (()=>{
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -70,27 +70,27 @@ export default (()=>{
-
+
-
+
-
+
-
+
-
+
diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js index 87a4d233cb3b5ab..111d47d31f5238d 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js @@ -1,6 +1,6 @@ import _JSXStyle from "styled-jsx/style"; -import styles from "./styles"; -const styles2 = require("./styles2"); +import styles from './styles'; +const styles2 = require('./styles2'); // external only export const Test1 = ()=>
@@ -26,7 +26,7 @@ export const Test2 = ()=>
external and dynamic

- <_JSXStyle id={"332b21af86b0ec6"} dynamic={[ + <_JSXStyle id={"e8741288e177981"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -53,7 +53,7 @@ export const Test3 = ({ color })=>
{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"} - <_JSXStyle id={"ec8f36d08fa7aa2c"} dynamic={[ + <_JSXStyle id={"8b1fcdcd507e19f4"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -93,7 +93,7 @@ export const Test5 = ()=>
// static and dynamic export const Test6 = ({ color })=>
{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"} - <_JSXStyle id={"ec8f36d08fa7aa2c"} dynamic={[ + <_JSXStyle id={"8b1fcdcd507e19f4"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -120,7 +120,7 @@ export const Test6 = ({ color })=>
dynamic only

- <_JSXStyle id={"332b21af86b0ec6"} dynamic={[ + <_JSXStyle id={"e8741288e177981"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -150,7 +150,7 @@ export const Test8 = ({ color })=>{ }; return
{

dynamic with scoped compound variable

- <_JSXStyle id={"c37e7ca12a9fbc5b"} dynamic={[ + <_JSXStyle id={"7829a8a99414dd8a"} dynamic={[ innerProps.color ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`} @@ -180,7 +180,7 @@ export const Test9 = ({ color })=>{ }; return
{

dynamic with compound variable

- <_JSXStyle id={"59d22b990ceca2d7"} dynamic={[ + <_JSXStyle id={"8a6fd91dabb8fa72"} dynamic={[ innerProps.color ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}
; }; -const foo = "red"; +const foo = 'red'; // dynamic with constant variable -export const Test10 = ()=>
+export const Test10 = ()=>
-

dynamic with constant variable

+

dynamic with constant variable

- <_JSXStyle id={"64eb0b4e09da0dd3"}>{`p.jsx-64eb0b4e09da0dd3{color:${foo}}`} + <_JSXStyle id={"5722acc9bc50a42a"}>{`p.jsx-5722acc9bc50a42a{color:${foo}}`}
; @@ -218,14 +218,14 @@ export const Test11 = ({ color })=>{ length: 5 }).map((item, i)=>
  • - <_JSXStyle id={"93933d24284432d0"} dynamic={[ + <_JSXStyle id={"c3f49652e652bedf"} dynamic={[ color ]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js index 482c1150fd2b88e..c0cd6ea4718bfaa 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/css-selector-after-pseudo/output.js @@ -2,7 +2,7 @@ import _JSXStyle from "styled-jsx/style"; function NavigationItem({ active , className , }) { return + }, className, 'navigation-item') || "")}> <_JSXStyle id={"2342aae4628612c6"}>{'.navigation-item.jsx-2342aae4628612c6 a::after{content:attr(data-text);content:attr(data-text)/""}'} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js index f78146a476f1365..7d147ff803a8bf7 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js @@ -1,19 +1,19 @@ import _JSXStyle from "styled-jsx/style"; -const color = "red"; -const otherColor = "green"; -const A = ()=>
    +const color = 'red'; +const otherColor = 'green'; +const A = ()=>
    -

    test

    +

    test

    - <_JSXStyle id={"319ecfcffea32bfb"}>{`p.jsx-319ecfcffea32bfb{color:${color}}`} + <_JSXStyle id={"c7fc0b05a693e9a4"}>{`p.jsx-c7fc0b05a693e9a4{color:${color}}`}
    ; -const B = ()=>
    +const B = ()=>
    -

    test

    +

    test

    - <_JSXStyle id={"8a19b9bd65b986e0"}>{`p.jsx-8a19b9bd65b986e0{color:${otherColor}}`} + <_JSXStyle id={"1046a40dadd9ba3a"}>{`p.jsx-1046a40dadd9ba3a{color:${otherColor}}`}
    ; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-class/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-class/output.js index 70fafc58726ec83..49ba7ea7f920a5f 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-class/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-class/output.js @@ -1,7 +1,7 @@ import _JSXStyle from "styled-jsx/style"; export default class { render() { - const Element = "div"; + const Element = 'div'; return

    dynamic element

    @@ -11,7 +11,7 @@ export default class {
    ; } }; -const Element2 = "div"; +const Element2 = 'div'; export const Test2 = class { render() { return diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-external/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-external/output.js index fe43b40b89c4a58..e96530e253354a9 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-external/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element-external/output.js @@ -1,9 +1,12 @@ import _JSXStyle from "styled-jsx/style"; -import styles from "./styles2"; +import styles from './styles2'; export default (({ level =1 })=>{ const Element = `h${level}`; return +

    dynamic element

    + <_JSXStyle id={styles.__hash}>{styles} +
    ; -}); \ No newline at end of file +}); diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element/output.js index 5b7a6e7900f48e5..fe05a5238005d61 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/dynamic-element/output.js @@ -19,7 +19,7 @@ export const TestLowerCase = ({ level =1 })=>{ ; }; -const Element2 = "div"; +const Element2 = 'div'; export const Test2 = ()=>{ return @@ -29,7 +29,7 @@ export const Test2 = ()=>{ ; }; -export const Test3 = ({ Component ="div" })=>{ +export const Test3 = ({ Component ='div' })=>{ return

    dynamic element

    diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js index 770c2b093e12361..a702c7c5c2482fa 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js @@ -1,89 +1,89 @@ import _JSXStyle from "styled-jsx/style"; const darken = (c)=>c ; -const color = "red"; -const otherColor = "green"; -const mediumScreen = "680px"; -const animationDuration = "200ms"; -const animationName = "my-cool-animation"; +const color = 'red'; +const otherColor = 'green'; +const mediumScreen = '680px'; +const animationDuration = '200ms'; +const animationName = 'my-cool-animation'; const obj = { - display: "block" + display: 'block' }; -export default (({ display })=>
    -

    test

    - <_JSXStyle id={"6116059e04f3bff7"}>{`p.${color}.jsx-1ada4ad4dab7822f{color:${otherColor};display:${obj.display}}`} + <_JSXStyle id={"8e76843694b6211e"}>{`p.${color}.jsx-2a76485ca2068ace{color:${otherColor};display:${obj.display}}`} - <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-1ada4ad4dab7822f{color:red}"} + <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-2a76485ca2068ace{color:red}"} - <_JSXStyle id={"171303fb0d7f788b"}>{`body{background:${color}}`} + <_JSXStyle id={"10dc1d9b22b2a7b5"}>{`body{background:${color}}`} - <_JSXStyle id={"171303fb0d7f788b"}>{`body{background:${color}}`} + <_JSXStyle id={"10dc1d9b22b2a7b5"}>{`body{background:${color}}`} // TODO: the next two should have the same hash - <_JSXStyle id={"332b21af86b0ec6"}>{`p.jsx-1ada4ad4dab7822f{color:${color}}`} + <_JSXStyle id={"e8741288e177981"}>{`p.jsx-2a76485ca2068ace{color:${color}}`} - <_JSXStyle id={"332b21af86b0ec6"}>{`p.jsx-1ada4ad4dab7822f{color:${color}}`} + <_JSXStyle id={"e8741288e177981"}>{`p.jsx-2a76485ca2068ace{color:${color}}`} - <_JSXStyle id={"50021e09364b96c8"} dynamic={[ + <_JSXStyle id={"df64ca12d2e4b695"} dynamic={[ darken(color) ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`} - <_JSXStyle id={"f07deae908c9294f"} dynamic={[ + <_JSXStyle id={"6d0e1b3ba7bfc0af"} dynamic={[ darken(color) + 2 ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`} - <_JSXStyle id={"4e4be2da62837c76"}>{`@media(min-width:${mediumScreen}){p.jsx-1ada4ad4dab7822f{color:green}p.jsx-1ada4ad4dab7822f{color:${`red`}}}p.jsx-1ada4ad4dab7822f{color:red}`} + <_JSXStyle id={"487ddbb5adef30ad"}>{`@media(min-width:${mediumScreen}){p.jsx-2a76485ca2068ace{color:green}p.jsx-2a76485ca2068ace{color:${`red`}}}p.jsx-2a76485ca2068ace{color:red}`} - <_JSXStyle id={"27040f0829fb73d4"}>{`p.jsx-1ada4ad4dab7822f{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`} + <_JSXStyle id={"443cba17cf59f486"}>{`p.jsx-2a76485ca2068ace{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`} - <_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 id={"7bb457ebb3d9dcfc"}>{`p.jsx-2a76485ca2068ace{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-2a76485ca2068ace{background:${color}}`} - <_JSXStyle id={"183a75aa3877c18a"} dynamic={[ - display ? "block" : "none" - ]}>{`span.__jsx-style-dynamic-selector{display:${display ? "block" : "none"}}`} + <_JSXStyle id={"4de68c6ba6380d96"} dynamic={[ + display ? 'block' : 'none' + ]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`} // TODO: causes bad syntax diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-global/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-global/output.js index 8955ddcabf52280..1f4f56be5170b3f 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-global/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-global/output.js @@ -1,12 +1,19 @@ import _JSXStyle from "styled-jsx/style"; -import styles, { foo as styles3 } from "./styles"; -const styles2 = require("./styles2"); +import styles, { foo as styles3 } from './styles'; +const styles2 = require('./styles2'); export default (()=>
    +

    test

    +
    woot
    +

    woot

    + <_JSXStyle id={styles2.__hash}>{styles2} + <_JSXStyle id={styles3.__hash}>{styles3} + <_JSXStyle id={styles.__hash}>{styles} +
    -); \ No newline at end of file +); diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-multi-line/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-multi-line/output.js index ace11cfe5be4766..d124759ad3fcc83 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-multi-line/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet-multi-line/output.js @@ -1,7 +1,10 @@ import _JSXStyle from "styled-jsx/style"; -import styles from "./styles"; +import styles from './styles'; export default (()=>
    +

    test

    + <_JSXStyle id={styles.__hash}>{styles} +
    -); \ No newline at end of file +); diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet/output.js index e0304b413fd0af4..dc50ee4c638c6d1 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/external-stylesheet/output.js @@ -1,7 +1,7 @@ import _JSXStyle from "styled-jsx/style"; -import styles from "./styles"; -const styles2 = require("./styles2"); -import { foo as styles3 } from "./styles"; +import styles from './styles'; +const styles2 = require('./styles2'); +import { foo as styles3 } from './styles'; export default (()=>

    test

    diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/fragment/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/fragment/output.js index aefcddc43fcb714..cdac92f794df182 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/fragment/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/fragment/output.js @@ -1,5 +1,5 @@ import _JSXStyle from "styled-jsx/style"; -import React from "react"; +import React from 'react'; export default (()=><>

    Testing!!!

    diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js index f36b6e2e7383719..088931f022d4f4c 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js @@ -1,14 +1,14 @@ import _JSXStyle from "styled-jsx/style"; export default (({ breakPoint })=>
    - <_JSXStyle id={"42a6f8ca08e1a043"} dynamic={[ + <_JSXStyle id={"583106813dd274f4"} dynamic={[ breakPoint ]}>{`@media(${breakPoint}){}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js index ac5394ea192a852..4aa287a6a1c0d08 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"5bbb77b0f67942dc"} dynamic={[ + <_JSXStyle id={"56eb85d11cc61daf"} dynamic={[ Typography.base.size.default, Typography.base.lineHeight, Target.mediumPlus, diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/multiple-jsx/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/multiple-jsx/output.js index 0014d0844a7ef62..40b9e0bb27b0ed7 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/multiple-jsx/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/multiple-jsx/output.js @@ -1,6 +1,6 @@ import _JSXStyle from "styled-jsx/style"; const attrs = { - id: "test" + id: 'test' }; const Test1 = ()=>
    diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/not-styled-jsx-tagged-templates/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/not-styled-jsx-tagged-templates/output.js index d4b7bfebdcf6cac..4d147784a9f4c6c 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/not-styled-jsx-tagged-templates/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/not-styled-jsx-tagged-templates/output.js @@ -1,5 +1,5 @@ -import css from "hell"; -const color = "red"; +import css from 'hell'; +const color = 'red'; const bar = css` div { font-size: 3em; @@ -21,4 +21,4 @@ const Title = styled.h1` `; const AnotherTitle = Title.extend`color: blue;`; export const Component = ()=>My page -; \ No newline at end of file +; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js index 19b912eb010255c..1e4316e34e0f093 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js @@ -1,17 +1,17 @@ import _JSXStyle from "styled-jsx/style"; import Link from "next/link"; export default function IndexPage() { - return
    + return
    Hello World.{" "} - Abound + Abound - <_JSXStyle id={"b642661fd6426842"}>{`a.jsx-b642661fd6426842{color:${"#abcdef"}12}`} + <_JSXStyle id={"fc95642a3265cb72"}>{`a.jsx-fc95642a3265cb72{color:${"#abcdef"}12}`}
    ; }; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js index 7b61c0b7ec131ea..909d566a0096131 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js @@ -1,31 +1,31 @@ import _JSXStyle from "styled-jsx/style"; -import colors, { size } from "./constants"; -const color = "red"; +import colors, { size } from './constants'; +const color = 'red'; const bar = new String("div.jsx-aaed0341accea8f{font-size:3em}"); 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 = "5ba1fcb8b8f3d807"; +a.__hash = "a0b0bfa04065ce9d"; export const uh = bar; -export const foo = new String(`div.jsx-945eaa83250ed332{color:${color}}`); -foo.__hash = "945eaa83250ed332"; +export const foo = new String(`div.jsx-40e01c278585442b{color:${color}}`); +foo.__hash = "40e01c278585442b"; ({ - styles: <_JSXStyle id={"c107a919a5b2943d"}>{`div.jsx-c107a919a5b2943d{color:${colors.green.light}}a.jsx-c107a919a5b2943d{color:red}`}, - className: "jsx-c107a919a5b2943d" + styles: <_JSXStyle id={"1864b70fe66c4fb5"}>{`div.jsx-1864b70fe66c4fb5{color:${colors.green.light}}a.jsx-1864b70fe66c4fb5{color:red}`}, + className: "jsx-1864b70fe66c4fb5" }); const b = { - styles: <_JSXStyle id={"c107a919a5b2943d"}>{`div.jsx-c107a919a5b2943d{color:${colors.green.light}}a.jsx-c107a919a5b2943d{color:red}`}, - className: "jsx-c107a919a5b2943d" + styles: <_JSXStyle id={"1864b70fe66c4fb5"}>{`div.jsx-1864b70fe66c4fb5{color:${colors.green.light}}a.jsx-1864b70fe66c4fb5{color:red}`}, + className: "jsx-1864b70fe66c4fb5" }; const dynamic = (colors1)=>{ const b = { - styles: <_JSXStyle id={"60132422fc87f1d1"} dynamic={[ + styles: <_JSXStyle id={"6739b456a2832bc7"} dynamic={[ colors1.green.light ]}>{`div.__jsx-style-dynamic-selector{color:${colors1.green.light}}a.__jsx-style-dynamic-selector{color:red}`}, className: _JSXStyle.dynamic([ [ - "60132422fc87f1d1", + "6739b456a2832bc7", [ colors1.green.light ] @@ -34,6 +34,6 @@ const dynamic = (colors1)=>{ }; }; export default { - styles: <_JSXStyle id={"e5da8dd7ff5c7f39"}>{`div.jsx-e5da8dd7ff5c7f39{font-size:3em}p.jsx-e5da8dd7ff5c7f39{color:${color}}`}, - className: "jsx-e5da8dd7ff5c7f39" + styles: <_JSXStyle id={"8f298dcba20b7575"}>{`div.jsx-8f298dcba20b7575{font-size:3em}p.jsx-8f298dcba20b7575{color:${color}}`}, + className: "jsx-8f298dcba20b7575" }; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js index a20f9f474040101..4bdf357cdd805e0 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js @@ -1,8 +1,8 @@ import _JSXStyle from "styled-jsx/style"; -export const Red = ({ Component ="button" , })=>{ +export const Red = ({ Component ='button' , })=>{ return { {} - <_JSXStyle id={"ca900d186ad0e495"} dynamic={[ + <_JSXStyle id={"50b0a4905a4d7613"} dynamic={[ e1, e2, e3, diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js index c94ca5493d06c47..35fc7daf6470f64 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js @@ -2,14 +2,14 @@ import _JSXStyle from "styled-jsx/style"; export default function Home({ fontFamily }) { return
    - <_JSXStyle id={"f804e2f486b6ac13"} dynamic={[ + <_JSXStyle id={"eaaa5fc10a418aa4"} dynamic={[ fontFamily ]}>{`body{font-family:${fontFamily}}code:before,code:after{content:"\`"}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js index 28d29b34b19665d..ceea6d455590f36 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js @@ -3,25 +3,25 @@ export default class { render() { return

    test

    - <_JSXStyle id={"e359801ddd3b3cb6"} dynamic={[ - inputSize ? "height: calc(2 * var(--a)) !important;" : "" - ]}>{`@media only screen{a.__jsx-style-dynamic-selector{${inputSize ? "height: calc(2 * var(--a)) !important;" : ""} + <_JSXStyle id={"f65b6d78a7616a5c"} dynamic={[ + inputSize ? 'height: calc(2 * var(--a)) !important;' : '' + ]}>{`@media only screen{a.__jsx-style-dynamic-selector{${inputSize ? 'height: calc(2 * var(--a)) !important;' : ''} }}`}
    ; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js index 7c0c59d4ac651a1..f937069d58a6a95 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"1a799d9370a3a386"} dynamic={[ + <_JSXStyle id={"5b2948e4057683ab"} dynamic={[ a[b], -1 * (c || 0), d diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js index 754e53aa0330908..62c1a4c1c327d40 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"4ca4ef3595473f53"} dynamic={[ + <_JSXStyle id={"98a45d4b66f5e6cc"} dynamic={[ a ]}>{`@media only screen{a.__jsx-style-dynamic-selector{color:${a}}}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js index 8f9e67c31304ac9..db10e355301fe9c 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js @@ -3,28 +3,28 @@ export default class { render() { return

    test

    - <_JSXStyle id={"97886c1e9511aafa"} 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 id={"62fb04e864e1847e"} dynamic={[ + a || 'var(--c)', + b || 'inherit' + ]}>{`.a:hover .b.__jsx-style-dynamic-selector{display:inline-block;padding:0 ${a || 'var(--c)'};color:${b || 'inherit'}}`}
    ; } diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js index 898bc9e3d60aa32..9a29db4516c7c91 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js @@ -3,28 +3,28 @@ export default class { render() { return

    test

    - <_JSXStyle id={"bcc606c168bcd197"} dynamic={[ - a ? "100%" : "200px", - b ? "0" : "8px 20px" - ]}>{`.item.__jsx-style-dynamic-selector{max-width:${a ? "100%" : "200px"};padding:${b ? "0" : "8px 20px"}}`} + <_JSXStyle id={"87ab3122c5e435af"} dynamic={[ + a ? '100%' : '200px', + b ? '0' : '8px 20px' + ]}>{`.item.__jsx-style-dynamic-selector{max-width:${a ? '100%' : '200px'};padding:${b ? '0' : '8px 20px'}}`}
    ; } diff --git a/packages/next-swc/crates/core/tests/loader/example/output.js b/packages/next-swc/crates/core/tests/loader/example/output.js index 23c806556546241..e7ce646a3e2ac53 100644 --- a/packages/next-swc/crates/core/tests/loader/example/output.js +++ b/packages/next-swc/crates/core/tests/loader/example/output.js @@ -49,7 +49,7 @@ function _unsupportedIterableToArray(o, minLen) { if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -import other from 'other'; +import other from "other"; var _other = _slicedToArray(other, 1), foo = _other[0]; var Foo = function Foo() { "use strict"; diff --git a/packages/next-swc/crates/core/tests/loader/issue-31627/output.js b/packages/next-swc/crates/core/tests/loader/issue-31627/output.js index 7cfb5d2942f45bf..0cbd09b419965dd 100644 --- a/packages/next-swc/crates/core/tests/loader/issue-31627/output.js +++ b/packages/next-swc/crates/core/tests/loader/issue-31627/output.js @@ -3,8 +3,8 @@ function _classCallCheck(instance, Constructor) { throw new TypeError("Cannot call a class as a function"); } } -import { useEffect } from 'react'; -import { select, selectAll } from 'd3-selection'; +import { useEffect } from "react"; +import { select, selectAll } from "d3-selection"; export default function Home() { useEffect(function() { new MyClass(); @@ -18,7 +18,7 @@ export default function Home() { var MyClass = function MyClass() { "use strict"; _classCallCheck(this, MyClass); - selectAll('.group').each(function() { - select(this).selectAll('path'); + selectAll(".group").each(function() { + select(this).selectAll("path"); }); }; diff --git a/packages/next-swc/crates/core/tests/loader/issue-32553/output.js b/packages/next-swc/crates/core/tests/loader/issue-32553/output.js index 70364d18bf7518d..183b610d5087b17 100644 --- a/packages/next-swc/crates/core/tests/loader/issue-32553/output.js +++ b/packages/next-swc/crates/core/tests/loader/issue-32553/output.js @@ -1,2 +1,2 @@ /*#__PURE__*/ React.createElement("div", null, "children"); -'<>hello'; +"<>hello"; diff --git a/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js b/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js index 8e100ad666c08d1..d0f8d43a2644f2b 100644 --- a/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js +++ b/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js @@ -17,7 +17,7 @@ function _templateObject() { }; return data; } -import styled from 'styled-components'; +import styled from "styled-components"; export var foo = styled.input.withConfig({ displayName: "input__foo", componentId: "sc-12c52e68-0" From ba7eea503663ac1b0759d068c888a5b21c64d4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 23 Mar 2022 18:48:25 +0900 Subject: [PATCH 14/24] Update test refs --- test/unit/next-swc.test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/unit/next-swc.test.ts b/test/unit/next-swc.test.ts index 9cff612359553b7..22b92fbb6843978 100644 --- a/test/unit/next-swc.test.ts +++ b/test/unit/next-swc.test.ts @@ -23,10 +23,10 @@ describe('next/swc', () => { `) expect(output).toMatchInlineSnapshot(` - "import { useState } from 'react'; - var ref = useState(0), count = ref[0], setCount = ref[1]; - " - `) +"import { useState } from \\"react\\"; +var ref = useState(0), count = ref[0], setCount = ref[1]; +" +`) }) it('should be able to ignore some Array-destructured hook return values', async () => { @@ -42,10 +42,10 @@ describe('next/swc', () => { `) expect(output).toMatchInlineSnapshot(` - "import { useState } from 'react'; - var ref = useState(0), setCount = ref[1]; - " - `) +"import { useState } from \\"react\\"; +var ref = useState(0), setCount = ref[1]; +" +`) }) }) }) From f2d7bca3e8529a28c6bf330a7eacbbc49d1db2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 23 Mar 2022 19:43:37 +0900 Subject: [PATCH 15/24] Update error reporter --- packages/next-swc/Cargo.lock | 4 ++-- .../tests/errors/next-dynamic/no-arguments/output.stderr | 4 ++-- .../errors/next-dynamic/options-as-variable/output.stderr | 4 ++-- .../errors/next-dynamic/too-many-arguments/output.stderr | 4 ++-- .../next-ssg/server-side-after-static-paths/output.stderr | 4 ++-- .../next-ssg/server-side-after-static-props/output.stderr | 4 ++-- .../next-ssg/static-paths-after-server-side/output.stderr | 4 ++-- .../next-ssg/static-props-after-server-side/output.stderr | 4 ++-- .../re-export-all-in-page/re-export-all/output.stderr | 4 ++-- .../core/tests/errors/styled-jsx/no-child/output.stderr | 6 +++--- .../tests/errors/styled-jsx/two-children/output.stderr | 8 ++++---- .../errors/styled-jsx/wrong-child-type/output.stderr | 8 ++++---- .../styled-jsx/wrong-jsx-expression-type/output.stderr | 8 ++++---- 13 files changed, 33 insertions(+), 33 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 36f4da67eadde98..929f2117aa1a891 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -2603,9 +2603,9 @@ dependencies = [ [[package]] name = "swc_error_reporters" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03cb606be4544bae11412d1ff32663de9607aec86d003d21ac1695b432fe40c8" +checksum = "c28653b7f324886314bffd4bd3e756c367ec3adde80758543f39db503537a4fd" dependencies = [ "miette", "swc_common", diff --git a/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr b/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr index a84b428c6441e4f..52fe86d001cf234 100644 --- a/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-dynamic/no-arguments/output.stderr @@ -1,6 +1,6 @@ x next/dynamic requires at least one argument - ,-[input.js:4:1] - 4 | const DynamicComponent = dynamic() + ,-[input.js:3:1] + 3 | const DynamicComponent = dynamic() : ^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr b/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr index 81d8ce0d542f6a1..ed1f15953555209 100644 --- a/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-dynamic/options-as-variable/output.stderr @@ -1,7 +1,7 @@ x next/dynamic options must be an object literal. | Read more: https://nextjs.org/docs/messages/invalid-dynamic-options-type - ,-[input.js:5:1] - 5 | const DynamicComponentWithCustomLoading = dynamic( + ,-[input.js:4:1] + 4 | const DynamicComponentWithCustomLoading = dynamic( : ^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr b/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr index 3e428c720583a3f..c23c99c751aee2e 100644 --- a/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.stderr @@ -1,6 +1,6 @@ x next/dynamic only accepts 2 arguments - ,-[input.js:4:1] - 4 | const DynamicComponentWithCustomLoading = dynamic( + ,-[input.js:3:1] + 3 | const DynamicComponentWithCustomLoading = dynamic( : ^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr index 3fb78077db1d3d4..fe67904041917d0 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/output.stderr @@ -1,6 +1,6 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - ,-[input.js:3:1] - 3 | export const getServerSideProps = function getServerSideProps() {} + ,-[input.js:2:1] + 2 | export const getServerSideProps = function getServerSideProps() {} : ^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr index e14c2069736734b..9fac72d6f632165 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr @@ -1,6 +1,6 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - ,-[input.js:3:1] - 3 | export { a as getServerSideProps } + ,-[input.js:2:1] + 2 | export { a as getServerSideProps } : ^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr index eafac0e544a5b7b..5ca8b1dc51821a7 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/output.stderr @@ -1,6 +1,6 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - ,-[input.js:3:1] - 3 | export { getStaticPaths } from 'a' + ,-[input.js:2:1] + 2 | export { getStaticPaths } from 'a' : ^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr index 2bcc19898547b39..80e4cf6ecb2b673 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/output.stderr @@ -1,6 +1,6 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps - ,-[input.js:2:1] - 2 | export { getStaticProps, getServerSideProps } + ,-[input.js:1:1] + 1 | export { getStaticProps, getServerSideProps } : ^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr b/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr index 7e2a401874df182..d2e7293e2085588 100644 --- a/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/re-export-all-in-page/re-export-all/output.stderr @@ -1,7 +1,7 @@ x Using `export * from '...'` in a page is disallowed. Please use `export { default } from '...'` instead. | Read more: https://nextjs.org/docs/messages/export-all-in-page - ,-[input.js:2:1] - 2 | export * from './other-page' + ,-[input.js:1:1] + 1 | export * from './other-page' : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr index 8b048525e4e07a4..f9789a9d4d850cd 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/no-child/output.stderr @@ -1,7 +1,7 @@ x Expected one child under JSX style tag, but got 0. | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - ,-[input.js:4:5] - 4 | ,-> + ,-[input.js:3:5] + 3 | ,-> `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr index a4fb3b041a8a401..333d1d6d9a7a5f9 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/two-children/output.stderr @@ -1,9 +1,9 @@ x Expected one child under JSX style tag, but got 2. | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - ,-[input.js:4:5] - 4 | ,-> + 6 | `-> `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr index efd0c72b2300cec..a524f640c0cdac6 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-child-type/output.stderr @@ -1,8 +1,8 @@ x Expected a single child of type JSXExpressionContainer under JSX Style tag. | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - ,-[input.js:4:5] - 4 | ,-> + ,-[input.js:3:5] + 3 | ,-> `---- diff --git a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr index 4dd9e08f3efb50a..93bcfe2857bc593 100644 --- a/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/styled-jsx/wrong-jsx-expression-type/output.stderr @@ -1,8 +1,8 @@ x Expected a template literal, string or identifier inside the JSXExpressionContainer. | Read more: https://nextjs.org/docs/messages/invalid-styled-jsx-children - ,-[input.js:4:5] - 4 | ,-> + ,-[input.js:3:5] + 3 | ,-> `---- From 864bf71cd73b73799c5dec07a2c470855535af9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 23 Mar 2022 20:10:06 +0900 Subject: [PATCH 16/24] Update snapshots --- .../__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap index aadfe37aab9875e..30ad20c91338a02 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox-app-doc.test.ts.snap @@ -5,14 +5,14 @@ exports[`ReactRefreshLogBox _app syntax error shows logbox 1`] = ` Error: x Expression expected ,---- - 4 | return <; + 3 | return <; : ^ \`---- x Unexpected token \`jsx name (Component)\`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, | string, regexp, \` for template literal, (, or an identifier ,---- - 4 | return <; + 3 | return <; : ^^^^^^^^^ \`---- @@ -26,7 +26,7 @@ exports[`ReactRefreshLogBox _document syntax error shows logbox 1`] = ` Error: x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key ,---- - 5 | class MyDocument extends Document {{ + 4 | class MyDocument extends Document {{ : ^ \`---- From 11f44bb0f3c10a4abc5340178c8053715d5f8420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 23 Mar 2022 21:01:29 +0900 Subject: [PATCH 17/24] Update snapshots --- .../__snapshots__/ReactRefreshLogBox.test.ts.snap | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap index 7493fc0b501ecaa..dc2f222b85f8348 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -71,7 +71,7 @@ exports[`ReactRefreshLogBox logbox: can recover from a syntax error without losi Error: x Unexpected eof ,---- - 2 | export default () =>
    runtime error 2`] = ` Error: x Unexpected eof ,---- - 9 | export default function FunctionNamed() { + 8 | export default function FunctionNamed() { : ^ \`---- @@ -146,7 +146,7 @@ exports[`ReactRefreshLogBox syntax > runtime error 3`] = ` Error: x Unexpected eof ,---- - 9 | export default function FunctionNamed() { + 8 | export default function FunctionNamed() { : ^ \`---- @@ -159,10 +159,10 @@ exports[`ReactRefreshLogBox unterminated JSX 1`] = ` "./index.js Error: x Unexpected eof - ,---- - 10 | - : ^ - \`---- + ,---- + 9 | + : ^ + \`---- Caused by: 0: failed to process input file From 762114df2fec55b00502f534e1bbdc49aa367082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 24 Mar 2022 16:26:53 +0900 Subject: [PATCH 18/24] Bug? --- packages/next-swc/Cargo.lock | 92 ++++++++++++------------ packages/next-swc/crates/core/Cargo.toml | 8 +-- packages/next-swc/crates/napi/Cargo.toml | 6 +- packages/next-swc/crates/wasm/Cargo.toml | 4 +- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 929f2117aa1a891..7b7039a9badaccb 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -1877,9 +1877,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "styled_components" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f1e263f5c528c1d99c0372528decab6eea1a79c03eabe9f9c54c4e40eaf743" +checksum = "c53764788592bbd0f72bdfa0ff879c934c9c952e881be7b4230f49a520d2b956" dependencies = [ "Inflector", "once_cell", @@ -1921,9 +1921,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.159.0" +version = "0.160.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1240ecb3c0844cd41f3004589acc0bba88bff7bff4b304059902dcbe2983a0" +checksum = "2a02a41d3fd6a0339af4010056601e35b90cb3e40a74c6b3f9e9ba93ec5b404c" dependencies = [ "ahash", "anyhow", @@ -1975,9 +1975,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.128.0" +version = "0.129.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b99c7e79fff6f6a2831632cf2863758ad9d9cb6c7a313d65f1cfa9af9b79f3" +checksum = "37d682e6d2b218eda8433a889edc038b138a2e18df3e47f96f22b6dbddba70ab" dependencies = [ "ahash", "anyhow", @@ -2144,9 +2144,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.72.0" +version = "0.73.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d97203319ad53b587a1ca3166a8e7446ee3911eea67d836a279c982652c8b1" +checksum = "a20447f3de45ecf25ecb13d7ca039fae8ea9c2acdcde1efb020526b5f7ffbc7a" dependencies = [ "is-macro", "num-bigint", @@ -2159,9 +2159,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.99.0" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db28818448161d5992e1d0d2b79653b4399459618756119e9a04c2dd787221f" +checksum = "5680f03f8b76597739bfa263b32944b14551e3103ab5bcc7b2ba521794fe019c" dependencies = [ "bitflags", "memchr", @@ -2191,9 +2191,9 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.61.0" +version = "0.62.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1e24dd6f333977b5f8208538ae97d6f10ef58a4750d5fe7838119389a51f45" +checksum = "946d85665a67f12a6e3f780f0a40961b819bddb58796261edf95156ff1a245f3" dependencies = [ "phf", "swc_atoms", @@ -2205,9 +2205,9 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af98897f867073ad7d3d551689bcd4d42bfd4fc2dbd0b83d240cc0a046449d46" +checksum = "6b338a831ed61250d2e345c3c609708808d3a8f7ab9fdc069a2743acea543036" dependencies = [ "ahash", "auto_impl", @@ -2246,9 +2246,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.95.0" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e929f67238c6f3f2335c2a831c13e1156e22bbd7c1a9be7025cf2dfed1d585" +checksum = "f05d316ad545d36324cd8218c272ab1348b32d8a635fa7a58e8b543f3440acc3" dependencies = [ "ahash", "indexmap", @@ -2277,9 +2277,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.96.0" +version = "0.97.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df352b7979ad7fc29f216bdfa10727b2ecaa781e0e89a585acf51aec15ed9c4" +checksum = "cfd6b0c3cb611fb5e10dcf29c840889dc18506189b1b0200010b38da924a4805" dependencies = [ "either", "enum_kind", @@ -2297,9 +2297,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.112.0" +version = "0.113.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1d2d90d78983c1e5bdd71a3f22be851d06ca24157844d5ef5397375abe28d8" +checksum = "cede1ab3f93f9547ece9d5d7717b926ee84065710ca647401f82e9cec2226872" dependencies = [ "ahash", "anyhow", @@ -2322,9 +2322,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.137.0" +version = "0.138.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199e27cf668cd13cb1e6ebff963f7353aa541f67f2ee48a2688ca65dd08e40ed" +checksum = "0d8d4cb28146013da04eb9bcbea4a3747e48bd75a7baee7e293f92e5487c1200" dependencies = [ "swc_atoms", "swc_common", @@ -2342,9 +2342,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.71.0" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9167dd43047162d06251beb8a61cad09e87b27fb400f0753ce30f67920182ed1" +checksum = "fb236fdb1ec203c8191465cce3bedcdcd89dd78a8caad92ab3d15397f65bfb1d" dependencies = [ "better_scoped_tls", "once_cell", @@ -2363,9 +2363,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.59.0" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d831b06b4c214a5edbcac97ef2c6a9b66827115dea1921f4fc3aeec91c03e50e" +checksum = "3eb7e5da22316e296d2e48eee3b681fa06c1a3c11645e211c0675f1b5e526e5c" dependencies = [ "swc_atoms", "swc_common", @@ -2377,9 +2377,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.84.1" +version = "0.85.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4547883c1c5ff8fb742fe88e68bce30baa3f2f22be3beb94a5fcbb695565678" +checksum = "c0d089031132a390a06e576dc84ecc6a42990da402158ce32556248d457b600e" dependencies = [ "ahash", "arrayvec 0.7.2", @@ -2416,9 +2416,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.97.0" +version = "0.98.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "754c1e49748efab7676891d4ba6134d7cebe9091434747f6cf2ad0816be15945" +checksum = "2e0abbe67fa75caa44759c6cb43b711fecca747ab7b8d17f3ce0fb6315d9f915" dependencies = [ "Inflector", "ahash", @@ -2440,9 +2440,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.107.0" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4ad791fb112a8a9416990d1907249ea6d9bd61b1f8f82b24f5705716ebeb895" +checksum = "d7bf2faf46122ce5a522f00d70ee07dcab55cdc2acf6566c6bc61f0d9f77f2bf" dependencies = [ "ahash", "dashmap 5.1.0", @@ -2463,9 +2463,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.92.0" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88f7b76c0e068d4663c7eaa3e0f97135aee40c03f4a6d76aff6729ee8e4cc6a" +checksum = "763242be40c953c9922c68c2d5a1cab712b7f24731d2c3ec3df42816c5c527a3" dependencies = [ "either", "serde", @@ -2482,9 +2482,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.99.0" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ef957320606a96d14fc5361e4efaea1f2987d58f55fc77fda0443cc12fdf5c" +checksum = "4c744387c1a3fc3d77f649c7139424ba81f4713dc8534e7a014bc356dcf92a18" dependencies = [ "ahash", "base64 0.13.0", @@ -2507,9 +2507,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.73.0" +version = "0.74.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8785d08da5ecd24fa4125ed647967c666aa2e43e0bfbdfbe6039c570fecd1a20" +checksum = "d0b0be0a745bb930103fc9cee09286d712e4c5359be166178b9f51af9bf3742c" dependencies = [ "ansi_term", "anyhow", @@ -2530,9 +2530,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.102.1" +version = "0.103.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b523892d177298f224d6b9e030dbc60634869cd2dad5e0e4367007c2afede4df" +checksum = "5fd451ccb471fb5aa44fc1b9c8c02e771441a354386757151286cb036336f6cf" dependencies = [ "serde", "swc_atoms", @@ -2546,9 +2546,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.75.0" +version = "0.76.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c96a2a3cd95edf5e0850d3682ba78b91aa52ecb80134ea28db77a9a3bc8f87" +checksum = "f564076be1d203c04f170cffd82bfcf9ba532bc5bf3f5198f39a214cf96e0518" dependencies = [ "indexmap", "once_cell", @@ -2562,9 +2562,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.58.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5158e2be44e7ab8ada738aed23e6efbbbfd939bb0318633d72289a52209ab5f" +checksum = "2348e0ce526f12e74c0b700f8fec234893386bb1afe1b8c3f46ad10aad22442f" dependencies = [ "num-bigint", "swc_atoms", @@ -2576,9 +2576,9 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.138.0" +version = "0.139.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c69d430199fa3e25c35022e187850c48cdbd53026380bf581366a6e76370ac4" +checksum = "ef384749312e1d3633bc24e322d3352a281714511062ec65290fcc6114f14b8f" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index e61d88c94e0422f..e2fdf73e01c5387 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -19,13 +19,13 @@ radix_fmt = "1" regex = "1.5" serde = "1" serde_json = "1" -styled_components = "0.21.0" -swc = "0.159.0" +styled_components = "0.22.0" +swc = "0.160.0" swc_atoms = "0.2.9" swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } swc_css = "0.103.0" swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } -swc_ecmascript = { version = "0.138.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.139.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" swc_cached = "0.1.1" swc_stylis = "0.99.1" @@ -33,6 +33,6 @@ tracing = {version = "0.1.28", features = ["release_max_level_off"]} handlebars = "4.2.1" [dev-dependencies] -swc_ecma_transforms_testing = "0.73.0" +swc_ecma_transforms_testing = "0.74.0" testing = "0.19.1" walkdir = "2.3.2" diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index 32ab32e5204e899..52b5e1de74c2a64 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -16,12 +16,12 @@ next-swc = {version = "0.0.0", path = "../core"} once_cell = "1.8.0" serde = "1" serde_json = "1" -swc = "0.159.0" +swc = "0.160.0" swc_atoms = "0.2.9" -swc_bundler = { version = "0.128.0", features = ["concurrent"] } +swc_bundler = { version = "0.129.0", features = ["concurrent"] } swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } -swc_ecmascript = { version = "0.138.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.139.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" [build-dependencies] diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index fe33c62448efc65..bfd997a5a0fb2c1 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -16,9 +16,9 @@ parking_lot_core = "=0.8.0" path-clean = "0.1" serde = {version = "1", features = ["derive"]} serde_json = "1" -swc = "0.159.0" +swc = "0.160.0" swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } -swc_ecmascript = { version = "0.138.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.139.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" From 719c21f310ebb09d643487b0a3bb1fa6e7bf169f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 24 Mar 2022 16:30:08 +0900 Subject: [PATCH 19/24] Fix --- packages/next-swc/Cargo.lock | 4 ++-- packages/next-swc/crates/core/src/styled_jsx/transform_css.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 7b7039a9badaccb..b636add123e5ed7 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -1965,9 +1965,9 @@ dependencies = [ [[package]] name = "swc_atoms" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5229fe227ff0060e13baa386d6e368797700eab909523f730008d191ee53ae" +checksum = "66c47429cf5863efa95e9e4004ebb89396c3edec6569d2c41ab3aec509bcc716" dependencies = [ "string_cache", "string_cache_codegen", diff --git a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs index 9607fc878f6aa15..e8a8b5f0e3057b9 100644 --- a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs +++ b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs @@ -97,7 +97,7 @@ pub fn transform_css( .map(|quasi| { TplElement { cooked: None, // ? Do we need cooked as well - raw: (*quasi).into(), + raw: quasi.replace("`", "\\`").into(), span: DUMMY_SP, tail: false, } From d71d03137a7b515f9e4ff8288ce9bc2515af604b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Mon, 28 Mar 2022 23:15:18 +0900 Subject: [PATCH 20/24] Fix lint --- packages/next-swc/crates/core/src/styled_jsx/transform_css.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs index e8a8b5f0e3057b9..c0d3a1c5cffa80a 100644 --- a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs +++ b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs @@ -97,7 +97,7 @@ pub fn transform_css( .map(|quasi| { TplElement { cooked: None, // ? Do we need cooked as well - raw: quasi.replace("`", "\\`").into(), + raw: quasi.replace('`', "\\`").into(), span: DUMMY_SP, tail: false, } From 7c5d9e3352c80a46bbc00691be1d0545b7561eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 30 Mar 2022 23:39:51 +0900 Subject: [PATCH 21/24] Update swc again --- packages/next-swc/Cargo.lock | 270 ++++++++--------------- packages/next-swc/crates/core/Cargo.toml | 14 +- packages/next-swc/crates/napi/Cargo.toml | 10 +- packages/next-swc/crates/wasm/Cargo.toml | 6 +- 4 files changed, 101 insertions(+), 199 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index b636add123e5ed7..d4ef8f48d68b79b 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -33,7 +33,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.5", + "getrandom", "once_cell", "serde", "version_check", @@ -431,7 +431,7 @@ checksum = "c0834a35a3fce649144119e18da2a4d8ed12ef3862f47183fd46f625d072d96c" dependencies = [ "cfg-if 1.0.0", "num_cpus", - "parking_lot 0.12.0", + "parking_lot", ] [[package]] @@ -575,17 +575,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.5" @@ -594,7 +583,7 @@ checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -1013,11 +1002,11 @@ dependencies = [ "swc_cached", "swc_common", "swc_css", + "swc_css_prefixer", "swc_ecma_loader", "swc_ecma_transforms_testing", "swc_ecmascript", "swc_node_base", - "swc_stylis", "testing", "tracing", "walkdir", @@ -1152,17 +1141,6 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20448fd678ec04e6ea15bbe0476874af65e98a01515d667aa49f1434dc44ebf4" -[[package]] -name = "parking_lot" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.0", -] - [[package]] name = "parking_lot" version = "0.12.0" @@ -1279,28 +1257,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ "phf_macros", - "phf_shared 0.10.0", + "phf_shared", "proc-macro-hack", ] -[[package]] -name = "phf_generator" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" -dependencies = [ - "phf_shared 0.8.0", - "rand 0.7.3", -] - [[package]] name = "phf_generator" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ - "phf_shared 0.10.0", - "rand 0.8.5", + "phf_shared", + "rand", ] [[package]] @@ -1309,23 +1277,14 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", + "phf_generator", + "phf_shared", "proc-macro-hack", "proc-macro2", "quote", "syn", ] -[[package]] -name = "phf_shared" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" -dependencies = [ - "siphasher", -] - [[package]] name = "phf_shared" version = "0.10.0" @@ -1453,20 +1412,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", -] - [[package]] name = "rand" version = "0.8.5" @@ -1474,18 +1419,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -1495,16 +1430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -1513,25 +1439,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.5", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -1832,26 +1740,26 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_cache" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33994d0838dc2d152d17a62adf608a869b5e846b65b389af7f3dbc1de45c5b26" +checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" dependencies = [ - "lazy_static", "new_debug_unreachable", - "parking_lot 0.11.1", - "phf_shared 0.10.0", + "once_cell", + "parking_lot", + "phf_shared", "precomputed-hash", "serde", ] [[package]] name = "string_cache_codegen" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", + "phf_generator", + "phf_shared", "proc-macro2", "quote", ] @@ -1877,9 +1785,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "styled_components" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53764788592bbd0f72bdfa0ff879c934c9c952e881be7b4230f49a520d2b956" +checksum = "a29f0d8eb056b9763d224462594cda0f2dc96aa613fab7ada00ade37d3f05443" dependencies = [ "Inflector", "once_cell", @@ -1921,9 +1829,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.160.0" +version = "0.161.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a02a41d3fd6a0339af4010056601e35b90cb3e40a74c6b3f9e9ba93ec5b404c" +checksum = "21ec4e431e58f946a96690e348e5a876534a2d99ccebc0690610f5410f0ccb89" dependencies = [ "ahash", "anyhow", @@ -1933,7 +1841,7 @@ dependencies = [ "indexmap", "lru", "once_cell", - "parking_lot 0.12.0", + "parking_lot", "pathdiff", "regex", "serde", @@ -1965,9 +1873,9 @@ dependencies = [ [[package]] name = "swc_atoms" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c47429cf5863efa95e9e4004ebb89396c3edec6569d2c41ab3aec509bcc716" +checksum = "ba8735ce37e421749498e038955abc1135eec6a4af0b54a173e55d2e5542d472" dependencies = [ "string_cache", "string_cache_codegen", @@ -1975,9 +1883,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.129.0" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d682e6d2b218eda8433a889edc038b138a2e18df3e47f96f22b6dbddba70ab" +checksum = "7019f6b663117b77c085b4bc432d13370fd7715fe1a7e63cb54070756710133a" dependencies = [ "ahash", "anyhow", @@ -1986,7 +1894,7 @@ dependencies = [ "indexmap", "is-macro", "once_cell", - "parking_lot 0.12.0", + "parking_lot", "petgraph", "radix_fmt", "rayon", @@ -2038,7 +1946,7 @@ dependencies = [ "from_variant", "num-bigint", "once_cell", - "parking_lot 0.12.0", + "parking_lot", "rustc-hash", "serde", "siphasher", @@ -2118,6 +2026,19 @@ dependencies = [ "swc_css_ast", ] +[[package]] +name = "swc_css_prefixer" +version = "0.99.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301926ee69de04a6643f9c4ac8dcc67c6a5de3edd9fe218c6c2cf99f8c934652" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_css_ast", + "swc_css_utils", + "swc_css_visit", +] + [[package]] name = "swc_css_utils" version = "0.88.2" @@ -2159,9 +2080,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.100.0" +version = "0.101.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5680f03f8b76597739bfa263b32944b14551e3103ab5bcc7b2ba521794fe019c" +checksum = "55757ca4dd7bd6882beeef38352e730ea06b772c14b1c49a46aa489605794def" dependencies = [ "bitflags", "memchr", @@ -2191,9 +2112,9 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.62.0" +version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "946d85665a67f12a6e3f780f0a40961b819bddb58796261edf95156ff1a245f3" +checksum = "d94b94ebbace370a5b28c9b57801e52f43580a4813e33a3f23f1f228487a1fbe" dependencies = [ "phf", "swc_atoms", @@ -2205,14 +2126,14 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b338a831ed61250d2e345c3c609708808d3a8f7ab9fdc069a2743acea543036" +checksum = "9be74227a2b1d2bb0f6060ed905c7dc1b298cba279dc99c7ad5e7886f5bff144" dependencies = [ "ahash", "auto_impl", "dashmap 5.1.0", - "parking_lot 0.12.0", + "parking_lot", "rayon", "regex", "serde", @@ -2235,7 +2156,7 @@ dependencies = [ "lru", "normpath", "once_cell", - "parking_lot 0.12.0", + "parking_lot", "path-clean", "serde", "serde_json", @@ -2246,14 +2167,14 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.96.0" +version = "0.97.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05d316ad545d36324cd8218c272ab1348b32d8a635fa7a58e8b543f3440acc3" +checksum = "6f8e7de2647680236508cf7ea06fdfcdf5a9c4632a9fd5a5d99764818a77188d" dependencies = [ "ahash", "indexmap", "once_cell", - "parking_lot 0.12.0", + "parking_lot", "rayon", "regex", "retain_mut", @@ -2266,8 +2187,8 @@ dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_parser", - "swc_ecma_transforms", "swc_ecma_transforms_base", + "swc_ecma_transforms_optimization", "swc_ecma_utils", "swc_ecma_visit", "swc_timer", @@ -2277,9 +2198,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.97.1" +version = "0.98.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd6b0c3cb611fb5e10dcf29c840889dc18506189b1b0200010b38da924a4805" +checksum = "e45b91e7d45fca94d60e31493475647ef7be6173e56d34aacdce3579dbd8c315" dependencies = [ "either", "enum_kind", @@ -2297,9 +2218,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.113.0" +version = "0.114.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cede1ab3f93f9547ece9d5d7717b926ee84065710ca647401f82e9cec2226872" +checksum = "dc23914b7af5f5087e8888e82a2a1835386305a5cfe0252e5fb743c0c994d567" dependencies = [ "ahash", "anyhow", @@ -2322,9 +2243,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.138.0" +version = "0.139.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8d4cb28146013da04eb9bcbea4a3747e48bd75a7baee7e293f92e5487c1200" +checksum = "6dbf12cb1884d8feaad7fbeb7f3196d3a3d30df8179eadd8b1785ac0471da261" dependencies = [ "swc_atoms", "swc_common", @@ -2342,9 +2263,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.72.0" +version = "0.73.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb236fdb1ec203c8191465cce3bedcdcd89dd78a8caad92ab3d15397f65bfb1d" +checksum = "98801b04bdcdd9a4870847416f07fc7c5fd0d1c9d3cfe90afa50062562d22bfa" dependencies = [ "better_scoped_tls", "once_cell", @@ -2363,9 +2284,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.60.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb7e5da22316e296d2e48eee3b681fa06c1a3c11645e211c0675f1b5e526e5c" +checksum = "27e3c8d1a0b800da20a831cc920d9a91fba1f369af547195f1869bc8354990d3" dependencies = [ "swc_atoms", "swc_common", @@ -2377,9 +2298,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.85.0" +version = "0.86.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d089031132a390a06e576dc84ecc6a42990da402158ce32556248d457b600e" +checksum = "d32c7565f1c220c99fc3c713ac09e172590cd89a9e3c5052141e51ad6ac8548b" dependencies = [ "ahash", "arrayvec 0.7.2", @@ -2416,9 +2337,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.98.0" +version = "0.99.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0abbe67fa75caa44759c6cb43b711fecca747ab7b8d17f3ce0fb6315d9f915" +checksum = "1d185c341ff825c91b10cdb755bb04b4b1afc172a0d49c82e34456bef11a2b28" dependencies = [ "Inflector", "ahash", @@ -2440,9 +2361,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.108.0" +version = "0.109.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bf2faf46122ce5a522f00d70ee07dcab55cdc2acf6566c6bc61f0d9f77f2bf" +checksum = "bee3cd507ce6a037d97cb4002577aed4889172b20410f6c75aac60322dfff8fa" dependencies = [ "ahash", "dashmap 5.1.0", @@ -2463,9 +2384,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.93.0" +version = "0.94.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763242be40c953c9922c68c2d5a1cab712b7f24731d2c3ec3df42816c5c527a3" +checksum = "b2f9247a4cec018ea30c5c877babaefff255d1187f4c23b4663af2a0a6ef5948" dependencies = [ "either", "serde", @@ -2482,9 +2403,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.100.0" +version = "0.101.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c744387c1a3fc3d77f649c7139424ba81f4713dc8534e7a014bc356dcf92a18" +checksum = "fa4ebd2bbd902ad2e490cf89441231942e3e42cb2f5ffd7b2f982f6b813ea2d8" dependencies = [ "ahash", "base64 0.13.0", @@ -2507,9 +2428,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.74.0" +version = "0.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b0be0a745bb930103fc9cee09286d712e4c5359be166178b9f51af9bf3742c" +checksum = "e088c1f7504ce44f35d933fbaba92c6da1421f29a6609256e17c1e56627b52ab" dependencies = [ "ansi_term", "anyhow", @@ -2530,9 +2451,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.103.0" +version = "0.104.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd451ccb471fb5aa44fc1b9c8c02e771441a354386757151286cb036336f6cf" +checksum = "82fa00fa362f8346c8d7ed4a464972f43471d56d6ad418efa3fca584d842fb79" dependencies = [ "serde", "swc_atoms", @@ -2546,9 +2467,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.76.0" +version = "0.77.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f564076be1d203c04f170cffd82bfcf9ba532bc5bf3f5198f39a214cf96e0518" +checksum = "39e7128690ddd0f56f79572dabb973f0b237e503e23d6dbcc2fe111dc0690202" dependencies = [ "indexmap", "once_cell", @@ -2576,9 +2497,9 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.139.0" +version = "0.140.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef384749312e1d3633bc24e322d3352a281714511062ec65290fcc6114f14b8f" +checksum = "492ee96c31b4260e32485ae638820397bb103745d04533877ce193818ccc53f9" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", @@ -2668,19 +2589,6 @@ dependencies = [ "swc_common", ] -[[package]] -name = "swc_stylis" -version = "0.99.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934358a12d57f2507a0a19bec13b573fe9236b01551417d0882d6364324527bf" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_css_ast", - "swc_css_utils", - "swc_css_visit", -] - [[package]] name = "swc_timer" version = "0.5.0" @@ -3041,12 +2949,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index e2fdf73e01c5387..43ee61ad4fb0550 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -19,20 +19,20 @@ radix_fmt = "1" regex = "1.5" serde = "1" serde_json = "1" -styled_components = "0.22.0" -swc = "0.160.0" -swc_atoms = "0.2.9" -swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } +styled_components = "0.23.0" +swc = "0.161.1" +swc_atoms = "0.2.11" +swc_common = { version = "0.17.18", features = ["concurrent", "sourcemap"] } swc_css = "0.103.0" swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } -swc_ecmascript = { version = "0.139.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.140.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" swc_cached = "0.1.1" -swc_stylis = "0.99.1" +swc_css_prefixer = "0.99.3" tracing = {version = "0.1.28", features = ["release_max_level_off"]} handlebars = "4.2.1" [dev-dependencies] -swc_ecma_transforms_testing = "0.74.0" +swc_ecma_transforms_testing = "0.75.0" testing = "0.19.1" walkdir = "2.3.2" diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index 52b5e1de74c2a64..cbc26b6fa6b959b 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -16,12 +16,12 @@ next-swc = {version = "0.0.0", path = "../core"} once_cell = "1.8.0" serde = "1" serde_json = "1" -swc = "0.160.0" -swc_atoms = "0.2.9" -swc_bundler = { version = "0.129.0", features = ["concurrent"] } -swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } +swc = "0.161.1" +swc_atoms = "0.2.11" +swc_bundler = { version = "0.130.0", features = ["concurrent"] } +swc_common = { version = "0.17.18", features = ["concurrent", "sourcemap"] } swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] } -swc_ecmascript = { version = "0.139.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc_ecmascript = { version = "0.140.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } swc_node_base = "0.5.1" [build-dependencies] diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index bfd997a5a0fb2c1..ecd35fa998df097 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -16,9 +16,9 @@ parking_lot_core = "=0.8.0" path-clean = "0.1" serde = {version = "1", features = ["derive"]} serde_json = "1" -swc = "0.160.0" -swc_common = { version = "0.17.17", features = ["concurrent", "sourcemap"] } -swc_ecmascript = { version = "0.139.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] } +swc = "0.161.1" +swc_common = { version = "0.17.18", features = ["concurrent", "sourcemap"] } +swc_ecmascript = { version = "0.140.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" From 0ff92970f96d287f9e80a7136d14a4edb82dede4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 30 Mar 2022 23:40:15 +0900 Subject: [PATCH 22/24] fixup --- packages/next-swc/crates/core/src/styled_jsx/transform_css.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs index c0d3a1c5cffa80a..83f4f28bf735283 100644 --- a/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs +++ b/packages/next-swc/crates/core/src/styled_jsx/transform_css.rs @@ -12,10 +12,10 @@ use swc_css::codegen::{ use swc_css::parser::parser::input::ParserInput; use swc_css::parser::{parse_str, parse_tokens, parser::ParserConfig}; use swc_css::visit::{VisitMut, VisitMutWith}; +use swc_css_prefixer::prefixer; use swc_ecmascript::ast::{Expr, Tpl, TplElement}; use swc_ecmascript::parser::StringInput; use swc_ecmascript::utils::HANDLER; -use swc_stylis::prefixer::prefixer; use tracing::{debug, trace}; use super::{hash_string, string_literal_expr, LocalStyle}; From 5352d57c5feb303d784f9851d4e2ef70a94817bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 31 Mar 2022 01:34:12 +0900 Subject: [PATCH 23/24] Update test refs --- .../attribute-generation-modes/output.js | 46 +++++++++---------- .../styled-jsx/different-jsx-ids/output.js | 12 ++--- .../fixture/styled-jsx/expressions/output.js | 40 ++++++++-------- .../fixture/styled-jsx/issue-30480/output.js | 4 +- .../output.js | 6 +-- .../number-after-placeholder/output.js | 6 +-- .../tests/fixture/styled-jsx/styles/output.js | 22 ++++----- .../fixture/styled-jsx/too-many/output.js | 4 +- .../fixture/styled-jsx/tpl-escape-2/output.js | 4 +- .../tpl-placeholder-1-as-property/output.js | 6 +-- .../output.js | 6 +-- .../tpl-placeholder-3-as-value/output.js | 6 +-- .../output.js | 6 +-- .../output.js | 6 +-- .../styled-jsx/transform-css-global/output.js | 2 +- .../styled-jsx/transform-css/output.js | 2 +- 16 files changed, 89 insertions(+), 89 deletions(-) diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js index 111d47d31f5238d..78b77d2fafb0177 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/attribute-generation-modes/output.js @@ -26,7 +26,7 @@ export const Test2 = ()=>
    external and dynamic

    - <_JSXStyle id={"e8741288e177981"} dynamic={[ + <_JSXStyle id={"accb2339a5faf0f2"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -53,7 +53,7 @@ export const Test3 = ({ color })=>
    {"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"} - <_JSXStyle id={"8b1fcdcd507e19f4"} dynamic={[ + <_JSXStyle id={"8e6465b81c401982"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -93,7 +93,7 @@ export const Test5 = ()=>
    // static and dynamic export const Test6 = ({ color })=>
    {"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"} - <_JSXStyle id={"8b1fcdcd507e19f4"} dynamic={[ + <_JSXStyle id={"8e6465b81c401982"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -120,7 +120,7 @@ export const Test6 = ({ color })=>
    dynamic only

    - <_JSXStyle id={"e8741288e177981"} dynamic={[ + <_JSXStyle id={"accb2339a5faf0f2"} dynamic={[ color ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`} @@ -150,7 +150,7 @@ export const Test8 = ({ color })=>{ }; return
    {

    dynamic with scoped compound variable

    - <_JSXStyle id={"7829a8a99414dd8a"} dynamic={[ + <_JSXStyle id={"3b89706ab84e735b"} dynamic={[ innerProps.color ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`} @@ -180,7 +180,7 @@ export const Test9 = ({ color })=>{ }; return
    {

    dynamic with compound variable

    - <_JSXStyle id={"8a6fd91dabb8fa72"} dynamic={[ + <_JSXStyle id={"65329f5bf03a1958"} dynamic={[ innerProps.color ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`} @@ -204,11 +204,11 @@ export const Test9 = ({ color })=>{ }; const foo = 'red'; // dynamic with constant variable -export const Test10 = ()=>
    +export const Test10 = ()=>
    -

    dynamic with constant variable

    +

    dynamic with constant variable

    - <_JSXStyle id={"5722acc9bc50a42a"}>{`p.jsx-5722acc9bc50a42a{color:${foo}}`} + <_JSXStyle id={"cbdf2f44af4108bd"}>{`p.jsx-cbdf2f44af4108bd{color:${foo}}`}
    ; @@ -218,14 +218,14 @@ export const Test11 = ({ color })=>{ length: 5 }).map((item, i)=>
  • - <_JSXStyle id={"c3f49652e652bedf"} dynamic={[ + <_JSXStyle id={"79c618068313f86e"} dynamic={[ color ]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js index 7d147ff803a8bf7..ab25163bbbbc225 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/different-jsx-ids/output.js @@ -1,19 +1,19 @@ import _JSXStyle from "styled-jsx/style"; const color = 'red'; const otherColor = 'green'; -const A = ()=>
    +const A = ()=>
    -

    test

    +

    test

    - <_JSXStyle id={"c7fc0b05a693e9a4"}>{`p.jsx-c7fc0b05a693e9a4{color:${color}}`} + <_JSXStyle id={"498d4e86e548e679"}>{`p.jsx-498d4e86e548e679{color:${color}}`}
    ; -const B = ()=>
    +const B = ()=>
    -

    test

    +

    test

    - <_JSXStyle id={"1046a40dadd9ba3a"}>{`p.jsx-1046a40dadd9ba3a{color:${otherColor}}`} + <_JSXStyle id={"d051a1c8140076ed"}>{`p.jsx-d051a1c8140076ed{color:${otherColor}}`}
    ; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js index a702c7c5c2482fa..965396751309d26 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/expressions/output.js @@ -9,79 +9,79 @@ const animationName = 'my-cool-animation'; const obj = { display: 'block' }; -export default (({ display })=>
    -

    test

    - <_JSXStyle id={"8e76843694b6211e"}>{`p.${color}.jsx-2a76485ca2068ace{color:${otherColor};display:${obj.display}}`} + <_JSXStyle id={"a8107430c6c528d0"}>{`p.${color}.jsx-ee922fe7eac00c5e{color:${otherColor};display:${obj.display}}`} - <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-2a76485ca2068ace{color:red}"} + <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-ee922fe7eac00c5e{color:red}"} - <_JSXStyle id={"10dc1d9b22b2a7b5"}>{`body{background:${color}}`} + <_JSXStyle id={"f0a3b803e45f3568"}>{`body{background:${color}}`} - <_JSXStyle id={"10dc1d9b22b2a7b5"}>{`body{background:${color}}`} + <_JSXStyle id={"f0a3b803e45f3568"}>{`body{background:${color}}`} // TODO: the next two should have the same hash - <_JSXStyle id={"e8741288e177981"}>{`p.jsx-2a76485ca2068ace{color:${color}}`} + <_JSXStyle id={"accb2339a5faf0f2"}>{`p.jsx-ee922fe7eac00c5e{color:${color}}`} - <_JSXStyle id={"e8741288e177981"}>{`p.jsx-2a76485ca2068ace{color:${color}}`} + <_JSXStyle id={"accb2339a5faf0f2"}>{`p.jsx-ee922fe7eac00c5e{color:${color}}`} - <_JSXStyle id={"df64ca12d2e4b695"} dynamic={[ + <_JSXStyle id={"f03bb8922a3e69b1"} dynamic={[ darken(color) ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`} - <_JSXStyle id={"6d0e1b3ba7bfc0af"} dynamic={[ + <_JSXStyle id={"b29f0adf1035840b"} dynamic={[ darken(color) + 2 ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`} - <_JSXStyle id={"487ddbb5adef30ad"}>{`@media(min-width:${mediumScreen}){p.jsx-2a76485ca2068ace{color:green}p.jsx-2a76485ca2068ace{color:${`red`}}}p.jsx-2a76485ca2068ace{color:red}`} + <_JSXStyle id={"d7df5b0be4ac2e3b"}>{`@media(min-width:${mediumScreen}){p.jsx-ee922fe7eac00c5e{color:green}p.jsx-ee922fe7eac00c5e{color:${`red`}}}p.jsx-ee922fe7eac00c5e{color:red}`} - <_JSXStyle id={"443cba17cf59f486"}>{`p.jsx-2a76485ca2068ace{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`} + <_JSXStyle id={"ff76c479bb5bf1a9"}>{`p.jsx-ee922fe7eac00c5e{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`} - <_JSXStyle id={"7bb457ebb3d9dcfc"}>{`p.jsx-2a76485ca2068ace{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-2a76485ca2068ace{background:${color}}`} + <_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 id={"4de68c6ba6380d96"} dynamic={[ + <_JSXStyle id={"374046f7d83960f0"} dynamic={[ display ? 'block' : 'none' ]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js index 088931f022d4f4c..56cc41a9c1344ef 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-30480/output.js @@ -1,14 +1,14 @@ import _JSXStyle from "styled-jsx/style"; export default (({ breakPoint })=>
    - <_JSXStyle id={"583106813dd274f4"} dynamic={[ + <_JSXStyle id={"1568e0a11702cf40"} dynamic={[ breakPoint ]}>{`@media(${breakPoint}){}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js index 4aa287a6a1c0d08..635dee420c680dd 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/issue-31562-interpolation-in-mdea/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"56eb85d11cc61daf"} dynamic={[ + <_JSXStyle id={"ac0c5daa02b1aeac"} dynamic={[ Typography.base.size.default, Typography.base.lineHeight, Target.mediumPlus, diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js index 1e4316e34e0f093..3028c66637f4823 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/number-after-placeholder/output.js @@ -1,17 +1,17 @@ import _JSXStyle from "styled-jsx/style"; import Link from "next/link"; export default function IndexPage() { - return
    + return
    Hello World.{" "} - Abound + Abound - <_JSXStyle id={"fc95642a3265cb72"}>{`a.jsx-fc95642a3265cb72{color:${"#abcdef"}12}`} + <_JSXStyle id={"2339e3d61ab4470c"}>{`a.jsx-2339e3d61ab4470c{color:${"#abcdef"}12}`}
    ; }; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js index 909d566a0096131..cc130f93623c42e 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/styles/output.js @@ -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 = "a0b0bfa04065ce9d"; +a.__hash = "3066b487d298d78f"; export const uh = bar; -export const foo = new String(`div.jsx-40e01c278585442b{color:${color}}`); -foo.__hash = "40e01c278585442b"; +export const foo = new String(`div.jsx-67354fc16554bdab{color:${color}}`); +foo.__hash = "67354fc16554bdab"; ({ - styles: <_JSXStyle id={"1864b70fe66c4fb5"}>{`div.jsx-1864b70fe66c4fb5{color:${colors.green.light}}a.jsx-1864b70fe66c4fb5{color:red}`}, - className: "jsx-1864b70fe66c4fb5" + styles: <_JSXStyle id={"ef44b0e76b4e59a2"}>{`div.jsx-ef44b0e76b4e59a2{color:${colors.green.light}}a.jsx-ef44b0e76b4e59a2{color:red}`}, + className: "jsx-ef44b0e76b4e59a2" }); const b = { - styles: <_JSXStyle id={"1864b70fe66c4fb5"}>{`div.jsx-1864b70fe66c4fb5{color:${colors.green.light}}a.jsx-1864b70fe66c4fb5{color:red}`}, - className: "jsx-1864b70fe66c4fb5" + styles: <_JSXStyle id={"ef44b0e76b4e59a2"}>{`div.jsx-ef44b0e76b4e59a2{color:${colors.green.light}}a.jsx-ef44b0e76b4e59a2{color:red}`}, + className: "jsx-ef44b0e76b4e59a2" }; const dynamic = (colors1)=>{ const b = { - styles: <_JSXStyle id={"6739b456a2832bc7"} dynamic={[ + styles: <_JSXStyle id={"d1249fb76dde6727"} dynamic={[ colors1.green.light ]}>{`div.__jsx-style-dynamic-selector{color:${colors1.green.light}}a.__jsx-style-dynamic-selector{color:red}`}, className: _JSXStyle.dynamic([ [ - "6739b456a2832bc7", + "d1249fb76dde6727", [ colors1.green.light ] @@ -34,6 +34,6 @@ const dynamic = (colors1)=>{ }; }; export default { - styles: <_JSXStyle id={"8f298dcba20b7575"}>{`div.jsx-8f298dcba20b7575{font-size:3em}p.jsx-8f298dcba20b7575{color:${color}}`}, - className: "jsx-8f298dcba20b7575" + styles: <_JSXStyle id={"d85f88350ca31aae"}>{`div.jsx-d85f88350ca31aae{font-size:3em}p.jsx-d85f88350ca31aae{color:${color}}`}, + className: "jsx-d85f88350ca31aae" }; diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js index 4bdf357cdd805e0..7d1f00367429a08 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/too-many/output.js @@ -2,7 +2,7 @@ import _JSXStyle from "styled-jsx/style"; export const Red = ({ Component ='button' , })=>{ return { {} - <_JSXStyle id={"50b0a4905a4d7613"} dynamic={[ + <_JSXStyle id={"6c7c8cee856673a7"} dynamic={[ e1, e2, e3, diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js index 35fc7daf6470f64..49dba8856f850c2 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-escape-2/output.js @@ -2,14 +2,14 @@ import _JSXStyle from "styled-jsx/style"; export default function Home({ fontFamily }) { return
    - <_JSXStyle id={"eaaa5fc10a418aa4"} dynamic={[ + <_JSXStyle id={"ae6b96ca586fe51a"} dynamic={[ fontFamily ]}>{`body{font-family:${fontFamily}}code:before,code:after{content:"\`"}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js index ceea6d455590f36..33eb36491735462 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-1-as-property/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"f65b6d78a7616a5c"} dynamic={[ + <_JSXStyle id={"e1b0d3df4c8dcbf0"} dynamic={[ inputSize ? 'height: calc(2 * var(--a)) !important;' : '' ]}>{`@media only screen{a.__jsx-style-dynamic-selector{${inputSize ? 'height: calc(2 * var(--a)) !important;' : ''} }}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js index f937069d58a6a95..0c5494d7423102a 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-2-as-part-of-value/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"5b2948e4057683ab"} dynamic={[ + <_JSXStyle id={"cdb278181c7e83cf"} dynamic={[ a[b], -1 * (c || 0), d diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js index 62c1a4c1c327d40..178d8034ba86ae3 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-3-as-value/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"98a45d4b66f5e6cc"} dynamic={[ + <_JSXStyle id={"b249ec2f79615bbf"} dynamic={[ a ]}>{`@media only screen{a.__jsx-style-dynamic-selector{color:${a}}}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js index db10e355301fe9c..f82910d09f7869f 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-4-as-part-of-value-in-multiple/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"62fb04e864e1847e"} dynamic={[ + <_JSXStyle id={"6021be0687550489"} dynamic={[ a || 'var(--c)', b || 'inherit' ]}>{`.a:hover .b.__jsx-style-dynamic-selector{display:inline-block;padding:0 ${a || 'var(--c)'};color:${b || 'inherit'}}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js index 9a29db4516c7c91..19db5c34597e011 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/tpl-placeholder-5-values-of-multiple-properties/output.js @@ -3,7 +3,7 @@ export default class { render() { return
    test

    - <_JSXStyle id={"87ab3122c5e435af"} dynamic={[ + <_JSXStyle id={"e2cf1d088389269b"} dynamic={[ a ? '100%' : '200px', b ? '0' : '8px 20px' ]}>{`.item.__jsx-style-dynamic-selector{max-width:${a ? '100%' : '200px'};padding:${b ? '0' : '8px 20px'}}`} diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js index 588d5bab13cb475..8da6860d65fd959 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css-global/output.js @@ -3,7 +3,7 @@ export default (()=>

    test

    - <_JSXStyle id={"53fd644ab080300c"}>{'html.jsx-53fd644ab080300c{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-53fd644ab080300c{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif}'} + <_JSXStyle id={"53fd644ab080300c"}>{'html.jsx-53fd644ab080300c{background-image:-webkit-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-moz-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-o-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);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-53fd644ab080300c{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif}'}
    ); diff --git a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js index aa8450ad2056fd7..07b23babd4811ca 100644 --- a/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js +++ b/packages/next-swc/crates/core/tests/fixture/styled-jsx/transform-css/output.js @@ -3,7 +3,7 @@ export default (()=>

    test

    - <_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{-webkit-box-shadow:0 0 10px black,inset 0 0 5px black;-moz-box-shadow:0 0 10px black,inset 0 0 5px black;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 id={"768337a97aceabd1"}>{'html.jsx-768337a97aceabd1{background-image:-webkit-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-moz-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-o-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);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{-webkit-box-shadow:0 0 10px black,inset 0 0 5px black;-moz-box-shadow:0 0 10px black,inset 0 0 5px black;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}}}'}
    ); From c06bedce4b20a8941224c07414254e44e3284cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 31 Mar 2022 01:37:06 +0900 Subject: [PATCH 24/24] Fix --- packages/next-swc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next-swc/Cargo.toml b/packages/next-swc/Cargo.toml index c3a00dd13c63524..da1a4d1a25e90f7 100644 --- a/packages/next-swc/Cargo.toml +++ b/packages/next-swc/Cargo.toml @@ -6,7 +6,7 @@ members = [ "crates/wasm" ] -[profile.dev.package.swc_stylis] +[profile.dev.package.swc_css_prefixer] opt-level = 2 [profile.release]