diff --git a/Cargo.lock b/Cargo.lock index 15aa82df0..9c1d6b610 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1154,7 +1154,7 @@ dependencies = [ [[package]] name = "modularize_imports" -version = "0.68.1" +version = "0.68.2" dependencies = [ "convert_case", "handlebars", @@ -1692,7 +1692,7 @@ dependencies = [ [[package]] name = "react_remove_properties" -version = "0.24.1" +version = "0.24.2" dependencies = [ "serde", "swc_atoms", @@ -1767,7 +1767,7 @@ checksum = "c707298afce11da2efef2f600116fa93ffa7a032b5d7b628aa17711ec81383ca" [[package]] name = "remove_console" -version = "0.25.1" +version = "0.25.2" dependencies = [ "serde", "swc_atoms", @@ -2153,7 +2153,7 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "styled_components" -version = "0.96.2" +version = "0.96.3" dependencies = [ "Inflector", "once_cell", @@ -2174,7 +2174,7 @@ dependencies = [ [[package]] name = "styled_jsx" -version = "0.73.3" +version = "0.73.4" dependencies = [ "anyhow", "lightningcss", @@ -2756,7 +2756,7 @@ dependencies = [ [[package]] name = "swc_emotion" -version = "0.72.1" +version = "0.72.2" dependencies = [ "base64 0.13.1", "byteorder", @@ -2830,7 +2830,7 @@ dependencies = [ [[package]] name = "swc_magic" -version = "0.19.1" +version = "0.19.2" dependencies = [ "serde", "swc_atoms", @@ -2855,7 +2855,7 @@ dependencies = [ [[package]] name = "swc_plugin_emotion" -version = "0.18.2" +version = "0.18.3" dependencies = [ "serde", "serde_json", @@ -2872,7 +2872,7 @@ dependencies = [ [[package]] name = "swc_plugin_jest" -version = "0.31.1" +version = "0.31.2" dependencies = [ "phf 0.10.1", "serde", @@ -2887,7 +2887,7 @@ dependencies = [ [[package]] name = "swc_plugin_loadable_components" -version = "0.18.1" +version = "0.18.2" dependencies = [ "once_cell", "regex", @@ -2916,7 +2916,7 @@ dependencies = [ [[package]] name = "swc_plugin_noop" -version = "0.18.1" +version = "0.18.2" dependencies = [ "swc_common", "swc_core", @@ -2943,7 +2943,7 @@ dependencies = [ [[package]] name = "swc_plugin_react_remove_properties" -version = "0.19.1" +version = "0.19.2" dependencies = [ "react_remove_properties", "serde_json", @@ -2959,7 +2959,7 @@ dependencies = [ [[package]] name = "swc_plugin_relay" -version = "0.7.1" +version = "0.7.2" dependencies = [ "once_cell", "regex", @@ -2977,7 +2977,7 @@ dependencies = [ [[package]] name = "swc_plugin_remove_console" -version = "0.19.1" +version = "0.19.2" dependencies = [ "remove_console", "serde_json", @@ -2992,7 +2992,7 @@ dependencies = [ [[package]] name = "swc_plugin_styled_components" -version = "0.40.1" +version = "0.40.2" dependencies = [ "serde", "serde_json", @@ -3009,7 +3009,7 @@ dependencies = [ [[package]] name = "swc_plugin_styled_jsx" -version = "0.20.1" +version = "0.20.2" dependencies = [ "anyhow", "serde_json", @@ -3030,7 +3030,7 @@ dependencies = [ [[package]] name = "swc_plugin_swc_magic" -version = "0.7.1" +version = "0.7.2" dependencies = [ "serde_json", "swc_core", @@ -3039,7 +3039,7 @@ dependencies = [ [[package]] name = "swc_plugin_transform_imports" -version = "0.19.1" +version = "0.19.2" dependencies = [ "modularize_imports", "serde_json", @@ -3054,7 +3054,7 @@ dependencies = [ [[package]] name = "swc_relay" -version = "0.44.1" +version = "0.44.2" dependencies = [ "once_cell", "regex", @@ -3614,7 +3614,7 @@ dependencies = [ [[package]] name = "xtask" -version = "0.8.1" +version = "0.8.2" dependencies = [ "anyhow", "cargo_metadata 0.18.0", diff --git a/README.md b/README.md index a678c89e3..f2e5769d4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Plugins for SWC, written in Rust - [`jest`](packages/jest) - [`loadable-components`](packages/loadable-components) - [`noop`](packages/noop) for testing Wasm plugin system itself -- [`loadable-components`](packages/loadable-components) - [`react-remove-properties`](packages/react-remove-properties) - [`relay`](packages/relay) - [`remove-console`](packages/remove-console) diff --git a/packages/emotion/CHANGELOG.md b/packages/emotion/CHANGELOG.md index 8236e3690..4767a3604 100644 --- a/packages/emotion/CHANGELOG.md +++ b/packages/emotion/CHANGELOG.md @@ -1,5 +1,11 @@ # @swc/plugin-emotion +## 2.5.116 + +### Patch Changes + +- 47db290: Fix string escaping issue + ## 2.5.115 ### Patch Changes diff --git a/packages/emotion/Cargo.toml b/packages/emotion/Cargo.toml index f0e14238c..60a2f052b 100644 --- a/packages/emotion/Cargo.toml +++ b/packages/emotion/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_emotion" publish = false -version = "0.18.2" +version = "0.18.3" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/emotion/README.md b/packages/emotion/README.md index 59165e343..38c947560 100644 --- a/packages/emotion/README.md +++ b/packages/emotion/README.md @@ -34,6 +34,12 @@ Source code for plugin itself (not transforms) are copied from https://github.co # @swc/plugin-emotion +## 2.5.116 + +### Patch Changes + +- 47db290: Fix string escaping issue + ## 2.5.115 ### Patch Changes diff --git a/packages/emotion/package.json b/packages/emotion/package.json index a68efb239..8ec5be00e 100644 --- a/packages/emotion/package.json +++ b/packages/emotion/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-emotion", - "version": "2.5.115", + "version": "2.5.116", "description": "SWC plugin for emotion css-in-js library", "main": "swc_plugin_emotion.wasm", "scripts": { diff --git a/packages/emotion/transform/Cargo.toml b/packages/emotion/transform/Cargo.toml index 216d45f72..0cdd31db7 100644 --- a/packages/emotion/transform/Cargo.toml +++ b/packages/emotion/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_emotion" repository = "https://github.com/swc-project/plugins.git" -version = "0.72.1" +version = "0.72.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/emotion/transform/src/lib.rs b/packages/emotion/transform/src/lib.rs index 1333bb09b..a7e5f9c4d 100644 --- a/packages/emotion/transform/src/lib.rs +++ b/packages/emotion/transform/src/lib.rs @@ -358,7 +358,19 @@ 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, index == 0, index == args_len - 1); + let css_input = q + .raw + .replace("\\`", "`") + .replace("\\$", "$") + .replace("\\b", "\u{0008}") + .replace("\\f", "\u{000C}") + .replace("\\n", "\n") + .replace("\\r", "\r") + .replace("\\t", "\t") + .replace("\\v", "\u{000B}") + .replace("\\\\", "\\"); + + let minified = minify_css_string(&css_input, 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/emotion/transform/tests/fixture/next/40385/1/input.tsx b/packages/emotion/transform/tests/fixture/next/40385/1/input.tsx new file mode 100644 index 000000000..38b1c661d --- /dev/null +++ b/packages/emotion/transform/tests/fixture/next/40385/1/input.tsx @@ -0,0 +1,26 @@ +import styled from "@emotion/styled"; + +export default function IndexPage() { + return ( + <> +

IndexPage

+ + + + ); +} + +const IconWrapper = styled.div` + &[class^="icon-"], + [class*=" icon-"] { + color: red; + } + + &.icon-chat:before { + content: "\\e904"; + } + + &.icon-check:before { + content: "\\e905"; + } +`; diff --git a/packages/emotion/transform/tests/fixture/next/40385/1/output.ts b/packages/emotion/transform/tests/fixture/next/40385/1/output.ts new file mode 100644 index 000000000..1dae05325 --- /dev/null +++ b/packages/emotion/transform/tests/fixture/next/40385/1/output.ts @@ -0,0 +1,21 @@ +import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; +import styled from "@emotion/styled"; +export default function IndexPage() { + return /*#__PURE__*/ _jsxs(_Fragment, { + children: [ + /*#__PURE__*/ _jsx("h1", { + children: "IndexPage" + }), + /*#__PURE__*/ _jsx(IconWrapper, { + className: "icon-chat" + }), + /*#__PURE__*/ _jsx(IconWrapper, { + className: "icon-check" + }) + ] + }); +} +const IconWrapper = /*#__PURE__*/ styled("div", { + target: "ewuh3ed0", + label: "IconWrapper" +})('&[class^="icon-"],[class*=" icon-"]{color:red;}&.icon-chat:before{content:"\\e904";}&.icon-check:before{content:"\\e905";}', "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBJbmRleFBhZ2UoKSB7XG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxoMT5JbmRleFBhZ2U8L2gxPlxuICAgICAgPEljb25XcmFwcGVyIGNsYXNzTmFtZT17XCJpY29uLWNoYXRcIn0gLz5cbiAgICAgIDxJY29uV3JhcHBlciBjbGFzc05hbWU9e1wiaWNvbi1jaGVja1wifSAvPlxuICAgIDwvPlxuICApO1xufVxuXG5jb25zdCBJY29uV3JhcHBlciA9IHN0eWxlZC5kaXZgXG4gICZbY2xhc3NePVwiaWNvbi1cIl0sXG4gIFtjbGFzcyo9XCIgaWNvbi1cIl0ge1xuICAgIGNvbG9yOiByZWQ7XG4gIH1cblxuICAmLmljb24tY2hhdDpiZWZvcmUge1xuICAgIGNvbnRlbnQ6IFwiXFxcXGU5MDRcIjtcbiAgfVxuXG4gICYuaWNvbi1jaGVjazpiZWZvcmUge1xuICAgIGNvbnRlbnQ6IFwiXFxcXGU5MDVcIjtcbiAgfVxuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFZb0IifQ== */"); diff --git a/packages/jest/Cargo.toml b/packages/jest/Cargo.toml index d95b57e3c..12ae6d616 100644 --- a/packages/jest/Cargo.toml +++ b/packages/jest/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_jest" publish = false -version = "0.31.1" +version = "0.31.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/loadable-components/Cargo.toml b/packages/loadable-components/Cargo.toml index f3996d808..3131715bd 100644 --- a/packages/loadable-components/Cargo.toml +++ b/packages/loadable-components/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_loadable_components" publish = false -version = "0.18.1" +version = "0.18.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/noop/Cargo.toml b/packages/noop/Cargo.toml index ec8c1ddc7..c5c81eddf 100644 --- a/packages/noop/Cargo.toml +++ b/packages/noop/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_noop" publish = false -version = "0.18.1" +version = "0.18.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/react-remove-properties/Cargo.toml b/packages/react-remove-properties/Cargo.toml index e8be311cb..39a64c951 100644 --- a/packages/react-remove-properties/Cargo.toml +++ b/packages/react-remove-properties/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_react_remove_properties" publish = false -version = "0.19.1" +version = "0.19.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/react-remove-properties/transform/Cargo.toml b/packages/react-remove-properties/transform/Cargo.toml index 881e2b2ac..883d4125d 100644 --- a/packages/react-remove-properties/transform/Cargo.toml +++ b/packages/react-remove-properties/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "react_remove_properties" repository = "https://github.com/swc-project/plugins.git" -version = "0.24.1" +version = "0.24.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/relay/Cargo.toml b/packages/relay/Cargo.toml index fc5c1c3fe..76188f140 100644 --- a/packages/relay/Cargo.toml +++ b/packages/relay/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_relay" publish = false -version = "0.7.1" +version = "0.7.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/relay/transform/Cargo.toml b/packages/relay/transform/Cargo.toml index e65835c22..0a3270099 100644 --- a/packages/relay/transform/Cargo.toml +++ b/packages/relay/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_relay" repository = "https://github.com/swc-project/plugins.git" -version = "0.44.1" +version = "0.44.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/remove-console/Cargo.toml b/packages/remove-console/Cargo.toml index dab67e6ad..723a70d2e 100644 --- a/packages/remove-console/Cargo.toml +++ b/packages/remove-console/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_remove_console" publish = false -version = "0.19.1" +version = "0.19.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/remove-console/transform/Cargo.toml b/packages/remove-console/transform/Cargo.toml index a8d9cba03..4cffbc0b8 100644 --- a/packages/remove-console/transform/Cargo.toml +++ b/packages/remove-console/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "remove_console" repository = "https://github.com/swc-project/plugins.git" -version = "0.25.1" +version = "0.25.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/styled-components/Cargo.toml b/packages/styled-components/Cargo.toml index ce4762551..14d618631 100644 --- a/packages/styled-components/Cargo.toml +++ b/packages/styled-components/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_styled_components" publish = false -version = "0.40.1" +version = "0.40.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/packages/styled-components/transform/Cargo.toml b/packages/styled-components/transform/Cargo.toml index 7dcf24c8e..7bd82fd0c 100644 --- a/packages/styled-components/transform/Cargo.toml +++ b/packages/styled-components/transform/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "styled_components" repository = "https://github.com/swc-project/plugins.git" -version = "0.96.2" +version = "0.96.3" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/styled-jsx/Cargo.toml b/packages/styled-jsx/Cargo.toml index f309eb45a..0c099ded7 100644 --- a/packages/styled-jsx/Cargo.toml +++ b/packages/styled-jsx/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_styled_jsx" publish = false -version = "0.20.1" +version = "0.20.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/styled-jsx/transform/Cargo.toml b/packages/styled-jsx/transform/Cargo.toml index 545e462f3..a1a0b4d70 100644 --- a/packages/styled-jsx/transform/Cargo.toml +++ b/packages/styled-jsx/transform/Cargo.toml @@ -4,7 +4,7 @@ description = "AST transforms visitor for styled-jsx" edition = "2021" license = "Apache-2.0" name = "styled_jsx" -version = "0.73.3" +version = "0.73.4" [features] custom_transform = ["swc_common/concurrent"] diff --git a/packages/swc-magic/Cargo.toml b/packages/swc-magic/Cargo.toml index a70f92f2f..ebaea2496 100644 --- a/packages/swc-magic/Cargo.toml +++ b/packages/swc-magic/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_swc_magic" publish = false -version = "0.7.1" +version = "0.7.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/swc-magic/transform/Cargo.toml b/packages/swc-magic/transform/Cargo.toml index 91012d13e..5870f99eb 100644 --- a/packages/swc-magic/transform/Cargo.toml +++ b/packages/swc-magic/transform/Cargo.toml @@ -4,7 +4,7 @@ description = "AST transforms visitor for swc-magic" edition = "2021" license = "Apache-2.0" name = "swc_magic" -version = "0.19.1" +version = "0.19.2" [dependencies] serde = { version = "1.0.189", features = ["derive"] } diff --git a/packages/transform-imports/Cargo.toml b/packages/transform-imports/Cargo.toml index fb6b6aa53..9588f4380 100644 --- a/packages/transform-imports/Cargo.toml +++ b/packages/transform-imports/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_transform_imports" publish = false -version = "0.19.1" +version = "0.19.2" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/transform-imports/transform/Cargo.toml b/packages/transform-imports/transform/Cargo.toml index f6afc2cec..3d17adbab 100644 --- a/packages/transform-imports/transform/Cargo.toml +++ b/packages/transform-imports/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "modularize_imports" repository = "https://github.com/swc-project/plugins.git" -version = "0.68.1" +version = "0.68.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 8c9c4f5f0..fb77d49a3 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "0.8.1" +version = "0.8.2" edition = "2021" publish = false