diff --git a/Cargo.lock b/Cargo.lock index eb76757d6..a3ed62830 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1151,7 +1151,7 @@ dependencies = [ [[package]] name = "modularize_imports" -version = "0.64.0" +version = "0.65.0" dependencies = [ "convert_case", "handlebars", @@ -1689,7 +1689,7 @@ dependencies = [ [[package]] name = "react_remove_properties" -version = "0.20.0" +version = "0.21.0" dependencies = [ "serde", "swc_atoms", @@ -1764,7 +1764,7 @@ checksum = "c707298afce11da2efef2f600116fa93ffa7a032b5d7b628aa17711ec81383ca" [[package]] name = "remove_console" -version = "0.21.0" +version = "0.22.0" dependencies = [ "serde", "swc_atoms", @@ -2150,7 +2150,7 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "styled_components" -version = "0.92.0" +version = "0.93.0" dependencies = [ "Inflector", "once_cell", @@ -2171,7 +2171,7 @@ dependencies = [ [[package]] name = "styled_jsx" -version = "0.69.0" +version = "0.70.0" dependencies = [ "easy-error", "lightningcss", @@ -2311,7 +2311,7 @@ dependencies = [ [[package]] name = "swc_constify" -version = "0.32.0" +version = "0.33.0" dependencies = [ "once_cell", "rustc-hash", @@ -2772,7 +2772,7 @@ dependencies = [ [[package]] name = "swc_emotion" -version = "0.68.0" +version = "0.69.0" dependencies = [ "base64 0.13.1", "byteorder", @@ -2846,7 +2846,7 @@ dependencies = [ [[package]] name = "swc_magic" -version = "0.15.0" +version = "0.16.0" dependencies = [ "serde", "swc_atoms", @@ -2871,7 +2871,7 @@ dependencies = [ [[package]] name = "swc_plugin_constify" -version = "0.3.0" +version = "0.4.0" dependencies = [ "swc_common", "swc_constify", @@ -2884,7 +2884,7 @@ dependencies = [ [[package]] name = "swc_plugin_emotion" -version = "0.14.0" +version = "0.15.0" dependencies = [ "serde", "serde_json", @@ -2901,7 +2901,7 @@ dependencies = [ [[package]] name = "swc_plugin_jest" -version = "0.27.0" +version = "0.28.0" dependencies = [ "phf 0.10.1", "serde", @@ -2916,7 +2916,7 @@ dependencies = [ [[package]] name = "swc_plugin_loadable_components" -version = "0.14.0" +version = "0.15.0" dependencies = [ "once_cell", "regex", @@ -2945,7 +2945,7 @@ dependencies = [ [[package]] name = "swc_plugin_noop" -version = "0.14.0" +version = "0.15.0" dependencies = [ "swc_common", "swc_core", @@ -2972,7 +2972,7 @@ dependencies = [ [[package]] name = "swc_plugin_react_remove_properties" -version = "0.15.0" +version = "0.16.0" dependencies = [ "react_remove_properties", "serde_json", @@ -2988,7 +2988,7 @@ dependencies = [ [[package]] name = "swc_plugin_relay" -version = "0.3.0" +version = "0.4.0" dependencies = [ "once_cell", "regex", @@ -3006,7 +3006,7 @@ dependencies = [ [[package]] name = "swc_plugin_remove_console" -version = "0.15.0" +version = "0.16.0" dependencies = [ "remove_console", "serde_json", @@ -3021,7 +3021,7 @@ dependencies = [ [[package]] name = "swc_plugin_styled_components" -version = "0.36.0" +version = "0.37.0" dependencies = [ "serde", "serde_json", @@ -3038,7 +3038,7 @@ dependencies = [ [[package]] name = "swc_plugin_styled_jsx" -version = "0.16.0" +version = "0.17.0" dependencies = [ "easy-error", "serde_json", @@ -3059,7 +3059,7 @@ dependencies = [ [[package]] name = "swc_plugin_swc_magic" -version = "0.3.0" +version = "0.4.0" dependencies = [ "serde_json", "swc_core", @@ -3068,7 +3068,7 @@ dependencies = [ [[package]] name = "swc_plugin_transform_imports" -version = "0.15.0" +version = "0.16.0" dependencies = [ "modularize_imports", "serde_json", @@ -3083,7 +3083,7 @@ dependencies = [ [[package]] name = "swc_relay" -version = "0.40.0" +version = "0.41.0" dependencies = [ "once_cell", "regex", @@ -3643,7 +3643,7 @@ dependencies = [ [[package]] name = "xtask" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "cargo_metadata 0.18.0", diff --git a/packages/constify/Cargo.toml b/packages/constify/Cargo.toml index 53901775a..cf0f0ce76 100644 --- a/packages/constify/Cargo.toml +++ b/packages/constify/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_plugin_constify" publish = false -version = "0.3.0" +version = "0.4.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/constify/package.json b/packages/constify/package.json index c49556bb9..7e9a1eba4 100644 --- a/packages/constify/package.json +++ b/packages/constify/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-constify", - "version": "0.1.39", + "version": "0.1.40", "description": "SWC plugin for optimization", "main": "swc_plugin_constify.wasm", "scripts": { diff --git a/packages/constify/transform/Cargo.toml b/packages/constify/transform/Cargo.toml index a62ba0a8c..2eefccc23 100644 --- a/packages/constify/transform/Cargo.toml +++ b/packages/constify/transform/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_constify" repository = "https://github.com/swc-project/plugins.git" -version = "0.32.0" +version = "0.33.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/emotion/Cargo.toml b/packages/emotion/Cargo.toml index 93d010b25..ba4338f33 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.14.0" +version = "0.15.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/emotion/package.json b/packages/emotion/package.json index ef73833be..e519eeaff 100644 --- a/packages/emotion/package.json +++ b/packages/emotion/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-emotion", - "version": "2.5.109", + "version": "2.5.110", "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 d098fb9c8..1777e84e3 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.68.0" +version = "0.69.0" # 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 ca0affdf5..817cd705b 100644 --- a/packages/emotion/transform/src/lib.rs +++ b/packages/emotion/transform/src/lib.rs @@ -13,10 +13,11 @@ use sourcemap::{RawToken, SourceMap as RawSourcemap}; use swc_atoms::JsWord; use swc_common::{comments::Comments, util::take::Take, BytePos, SourceMapperDyn, DUMMY_SP}; use swc_ecma_ast::{ - ArrayLit, CallExpr, Callee, Expr, ExprOrSpread, Id, Ident, ImportDecl, ImportSpecifier, - JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXElement, JSXElementName, JSXExpr, - JSXExprContainer, JSXObject, KeyValueProp, MemberProp, ModuleExportName, ObjectLit, Pat, Prop, - PropName, PropOrSpread, SourceMapperExt, SpreadElement, Tpl, VarDeclarator, + ArrayLit, CallExpr, Callee, ClassDecl, ClassMethod, ClassProp, Expr, ExprOrSpread, FnDecl, Id, + Ident, ImportDecl, ImportSpecifier, JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, + JSXElement, JSXElementName, JSXExpr, JSXExprContainer, JSXObject, KeyValueProp, MemberProp, + MethodProp, ModuleExportName, ObjectLit, Pat, Prop, PropName, PropOrSpread, SourceMapperExt, + SpreadElement, Tpl, VarDeclarator, }; use swc_ecma_utils::ExprFactory; use swc_ecma_visit::{Fold, FoldWith}; @@ -76,6 +77,9 @@ static EMOTION_OFFICIAL_LIBRARIES: Lazy> = Lazy::new(|| ] }); +static INVALID_LABEL_SPACES: Lazy = + Lazy::new(|| RegexBuilder::new(r#"\s+"#).build().unwrap()); + static INVALID_CSS_CLASS_NAME_CHARACTERS: Lazy = Lazy::new(|| { RegexBuilder::new(r##"[!"#$%&'()*+,./:;<=>?@\[\]^`|}~{]"##) .build() @@ -178,6 +182,7 @@ pub struct EmotionTransformer { import_packages: FxHashMap, emotion_target_class_name_count: usize, current_context: Option, + current_class: Option, // skip `css` transformation if it in JSX Element/Attribute in_jsx_element: bool, @@ -217,13 +222,19 @@ impl EmotionTransformer { import_packages: FxHashMap::default(), emotion_target_class_name_count: 0, current_context: None, + current_class: None, in_jsx_element: false, registered_imports, } } - fn sanitize_label_part<'t>(&self, label_part: &'t str) -> Cow<'t, str> { - INVALID_CSS_CLASS_NAME_CHARACTERS.replace_all(label_part, "-") + fn sanitize_label_part<'t>(&self, label_part: &'t str) -> String { + // Existing @emotion/babel-plugin behaviour is to replace all spaces + // with a single hyphen + let without_spaces = INVALID_LABEL_SPACES.replace_all(label_part, "-"); + INVALID_CSS_CLASS_NAME_CHARACTERS + .replace_all(&without_spaces, "-") + .to_string() } fn create_label(&self, with_prefix: bool) -> String { @@ -244,6 +255,10 @@ impl EmotionTransformer { if let Some(dirname) = self.dirname.as_ref() { label = label.replace("[dirname]", &self.sanitize_label_part(dirname)); }; + } else { + // Existing @emotion/babel-plugin behaviour is to + // not provide a label if there is no available identifier + return "".to_string(); } label } @@ -430,9 +445,72 @@ impl Fold for EmotionTransformer { if let Pat::Ident(i) = &dec.name { self.current_context = Some(i.id.as_ref().to_owned()); } + // If we encounter a named function expression + if let Expr::Fn(f) = *dec.init.clone().unwrap() { + if let Some(i) = &f.ident { + self.current_context = Some(i.sym.as_ref().to_owned()); + } + } dec.fold_children_with(self) } + fn fold_key_value_prop(&mut self, kv: KeyValueProp) -> KeyValueProp { + match &kv.key { + PropName::Ident(k) => { + self.current_context = Some(k.sym.as_ref().to_owned()); + } + PropName::Str(k) => { + self.current_context = Some(k.value.as_ref().to_owned()); + } + _ => (), + } + kv.fold_children_with(self) + } + + fn fold_method_prop(&mut self, mp: MethodProp) -> MethodProp { + if let PropName::Ident(p) = &mp.key { + self.current_context = Some(p.sym.as_ref().to_owned()); + } + mp.fold_children_with(self) + } + + fn fold_fn_decl(&mut self, fn_dec: FnDecl) -> FnDecl { + self.current_context = Some(fn_dec.ident.sym.as_ref().to_owned()); + fn_dec.fold_children_with(self) + } + + fn fold_class_decl(&mut self, cd: ClassDecl) -> ClassDecl { + self.current_class = Some(cd.ident.sym.as_ref().to_owned()); + self.current_context = self.current_class.clone(); + cd.fold_children_with(self) + } + + fn fold_class_method(&mut self, cm: ClassMethod) -> ClassMethod { + // class methods use the class name for the context + if self.current_class.is_some() { + self.current_context = self.current_class.clone(); + } + cm.fold_children_with(self) + } + + fn fold_class_prop(&mut self, cp: ClassProp) -> ClassProp { + if let PropName::Ident(p) = &cp.key { + self.current_context = Some(p.sym.as_ref().to_owned()); + } + cp.fold_children_with(self) + } + + fn fold_computed_prop_name( + &mut self, + n: swc_ecma_ast::ComputedPropName, + ) -> swc_ecma_ast::ComputedPropName { + // Existing @emotion/babel-plugin behaviour is that computed + // properties do not have a label. We reset the label here as + // an unset label is reduced to an empty string in `create_label`. + self.current_context = None; + n.fold_children_with(self) + } + fn fold_call_expr(&mut self, mut expr: CallExpr) -> CallExpr { // If no package that we care about is imported, skip the following // transformation logic. diff --git a/packages/emotion/transform/tests/fixture.rs b/packages/emotion/transform/tests/fixture.rs index d1b97e004..63283d4ed 100644 --- a/packages/emotion/transform/tests/fixture.rs +++ b/packages/emotion/transform/tests/fixture.rs @@ -72,8 +72,8 @@ fn next_emotion_fixture(input: PathBuf) { // "/labels/filename" -> "[filename]" // "/labels/filename-local" -> "[filename]-[local]" // "/labels/local" -> "[local]" -#[fixture("tests/labels/**/output.js")] -fn emotion_label_fixture(output: PathBuf) { +#[fixture("tests/labels/options/**/output.js")] +fn emotion_label_option_fixture(output: PathBuf) { let output_folder = output.parent().unwrap(); let output_folder_name = output_folder.file_name().unwrap().to_str().unwrap(); let input = output_folder.parent().unwrap().join("input.tsx"); @@ -136,8 +136,17 @@ fn emotion_label_fixture(output: PathBuf) { ); } -#[fixture("tests/label-sanitisation/**/*.ts")] +#[fixture("tests/labels/emotion-js/**/*.ts")] +fn emotion_label_original(input: PathBuf) { + emotion_label(input, "[local]".to_string()) +} + +#[fixture("tests/labels/sanitisation/**/*.ts")] fn emotion_label_sanitisation(input: PathBuf) { + emotion_label(input, "[dirname]-[filename]-[local]".to_string()) +} + +fn emotion_label(input: PathBuf, label: String) { let output_folder_name = input .parent() .unwrap() @@ -174,7 +183,7 @@ fn emotion_label_sanitisation(input: PathBuf) { enabled: Some(true), sourcemap: Some(true), auto_label: Some(true), - label_format: Some("[dirname]-[filename]-[local]".to_string()), + label_format: Some(label.to_owned()), ..Default::default() }, &PathBuf::from(format!("{output_folder_name}/{input_file_name}")), diff --git a/packages/emotion/transform/tests/fixture/comments/output.ts b/packages/emotion/transform/tests/fixture/comments/output.ts index aaa5200df..0f7a1ffd8 100644 --- a/packages/emotion/transform/tests/fixture/comments/output.ts +++ b/packages/emotion/transform/tests/fixture/comments/output.ts @@ -1,7 +1,7 @@ import styled from "@emotion/styled"; export default /*#__PURE__*/ styled("div", { target: "e1h8m75k0", - label: "[local]", + label: "", })( "color:red;.foo{color:blue;}width:10px;", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuXG5leHBvcnQgZGVmYXVsdCBzdHlsZWQuZGl2YFxuICBjb2xvcjogcmVkO1xuICAuZm9vIHtcbiAgICBjb2xvcjogYmx1ZTtcbiAgICAvKipcbiAgICAgIG11bHRpIGxpbmUgY29tbWVudHNcbiAgICAqL1xuICB9XG4gIC8qIC8qICovXG4gIHdpZHRoOiAxMHB4O1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFZSJ9 */" diff --git a/packages/emotion/transform/tests/fixture/css-in-callback/output.ts b/packages/emotion/transform/tests/fixture/css-in-callback/output.ts index 0464c99d1..2d515fd1a 100644 --- a/packages/emotion/transform/tests/fixture/css-in-callback/output.ts +++ b/packages/emotion/transform/tests/fixture/css-in-callback/output.ts @@ -55,7 +55,7 @@ const Container2 = /*#__PURE__*/ styled("div", { export class SimpleComponent extends PureComponent { render() { return /*#__PURE__*/ _jsxs(Container, { - css: /*#__PURE__*/ css("color:hotpink;", "Container2", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IENvbnRhaW5lcldpdGhPcHRpb25zID0gc3R5bGVkKCdkaXYnLCB7XG4gIHNob3VsZEZvcndhcmRQcm9wOiAocHJvcGVydHlOYW1lOiBzdHJpbmcpID0+ICFwcm9wZXJ0eU5hbWUuc3RhcnRzV2l0aCgnJCcpLFxufSlgXG4gIGNvbG9yOiBob3RwaW5rO1xuYFxuXG5jb25zdCBTcGFuQ29udGFpbmVyID0gc3R5bGVkKCdzcGFuJykoe1xuICBiYWNrZ3JvdW5kOiAneWVsbG93Jyxcbn0pXG5cbmV4cG9ydCBjb25zdCBEaXZDb250YWluZXJFeHRlbmRlZCA9IHN0eWxlZChEaXZDb250YWluZXIpYGBcbmV4cG9ydCBjb25zdCBEaXZDb250YWluZXJFeHRlbmRlZDIgPSBzdHlsZWQoRGl2Q29udGFpbmVyKSh7fSlcblxuY29uc3QgQ29udGFpbmVyID0gc3R5bGVkKCdidXR0b24nKWBcbiAgYmFja2dyb3VuZDogcmVkO1xuICAke3N0eWxlc0luQ2FsbGJhY2t9XG4gICR7KCkgPT5cbiAgICBjc3Moe1xuICAgICAgYmFja2dyb3VuZDogJ3JlZCcsXG4gICAgfSl9XG4gIGNvbG9yOiB5ZWxsb3c7XG4gIGZvbnQtc2l6ZTogMTJweDtcbmBcblxuY29uc3QgQ29udGFpbmVyMiA9IHN0eWxlZC5kaXZgXG4gIGJhY2tncm91bmQ6IHJlZDtcbmBcblxuZXhwb3J0IGNsYXNzIFNpbXBsZUNvbXBvbmVudCBleHRlbmRzIFB1cmVDb21wb25lbnQge1xuICByZW5kZXIoKSB7XG4gICAgcmV0dXJuIChcbiAgICAgIDxDb250YWluZXJcbiAgICAgICAgY3NzPXtjc3NgXG4gICAgICAgICAgY29sb3I6IGhvdHBpbms7XG4gICAgICAgIGB9XG4gICAgICA+XG4gICAgICAgIDxHbG9iYWxcbiAgICAgICAgICBzdHlsZXM9e2Nzc2BcbiAgICAgICAgICAgIGh0bWwsXG4gICAgICAgICAgICBib2R5IHtcbiAgICAgICAgICAgICAgcGFkZGluZzogM3JlbSAxcmVtO1xuICAgICAgICAgICAgICBtYXJnaW46IDA7XG4gICAgICAgICAgICAgIGJhY2tncm91bmQ6IHBhcGF5YXdoaXA7XG4gICAgICAgICAgICAgIG1pbi1oZWlnaHQ6IDEwMCU7XG4gICAgICAgICAgICAgIGZvbnQtZmFtaWx5OiBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmO1xuICAgICAgICAgICAgICBmb250LXNpemU6IDI0cHg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgYH1cbiAgICAgICAgLz5cbiAgICAgICAgPHNwYW4+aGVsbG88L3NwYW4+XG4gICAgICA8L0NvbnRhaW5lcj5cbiAgICApXG4gIH1cbn1cblxuUmVhY3RET00ucmVuZGVyKDxTaW1wbGVDb21wb25lbnQgLz4sIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNhcHAnKSlcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE4RGEifQ== */"), + css: /*#__PURE__*/ css("color:hotpink;", "SimpleComponent", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IFB1cmVDb21wb25lbnQgfSBmcm9tICdyZWFjdCdcbmltcG9ydCBSZWFjdERPTSBmcm9tICdyZWFjdC1kb20nXG5cbmNvbnN0IHN0eWxlc0luQ2FsbGJhY2sgPSAocHJvcHM6IGFueSkgPT5cbiAgY3NzKHtcbiAgICBjb2xvcjogJ3JlZCcsXG4gICAgYmFja2dyb3VuZDogJ3llbGxvdycsXG4gICAgd2lkdGg6IGAke3Byb3BzLnNjYWxlICogMTAwfXB4YCxcbiAgfSlcblxuY29uc3Qgc3R5bGVzID0gY3NzKHtcbiAgY29sb3I6ICdyZWQnLFxuICB3aWR0aDogJzIwcHgnLFxufSlcblxuY29uc3Qgc3R5bGVzMiA9IGNzc2BcbiAgY29sb3I6IHJlZDtcbiAgd2lkdGg6IDIwcHg7XG5gXG5cbmNvbnN0IERpdkNvbnRhaW5lciA9IHN0eWxlZC5kaXYoe1xuICBiYWNrZ3JvdW5kOiAncmVkJyxcbn0pXG5cbmNvbnN0IERpdkNvbnRhaW5lcjIgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kOiByZWQ7XG5gXG5cbmNvbnN0IENvbnRhaW5lcldpdGhPcHRpb25zID0gc3R5bGVkKCdkaXYnLCB7XG4gIHNob3VsZEZvcndhcmRQcm9wOiAocHJvcGVydHlOYW1lOiBzdHJpbmcpID0+ICFwcm9wZXJ0eU5hbWUuc3RhcnRzV2l0aCgnJCcpLFxufSlgXG4gIGNvbG9yOiBob3RwaW5rO1xuYFxuXG5jb25zdCBTcGFuQ29udGFpbmVyID0gc3R5bGVkKCdzcGFuJykoe1xuICBiYWNrZ3JvdW5kOiAneWVsbG93Jyxcbn0pXG5cbmV4cG9ydCBjb25zdCBEaXZDb250YWluZXJFeHRlbmRlZCA9IHN0eWxlZChEaXZDb250YWluZXIpYGBcbmV4cG9ydCBjb25zdCBEaXZDb250YWluZXJFeHRlbmRlZDIgPSBzdHlsZWQoRGl2Q29udGFpbmVyKSh7fSlcblxuY29uc3QgQ29udGFpbmVyID0gc3R5bGVkKCdidXR0b24nKWBcbiAgYmFja2dyb3VuZDogcmVkO1xuICAke3N0eWxlc0luQ2FsbGJhY2t9XG4gICR7KCkgPT5cbiAgICBjc3Moe1xuICAgICAgYmFja2dyb3VuZDogJ3JlZCcsXG4gICAgfSl9XG4gIGNvbG9yOiB5ZWxsb3c7XG4gIGZvbnQtc2l6ZTogMTJweDtcbmBcblxuY29uc3QgQ29udGFpbmVyMiA9IHN0eWxlZC5kaXZgXG4gIGJhY2tncm91bmQ6IHJlZDtcbmBcblxuZXhwb3J0IGNsYXNzIFNpbXBsZUNvbXBvbmVudCBleHRlbmRzIFB1cmVDb21wb25lbnQge1xuICByZW5kZXIoKSB7XG4gICAgcmV0dXJuIChcbiAgICAgIDxDb250YWluZXJcbiAgICAgICAgY3NzPXtjc3NgXG4gICAgICAgICAgY29sb3I6IGhvdHBpbms7XG4gICAgICAgIGB9XG4gICAgICA+XG4gICAgICAgIDxHbG9iYWxcbiAgICAgICAgICBzdHlsZXM9e2Nzc2BcbiAgICAgICAgICAgIGh0bWwsXG4gICAgICAgICAgICBib2R5IHtcbiAgICAgICAgICAgICAgcGFkZGluZzogM3JlbSAxcmVtO1xuICAgICAgICAgICAgICBtYXJnaW46IDA7XG4gICAgICAgICAgICAgIGJhY2tncm91bmQ6IHBhcGF5YXdoaXA7XG4gICAgICAgICAgICAgIG1pbi1oZWlnaHQ6IDEwMCU7XG4gICAgICAgICAgICAgIGZvbnQtZmFtaWx5OiBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmO1xuICAgICAgICAgICAgICBmb250LXNpemU6IDI0cHg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgYH1cbiAgICAgICAgLz5cbiAgICAgICAgPHNwYW4+aGVsbG88L3NwYW4+XG4gICAgICA8L0NvbnRhaW5lcj5cbiAgICApXG4gIH1cbn1cblxuUmVhY3RET00ucmVuZGVyKDxTaW1wbGVDb21wb25lbnQgLz4sIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNhcHAnKSlcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE4RGEifQ== */"), children: [ /*#__PURE__*/ _jsx(Global, { styles: [ diff --git a/packages/emotion/transform/tests/fixture/import-map/vanilla/output.ts b/packages/emotion/transform/tests/fixture/import-map/vanilla/output.ts index 899b94e0d..08f899b82 100644 --- a/packages/emotion/transform/tests/fixture/import-map/vanilla/output.ts +++ b/packages/emotion/transform/tests/fixture/import-map/vanilla/output.ts @@ -1,4 +1,4 @@ import { something } from 'package-three'; /*#__PURE__*/ something({ color: 'green' -}, "label:[local]", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHNvbWV0aGluZyB9IGZyb20gJ3BhY2thZ2UtdGhyZWUnXG5cbnNvbWV0aGluZyh7IGNvbG9yOiAnZ3JlZW4nIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEifQ== */"); +}, "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHNvbWV0aGluZyB9IGZyb20gJ3BhY2thZ2UtdGhyZWUnXG5cbnNvbWV0aGluZyh7IGNvbG9yOiAnZ3JlZW4nIH0pXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEifQ== */"); diff --git a/packages/emotion/transform/tests/fixture/issues/180/input.tsx b/packages/emotion/transform/tests/fixture/issues/180/input.tsx new file mode 100644 index 000000000..e5114660c --- /dev/null +++ b/packages/emotion/transform/tests/fixture/issues/180/input.tsx @@ -0,0 +1,39 @@ +import { css } from "@emotion/react"; +import styled from "@emotion/styled"; + +// Example 1 +function myStyled(Component) { + return styled(Component)` + background-color: red; + `; +} + +function myCss(color) { + return css` + background-color: ${color}; + `; +} + +const myStyles = myCss("red"); + +const Div = myStyled("div"); + +function App() { + return ( + <> +
one
+
two
+ + ); +} + +// Example 2 +const styles = { + keyA: css({ + padding: 0, + }), + keyB: css({ + margin: 0, + }), +}; +const App2 = () =>
hello world
; diff --git a/packages/emotion/transform/tests/fixture/issues/180/output.ts b/packages/emotion/transform/tests/fixture/issues/180/output.ts new file mode 100644 index 000000000..d14c33448 --- /dev/null +++ b/packages/emotion/transform/tests/fixture/issues/180/output.ts @@ -0,0 +1,41 @@ +import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; +import { css } from "@emotion/react"; +import styled from "@emotion/styled"; +// Example 1 +function myStyled(Component) { + return /*#__PURE__*/ styled(Component, { + target: "enb90uf0", + label: "myStyled" + })("background-color:red;", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbi8vIEV4YW1wbGUgMVxuZnVuY3Rpb24gbXlTdHlsZWQoQ29tcG9uZW50KSB7XG4gIHJldHVybiBzdHlsZWQoQ29tcG9uZW50KWBcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZWQ7XG4gIGA7XG59XG5cbmZ1bmN0aW9uIG15Q3NzKGNvbG9yKSB7XG4gIHJldHVybiBjc3NgXG4gICAgYmFja2dyb3VuZC1jb2xvcjogJHtjb2xvcn07XG4gIGA7XG59XG5cbmNvbnN0IG15U3R5bGVzID0gbXlDc3MoXCJyZWRcIik7XG5cbmNvbnN0IERpdiA9IG15U3R5bGVkKFwiZGl2XCIpO1xuXG5mdW5jdGlvbiBBcHAoKSB7XG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxEaXY+b25lPC9EaXY+XG4gICAgICA8ZGl2IGNzcz17bXlTdHlsZXN9PnR3bzwvZGl2PlxuICAgIDwvPlxuICApO1xufVxuXG4vLyBFeGFtcGxlIDJcbmNvbnN0IHN0eWxlcyA9IHtcbiAga2V5QTogY3NzKHtcbiAgICBwYWRkaW5nOiAwLFxuICB9KSxcbiAga2V5QjogY3NzKHtcbiAgICBtYXJnaW46IDAsXG4gIH0pLFxufTtcbmNvbnN0IEFwcDIgPSAoKSA9PiA8ZGl2IGNsYXNzbmFtZT17c3R5bGVzLmtleUF9PmhlbGxvIHdvcmxkPC9kaXY+O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtTIn0= */"); +} +function myCss(color) { + return /*#__PURE__*/ css("background-color:", color, ";", "myCss", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbi8vIEV4YW1wbGUgMVxuZnVuY3Rpb24gbXlTdHlsZWQoQ29tcG9uZW50KSB7XG4gIHJldHVybiBzdHlsZWQoQ29tcG9uZW50KWBcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZWQ7XG4gIGA7XG59XG5cbmZ1bmN0aW9uIG15Q3NzKGNvbG9yKSB7XG4gIHJldHVybiBjc3NgXG4gICAgYmFja2dyb3VuZC1jb2xvcjogJHtjb2xvcn07XG4gIGA7XG59XG5cbmNvbnN0IG15U3R5bGVzID0gbXlDc3MoXCJyZWRcIik7XG5cbmNvbnN0IERpdiA9IG15U3R5bGVkKFwiZGl2XCIpO1xuXG5mdW5jdGlvbiBBcHAoKSB7XG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxEaXY+b25lPC9EaXY+XG4gICAgICA8ZGl2IGNzcz17bXlTdHlsZXN9PnR3bzwvZGl2PlxuICAgIDwvPlxuICApO1xufVxuXG4vLyBFeGFtcGxlIDJcbmNvbnN0IHN0eWxlcyA9IHtcbiAga2V5QTogY3NzKHtcbiAgICBwYWRkaW5nOiAwLFxuICB9KSxcbiAga2V5QjogY3NzKHtcbiAgICBtYXJnaW46IDAsXG4gIH0pLFxufTtcbmNvbnN0IEFwcDIgPSAoKSA9PiA8ZGl2IGNsYXNzbmFtZT17c3R5bGVzLmtleUF9PmhlbGxvIHdvcmxkPC9kaXY+O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVdTIn0= */"); +} +const myStyles = myCss("red"); +const Div = myStyled("div"); +function App() { + return /*#__PURE__*/ _jsxs(_Fragment, { + children: [ + /*#__PURE__*/ _jsx(Div, { + children: "one" + }), + /*#__PURE__*/ _jsx("div", { + css: myStyles, + children: "two" + }) + ] + }); +} +// Example 2 +const styles = { + keyA: /*#__PURE__*/ css({ + padding: 0 + }, "label:keyA", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbi8vIEV4YW1wbGUgMVxuZnVuY3Rpb24gbXlTdHlsZWQoQ29tcG9uZW50KSB7XG4gIHJldHVybiBzdHlsZWQoQ29tcG9uZW50KWBcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZWQ7XG4gIGA7XG59XG5cbmZ1bmN0aW9uIG15Q3NzKGNvbG9yKSB7XG4gIHJldHVybiBjc3NgXG4gICAgYmFja2dyb3VuZC1jb2xvcjogJHtjb2xvcn07XG4gIGA7XG59XG5cbmNvbnN0IG15U3R5bGVzID0gbXlDc3MoXCJyZWRcIik7XG5cbmNvbnN0IERpdiA9IG15U3R5bGVkKFwiZGl2XCIpO1xuXG5mdW5jdGlvbiBBcHAoKSB7XG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxEaXY+b25lPC9EaXY+XG4gICAgICA8ZGl2IGNzcz17bXlTdHlsZXN9PnR3bzwvZGl2PlxuICAgIDwvPlxuICApO1xufVxuXG4vLyBFeGFtcGxlIDJcbmNvbnN0IHN0eWxlcyA9IHtcbiAga2V5QTogY3NzKHtcbiAgICBwYWRkaW5nOiAwLFxuICB9KSxcbiAga2V5QjogY3NzKHtcbiAgICBtYXJnaW46IDAsXG4gIH0pLFxufTtcbmNvbnN0IEFwcDIgPSAoKSA9PiA8ZGl2IGNsYXNzbmFtZT17c3R5bGVzLmtleUF9PmhlbGxvIHdvcmxkPC9kaXY+O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQStCUSJ9 */"), + keyB: /*#__PURE__*/ css({ + margin: 0 + }, "label:keyB", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHMiLCJzb3VyY2VzIjpbImlucHV0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbi8vIEV4YW1wbGUgMVxuZnVuY3Rpb24gbXlTdHlsZWQoQ29tcG9uZW50KSB7XG4gIHJldHVybiBzdHlsZWQoQ29tcG9uZW50KWBcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZWQ7XG4gIGA7XG59XG5cbmZ1bmN0aW9uIG15Q3NzKGNvbG9yKSB7XG4gIHJldHVybiBjc3NgXG4gICAgYmFja2dyb3VuZC1jb2xvcjogJHtjb2xvcn07XG4gIGA7XG59XG5cbmNvbnN0IG15U3R5bGVzID0gbXlDc3MoXCJyZWRcIik7XG5cbmNvbnN0IERpdiA9IG15U3R5bGVkKFwiZGl2XCIpO1xuXG5mdW5jdGlvbiBBcHAoKSB7XG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxEaXY+b25lPC9EaXY+XG4gICAgICA8ZGl2IGNzcz17bXlTdHlsZXN9PnR3bzwvZGl2PlxuICAgIDwvPlxuICApO1xufVxuXG4vLyBFeGFtcGxlIDJcbmNvbnN0IHN0eWxlcyA9IHtcbiAga2V5QTogY3NzKHtcbiAgICBwYWRkaW5nOiAwLFxuICB9KSxcbiAga2V5QjogY3NzKHtcbiAgICBtYXJnaW46IDAsXG4gIH0pLFxufTtcbmNvbnN0IEFwcDIgPSAoKSA9PiA8ZGl2IGNsYXNzbmFtZT17c3R5bGVzLmtleUF9PmhlbGxvIHdvcmxkPC9kaXY+O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtDUSJ9 */") +}; +const App2 = ()=>/*#__PURE__*/ _jsx("div", { + classname: styles.keyA, + children: "hello world" + }); diff --git a/packages/emotion/transform/tests/label-sanitisation/bad.const.name.js b/packages/emotion/transform/tests/label-sanitisation/bad.const.name.js deleted file mode 100644 index 5b9bf186f..000000000 --- a/packages/emotion/transform/tests/label-sanitisation/bad.const.name.js +++ /dev/null @@ -1,8 +0,0 @@ -import styled from "@emotion/styled"; -export const Dollar$Div = /*#__PURE__*/ styled("div", { - target: "elomtyh0", - label: "label-sanitisation-bad-const-name-Dollar-Div", -})( - "background-color:black;", - "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGFiZWwtc2FuaXRpc2F0aW9uL2JhZC5jb25zdC5uYW1lLnRzIiwic291cmNlcyI6WyJsYWJlbC1zYW5pdGlzYXRpb24vYmFkLmNvbnN0Lm5hbWUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbmV4cG9ydCBjb25zdCBEb2xsYXIkRGl2ID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZC1jb2xvcjogYmxhY2s7XG5gO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUUwQiJ9 */" -); diff --git a/packages/emotion/transform/tests/label-sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.js b/packages/emotion/transform/tests/label-sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.js deleted file mode 100644 index afb286831..000000000 --- a/packages/emotion/transform/tests/label-sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.js +++ /dev/null @@ -1,8 +0,0 @@ -import styled from "@emotion/styled"; -export const StyledDiv = /*#__PURE__*/ styled("div", { - target: "e17wqgfl0", - label: "label-sanitisation-bad-name----------------------StyledDiv", -})( - "background-color:black;", - "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGFiZWwtc2FuaXRpc2F0aW9uL2JhZC5uYW1lLiEjJCUmKCkrLC47PUBbXV5gfX57LnRzIiwic291cmNlcyI6WyJsYWJlbC1zYW5pdGlzYXRpb24vYmFkLm5hbWUuISMkJSYoKSssLjs9QFtdXmB9fnsudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWREaXYgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kLWNvbG9yOiBibGFjaztcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRXlCIn0= */" -); diff --git a/packages/emotion/transform/tests/label-sanitisation/input.styles.js b/packages/emotion/transform/tests/label-sanitisation/input.styles.js deleted file mode 100644 index ac0d9f497..000000000 --- a/packages/emotion/transform/tests/label-sanitisation/input.styles.js +++ /dev/null @@ -1,8 +0,0 @@ -import styled from "@emotion/styled"; -export const StyledDiv = /*#__PURE__*/ styled("div", { - target: "e17wqgfl0", - label: "label-sanitisation-input-styles-StyledDiv", -})( - "background-color:black;", - "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGFiZWwtc2FuaXRpc2F0aW9uL2lucHV0LnN0eWxlcy50cyIsInNvdXJjZXMiOlsibGFiZWwtc2FuaXRpc2F0aW9uL2lucHV0LnN0eWxlcy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcIjtcblxuZXhwb3J0IGNvbnN0IFN0eWxlZERpdiA9IHN0eWxlZC5kaXZgXG4gIGJhY2tncm91bmQtY29sb3I6IGJsYWNrO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFeUIifQ== */" -); diff --git a/packages/emotion/transform/tests/labels/emotion-js/actual-expected-usage.js b/packages/emotion/transform/tests/labels/emotion-js/actual-expected-usage.js new file mode 100644 index 000000000..b835088a9 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/actual-expected-usage.js @@ -0,0 +1,6 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/actual-expected-usage.js +import { jsx as _jsx } from "react/jsx-runtime"; +import { jsx, css } from "@emotion/react"; +const SomeComponent = ()=>/*#__PURE__*/ _jsx("div", { + css: /*#__PURE__*/ css("color:hotpink;", "SomeComponent", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9hY3R1YWwtZXhwZWN0ZWQtdXNhZ2UudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvYWN0dWFsLWV4cGVjdGVkLXVzYWdlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9hY3R1YWwtZXhwZWN0ZWQtdXNhZ2UuanNcblxuaW1wb3J0IHsganN4LCBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vcmVhY3RcIjtcblxuY29uc3QgU29tZUNvbXBvbmVudCA9ICgpID0+IChcbiAgPGRpdlxuICAgIGNzcz17Y3NzYFxuICAgICAgY29sb3I6IGhvdHBpbms7XG4gICAgYH1cbiAgLz5cbik7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBTVMifQ== */") + }); diff --git a/packages/emotion/transform/tests/labels/emotion-js/actual-expected-usage.ts b/packages/emotion/transform/tests/labels/emotion-js/actual-expected-usage.ts new file mode 100644 index 000000000..9fefd2fe7 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/actual-expected-usage.ts @@ -0,0 +1,11 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/actual-expected-usage.js + +import { jsx, css } from "@emotion/react"; + +const SomeComponent = () => ( +
+); diff --git a/packages/emotion/transform/tests/labels/emotion-js/basic.js b/packages/emotion/transform/tests/labels/emotion-js/basic.js new file mode 100644 index 000000000..8d35e92dc --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/basic.js @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/basic.js +import { css } from "@emotion/react"; +function doThing() { + return /*#__PURE__*/ css("display:flex;", "doThing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9iYXNpYy50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9iYXNpYy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vYmFzaWMuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmZ1bmN0aW9uIGRvVGhpbmcoKSB7XG4gIHJldHVybiBjc3NgXG4gICAgZGlzcGxheTogZmxleDtcbiAgYDtcbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLUyJ9 */"); +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/basic.ts b/packages/emotion/transform/tests/labels/emotion-js/basic.ts new file mode 100644 index 000000000..c1240ea81 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/basic.ts @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/basic.js + +import { css } from "@emotion/react"; + +function doThing() { + return css` + display: flex; + `; +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/call-expression.js b/packages/emotion/transform/tests/labels/emotion-js/call-expression.js new file mode 100644 index 000000000..a4d9f06e8 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/call-expression.js @@ -0,0 +1,7 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/call-expression.js +import { css } from "@emotion/react"; +function doThing() { + return /*#__PURE__*/ css({ + color: "hotpink" + }, "label:doThing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9jYWxsLWV4cHJlc3Npb24udHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvY2FsbC1leHByZXNzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9jYWxsLWV4cHJlc3Npb24uanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmZ1bmN0aW9uIGRvVGhpbmcoKSB7XG4gIHJldHVybiBjc3MoeyBjb2xvcjogXCJob3RwaW5rXCIgfSk7XG59XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS1MifQ== */"); +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/call-expression.ts b/packages/emotion/transform/tests/labels/emotion-js/call-expression.ts new file mode 100644 index 000000000..4c2d885a8 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/call-expression.ts @@ -0,0 +1,7 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/call-expression.js + +import { css } from "@emotion/react"; + +function doThing() { + return css({ color: "hotpink" }); +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/call-inside-call.js b/packages/emotion/transform/tests/labels/emotion-js/call-inside-call.js new file mode 100644 index 000000000..9feb07ec7 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/call-inside-call.js @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/call-inside-call.js +import { css } from "@emotion/react"; +const thing = /*#__PURE__*/ css("display:flex;&:hover{", css` + color: hotpink; + `, ";}", "thing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9jYWxsLWluc2lkZS1jYWxsLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2NhbGwtaW5zaWRlLWNhbGwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2NhbGwtaW5zaWRlLWNhbGwuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0gY3NzYFxuICBkaXNwbGF5OiBmbGV4O1xuICAmOmhvdmVyIHtcbiAgICAke2Nzc2BcbiAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgIGB9O1xuICB9XG5gO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUljIn0= */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/call-inside-call.ts b/packages/emotion/transform/tests/labels/emotion-js/call-inside-call.ts new file mode 100644 index 000000000..60248b4ff --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/call-inside-call.ts @@ -0,0 +1,12 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/call-inside-call.js + +import { css } from "@emotion/react"; + +const thing = css` + display: flex; + &:hover { + ${css` + color: hotpink; + `}; + } +`; diff --git a/packages/emotion/transform/tests/labels/emotion-js/comment-with-interpolation.js b/packages/emotion/transform/tests/labels/emotion-js/comment-with-interpolation.js new file mode 100644 index 000000000..64393e3c0 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/comment-with-interpolation.js @@ -0,0 +1,4 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/comment-with-interpolation.js +import { css } from "@emotion/react"; +/*#__PURE__*/ css("green", ";/*\n\n something:", "something", ";*/\n color:hotpink;", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9jb21tZW50LXdpdGgtaW50ZXJwb2xhdGlvbi50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9jb21tZW50LXdpdGgtaW50ZXJwb2xhdGlvbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vY29tbWVudC13aXRoLWludGVycG9sYXRpb24uanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNzc2BcbiAgLy8gY29sb3I6ICR7XCJncmVlblwifTtcbiAgLypcblxuICBzb21ldGhpbmc6ICR7XCJzb21ldGhpbmdcIn07XG5cbiAgKi9cbiAgY29sb3I6IGhvdHBpbms7XG5gO1xuXG5jc3NgXG4gIC8vIGNvbG9yOiAke1wiZ3JlZW5cIn07XG4gIC8qXG5cbiAgc29tZXRoaW5nOiAke1wic29tZXRoaW5nXCJ9O1xuXG4gICovXG4gIGNvbG9yOiAke1wiaG90cGlua1wifTtcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEifQ== */"); +/*#__PURE__*/ css("green", ";/*\n\n something:", "something", ";*/\n color:", "hotpink", ";", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9jb21tZW50LXdpdGgtaW50ZXJwb2xhdGlvbi50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9jb21tZW50LXdpdGgtaW50ZXJwb2xhdGlvbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vY29tbWVudC13aXRoLWludGVycG9sYXRpb24uanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNzc2BcbiAgLy8gY29sb3I6ICR7XCJncmVlblwifTtcbiAgLypcblxuICBzb21ldGhpbmc6ICR7XCJzb21ldGhpbmdcIn07XG5cbiAgKi9cbiAgY29sb3I6IGhvdHBpbms7XG5gO1xuXG5jc3NgXG4gIC8vIGNvbG9yOiAke1wiZ3JlZW5cIn07XG4gIC8qXG5cbiAgc29tZXRoaW5nOiAke1wic29tZXRoaW5nXCJ9O1xuXG4gICovXG4gIGNvbG9yOiAke1wiaG90cGlua1wifTtcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBY0EifQ== */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/comment-with-interpolation.ts b/packages/emotion/transform/tests/labels/emotion-js/comment-with-interpolation.ts new file mode 100644 index 000000000..0684153b0 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/comment-with-interpolation.ts @@ -0,0 +1,23 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/comment-with-interpolation.js + +import { css } from "@emotion/react"; + +css` + // color: ${"green"}; + /* + + something: ${"something"}; + + */ + color: hotpink; +`; + +css` + // color: ${"green"}; + /* + + something: ${"something"}; + + */ + color: ${"hotpink"}; +`; diff --git a/packages/emotion/transform/tests/labels/emotion-js/impure.js b/packages/emotion/transform/tests/labels/emotion-js/impure.js new file mode 100644 index 000000000..f94d9a1db --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/impure.js @@ -0,0 +1,6 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/impure.js +import { css } from "@emotion/react"; +function thing() {} +function doThing() { + return /*#__PURE__*/ css("display:", thing(), ";", "doThing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9pbXB1cmUudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvaW1wdXJlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9pbXB1cmUuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmZ1bmN0aW9uIHRoaW5nKCkge31cblxuZnVuY3Rpb24gZG9UaGluZygpIHtcbiAgcmV0dXJuIGNzc2BcbiAgICBkaXNwbGF5OiAke3RoaW5nKCl9O1xuICBgO1xufVxuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9TIn0= */"); +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/impure.ts b/packages/emotion/transform/tests/labels/emotion-js/impure.ts new file mode 100644 index 000000000..3bf86fe5e --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/impure.ts @@ -0,0 +1,11 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/impure.js + +import { css } from "@emotion/react"; + +function thing() {} + +function doThing() { + return css` + display: ${thing()}; + `; +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-arrow-function.js b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-arrow-function.js new file mode 100644 index 000000000..965a4a6e1 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-arrow-function.js @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-anonymous-arrow-function.js +import { css } from "@emotion/react"; +export default (()=>{ + /*#__PURE__*/ css("color:hotpink;", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9pbnNpZGUtYW5vbnltb3VzLWFycm93LWZ1bmN0aW9uLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2luc2lkZS1hbm9ueW1vdXMtYXJyb3ctZnVuY3Rpb24udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2luc2lkZS1hbm9ueW1vdXMtYXJyb3ctZnVuY3Rpb24uanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmV4cG9ydCBkZWZhdWx0ICgpID0+IHtcbiAgY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgO1xufTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLRSJ9 */"); +}); diff --git a/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-arrow-function.ts b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-arrow-function.ts new file mode 100644 index 000000000..2cda3fbe6 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-arrow-function.ts @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-anonymous-arrow-function.js + +import { css } from "@emotion/react"; + +export default () => { + css` + color: hotpink; + `; +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-function.js b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-function.js new file mode 100644 index 000000000..02691c30d --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-function.js @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-anonymous-function.js +import { css } from "@emotion/react"; +export default (()=>{ + /*#__PURE__*/ css("color:hotpink;", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9pbnNpZGUtYW5vbnltb3VzLWZ1bmN0aW9uLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2luc2lkZS1hbm9ueW1vdXMtZnVuY3Rpb24udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2luc2lkZS1hbm9ueW1vdXMtZnVuY3Rpb24uanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmV4cG9ydCBkZWZhdWx0ICgpID0+IHtcbiAgY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgO1xufTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLRSJ9 */"); +}); diff --git a/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-function.ts b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-function.ts new file mode 100644 index 000000000..da502cd3a --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/inside-anonymous-function.ts @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-anonymous-function.js + +import { css } from "@emotion/react"; + +export default () => { + css` + color: hotpink; + `; +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/inside-class.js b/packages/emotion/transform/tests/labels/emotion-js/inside-class.js new file mode 100644 index 000000000..15ca8f115 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/inside-class.js @@ -0,0 +1,20 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-class.js +import { jsx as _jsx } from "react/jsx-runtime"; +import { Component } from "react"; +import { jsx, css } from "@emotion/react"; +class SomeComponent extends Component { + private member = /*#__PURE__*/ css("color:hotpink;", "member", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9pbnNpZGUtY2xhc3MudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvaW5zaWRlLWNsYXNzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9pbnNpZGUtY2xhc3MuanNcblxuaW1wb3J0IHsgQ29tcG9uZW50IH0gZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgeyBqc3gsIGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuXG5jbGFzcyBTb21lQ29tcG9uZW50IGV4dGVuZHMgQ29tcG9uZW50IHtcbiAgcHJpdmF0ZSBtZW1iZXIgPSBjc3NgXG4gICAgY29sb3I6IGhvdHBpbms7XG4gIGA7XG5cbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2XG4gICAgICAgIGNzcz17Y3NzYFxuICAgICAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgICAgICBgfVxuICAgICAgLz5cbiAgICApO1xuICB9XG59XG5cbmNsYXNzIFNvbWVPdGhlckNvbXBvbmVudCBleHRlbmRzIENvbXBvbmVudCB7XG4gIHByaXZhdGUgbWVtYmVyID0gY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgO1xuXG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPGRpdlxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcblxuICAgICAgICAgIC5mb28ge1xuICAgICAgICAgICAgJHt0aGlzLm1lbWJlcn1cbiAgICAgICAgICB9XG4gICAgICAgIGB9XG4gICAgICAvPlxuICAgICk7XG4gIH1cbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNbUIifQ== */"); + render() { + return /*#__PURE__*/ _jsx("div", { + css: /*#__PURE__*/ css("color:hotpink;", "SomeComponent", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9pbnNpZGUtY2xhc3MudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvaW5zaWRlLWNsYXNzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9pbnNpZGUtY2xhc3MuanNcblxuaW1wb3J0IHsgQ29tcG9uZW50IH0gZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgeyBqc3gsIGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuXG5jbGFzcyBTb21lQ29tcG9uZW50IGV4dGVuZHMgQ29tcG9uZW50IHtcbiAgcHJpdmF0ZSBtZW1iZXIgPSBjc3NgXG4gICAgY29sb3I6IGhvdHBpbms7XG4gIGA7XG5cbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2XG4gICAgICAgIGNzcz17Y3NzYFxuICAgICAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgICAgICBgfVxuICAgICAgLz5cbiAgICApO1xuICB9XG59XG5cbmNsYXNzIFNvbWVPdGhlckNvbXBvbmVudCBleHRlbmRzIENvbXBvbmVudCB7XG4gIHByaXZhdGUgbWVtYmVyID0gY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgO1xuXG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPGRpdlxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcblxuICAgICAgICAgIC5mb28ge1xuICAgICAgICAgICAgJHt0aGlzLm1lbWJlcn1cbiAgICAgICAgICB9XG4gICAgICAgIGB9XG4gICAgICAvPlxuICAgICk7XG4gIH1cbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFhYSJ9 */") + }); + } +} +class SomeOtherComponent extends Component { + private member = /*#__PURE__*/ css("color:hotpink;", "member", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9pbnNpZGUtY2xhc3MudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvaW5zaWRlLWNsYXNzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9pbnNpZGUtY2xhc3MuanNcblxuaW1wb3J0IHsgQ29tcG9uZW50IH0gZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgeyBqc3gsIGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuXG5jbGFzcyBTb21lQ29tcG9uZW50IGV4dGVuZHMgQ29tcG9uZW50IHtcbiAgcHJpdmF0ZSBtZW1iZXIgPSBjc3NgXG4gICAgY29sb3I6IGhvdHBpbms7XG4gIGA7XG5cbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2XG4gICAgICAgIGNzcz17Y3NzYFxuICAgICAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgICAgICBgfVxuICAgICAgLz5cbiAgICApO1xuICB9XG59XG5cbmNsYXNzIFNvbWVPdGhlckNvbXBvbmVudCBleHRlbmRzIENvbXBvbmVudCB7XG4gIHByaXZhdGUgbWVtYmVyID0gY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgO1xuXG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPGRpdlxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcblxuICAgICAgICAgIC5mb28ge1xuICAgICAgICAgICAgJHt0aGlzLm1lbWJlcn1cbiAgICAgICAgICB9XG4gICAgICAgIGB9XG4gICAgICAvPlxuICAgICk7XG4gIH1cbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFzQm1CIn0= */"); + render() { + return /*#__PURE__*/ _jsx("div", { + css: /*#__PURE__*/ css("color:hotpink;.foo{", this.member, "}", "SomeOtherComponent", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9pbnNpZGUtY2xhc3MudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvaW5zaWRlLWNsYXNzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9pbnNpZGUtY2xhc3MuanNcblxuaW1wb3J0IHsgQ29tcG9uZW50IH0gZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgeyBqc3gsIGNzcyB9IGZyb20gXCJAZW1vdGlvbi9yZWFjdFwiO1xuXG5jbGFzcyBTb21lQ29tcG9uZW50IGV4dGVuZHMgQ29tcG9uZW50IHtcbiAgcHJpdmF0ZSBtZW1iZXIgPSBjc3NgXG4gICAgY29sb3I6IGhvdHBpbms7XG4gIGA7XG5cbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2XG4gICAgICAgIGNzcz17Y3NzYFxuICAgICAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgICAgICBgfVxuICAgICAgLz5cbiAgICApO1xuICB9XG59XG5cbmNsYXNzIFNvbWVPdGhlckNvbXBvbmVudCBleHRlbmRzIENvbXBvbmVudCB7XG4gIHByaXZhdGUgbWVtYmVyID0gY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgO1xuXG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPGRpdlxuICAgICAgICBjc3M9e2Nzc2BcbiAgICAgICAgICBjb2xvcjogaG90cGluaztcblxuICAgICAgICAgIC5mb28ge1xuICAgICAgICAgICAgJHt0aGlzLm1lbWJlcn1cbiAgICAgICAgICB9XG4gICAgICAgIGB9XG4gICAgICAvPlxuICAgICk7XG4gIH1cbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE2QmEifQ== */") + }); + } +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/inside-class.ts b/packages/emotion/transform/tests/labels/emotion-js/inside-class.ts new file mode 100644 index 000000000..2935cb0c8 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/inside-class.ts @@ -0,0 +1,40 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/inside-class.js + +import { Component } from "react"; +import { jsx, css } from "@emotion/react"; + +class SomeComponent extends Component { + private member = css` + color: hotpink; + `; + + render() { + return ( +
+ ); + } +} + +class SomeOtherComponent extends Component { + private member = css` + color: hotpink; + `; + + render() { + return ( +
+ ); + } +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-1.js b/packages/emotion/transform/tests/labels/emotion-js/label-1.js new file mode 100644 index 000000000..1cd34ba08 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-1.js @@ -0,0 +1,3 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-1.js +import { css } from "@emotion/react"; +const thing = /*#__PURE__*/ css("color:hotpink;", "thing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC0xLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2xhYmVsLTEudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2xhYmVsLTEuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0gY3NzYFxuICBjb2xvcjogaG90cGluaztcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSWMifQ== */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-1.ts b/packages/emotion/transform/tests/labels/emotion-js/label-1.ts new file mode 100644 index 000000000..9ee345e62 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-1.ts @@ -0,0 +1,7 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-1.js + +import { css } from "@emotion/react"; + +const thing = css` + color: hotpink; +`; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-arrow-as-obj-property.js b/packages/emotion/transform/tests/labels/emotion-js/label-arrow-as-obj-property.js new file mode 100644 index 000000000..1263f773f --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-arrow-as-obj-property.js @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-arrow-as-obj-property.js +import { css } from "@emotion/react"; +export const styles = { + colorFn1: ()=>/*#__PURE__*/ css("color:hotpink;", "colorFn1", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1hcnJvdy1hcy1vYmotcHJvcGVydHkudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvbGFiZWwtYXJyb3ctYXMtb2JqLXByb3BlcnR5LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9sYWJlbC1hcnJvdy1hcy1vYmotcHJvcGVydHkuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmV4cG9ydCBjb25zdCBzdHlsZXMgPSB7XG4gIGNvbG9yRm4xOiAoKSA9PiBjc3NgXG4gICAgY29sb3I6IGhvdHBpbms7XG4gIGAsXG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtrQiJ9 */") +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-arrow-as-obj-property.ts b/packages/emotion/transform/tests/labels/emotion-js/label-arrow-as-obj-property.ts new file mode 100644 index 000000000..7d8d32c5d --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-arrow-as-obj-property.ts @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-arrow-as-obj-property.js + +import { css } from "@emotion/react"; + +export const styles = { + colorFn1: () => css` + color: hotpink; + `, +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-as-obj-property.js b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-as-obj-property.js new file mode 100644 index 000000000..5ec2be6c5 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-as-obj-property.js @@ -0,0 +1,7 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-as-obj-property.js +import { css } from "@emotion/react"; +export const styles = { + colorFn1: function() { + return /*#__PURE__*/ css("color:hotpink;", "colorFn1", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1mdW5jdGlvbi1leHByZXNzaW9uLWFzLW9iai1wcm9wZXJ0eS50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9sYWJlbC1mdW5jdGlvbi1leHByZXNzaW9uLWFzLW9iai1wcm9wZXJ0eS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vbGFiZWwtZnVuY3Rpb24tZXhwcmVzc2lvbi1hcy1vYmotcHJvcGVydHkuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmV4cG9ydCBjb25zdCBzdHlsZXMgPSB7XG4gIGNvbG9yRm4xOiBmdW5jdGlvbiAoKSB7XG4gICAgcmV0dXJuIGNzc2BcbiAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgIGA7XG4gIH0sXG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1XIn0= */"); + } +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-as-obj-property.ts b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-as-obj-property.ts new file mode 100644 index 000000000..0b3d8a771 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-as-obj-property.ts @@ -0,0 +1,11 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-as-obj-property.js + +import { css } from "@emotion/react"; + +export const styles = { + colorFn1: function () { + return css` + color: hotpink; + `; + }, +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-named.js b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-named.js new file mode 100644 index 000000000..cd6ef528d --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-named.js @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-named.js +import { css } from "@emotion/react"; +const thing = function someName() { + return /*#__PURE__*/ css("color:hotpink;", "someName", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1mdW5jdGlvbi1leHByZXNzaW9uLW5hbWVkLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2xhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24tbmFtZWQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2xhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24tbmFtZWQuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0gZnVuY3Rpb24gc29tZU5hbWUoKSB7XG4gIHJldHVybiBjc3NgXG4gICAgY29sb3I6IGhvdHBpbms7XG4gIGA7XG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtTIn0= */"); +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-named.ts b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-named.ts new file mode 100644 index 000000000..013765ad3 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression-named.ts @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-named.js + +import { css } from "@emotion/react"; + +const thing = function someName() { + return css` + color: hotpink; + `; +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-function-expression.js b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression.js new file mode 100644 index 000000000..208d39600 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression.js @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression.js +import { css } from "@emotion/react"; +const thing = function() { + return /*#__PURE__*/ css("color:hotpink;", "thing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1mdW5jdGlvbi1leHByZXNzaW9uLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2xhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2xhYmVsLWZ1bmN0aW9uLWV4cHJlc3Npb24uanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0gZnVuY3Rpb24gKCkge1xuICByZXR1cm4gY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgO1xufTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLUyJ9 */"); +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-function-expression.ts b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression.ts new file mode 100644 index 000000000..0c89b3dcc --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-function-expression.ts @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression.js + +import { css } from "@emotion/react"; + +const thing = function () { + return css` + color: hotpink; + `; +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-no-final-semi.js b/packages/emotion/transform/tests/labels/emotion-js/label-no-final-semi.js new file mode 100644 index 000000000..a0cd2070d --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-no-final-semi.js @@ -0,0 +1,4 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-no-final-semi.js +import { css } from "@emotion/react"; +// prettier-ignore +const thing = /*#__PURE__*/ css("color:hotpink", "thing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1uby1maW5hbC1zZW1pLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2xhYmVsLW5vLWZpbmFsLXNlbWkudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2xhYmVsLW5vLWZpbmFsLXNlbWkuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbi8vIHByZXR0aWVyLWlnbm9yZVxuY29uc3QgdGhpbmcgPSBjc3NgXG4gIGNvbG9yOiBob3RwaW5rXG5gXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2MifQ== */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-no-final-semi.ts b/packages/emotion/transform/tests/labels/emotion-js/label-no-final-semi.ts new file mode 100644 index 000000000..09fcafe1e --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-no-final-semi.ts @@ -0,0 +1,8 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-no-final-semi.js + +import { css } from "@emotion/react"; + +// prettier-ignore +const thing = css` + color: hotpink +` diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-obj-method.js b/packages/emotion/transform/tests/labels/emotion-js/label-obj-method.js new file mode 100644 index 000000000..79f1642bf --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-obj-method.js @@ -0,0 +1,10 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-obj-method.js +import { jsx as _jsx } from "react/jsx-runtime"; +import { css } from "@emotion/react"; +const obj = { + FooBar () { + return /*#__PURE__*/ _jsx("div", { + css: /*#__PURE__*/ css("background-color:hotpink;", "FooBar", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1vYmotbWV0aG9kLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL2xhYmVsLW9iai1tZXRob2QudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL2xhYmVsLW9iai1tZXRob2QuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IG9iaiA9IHtcbiAgRm9vQmFyKCkge1xuICAgIHJldHVybiAoXG4gICAgICA8ZGl2XG4gICAgICAgIGNzcz17Y3NzYFxuICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6IGhvdHBpbms7XG4gICAgICAgIGB9XG4gICAgICAvPlxuICAgICk7XG4gIH0sXG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFhIn0= */") + }); + } +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-obj-method.ts b/packages/emotion/transform/tests/labels/emotion-js/label-obj-method.ts new file mode 100644 index 000000000..cd77a2ffc --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-obj-method.ts @@ -0,0 +1,15 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-obj-method.js + +import { css } from "@emotion/react"; + +const obj = { + FooBar() { + return ( +
+ ); + }, +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-obj-property-literal.js b/packages/emotion/transform/tests/labels/emotion-js/label-obj-property-literal.js new file mode 100644 index 000000000..6fe77b156 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-obj-property-literal.js @@ -0,0 +1,8 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-obj-property-literal.js +import { jsx as _jsx } from "react/jsx-runtime"; +import { css } from "@emotion/react"; +const obj = { + "red component": /*#__PURE__*/ _jsx("div", { + css: /*#__PURE__*/ css("background-color:hotpink;", "red-component", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1vYmotcHJvcGVydHktbGl0ZXJhbC50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9sYWJlbC1vYmotcHJvcGVydHktbGl0ZXJhbC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vbGFiZWwtb2JqLXByb3BlcnR5LWxpdGVyYWwuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IG9iaiA9IHtcbiAgXCJyZWQgY29tcG9uZW50XCI6IChcbiAgICA8ZGl2XG4gICAgICBjc3M9e2Nzc2BcbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogaG90cGluaztcbiAgICAgIGB9XG4gICAgLz5cbiAgKSxcbn07XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT1cifQ== */") + }) +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-obj-property-literal.ts b/packages/emotion/transform/tests/labels/emotion-js/label-obj-property-literal.ts new file mode 100644 index 000000000..20c587446 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-obj-property-literal.ts @@ -0,0 +1,13 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-obj-property-literal.js + +import { css } from "@emotion/react"; + +const obj = { + "red component": ( +
+ ), +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-object.js b/packages/emotion/transform/tests/labels/emotion-js/label-object.js new file mode 100644 index 000000000..4f2b014fb --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-object.js @@ -0,0 +1,7 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-object.js +import { css } from "@emotion/react"; +const thing = { + thisShouldBeTheLabel: /*#__PURE__*/ css("color:hotpink;", "thisShouldBeTheLabel", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1vYmplY3QudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvbGFiZWwtb2JqZWN0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9sYWJlbC1vYmplY3QuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0ge1xuICB0aGlzU2hvdWxkQmVUaGVMYWJlbDogY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgLFxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgJ3Nob3VsZEJlQW5vdGhlckxhYmVsJzpjc3NgXG4gICAgY29sb3I6Z3JlZW47XG4gIGAsXG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUt3QiJ9 */"), + // prettier-ignore + 'shouldBeAnotherLabel': /*#__PURE__*/ css("color:green;", "shouldBeAnotherLabel", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9sYWJlbC1vYmplY3QudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvbGFiZWwtb2JqZWN0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9sYWJlbC1vYmplY3QuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0ge1xuICB0aGlzU2hvdWxkQmVUaGVMYWJlbDogY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgLFxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgJ3Nob3VsZEJlQW5vdGhlckxhYmVsJzpjc3NgXG4gICAgY29sb3I6Z3JlZW47XG4gIGAsXG59O1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVN5QiJ9 */") +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/label-object.ts b/packages/emotion/transform/tests/labels/emotion-js/label-object.ts new file mode 100644 index 000000000..d7095c7f0 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/label-object.ts @@ -0,0 +1,13 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/label-object.js + +import { css } from "@emotion/react"; + +const thing = { + thisShouldBeTheLabel: css` + color: hotpink; + `, + // prettier-ignore + 'shouldBeAnotherLabel':css` + color:green; + `, +}; diff --git a/packages/emotion/transform/tests/labels/emotion-js/multiple-calls.js b/packages/emotion/transform/tests/labels/emotion-js/multiple-calls.js new file mode 100644 index 000000000..9b846b166 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/multiple-calls.js @@ -0,0 +1,4 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/multiple-calls.js +import { css } from "@emotion/react"; +const thing = /*#__PURE__*/ css("color:hotpink;", "thing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9tdWx0aXBsZS1jYWxscy50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9tdWx0aXBsZS1jYWxscy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vbXVsdGlwbGUtY2FsbHMuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0gY3NzYFxuICBjb2xvcjogaG90cGluaztcbmA7XG5cbmNvbnN0IG90aGVyVGhpbmcgPSBjc3NgXG4gIGNvbG9yOiBncmVlbjtcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSWMifQ== */"); +const otherThing = /*#__PURE__*/ css("color:green;", "otherThing", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9tdWx0aXBsZS1jYWxscy50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9tdWx0aXBsZS1jYWxscy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vbXVsdGlwbGUtY2FsbHMuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IHRoaW5nID0gY3NzYFxuICBjb2xvcjogaG90cGluaztcbmA7XG5cbmNvbnN0IG90aGVyVGhpbmcgPSBjc3NgXG4gIGNvbG9yOiBncmVlbjtcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUW1CIn0= */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/multiple-calls.ts b/packages/emotion/transform/tests/labels/emotion-js/multiple-calls.ts new file mode 100644 index 000000000..a5b3e7053 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/multiple-calls.ts @@ -0,0 +1,11 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/multiple-calls.js + +import { css } from "@emotion/react"; + +const thing = css` + color: hotpink; +`; + +const otherThing = css` + color: green; +`; diff --git a/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.js b/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.js new file mode 100644 index 000000000..a0db2fb5d --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.js @@ -0,0 +1,2 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-actual-import.js +import "@emotion/react"; diff --git a/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.ts b/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.ts new file mode 100644 index 000000000..f2703d5cf --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/no-actual-import.ts @@ -0,0 +1,3 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-actual-import.js + +import "@emotion/react"; diff --git a/packages/emotion/transform/tests/labels/emotion-js/no-label-array-pattern.js b/packages/emotion/transform/tests/labels/emotion-js/no-label-array-pattern.js new file mode 100644 index 000000000..c6f4a104b --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/no-label-array-pattern.js @@ -0,0 +1,6 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-label-array-pattern.js +import { css } from "@emotion/react"; +const [weirdo] = [ + /*#__PURE__*/ css("color:hotpink;", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9uby1sYWJlbC1hcnJheS1wYXR0ZXJuLnRzIiwic291cmNlcyI6WyJlbW90aW9uLWpzL25vLWxhYmVsLWFycmF5LXBhdHRlcm4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL2Vtb3Rpb24tanMvZW1vdGlvbi9ibG9iL21haW4vcGFja2FnZXMvYmFiZWwtcGx1Z2luL19fdGVzdHNfXy9jc3MtbWFjcm8vX19maXh0dXJlc19fL25vLWxhYmVsLWFycmF5LXBhdHRlcm4uanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IFt3ZWlyZG9dID0gW1xuICBjc3NgXG4gICAgY29sb3I6IGhvdHBpbms7XG4gIGAsXG5dO1xuXG5leHBvcnQgZGVmYXVsdCB3ZWlyZG87XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0UifQ== */") +]; +export default weirdo; diff --git a/packages/emotion/transform/tests/labels/emotion-js/no-label-array-pattern.ts b/packages/emotion/transform/tests/labels/emotion-js/no-label-array-pattern.ts new file mode 100644 index 000000000..17081e784 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/no-label-array-pattern.ts @@ -0,0 +1,11 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-label-array-pattern.js + +import { css } from "@emotion/react"; + +const [weirdo] = [ + css` + color: hotpink; + `, +]; + +export default weirdo; diff --git a/packages/emotion/transform/tests/labels/emotion-js/no-label-obj-pattern-computed-property.js b/packages/emotion/transform/tests/labels/emotion-js/no-label-obj-pattern-computed-property.js new file mode 100644 index 000000000..480c1e41a --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/no-label-obj-pattern-computed-property.js @@ -0,0 +1,7 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-label-obj-pattern-computed-property.js +import { css } from "@emotion/react"; +const computed = "weirdo"; +const { weirdo } = { + [computed]: /*#__PURE__*/ css("color:hotpink;", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9uby1sYWJlbC1vYmotcGF0dGVybi1jb21wdXRlZC1wcm9wZXJ0eS50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9uby1sYWJlbC1vYmotcGF0dGVybi1jb21wdXRlZC1wcm9wZXJ0eS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vbm8tbGFiZWwtb2JqLXBhdHRlcm4tY29tcHV0ZWQtcHJvcGVydHkuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNvbnN0IGNvbXB1dGVkID0gXCJ3ZWlyZG9cIjtcblxuY29uc3QgeyB3ZWlyZG8gfSA9IHtcbiAgW2NvbXB1dGVkXTogY3NzYFxuICAgIGNvbG9yOiBob3RwaW5rO1xuICBgLFxufTtcblxuZXhwb3J0IGRlZmF1bHQgd2VpcmRvO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9jIn0= */") +}; +export default weirdo; diff --git a/packages/emotion/transform/tests/labels/emotion-js/no-label-obj-pattern-computed-property.ts b/packages/emotion/transform/tests/labels/emotion-js/no-label-obj-pattern-computed-property.ts new file mode 100644 index 000000000..ebbd2cc81 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/no-label-obj-pattern-computed-property.ts @@ -0,0 +1,13 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/no-label-obj-pattern-computed-property.js + +import { css } from "@emotion/react"; + +const computed = "weirdo"; + +const { weirdo } = { + [computed]: css` + color: hotpink; + `, +}; + +export default weirdo; diff --git a/packages/emotion/transform/tests/labels/emotion-js/object-dynamic-property.js b/packages/emotion/transform/tests/labels/emotion-js/object-dynamic-property.js new file mode 100644 index 000000000..fd169460a --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/object-dynamic-property.js @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/object-dynamic-property.js +import { css } from "@emotion/react"; +function doThing() { + return { + [/*#__PURE__*/ css({ + color: "hotpink" + }, "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9vYmplY3QtZHluYW1pYy1wcm9wZXJ0eS50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9vYmplY3QtZHluYW1pYy1wcm9wZXJ0eS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vb2JqZWN0LWR5bmFtaWMtcHJvcGVydHkuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmZ1bmN0aW9uIGRvVGhpbmcoKSB7XG4gIHJldHVybiB7XG4gICAgW2Nzcyh7IGNvbG9yOiBcImhvdHBpbmtcIiB9KV06IFwiY29sZGJsdWVcIixcbiAgfTtcbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNSyJ9 */")]: "coldblue" + }; +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/object-dynamic-property.ts b/packages/emotion/transform/tests/labels/emotion-js/object-dynamic-property.ts new file mode 100644 index 000000000..29ed38e7d --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/object-dynamic-property.ts @@ -0,0 +1,9 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/object-dynamic-property.js + +import { css } from "@emotion/react"; + +function doThing() { + return { + [css({ color: "hotpink" })]: "coldblue", + }; +} diff --git a/packages/emotion/transform/tests/labels/emotion-js/object-pattern-variable-declarator.js b/packages/emotion/transform/tests/labels/emotion-js/object-pattern-variable-declarator.js new file mode 100644 index 000000000..e5d774bec --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/object-pattern-variable-declarator.js @@ -0,0 +1,11 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/object-pattern-variable-declarator.js +import { jsx as _jsx } from "react/jsx-runtime"; +import { css } from "@emotion/react"; +import { extractCritical } from "@emotion/server"; +import React from "react"; +import { renderToString } from "react-dom/server"; +const { css: styles } = extractCritical(renderToString(/*#__PURE__*/ _jsx("div", { + css: css` + color: hotpink; + ` +}))); diff --git a/packages/emotion/transform/tests/labels/emotion-js/object-pattern-variable-declarator.ts b/packages/emotion/transform/tests/labels/emotion-js/object-pattern-variable-declarator.ts new file mode 100644 index 000000000..b4ce113db --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/object-pattern-variable-declarator.ts @@ -0,0 +1,16 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/object-pattern-variable-declarator.js + +import { css } from "@emotion/react"; +import { extractCritical } from "@emotion/server"; +import React from "react"; +import { renderToString } from "react-dom/server"; + +const { css: styles } = extractCritical( + renderToString( +
+ ) +); diff --git a/packages/emotion/transform/tests/labels/emotion-js/other-imports.js b/packages/emotion/transform/tests/labels/emotion-js/other-imports.js new file mode 100644 index 000000000..aa6ccc9a6 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/other-imports.js @@ -0,0 +1,3 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/other-imports.js +import { nonExistantImport } from "@emotion/react"; +nonExistantImport(); diff --git a/packages/emotion/transform/tests/labels/emotion-js/other-imports.ts b/packages/emotion/transform/tests/labels/emotion-js/other-imports.ts new file mode 100644 index 000000000..d79b7c71b --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/other-imports.ts @@ -0,0 +1,5 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/other-imports.js + +import { nonExistantImport } from "@emotion/react"; + +nonExistantImport(); diff --git a/packages/emotion/transform/tests/labels/emotion-js/remove-block-comments.js b/packages/emotion/transform/tests/labels/emotion-js/remove-block-comments.js new file mode 100644 index 000000000..46b40ad8c --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/remove-block-comments.js @@ -0,0 +1,3 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/remove-block-comments.js +import { css } from "@emotion/react"; +/*#__PURE__*/ css("color:hotpink;", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9yZW1vdmUtYmxvY2stY29tbWVudHMudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvcmVtb3ZlLWJsb2NrLWNvbW1lbnRzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy9yZW1vdmUtYmxvY2stY29tbWVudHMuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNzc2BcbiAgLyogY29sb3I6Z3JlZW47XG5kZGpmd2prbmdcbiAgKi9cbiAgY29sb3I6IGhvdHBpbms7XG5gO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBIn0= */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/remove-block-comments.ts b/packages/emotion/transform/tests/labels/emotion-js/remove-block-comments.ts new file mode 100644 index 000000000..22b227544 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/remove-block-comments.ts @@ -0,0 +1,10 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/remove-block-comments.js + +import { css } from "@emotion/react"; + +css` + /* color:green; +ddjfwjkng + */ + color: hotpink; +`; diff --git a/packages/emotion/transform/tests/labels/emotion-js/remove-line-comments.js b/packages/emotion/transform/tests/labels/emotion-js/remove-line-comments.js new file mode 100644 index 000000000..8b95cb29d --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/remove-line-comments.js @@ -0,0 +1,3 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/remove-line-comments.js +import { css } from "@emotion/react"; +/*#__PURE__*/ css("color:hotpink;", "", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy9yZW1vdmUtbGluZS1jb21tZW50cy50cyIsInNvdXJjZXMiOlsiZW1vdGlvbi1qcy9yZW1vdmUtbGluZS1jb21tZW50cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBodHRwczovL2dpdGh1Yi5jb20vZW1vdGlvbi1qcy9lbW90aW9uL2Jsb2IvbWFpbi9wYWNrYWdlcy9iYWJlbC1wbHVnaW4vX190ZXN0c19fL2Nzcy1tYWNyby9fX2ZpeHR1cmVzX18vcmVtb3ZlLWxpbmUtY29tbWVudHMuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmNzc2BcbiAgLy8gY29sb3I6IGdyZWVuO1xuICBjb2xvcjogaG90cGluaztcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEifQ== */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/remove-line-comments.ts b/packages/emotion/transform/tests/labels/emotion-js/remove-line-comments.ts new file mode 100644 index 000000000..d364ee54b --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/remove-line-comments.ts @@ -0,0 +1,8 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/remove-line-comments.js + +import { css } from "@emotion/react"; + +css` + // color: green; + color: hotpink; +`; diff --git a/packages/emotion/transform/tests/labels/emotion-js/tagged-template-args-forwarded.js b/packages/emotion/transform/tests/labels/emotion-js/tagged-template-args-forwarded.js new file mode 100644 index 000000000..aa233c23f --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/tagged-template-args-forwarded.js @@ -0,0 +1,6 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/tagged-template-args-forwarded.js +import { css } from "@emotion/react"; +function media(...args) { + return /*#__PURE__*/ css("@media (min-width:100px){", css(...args), ";}", "media", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy90YWdnZWQtdGVtcGxhdGUtYXJncy1mb3J3YXJkZWQudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvdGFnZ2VkLXRlbXBsYXRlLWFyZ3MtZm9yd2FyZGVkLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy90YWdnZWQtdGVtcGxhdGUtYXJncy1mb3J3YXJkZWQuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmZ1bmN0aW9uIG1lZGlhKC4uLmFyZ3MpIHtcbiAgcmV0dXJuIGNzc2BcbiAgICBAbWVkaWEgKG1pbi13aWR0aDogMTAwcHgpIHtcbiAgICAgICR7Y3NzKC4uLmFyZ3MpfTtcbiAgICB9XG4gIGA7XG59XG5cbmNvbnN0IHRlc3QgPSBjc3NgXG4gICR7bWVkaWFgY29sb3I6IHJlZDtgfTtcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS1MifQ== */"); +} +const test = /*#__PURE__*/ css(media`color: red;`, ";", "test", "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1qcy90YWdnZWQtdGVtcGxhdGUtYXJncy1mb3J3YXJkZWQudHMiLCJzb3VyY2VzIjpbImVtb3Rpb24tanMvdGFnZ2VkLXRlbXBsYXRlLWFyZ3MtZm9yd2FyZGVkLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9lbW90aW9uLWpzL2Vtb3Rpb24vYmxvYi9tYWluL3BhY2thZ2VzL2JhYmVsLXBsdWdpbi9fX3Rlc3RzX18vY3NzLW1hY3JvL19fZml4dHVyZXNfXy90YWdnZWQtdGVtcGxhdGUtYXJncy1mb3J3YXJkZWQuanNcblxuaW1wb3J0IHsgY3NzIH0gZnJvbSBcIkBlbW90aW9uL3JlYWN0XCI7XG5cbmZ1bmN0aW9uIG1lZGlhKC4uLmFyZ3MpIHtcbiAgcmV0dXJuIGNzc2BcbiAgICBAbWVkaWEgKG1pbi13aWR0aDogMTAwcHgpIHtcbiAgICAgICR7Y3NzKC4uLmFyZ3MpfTtcbiAgICB9XG4gIGA7XG59XG5cbmNvbnN0IHRlc3QgPSBjc3NgXG4gICR7bWVkaWFgY29sb3I6IHJlZDtgfTtcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBWWEifQ== */"); diff --git a/packages/emotion/transform/tests/labels/emotion-js/tagged-template-args-forwarded.ts b/packages/emotion/transform/tests/labels/emotion-js/tagged-template-args-forwarded.ts new file mode 100644 index 000000000..a95d7e3b7 --- /dev/null +++ b/packages/emotion/transform/tests/labels/emotion-js/tagged-template-args-forwarded.ts @@ -0,0 +1,15 @@ +// https://github.com/emotion-js/emotion/blob/main/packages/babel-plugin/__tests__/css-macro/__fixtures__/tagged-template-args-forwarded.js + +import { css } from "@emotion/react"; + +function media(...args) { + return css` + @media (min-width: 100px) { + ${css(...args)}; + } + `; +} + +const test = css` + ${media`color: red;`}; +`; diff --git a/packages/emotion/transform/tests/labels/dirname-filename-local/output.js b/packages/emotion/transform/tests/labels/options/dirname-filename-local/output.js similarity index 100% rename from packages/emotion/transform/tests/labels/dirname-filename-local/output.js rename to packages/emotion/transform/tests/labels/options/dirname-filename-local/output.js diff --git a/packages/emotion/transform/tests/labels/dirname/output.js b/packages/emotion/transform/tests/labels/options/dirname/output.js similarity index 100% rename from packages/emotion/transform/tests/labels/dirname/output.js rename to packages/emotion/transform/tests/labels/options/dirname/output.js diff --git a/packages/emotion/transform/tests/labels/filename-local/output.js b/packages/emotion/transform/tests/labels/options/filename-local/output.js similarity index 100% rename from packages/emotion/transform/tests/labels/filename-local/output.js rename to packages/emotion/transform/tests/labels/options/filename-local/output.js diff --git a/packages/emotion/transform/tests/labels/filename/output.js b/packages/emotion/transform/tests/labels/options/filename/output.js similarity index 100% rename from packages/emotion/transform/tests/labels/filename/output.js rename to packages/emotion/transform/tests/labels/options/filename/output.js diff --git a/packages/emotion/transform/tests/labels/input.tsx b/packages/emotion/transform/tests/labels/options/input.tsx similarity index 100% rename from packages/emotion/transform/tests/labels/input.tsx rename to packages/emotion/transform/tests/labels/options/input.tsx diff --git a/packages/emotion/transform/tests/labels/local/output.js b/packages/emotion/transform/tests/labels/options/local/output.js similarity index 100% rename from packages/emotion/transform/tests/labels/local/output.js rename to packages/emotion/transform/tests/labels/options/local/output.js diff --git a/packages/emotion/transform/tests/labels/sanitisation/bad.const.name.js b/packages/emotion/transform/tests/labels/sanitisation/bad.const.name.js new file mode 100644 index 000000000..8f4d4f587 --- /dev/null +++ b/packages/emotion/transform/tests/labels/sanitisation/bad.const.name.js @@ -0,0 +1,8 @@ +import styled from "@emotion/styled"; +export const Dollar$Div = /*#__PURE__*/ styled("div", { + target: "elomtyh0", + label: "sanitisation-bad-const-name-Dollar-Div", +})( + "background-color:black;", + "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2FuaXRpc2F0aW9uL2JhZC5jb25zdC5uYW1lLnRzIiwic291cmNlcyI6WyJzYW5pdGlzYXRpb24vYmFkLmNvbnN0Lm5hbWUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbmV4cG9ydCBjb25zdCBEb2xsYXIkRGl2ID0gc3R5bGVkLmRpdmBcbiAgYmFja2dyb3VuZC1jb2xvcjogYmxhY2s7XG5gO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUUwQiJ9 */" +); diff --git a/packages/emotion/transform/tests/label-sanitisation/bad.const.name.ts b/packages/emotion/transform/tests/labels/sanitisation/bad.const.name.ts similarity index 100% rename from packages/emotion/transform/tests/label-sanitisation/bad.const.name.ts rename to packages/emotion/transform/tests/labels/sanitisation/bad.const.name.ts diff --git a/packages/emotion/transform/tests/labels/sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.js b/packages/emotion/transform/tests/labels/sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.js new file mode 100644 index 000000000..47671fa93 --- /dev/null +++ b/packages/emotion/transform/tests/labels/sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.js @@ -0,0 +1,8 @@ +import styled from "@emotion/styled"; +export const StyledDiv = /*#__PURE__*/ styled("div", { + target: "e17wqgfl0", + label: "sanitisation-bad-name----------------------StyledDiv", +})( + "background-color:black;", + "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2FuaXRpc2F0aW9uL2JhZC5uYW1lLiEjJCUmKCkrLC47PUBbXV5gfX57LnRzIiwic291cmNlcyI6WyJzYW5pdGlzYXRpb24vYmFkLm5hbWUuISMkJSYoKSssLjs9QFtdXmB9fnsudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWREaXYgPSBzdHlsZWQuZGl2YFxuICBiYWNrZ3JvdW5kLWNvbG9yOiBibGFjaztcbmA7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRXlCIn0= */" +); diff --git a/packages/emotion/transform/tests/label-sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.ts b/packages/emotion/transform/tests/labels/sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.ts similarity index 100% rename from packages/emotion/transform/tests/label-sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.ts rename to packages/emotion/transform/tests/labels/sanitisation/bad.name.!#$%&()+,.;=@[]^`}~{.ts diff --git a/packages/emotion/transform/tests/labels/sanitisation/input.styles.js b/packages/emotion/transform/tests/labels/sanitisation/input.styles.js new file mode 100644 index 000000000..73681f5f6 --- /dev/null +++ b/packages/emotion/transform/tests/labels/sanitisation/input.styles.js @@ -0,0 +1,8 @@ +import styled from "@emotion/styled"; +export const StyledDiv = /*#__PURE__*/ styled("div", { + target: "e17wqgfl0", + label: "sanitisation-input-styles-StyledDiv", +})( + "background-color:black;", + "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2FuaXRpc2F0aW9uL2lucHV0LnN0eWxlcy50cyIsInNvdXJjZXMiOlsic2FuaXRpc2F0aW9uL2lucHV0LnN0eWxlcy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcIjtcblxuZXhwb3J0IGNvbnN0IFN0eWxlZERpdiA9IHN0eWxlZC5kaXZgXG4gIGJhY2tncm91bmQtY29sb3I6IGJsYWNrO1xuYDtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFeUIifQ== */" +); diff --git a/packages/emotion/transform/tests/label-sanitisation/input.styles.ts b/packages/emotion/transform/tests/labels/sanitisation/input.styles.ts similarity index 100% rename from packages/emotion/transform/tests/label-sanitisation/input.styles.ts rename to packages/emotion/transform/tests/labels/sanitisation/input.styles.ts diff --git a/packages/jest/Cargo.toml b/packages/jest/Cargo.toml index 523e9b727..d6ddfc8a4 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.27.0" +version = "0.28.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/jest/package.json b/packages/jest/package.json index 740816bbe..f1967b4dc 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-jest", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for jest", "main": "swc_plugin_jest.wasm", "scripts": { diff --git a/packages/loadable-components/Cargo.toml b/packages/loadable-components/Cargo.toml index 8c7c3abbb..5db963b48 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.14.0" +version = "0.15.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/loadable-components/package.json b/packages/loadable-components/package.json index c5be0640c..5399e0b5b 100644 --- a/packages/loadable-components/package.json +++ b/packages/loadable-components/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-loadable-components", - "version": "0.3.109", + "version": "0.3.110", "description": "SWC plugin for `@loadable/components`", "main": "swc_plugin_loadable_components.wasm", "scripts": { diff --git a/packages/noop/Cargo.toml b/packages/noop/Cargo.toml index f8c2dbd84..ee76178cf 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.14.0" +version = "0.15.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/noop/package.json b/packages/noop/package.json index 4bc92826c..3f32bc046 100644 --- a/packages/noop/package.json +++ b/packages/noop/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-noop", - "version": "1.5.107", + "version": "1.5.108", "description": "Noop SWC plugin, for debugging", "main": "swc_plugin_noop.wasm", "scripts": { diff --git a/packages/react-remove-properties/Cargo.toml b/packages/react-remove-properties/Cargo.toml index 249425fd0..2cde16a84 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.15.0" +version = "0.16.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/react-remove-properties/package.json b/packages/react-remove-properties/package.json index be74dd433..502924061 100644 --- a/packages/react-remove-properties/package.json +++ b/packages/react-remove-properties/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-react-remove-properties", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for https://www.npmjs.com/package/babel-plugin-react-remove-properties", "main": "swc_plugin_react_remove_properties.wasm", "scripts": { diff --git a/packages/react-remove-properties/transform/Cargo.toml b/packages/react-remove-properties/transform/Cargo.toml index 3e686256c..714525409 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.20.0" +version = "0.21.0" # 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 5b81e1749..cc52acb66 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.3.0" +version = "0.4.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/relay/package.json b/packages/relay/package.json index 105c4694f..2a098fb50 100644 --- a/packages/relay/package.json +++ b/packages/relay/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-relay", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for relay", "main": "swc_plugin_relay.wasm", "types": "./types.d.ts", diff --git a/packages/relay/transform/Cargo.toml b/packages/relay/transform/Cargo.toml index 53f1c279f..0e000daec 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.40.0" +version = "0.41.0" # 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 556926ab2..46e126d9c 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.15.0" +version = "0.16.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/remove-console/package.json b/packages/remove-console/package.json index 52aa549a3..84d443dee 100644 --- a/packages/remove-console/package.json +++ b/packages/remove-console/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-remove-console", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for https://www.npmjs.com/package/babel-plugin-remove-console", "main": "swc_plugin_remove_console.wasm", "scripts": { diff --git a/packages/remove-console/transform/Cargo.toml b/packages/remove-console/transform/Cargo.toml index 02b82ae40..e1c878d9d 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.21.0" +version = "0.22.0" # 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 11d7aa06d..b14a1c8d3 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.36.0" +version = "0.37.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/packages/styled-components/package.json b/packages/styled-components/package.json index d0710b209..828394b78 100644 --- a/packages/styled-components/package.json +++ b/packages/styled-components/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-styled-components", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for styled-components", "main": "swc_plugin_styled_components.wasm", "scripts": { diff --git a/packages/styled-components/transform/Cargo.toml b/packages/styled-components/transform/Cargo.toml index 35b89a0f2..fcde44e1a 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.92.0" +version = "0.93.0" # 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 cc794c587..951b97ffb 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.16.0" +version = "0.17.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/styled-jsx/package.json b/packages/styled-jsx/package.json index 09476ee07..d1a80bcec 100644 --- a/packages/styled-jsx/package.json +++ b/packages/styled-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-styled-jsx", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for styled-jsx", "main": "swc_plugin_styled_jsx.wasm", "scripts": { diff --git a/packages/styled-jsx/transform/Cargo.toml b/packages/styled-jsx/transform/Cargo.toml index 74030691f..c4406fcaa 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.69.0" +version = "0.70.0" [features] custom_transform = ["swc_common/concurrent"] diff --git a/packages/swc-magic/Cargo.toml b/packages/swc-magic/Cargo.toml index dab3fe3b7..3ce5c3910 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.3.0" +version = "0.4.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/swc-magic/package.json b/packages/swc-magic/package.json index 33afe4c4f..fb24ffa5b 100644 --- a/packages/swc-magic/package.json +++ b/packages/swc-magic/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-swc-magic", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for swc-magic", "main": "swc_plugin_swc_magic.wasm", "scripts": { diff --git a/packages/swc-magic/transform/Cargo.toml b/packages/swc-magic/transform/Cargo.toml index 586470d3f..70c4a5db8 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.15.0" +version = "0.16.0" [dependencies] serde = { version = "1.0.189", features = ["derive"] } diff --git a/packages/transform-imports/Cargo.toml b/packages/transform-imports/Cargo.toml index f51ab7ef4..3f1fbd215 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.15.0" +version = "0.16.0" [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/transform-imports/package.json b/packages/transform-imports/package.json index 54aa44e8c..b3ee94be3 100644 --- a/packages/transform-imports/package.json +++ b/packages/transform-imports/package.json @@ -1,6 +1,6 @@ { "name": "@swc/plugin-transform-imports", - "version": "1.5.109", + "version": "1.5.110", "description": "SWC plugin for https://www.npmjs.com/package/babel-plugin-transform-imports", "main": "swc_plugin_transform_imports.wasm", "scripts": { diff --git a/packages/transform-imports/transform/Cargo.toml b/packages/transform-imports/transform/Cargo.toml index e07aaea3a..a676be53c 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.64.0" +version = "0.65.0" # 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 b0bd61da6..315bdf1d7 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "0.4.0" +version = "0.5.0" edition = "2021" publish = false