Unverified Commit b68f7838 authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

chore: Update swc (#40832)

This PR update swc crates to
https://github.com/swc-project/swc/commit/8a5ed1e0baee970a840a3d0e20e5693f653e8edb


Noticeable changes include

 - TS 4.9 support.
 - Huge performance improvement (of every api).
parent cc7fd2c2
This diff is collapsed.
...@@ -28,7 +28,7 @@ styled_jsx = {path="../styled_jsx"} ...@@ -28,7 +28,7 @@ styled_jsx = {path="../styled_jsx"}
modularize_imports = {path="../modularize_imports"} modularize_imports = {path="../modularize_imports"}
tracing = { version = "0.1.32", features = ["release_max_level_info"] } tracing = { version = "0.1.32", features = ["release_max_level_info"] }
swc_core = { version = "0.23.24", features = [ swc_core = { version = "0.26.0", features = [
"common_concurrent", "common_concurrent",
"ecma_ast", "ecma_ast",
"ecma_visit", "ecma_visit",
...@@ -48,6 +48,6 @@ swc_core = { version = "0.23.24", features = [ ...@@ -48,6 +48,6 @@ swc_core = { version = "0.23.24", features = [
] } ] }
[dev-dependencies] [dev-dependencies]
swc_core = { version = "0.23.24", features = ["testing_transform"] } swc_core = { version = "0.26.0", features = ["testing_transform"] }
testing = "0.30.7" testing = "0.30.10"
walkdir = "2.3.2" walkdir = "2.3.2"
...@@ -41,7 +41,7 @@ impl Fold for HookOptimizer { ...@@ -41,7 +41,7 @@ impl Fold for HookOptimizer {
fn fold_decl(&mut self, node: Decl) -> Decl { fn fold_decl(&mut self, node: Decl) -> Decl {
let node = node.fold_children_with(self); let node = node.fold_children_with(self);
match node { match node {
Decl::Var(VarDecl { Decl::Var(box VarDecl {
decls, decls,
span, span,
kind, kind,
...@@ -52,12 +52,12 @@ impl Fold for HookOptimizer { ...@@ -52,12 +52,12 @@ impl Fold for HookOptimizer {
new_decls.push(self.get_decl(decl)); new_decls.push(self.get_decl(decl));
} }
Decl::Var(VarDecl { Decl::Var(Box::new(VarDecl {
decls: new_decls, decls: new_decls,
span, span,
kind, kind,
declare, declare,
}) }))
} }
_ => node, _ => node,
} }
......
...@@ -28,6 +28,7 @@ DEALINGS IN THE SOFTWARE. ...@@ -28,6 +28,7 @@ DEALINGS IN THE SOFTWARE.
#![recursion_limit = "2048"] #![recursion_limit = "2048"]
#![deny(clippy::all)] #![deny(clippy::all)]
#![feature(box_patterns)]
use auto_cjs::contains_cjs; use auto_cjs::contains_cjs;
use either::Either; use either::Either;
......
...@@ -46,7 +46,7 @@ impl<'a> FontImportsGenerator<'a> { ...@@ -46,7 +46,7 @@ impl<'a> FontImportsGenerator<'a> {
values.append(&mut json_values); values.append(&mut json_values);
return Some(ImportDecl { return Some(ImportDecl {
src: Str { src: Box::new(Str {
value: JsWord::from(format!( value: JsWord::from(format!(
"{}?{}", "{}?{}",
font_function.loader, font_function.loader,
...@@ -54,7 +54,7 @@ impl<'a> FontImportsGenerator<'a> { ...@@ -54,7 +54,7 @@ impl<'a> FontImportsGenerator<'a> {
)), )),
raw: None, raw: None,
span: DUMMY_SP, span: DUMMY_SP,
}, }),
specifiers: vec![], specifiers: vec![],
type_only: false, type_only: false,
asserts: None, asserts: None,
......
...@@ -495,12 +495,12 @@ impl Fold for NextSsg { ...@@ -495,12 +495,12 @@ impl Fold for NextSsg {
if let Some(var) = var.take() { if let Some(var) = var.take() {
new.push(ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { new.push(ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl {
span: DUMMY_SP, span: DUMMY_SP,
decl: Decl::Var(VarDecl { decl: Decl::Var(Box::new(VarDecl {
span: DUMMY_SP, span: DUMMY_SP,
kind: VarDeclKind::Var, kind: VarDeclKind::Var,
declare: Default::default(), declare: Default::default(),
decls: vec![var], decls: vec![var],
}), })),
}))) })))
} }
} }
......
...@@ -43,7 +43,7 @@ impl Fold for PageConfig { ...@@ -43,7 +43,7 @@ impl Fold for PageConfig {
true => String::from("mock_timestamp"), true => String::from("mock_timestamp"),
false => Utc::now().timestamp().to_string(), false => Utc::now().timestamp().to_string(),
}; };
return vec![ModuleItem::Stmt(Stmt::Decl(Decl::Var(VarDecl { return vec![ModuleItem::Stmt(Stmt::Decl(Decl::Var(Box::new(VarDecl {
decls: vec![VarDeclarator { decls: vec![VarDeclarator {
name: Pat::Ident(BindingIdent { name: Pat::Ident(BindingIdent {
id: Ident { id: Ident {
...@@ -64,7 +64,7 @@ impl Fold for PageConfig { ...@@ -64,7 +64,7 @@ impl Fold for PageConfig {
span: DUMMY_SP, span: DUMMY_SP,
kind: VarDeclKind::Const, kind: VarDeclKind::Const,
declare: false, declare: false,
})))]; }))))];
} }
} }
......
...@@ -161,7 +161,7 @@ impl<C: Comments> ReactServerComponents<C> { ...@@ -161,7 +161,7 @@ impl<C: Comments> ReactServerComponents<C> {
prepend_stmts( prepend_stmts(
&mut module.body, &mut module.body,
vec![ vec![
ModuleItem::Stmt(Stmt::Decl(Decl::Var(VarDecl { ModuleItem::Stmt(Stmt::Decl(Decl::Var(Box::new(VarDecl {
span: DUMMY_SP, span: DUMMY_SP,
kind: VarDeclKind::Const, kind: VarDeclKind::Const,
decls: vec![VarDeclarator { decls: vec![VarDeclarator {
...@@ -185,7 +185,7 @@ impl<C: Comments> ReactServerComponents<C> { ...@@ -185,7 +185,7 @@ impl<C: Comments> ReactServerComponents<C> {
definite: false, definite: false,
}], }],
declare: false, declare: false,
}))), })))),
ModuleItem::Stmt(Stmt::Expr(ExprStmt { ModuleItem::Stmt(Stmt::Expr(ExprStmt {
span: DUMMY_SP, span: DUMMY_SP,
expr: Box::new(Expr::Assign(AssignExpr { expr: Box::new(Expr::Assign(AssignExpr {
......
...@@ -5,7 +5,7 @@ description = "AST Transforms for emotion" ...@@ -5,7 +5,7 @@ description = "AST Transforms for emotion"
license = "Apache-2.0" license = "Apache-2.0"
name = "swc_emotion" name = "swc_emotion"
repository = "https://github.com/vercel/next.js.git" repository = "https://github.com/vercel/next.js.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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
...@@ -19,9 +19,9 @@ regex = "1.5" ...@@ -19,9 +19,9 @@ regex = "1.5"
serde = "1" serde = "1"
sourcemap = "6.0.1" sourcemap = "6.0.1"
tracing = { version = "0.1.32", features = ["release_max_level_info"] } tracing = { version = "0.1.32", features = ["release_max_level_info"] }
swc_core = { version = "0.23.24", features = ["common", "ecma_ast","ecma_codegen", "ecma_utils", "ecma_visit", "trace_macro"] } swc_core = { version = "0.26.0", features = ["common", "ecma_ast","ecma_codegen", "ecma_utils", "ecma_visit", "trace_macro"] }
[dev-dependencies] [dev-dependencies]
swc_core = { version = "0.23.24", features = ["testing_transform", "ecma_transforms_react"] } swc_core = { version = "0.26.0", features = ["testing_transform", "ecma_transforms_react"] }
testing = "0.30.7" testing = "0.30.10"
serde_json = "1" serde_json = "1"
...@@ -5,7 +5,7 @@ edition = "2018" ...@@ -5,7 +5,7 @@ edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
name = "modularize_imports" name = "modularize_imports"
repository = "https://github.com/vercel/next.js.git" repository = "https://github.com/vercel/next.js.git"
version = "0.18.0" version = "0.19.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
...@@ -15,8 +15,8 @@ handlebars = "4.2.1" ...@@ -15,8 +15,8 @@ handlebars = "4.2.1"
once_cell = "1.13.0" once_cell = "1.13.0"
regex = "1.5" regex = "1.5"
serde = "1" serde = "1"
swc_core = { version = "0.23.24", features = ["cached", "ecma_ast", "ecma_visit"] } swc_core = { version = "0.26.0", features = ["cached", "ecma_ast", "ecma_visit"] }
[dev-dependencies] [dev-dependencies]
swc_core = { version = "0.23.24", features = ["testing_transform"] } swc_core = { version = "0.26.0", features = ["testing_transform"] }
testing = "0.30.7" testing = "0.30.10"
...@@ -91,7 +91,7 @@ impl<'a> Rewriter<'a> { ...@@ -91,7 +91,7 @@ impl<'a> Rewriter<'a> {
}; };
out.push(ImportDecl { out.push(ImportDecl {
specifiers: vec![specifier], specifiers: vec![specifier],
src: Str::from(new_path.as_ref()), src: Box::new(Str::from(new_path.as_ref())),
span: old_decl.span, span: old_decl.span,
type_only: false, type_only: false,
asserts: None, asserts: None,
......
...@@ -30,7 +30,7 @@ next-swc = {version = "0.0.0", path = "../core"} ...@@ -30,7 +30,7 @@ next-swc = {version = "0.0.0", path = "../core"}
once_cell = "1.13.0" once_cell = "1.13.0"
serde = "1" serde = "1"
serde_json = "1" serde_json = "1"
swc_core = { version = "0.23.24", features = [ swc_core = { version = "0.26.0", features = [
"allocator_node", "allocator_node",
"base_concurrent", # concurrent? "base_concurrent", # concurrent?
"common_concurrent", "common_concurrent",
......
...@@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] ...@@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0" license = "Apache-2.0"
name = "styled_components" name = "styled_components"
repository = "https://github.com/vercel/next.js.git" repository = "https://github.com/vercel/next.js.git"
version = "0.43.0" version = "0.44.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
...@@ -16,7 +16,7 @@ once_cell = "1.13.0" ...@@ -16,7 +16,7 @@ once_cell = "1.13.0"
regex = {version = "1.5.4", features = ["std", "perf"], default-features = false} regex = {version = "1.5.4", features = ["std", "perf"], default-features = false}
serde = {version = "1.0.130", features = ["derive"]} serde = {version = "1.0.130", features = ["derive"]}
tracing = "0.1.32" tracing = "0.1.32"
swc_core = { version = "0.23.24", features = [ swc_core = { version = "0.26.0", features = [
"common", "common",
"ecma_ast", "ecma_ast",
"ecma_utils", "ecma_utils",
...@@ -25,8 +25,8 @@ swc_core = { version = "0.23.24", features = [ ...@@ -25,8 +25,8 @@ swc_core = { version = "0.23.24", features = [
[dev-dependencies] [dev-dependencies]
serde_json = "1" serde_json = "1"
testing = "0.30.7" testing = "0.30.10"
swc_core = { version = "0.23.24", features = [ swc_core = { version = "0.26.0", features = [
"ecma_parser", "ecma_parser",
"ecma_transforms", "ecma_transforms",
"testing_transform" "testing_transform"
......
...@@ -314,12 +314,12 @@ impl VisitMut for TranspileCssProp { ...@@ -314,12 +314,12 @@ impl VisitMut for TranspileCssProp {
}), }),
definite: false, definite: false,
}; };
let stmt = Stmt::Decl(Decl::Var(VarDecl { let stmt = Stmt::Decl(Decl::Var(Box::new(VarDecl {
span: DUMMY_SP, span: DUMMY_SP,
kind: VarDeclKind::Var, kind: VarDeclKind::Var,
declare: false, declare: false,
decls: vec![var], decls: vec![var],
})); })));
match inject_after { match inject_after {
Some(injector) => { Some(injector) => {
let id = injector.to_id(); let id = injector.to_id();
...@@ -375,11 +375,11 @@ impl VisitMut for TranspileCssProp { ...@@ -375,11 +375,11 @@ impl VisitMut for TranspileCssProp {
ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl { ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl {
span: DUMMY_SP, span: DUMMY_SP,
specifiers: vec![specifier], specifiers: vec![specifier],
src: Str { src: Box::new(Str {
span: DUMMY_SP, span: DUMMY_SP,
value: "styled-components".into(), value: "styled-components".into(),
raw: None, raw: None,
}, }),
type_only: Default::default(), type_only: Default::default(),
asserts: Default::default(), asserts: Default::default(),
})), })),
......
...@@ -5,7 +5,7 @@ edition = "2018" ...@@ -5,7 +5,7 @@ edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
name = "styled_jsx" name = "styled_jsx"
repository = "https://github.com/vercel/next.js.git" repository = "https://github.com/vercel/next.js.git"
version = "0.18.0" version = "0.19.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
...@@ -13,7 +13,7 @@ version = "0.18.0" ...@@ -13,7 +13,7 @@ version = "0.18.0"
easy-error = "1.0.0" easy-error = "1.0.0"
tracing = "0.1.32" tracing = "0.1.32"
swc_core = { version = "0.23.24", features = [ swc_core = { version = "0.26.0", features = [
"common", "common",
"css_ast", "css_ast",
"css_codegen", "css_codegen",
...@@ -27,7 +27,7 @@ swc_core = { version = "0.23.24", features = [ ...@@ -27,7 +27,7 @@ swc_core = { version = "0.23.24", features = [
] } ] }
[dev-dependencies] [dev-dependencies]
testing = "0.30.7" testing = "0.30.10"
swc_core = { version = "0.23.24", features = [ swc_core = { version = "0.26.0", features = [
"testing_transform" "testing_transform"
] } ] }
#![feature(box_patterns)]
use easy_error::{bail, Error}; use easy_error::{bail, Error};
use std::collections::hash_map::DefaultHasher; use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
...@@ -320,7 +322,7 @@ impl Fold for StyledJSXTransformer { ...@@ -320,7 +322,7 @@ impl Fold for StyledJSXTransformer {
for item in items { for item in items {
let new_item = item.fold_children_with(self); let new_item = item.fold_children_with(self);
if let Some((default_ident, default_expr)) = &self.add_default_decl { if let Some((default_ident, default_expr)) = &self.add_default_decl {
new_items.push(ModuleItem::Stmt(Stmt::Decl(Decl::Var(VarDecl { new_items.push(ModuleItem::Stmt(Stmt::Decl(Decl::Var(Box::new(VarDecl {
kind: VarDeclKind::Const, kind: VarDeclKind::Const,
declare: false, declare: false,
decls: vec![VarDeclarator { decls: vec![VarDeclarator {
...@@ -337,7 +339,7 @@ impl Fold for StyledJSXTransformer { ...@@ -337,7 +339,7 @@ impl Fold for StyledJSXTransformer {
span: DUMMY_SP, span: DUMMY_SP,
}], }],
span: DUMMY_SP, span: DUMMY_SP,
})))); })))));
self.add_default_decl = None; self.add_default_decl = None;
if let Some(add_hash) = self.add_hash.take() { if let Some(add_hash) = self.add_hash.take() {
new_items.push(ModuleItem::Stmt(add_hash_statement(add_hash))); new_items.push(ModuleItem::Stmt(add_hash_statement(add_hash)));
...@@ -921,7 +923,7 @@ fn add_hash_statement((id, hash): (Id, String)) -> Stmt { ...@@ -921,7 +923,7 @@ fn add_hash_statement((id, hash): (Id, String)) -> Stmt {
fn is_styled_css_import(item: &ModuleItem) -> bool { fn is_styled_css_import(item: &ModuleItem) -> bool {
if let ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl { if let ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl {
src: Str { value, .. }, src: box Str { value, .. },
.. ..
})) = item })) = item
{ {
......
...@@ -307,11 +307,11 @@ pub fn styled_jsx_import_decl(style_import_name: &str) -> ModuleItem { ...@@ -307,11 +307,11 @@ pub fn styled_jsx_import_decl(style_import_name: &str) -> ModuleItem {
}, },
span: DUMMY_SP, span: DUMMY_SP,
})], })],
src: Str { src: Box::new(Str {
span: DUMMY_SP, span: DUMMY_SP,
value: "styled-jsx/style".into(), value: "styled-jsx/style".into(),
raw: None, raw: None,
}, }),
})) }))
} }
......
...@@ -24,7 +24,7 @@ export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles ...@@ -24,7 +24,7 @@ export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles
// external and dynamic // external and dynamic
export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[ [
"e7486f61219e66af", "f08108daf927b99d",
[ [
color color
] ]
...@@ -33,14 +33,14 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " ...@@ -33,14 +33,14 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " "
<p className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([ <p className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[ [
"e7486f61219e66af", "f08108daf927b99d",
[ [
color color
] ]
] ]
])}>external and dynamic</p> ])}>external and dynamic</p>
<_JSXStyle id={"e7486f61219e66af"} dynamic={[ <_JSXStyle id={"f08108daf927b99d"} dynamic={[
color color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
...@@ -50,7 +50,7 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " ...@@ -50,7 +50,7 @@ export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " "
// external, static and dynamic // external, static and dynamic
export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[ [
"9ef7fdf2e339f135", "9779eebad83219f8",
[ [
color color
] ]
...@@ -59,7 +59,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js ...@@ -59,7 +59,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js
<p className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([ <p className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[ [
"9ef7fdf2e339f135", "9779eebad83219f8",
[ [
color color
] ]
...@@ -68,7 +68,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js ...@@ -68,7 +68,7 @@ export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " js
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle> <_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"9ef7fdf2e339f135"} dynamic={[ <_JSXStyle id={"9779eebad83219f8"} dynamic={[
color color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
...@@ -88,7 +88,7 @@ export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}> ...@@ -88,7 +88,7 @@ export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}>
// static and dynamic // static and dynamic
export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[ [
"9ef7fdf2e339f135", "9779eebad83219f8",
[ [
color color
] ]
...@@ -97,7 +97,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS ...@@ -97,7 +97,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
<p className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([ <p className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[ [
"9ef7fdf2e339f135", "9779eebad83219f8",
[ [
color color
] ]
...@@ -106,7 +106,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS ...@@ -106,7 +106,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle> <_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"9ef7fdf2e339f135"} dynamic={[ <_JSXStyle id={"9779eebad83219f8"} dynamic={[
color color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
...@@ -114,7 +114,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS ...@@ -114,7 +114,7 @@ export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JS
// dynamic only // dynamic only
export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([ export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
[ [
"e7486f61219e66af", "f08108daf927b99d",
[ [
color color
] ]
...@@ -123,14 +123,14 @@ export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([ ...@@ -123,14 +123,14 @@ export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
<p className={_JSXStyle.dynamic([ <p className={_JSXStyle.dynamic([
[ [
"e7486f61219e66af", "f08108daf927b99d",
[ [
color color
] ]
] ]
])}>dynamic only</p> ])}>dynamic only</p>
<_JSXStyle id={"e7486f61219e66af"} dynamic={[ <_JSXStyle id={"f08108daf927b99d"} dynamic={[
color color
]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
...@@ -143,7 +143,7 @@ export const Test8 = ({ color })=>{ ...@@ -143,7 +143,7 @@ export const Test8 = ({ color })=>{
}; };
return <div className={_JSXStyle.dynamic([ return <div className={_JSXStyle.dynamic([
[ [
"1f1fbf7e754ca7cb", "62256c563b89bfae",
[ [
innerProps.color innerProps.color
] ]
...@@ -152,14 +152,14 @@ export const Test8 = ({ color })=>{ ...@@ -152,14 +152,14 @@ export const Test8 = ({ color })=>{
<p className={_JSXStyle.dynamic([ <p className={_JSXStyle.dynamic([
[ [
"1f1fbf7e754ca7cb", "62256c563b89bfae",
[ [
innerProps.color innerProps.color
] ]
] ]
])}>dynamic with scoped compound variable</p> ])}>dynamic with scoped compound variable</p>
<_JSXStyle id={"1f1fbf7e754ca7cb"} dynamic={[ <_JSXStyle id={"62256c563b89bfae"} dynamic={[
innerProps.color innerProps.color
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
...@@ -173,7 +173,7 @@ export const Test9 = ({ color })=>{ ...@@ -173,7 +173,7 @@ export const Test9 = ({ color })=>{
}; };
return <div className={_JSXStyle.dynamic([ return <div className={_JSXStyle.dynamic([
[ [
"460abeb3d95fb60d", "708723e452f192e4",
[ [
innerProps.color innerProps.color
] ]
...@@ -182,14 +182,14 @@ export const Test9 = ({ color })=>{ ...@@ -182,14 +182,14 @@ export const Test9 = ({ color })=>{
<p className={_JSXStyle.dynamic([ <p className={_JSXStyle.dynamic([
[ [
"460abeb3d95fb60d", "708723e452f192e4",
[ [
innerProps.color innerProps.color
] ]
] ]
])}>dynamic with compound variable</p> ])}>dynamic with compound variable</p>
<_JSXStyle id={"460abeb3d95fb60d"} dynamic={[ <_JSXStyle id={"708723e452f192e4"} dynamic={[
innerProps.color innerProps.color
]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}</_JSXStyle>
...@@ -210,14 +210,14 @@ export const Test11 = ({ color })=>{ ...@@ -210,14 +210,14 @@ export const Test11 = ({ color })=>{
length: 5 length: 5
}).map((item, i)=><li key={i} className={_JSXStyle.dynamic([ }).map((item, i)=><li key={i} className={_JSXStyle.dynamic([
[ [
"307a31332e39b502", "a2585dff420632b1",
[ [
color color
] ]
] ]
]) + " " + "item"}> ]) + " " + "item"}>
<_JSXStyle id={"307a31332e39b502"} dynamic={[ <_JSXStyle id={"a2585dff420632b1"} dynamic={[
color color
]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle> ]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`}</_JSXStyle>
......
import _JSXStyle from "styled-jsx/style"; import _JSXStyle from "styled-jsx/style";
const color = 'red'; const color = 'red';
const otherColor = 'green'; const otherColor = 'green';
const A = ()=><div className={"jsx-551210e97e875d0e"}> const A = ()=><div className={"jsx-8522d6f4b7f930d2"}>
<p className={"jsx-551210e97e875d0e"}>test</p> <p className={"jsx-8522d6f4b7f930d2"}>test</p>
<_JSXStyle id={"551210e97e875d0e"}>{`p.jsx-551210e97e875d0e{color:${color}}`}</_JSXStyle> <_JSXStyle id={"8522d6f4b7f930d2"}>{`p.jsx-8522d6f4b7f930d2{color:${color}}`}</_JSXStyle>
</div>; </div>;
const B = ()=><div className={"jsx-d1ed441bb35f699d"}> const B = ()=><div className={"jsx-d1ed441bb35f699d"}>
......
...@@ -8,79 +8,79 @@ const animationName = 'my-cool-animation'; ...@@ -8,79 +8,79 @@ const animationName = 'my-cool-animation';
const obj = { const obj = {
display: 'block' display: 'block'
}; };
export default (({ display })=><div className={"jsx-78f0c8c617eb8e50 " + _JSXStyle.dynamic([ export default (({ display })=><div className={"jsx-b452af554142d27 " + _JSXStyle.dynamic([
[ [
"cf795552a2848e6c", "469c0b1cc43512b8",
[ [
display ? 'block' : 'none' display ? 'block' : 'none'
] ]
], ],
[ [
"e9bc1314d862fde1", "d05e300c372f73ee",
[ [
darken(color) + 2 darken(color) + 2
] ]
], ],
[ [
"97b2dd85b3a5c42d", "72e421eb2017491a",
[ [
darken(color) darken(color)
] ]
] ]
])}> ])}>
<p className={"jsx-78f0c8c617eb8e50 " + _JSXStyle.dynamic([ <p className={"jsx-b452af554142d27 " + _JSXStyle.dynamic([
[ [
"cf795552a2848e6c", "469c0b1cc43512b8",
[ [
display ? 'block' : 'none' display ? 'block' : 'none'
] ]
], ],
[ [
"e9bc1314d862fde1", "d05e300c372f73ee",
[ [
darken(color) + 2 darken(color) + 2
] ]
], ],
[ [
"97b2dd85b3a5c42d", "72e421eb2017491a",
[ [
darken(color) darken(color)
] ]
] ]
])}>test</p> ])}>test</p>
<_JSXStyle id={"95409d3438a768bd"}>{`p.${color}.jsx-78f0c8c617eb8e50{color:${otherColor};display:${obj.display}}`}</_JSXStyle> <_JSXStyle id={"cb56eab0db38d266"}>{`p.${color}.jsx-b452af554142d27{color:${otherColor};display:${obj.display}}`}</_JSXStyle>
<_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-78f0c8c617eb8e50{color:red}"}</_JSXStyle> <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-b452af554142d27{color:red}"}</_JSXStyle>
<_JSXStyle id={"ecd8dfc6d11e2c5e"}>{`body{background:${color}}`}</_JSXStyle> <_JSXStyle id={"e66306ac259712aa"}>{`body{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"ecd8dfc6d11e2c5e"}>{`body{background:${color}}`}</_JSXStyle> <_JSXStyle id={"e66306ac259712aa"}>{`body{background:${color}}`}</_JSXStyle>
// TODO: the next two should have the same hash // TODO: the next two should have the same hash
<_JSXStyle id={"e7486f61219e66af"}>{`p.jsx-78f0c8c617eb8e50{color:${color}}`}</_JSXStyle> <_JSXStyle id={"f08108daf927b99d"}>{`p.jsx-b452af554142d27{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"e7486f61219e66af"}>{`p.jsx-78f0c8c617eb8e50{color:${color}}`}</_JSXStyle> <_JSXStyle id={"f08108daf927b99d"}>{`p.jsx-b452af554142d27{color:${color}}`}</_JSXStyle>
<_JSXStyle id={"97b2dd85b3a5c42d"} dynamic={[ <_JSXStyle id={"72e421eb2017491a"} dynamic={[
darken(color) darken(color)
]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`}</_JSXStyle>
<_JSXStyle id={"e9bc1314d862fde1"} dynamic={[ <_JSXStyle id={"d05e300c372f73ee"} dynamic={[
darken(color) + 2 darken(color) + 2
]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`}</_JSXStyle> ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`}</_JSXStyle>
<_JSXStyle id={"7c5c5bde49d6c65d"}>{`@media(min-width:${mediumScreen}){p.jsx-78f0c8c617eb8e50{color:green}p.jsx-78f0c8c617eb8e50{color:${`red`}}}p.jsx-78f0c8c617eb8e50{color:red}`}</_JSXStyle> <_JSXStyle id={"7c5c5bde49d6c65d"}>{`@media(min-width:${mediumScreen}){p.jsx-b452af554142d27{color:green}p.jsx-b452af554142d27{color:${`red`}}}p.jsx-b452af554142d27{color:red}`}</_JSXStyle>
<_JSXStyle id={"c5506be0b4762e0b"}>{`p.jsx-78f0c8c617eb8e50{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle> <_JSXStyle id={"c5506be0b4762e0b"}>{`p.jsx-b452af554142d27{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"82f0f2f07692d2e2"}>{`p.jsx-78f0c8c617eb8e50{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-78f0c8c617eb8e50{background:${color}}`}</_JSXStyle> <_JSXStyle id={"ed798aa885be9084"}>{`p.jsx-b452af554142d27{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-b452af554142d27{background:${color}}`}</_JSXStyle>
<_JSXStyle id={"cf795552a2848e6c"} dynamic={[ <_JSXStyle id={"469c0b1cc43512b8"} dynamic={[
display ? 'block' : 'none' display ? 'block' : 'none'
]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`}</_JSXStyle> ]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`}</_JSXStyle>
......
...@@ -3,7 +3,7 @@ export default class { ...@@ -3,7 +3,7 @@ export default class {
render() { render() {
return <div className={_JSXStyle.dynamic([ return <div className={_JSXStyle.dynamic([
[ [
"f6f794581d963a47", "60bda1963c17b640",
[ [
Typography.base.size.default, Typography.base.size.default,
Typography.base.lineHeight, Typography.base.lineHeight,
...@@ -17,7 +17,7 @@ export default class { ...@@ -17,7 +17,7 @@ export default class {
<p className={_JSXStyle.dynamic([ <p className={_JSXStyle.dynamic([
[ [
"f6f794581d963a47", "60bda1963c17b640",
[ [
Typography.base.size.default, Typography.base.size.default,
Typography.base.lineHeight, Typography.base.lineHeight,
...@@ -29,7 +29,7 @@ export default class { ...@@ -29,7 +29,7 @@ export default class {
] ]
])}>test</p> ])}>test</p>
<_JSXStyle id={"f6f794581d963a47"} dynamic={[ <_JSXStyle id={"60bda1963c17b640"} dynamic={[
Typography.base.size.default, Typography.base.size.default,
Typography.base.lineHeight, Typography.base.lineHeight,
Target.mediumPlus, Target.mediumPlus,
......
...@@ -6,10 +6,10 @@ bar.__hash = "aaed0341accea8f"; ...@@ -6,10 +6,10 @@ bar.__hash = "aaed0341accea8f";
const baz = new String("div{font-size:3em}"); const baz = new String("div{font-size:3em}");
baz.__hash = "aaed0341accea8f"; baz.__hash = "aaed0341accea8f";
const a = new String(`div{font-size:${size}em}`); const a = new String(`div{font-size:${size}em}`);
a.__hash = "b6966e11ccb637f2"; a.__hash = "b4e02b3e84cc50c";
export const uh = bar; export const uh = bar;
export const foo = new String(`div.jsx-dbfc29cedbb5f49b{color:${color}}`); export const foo = new String(`div.jsx-1a001e3709d54ba4{color:${color}}`);
foo.__hash = "dbfc29cedbb5f49b"; foo.__hash = "1a001e3709d54ba4";
({ ({
styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>, styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`}</_JSXStyle>,
className: "jsx-38ae14c4ec5e0907" className: "jsx-38ae14c4ec5e0907"
...@@ -34,6 +34,6 @@ const dynamic = (colors)=>{ ...@@ -34,6 +34,6 @@ const dynamic = (colors)=>{
}; };
}; };
export default { export default {
styles: <_JSXStyle id={"a300397bb1f6c7cd"}>{`div.jsx-a300397bb1f6c7cd{font-size:3em}p.jsx-a300397bb1f6c7cd{color:${color}}`}</_JSXStyle>, styles: <_JSXStyle id={"e14aa5a1efa47449"}>{`div.jsx-e14aa5a1efa47449{font-size:3em}p.jsx-e14aa5a1efa47449{color:${color}}`}</_JSXStyle>,
className: "jsx-a300397bb1f6c7cd" className: "jsx-e14aa5a1efa47449"
}; };
...@@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4.8" ...@@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4.8"
getrandom = { version = "0.2.5", optional = true, default-features = false } getrandom = { version = "0.2.5", optional = true, default-features = false }
js-sys = "0.3.59" js-sys = "0.3.59"
swc_core = { version = "0.23.24", features = [ swc_core = { version = "0.26.0", features = [
"common_concurrent", "common_concurrent",
"binding_macro_wasm", "binding_macro_wasm",
"ecma_codegen", "ecma_codegen",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment