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

Update swc (#29969)

Co-authored-by: 's avatarkdy1 <kdy1@users.noreply.github.com>
parent dff6a71e
......@@ -581,9 +581,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.103"
version = "0.2.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6"
checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce"
[[package]]
name = "lock_api"
......@@ -1809,9 +1809,9 @@ dependencies = [
[[package]]
name = "swc_ecma_ast"
version = "0.54.3"
version = "0.54.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae24a6603262822de50069ff72394b0d208267e5bd5298678ba6a79f670c40f"
checksum = "83ea102b5cd8a48adf11cc62d58c84add7a419999b219211e2a837e748787c9d"
dependencies = [
"is-macro",
"num-bigint",
......@@ -1893,9 +1893,9 @@ dependencies = [
[[package]]
name = "swc_ecma_minifier"
version = "0.40.0"
version = "0.40.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de20e3de59fa9515a441fd89da583adddd92b9da1a3576ccd0b3fdf605a34d8a"
checksum = "8ae16e558981277b544d9cda017f37627c7961fbb2098d628da5484669dc4b65"
dependencies = [
"indexmap",
"once_cell",
......@@ -1920,9 +1920,9 @@ dependencies = [
[[package]]
name = "swc_ecma_parser"
version = "0.73.13"
version = "0.73.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb14098c8e2c9678e2ec4324183a0e2508b26fcead24bfd7b1ee3c7a2af36cc7"
checksum = "da32f08bd41b37190ce08110bee5d1d6c88ae94ecbfb6d4d3c4a13fe4769a182"
dependencies = [
"either",
"enum_kind",
......@@ -1987,9 +1987,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_base"
version = "0.38.0"
version = "0.38.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce2937a415e5aaeb584cf3228c045a5fb66241a5d08a5799545e7172e7aba30e"
checksum = "644f7941823e8368ffd7fcedcebcd9e605adee6c91dd4a40f1de2495e453a7ec"
dependencies = [
"once_cell",
"phf",
......@@ -2019,9 +2019,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_compat"
version = "0.43.1"
version = "0.43.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f5d1b842f96d6f8dacf8c3909b80722b647a93960bdbd99f54a5f07f3cccc"
checksum = "66677d5e4f617f499642db61e11de86b103ce1e47d1f9971860b8be333471a57"
dependencies = [
"ahash",
"arrayvec",
......@@ -2120,9 +2120,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_react"
version = "0.50.0"
version = "0.50.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e4c27b30d35af65882de3bbdeb14a5d9805c35cf0383f2bd91048134384381"
checksum = "570111bf9fe7f7b8d49a686e7fe94bec0e89c192b9c69cd9f37f60c29fc42b50"
dependencies = [
"ahash",
"base64 0.13.0",
......
......@@ -66,11 +66,11 @@ pub struct TransformOptions {
pub fn custom_before_pass(name: &FileName, opts: &TransformOptions) -> impl Fold {
chain!(
styled_jsx::styled_jsx(),
hook_optimizer::hook_optimizer(),
Optional::new(next_ssg::next_ssg(), !opts.disable_next_ssg),
amp_attributes::amp_attributes(),
next_dynamic::next_dynamic(name.clone(), opts.pages_dir.clone()),
styled_jsx::styled_jsx()
)
}
......
......@@ -8,12 +8,12 @@ use swc_ecmascript::minifier::{
eval::{EvalResult, Evaluator},
marks::Marks,
};
use swc_ecmascript::utils::private_ident;
use swc_ecmascript::utils::{
collect_decls,
ident::{Id, IdentLike},
prepend, HANDLER,
};
use swc_ecmascript::utils::{drop_span, private_ident};
use swc_ecmascript::visit::{Fold, FoldWith};
//use external::external_styles;
......@@ -413,7 +413,7 @@ impl StyledJSXTransformer {
css_span = span.clone();
is_dynamic = false;
} else {
expr.clone().hash(&mut hasher);
drop_span(expr.clone()).hash(&mut hasher);
let mut s = String::new();
for i in 0..quasis.len() {
let placeholder = if i == quasis.len() - 1 {
......
use std::collections::hash_map::DefaultHasher;
use std::hash::Hasher;
use swc_common::DUMMY_SP;
use swc_ecmascript::ast::*;
use swc_ecmascript::{ast::*, utils::drop_span};
use super::{ExternalStyle, JSXStyle, LocalStyle};
......@@ -39,7 +39,7 @@ pub fn compute_class_names(
}
JSXStyle::External(external) => {
if !external.is_global {
external_styles.push(external.expr.clone());
external_styles.push(drop_span(external.expr.clone()));
}
}
}
......
......@@ -31,9 +31,12 @@ use crate::{
util::{CtxtExt, MapErr},
TransformOptions,
};
use anyhow::{Context as _, Error};
use napi::{CallContext, Env, JsBoolean, JsObject, JsString, Task};
use std::sync::Arc;
use anyhow::{anyhow, Context as _, Error};
use napi::{CallContext, Env, JsBoolean, JsObject, JsString, Status, Task};
use std::{
panic::{catch_unwind, AssertUnwindSafe},
sync::Arc,
};
use swc::{try_with_handler, Compiler, TransformOutput};
use swc_common::{FileName, SourceFile};
use swc_ecmascript::ast::Program;
......@@ -57,21 +60,37 @@ impl Task for TransformTask {
type JsValue = JsObject;
fn compute(&mut self) -> napi::Result<Self::Output> {
try_with_handler(self.c.cm.clone(), |handler| {
self.c.run(|| match self.input {
Input::Source(ref s) => {
let before_pass = custom_before_pass(&s.name, &self.options);
self.c.process_js_with_custom_pass(
s.clone(),
&handler,
&self.options.swc,
before_pass,
noop(),
)
}
let res = catch_unwind(AssertUnwindSafe(|| {
try_with_handler(self.c.cm.clone(), |handler| {
self.c.run(|| match self.input {
Input::Source(ref s) => {
let before_pass = custom_before_pass(&s.name, &self.options);
self.c.process_js_with_custom_pass(
s.clone(),
&handler,
&self.options.swc,
before_pass,
noop(),
)
}
})
})
})
.convert_err()
}))
.map_err(|err| {
if let Some(s) = err.downcast_ref::<String>() {
anyhow!("failed to process {}", s)
} else {
anyhow!("failed to process")
}
});
match res {
Ok(res) => res.convert_err(),
Err(err) => Err(napi::Error::new(
Status::GenericFailure,
format!("{:?}", err),
)),
}
}
fn resolve(self, env: Env, result: Self::Output) -> napi::Result<Self::JsValue> {
......
......@@ -3,11 +3,12 @@ use next_swc::{
styled_jsx::styled_jsx,
};
use std::path::PathBuf;
use swc_common::{chain, comments::SingleThreadedComments, FileName, Mark};
use swc_common::{chain, comments::SingleThreadedComments, FileName, Mark, Span, DUMMY_SP};
use swc_ecma_transforms_testing::{test, test_fixture};
use swc_ecmascript::{
parser::{EsConfig, Syntax},
transforms::react::jsx,
visit::as_folder,
};
use testing::fixture;
......@@ -77,3 +78,22 @@ fn styled_jsx_fixture(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture(syntax(), &|_tr| styled_jsx(), &input, &output);
}
pub struct DropSpan;
impl swc_ecmascript::visit::VisitMut for DropSpan {
fn visit_mut_span(&mut self, span: &mut Span) {
*span = DUMMY_SP
}
}
/// Hash of styled-jsx should not depend on the span of expressions.
#[fixture("tests/fixture/styled-jsx/**/input.js")]
fn styled_jsx_span_should_not_affect_hash(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture(
syntax(),
&|_tr| chain!(as_folder(DropSpan), styled_jsx()),
&input,
&output,
);
}
......@@ -2,109 +2,137 @@ import _JSXStyle from "styled-jsx/style";
import styles from "./styles";
const styles2 = require("./styles2");
export const Test1 = ()=><div className={`jsx-${styles2.__hash} jsx-${styles.__hash}`}>
<p className={`jsx-${styles2.__hash} jsx-${styles.__hash}`}>external only</p>
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
<_JSXStyle id={styles2.__hash}>{styles2}</_JSXStyle>
</div>
;
export const Test2 = ()=><div className={"jsx-81a68341e430a972 " + `jsx-${styles.__hash}`}>
<p className={"jsx-81a68341e430a972 " + `jsx-${styles.__hash}`}>external and static</p>
<_JSXStyle id={"81a68341e430a972"}>{"p.jsx-81a68341e430a972 {color:red}"}</_JSXStyle>
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
</div>
;
export const Test3 = ({ color })=><div className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[
"26b457d3bc475235",
"5cadd6714ea141b4",
[
color
]
]
])}>
<p className={`jsx-${styles.__hash}` + " " + _JSXStyle.dynamic([
[
"26b457d3bc475235",
"5cadd6714ea141b4",
[
color
]
]
])}>external and dynamic</p>
<_JSXStyle id={"26b457d3bc475235"} dynamic={[
<_JSXStyle id={"5cadd6714ea141b4"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector {color:${color}}`}</_JSXStyle>
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
</div>
;
export const Test4 = ({ color })=><div className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"e6cca97eb9ca1a15",
"8f336bc49da94d3f",
[
color
]
]
])}>
<p className={`jsx-${styles.__hash}` + " jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"e6cca97eb9ca1a15",
"8f336bc49da94d3f",
[
color
]
]
])}>external, static and dynamic</p>
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c {display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"c86b0d7e7328204f"} dynamic={[
<_JSXStyle id={"5cadd6714ea141b4"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector {color:${color}}`}</_JSXStyle>
<_JSXStyle id={styles.__hash}>{styles}</_JSXStyle>
</div>
;
export const Test5 = ()=><div className={"jsx-df0159ebd3f9fb6f"}>
<p className={"jsx-df0159ebd3f9fb6f"}>static only</p>
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-df0159ebd3f9fb6f {display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"81a68341e430a972"}>{"p.jsx-df0159ebd3f9fb6f {color:red}"}</_JSXStyle>
</div>
;
export const Test6 = ({ color })=><div className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"a55f0611581d64ca",
"8f336bc49da94d3f",
[
color
]
]
])}>
<p className={"jsx-ceba8c9ce34e3d0c " + _JSXStyle.dynamic([
[
"a55f0611581d64ca",
"8f336bc49da94d3f",
[
color
]
]
])}>static and dynamic</p>
<_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c {display:inline-block}"}</_JSXStyle>
<_JSXStyle id={"f0677f918e6b5a01"} dynamic={[
<_JSXStyle id={"5cadd6714ea141b4"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector {color:${color}}`}</_JSXStyle>
</div>
;
export const Test7 = ({ color })=><div className={_JSXStyle.dynamic([
[
"4adc07771eb3723",
"5cadd6714ea141b4",
[
color
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"4adc07771eb3723",
"5cadd6714ea141b4",
[
color
]
]
])}>dynamic only</p>
<_JSXStyle id={"4adc07771eb3723"} dynamic={[
<_JSXStyle id={"5cadd6714ea141b4"} dynamic={[
color
]}>{`p.__jsx-style-dynamic-selector {color:${color}}`}</_JSXStyle>
</div>
;
export const Test8 = ({ color })=>{
......@@ -114,23 +142,26 @@ export const Test8 = ({ color })=>{
};
return <div className={_JSXStyle.dynamic([
[
"a552a4a765a9ca4e",
"6e7028e37f6f2a1c",
[
innerProps.color
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"a552a4a765a9ca4e",
"6e7028e37f6f2a1c",
[
innerProps.color
]
]
])}>dynamic with scoped compound variable</p>
<_JSXStyle id={"a552a4a765a9ca4e"} dynamic={[
<_JSXStyle id={"6e7028e37f6f2a1c"} dynamic={[
innerProps.color
]}>{`p.__jsx-style-dynamic-selector {color:${innerProps.color}}`}</_JSXStyle>
</div>;
}
};
......@@ -140,29 +171,35 @@ export const Test9 = ({ color })=>{
};
return <div className={_JSXStyle.dynamic([
[
"7ef39e3312c80ead",
"33344a45c20c74fe",
[
innerProps.color
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"7ef39e3312c80ead",
"33344a45c20c74fe",
[
innerProps.color
]
]
])}>dynamic with compound variable</p>
<_JSXStyle id={"7ef39e3312c80ead"} dynamic={[
<_JSXStyle id={"33344a45c20c74fe"} dynamic={[
innerProps.color
]}>{`p.__jsx-style-dynamic-selector {color:${innerProps.color}}`}</_JSXStyle>
</div>;
};
const foo = "red";
export const Test10 = ()=><div className={"jsx-688a08f9e73a5653"}>
<p className={"jsx-688a08f9e73a5653"}>dynamic with constant variable</p>
<_JSXStyle id={"688a08f9e73a5653"}>{`p.jsx-688a08f9e73a5653 {color:${foo}}`}</_JSXStyle>
export const Test10 = ()=><div className={"jsx-e993bec5c22e1b75"}>
<p className={"jsx-e993bec5c22e1b75"}>dynamic with constant variable</p>
<_JSXStyle id={"e993bec5c22e1b75"}>{`p.jsx-e993bec5c22e1b75 {color:${foo}}`}</_JSXStyle>
</div>
;
export const Test11 = ({ color })=>{
......@@ -170,17 +207,20 @@ export const Test11 = ({ color })=>{
length: 5
}).map((item, i)=><li key={i} className={_JSXStyle.dynamic([
[
"ebe03db0369a2939",
"5dc7166977a4514",
[
color
]
]
]) + " " + "item"}>
<_JSXStyle id={"ebe03db0369a2939"} dynamic={[
<_JSXStyle id={"5dc7166977a4514"} dynamic={[
color
]}>{`.item.__jsx-style-dynamic-selector {color:${color}}`}</_JSXStyle>
Item #{i + 1}
</li>
);
return <ul className="items">{items}</ul>;
};
\ No newline at end of file
};
import _JSXStyle from "styled-jsx/style";
const color = "red";
const otherColor = "green";
const A = ()=><div className={"jsx-706d62168f5e52dc"}>
<p className={"jsx-706d62168f5e52dc"}>test</p>
<_JSXStyle id={"706d62168f5e52dc"}>{`p.jsx-706d62168f5e52dc {color:${color}}`}</_JSXStyle>
const A = ()=><div className={"jsx-f44d626e14f3cfbc"}>
<p className={"jsx-f44d626e14f3cfbc"}>test</p>
<_JSXStyle id={"f44d626e14f3cfbc"}>{`p.jsx-f44d626e14f3cfbc {color:${color}}`}</_JSXStyle>
</div>
;
const B = ()=><div className={"jsx-d698fce2ff7d98bb"}>
<p className={"jsx-d698fce2ff7d98bb"}>test</p>
<_JSXStyle id={"d698fce2ff7d98bb"}>{`p.jsx-d698fce2ff7d98bb {color:${otherColor}}`}</_JSXStyle>
const B = ()=><div className={"jsx-9db1df72abe82640"}>
<p className={"jsx-9db1df72abe82640"}>test</p>
<_JSXStyle id={"9db1df72abe82640"}>{`p.jsx-9db1df72abe82640 {color:${otherColor}}`}</_JSXStyle>
</div>
;
export default (()=><div >
<A />
<B />
</div>
);
\ No newline at end of file
);
......@@ -9,73 +9,91 @@ const animationName = "my-cool-animation";
const obj = {
display: "block"
};
export default (({ display })=><div className={"jsx-802e359ee0ab20c4 " + _JSXStyle.dynamic([
export default (({ display })=><div className={"jsx-843124768056a74c " + _JSXStyle.dynamic([
[
"76aa3eae4e21e4ca",
"a124d516c2c0707d",
[
display ? "block" : "none"
]
],
[
"5ba905f763f40220",
"108a316873f1c6fc",
[
darken(color) + 2
]
],
[
"c4bb394aae9bd00b",
"785cf5e120672da8",
[
darken(color)
]
]
])}>
<p className={"jsx-802e359ee0ab20c4 " + _JSXStyle.dynamic([
<p className={"jsx-843124768056a74c " + _JSXStyle.dynamic([
[
"76aa3eae4e21e4ca",
"a124d516c2c0707d",
[
display ? "block" : "none"
]
],
[
"5ba905f763f40220",
"108a316873f1c6fc",
[
darken(color) + 2
]
],
[
"c4bb394aae9bd00b",
"785cf5e120672da8",
[
darken(color)
]
]
])}>test</p>
<_JSXStyle id={"f3d3af42197b4734"}>{`p.${color}.jsx-802e359ee0ab20c4 {color:${otherColor};
<_JSXStyle id={"5df43f2861c900e6"}>{`p.${color}.jsx-843124768056a74c {color:${otherColor};
display:${obj.display}}`}</_JSXStyle>
<_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-802e359ee0ab20c4 {color:red}"}</_JSXStyle>
<_JSXStyle id={"32d670fe91cc2fa1"}>{`body {background:${color}}`}</_JSXStyle>
<_JSXStyle id={"3134af19d5bf663e"}>{`body {background:${color}}`}</_JSXStyle>
<_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-843124768056a74c {color:red}"}</_JSXStyle>
<_JSXStyle id={"a971cf00393d41be"}>{`body {background:${color}}`}</_JSXStyle>
<_JSXStyle id={"a971cf00393d41be"}>{`body {background:${color}}`}</_JSXStyle>
// TODO: the next two should have the same hash
<_JSXStyle id={"8e512e75f8a7c096"}>{`p.jsx-802e359ee0ab20c4 {color:${color}}`}</_JSXStyle>
<_JSXStyle id={"c25992945d0883cd"}>{`p.jsx-802e359ee0ab20c4 {color:${color}}`}</_JSXStyle>
<_JSXStyle id={"2f77c12736da5e9e"} dynamic={[
<_JSXStyle id={"5cadd6714ea141b4"}>{`p.jsx-843124768056a74c {color:${color}}`}</_JSXStyle>
<_JSXStyle id={"5cadd6714ea141b4"}>{`p.jsx-843124768056a74c {color:${color}}`}</_JSXStyle>
<_JSXStyle id={"6b2c0e0cad82feb7"} dynamic={[
darken(color)
]}>{`p.__jsx-style-dynamic-selector {color:${darken(color)}}`}</_JSXStyle>
<_JSXStyle id={"10454d61c818c6eb"} dynamic={[
<_JSXStyle id={"6468493b508fe311"} dynamic={[
darken(color) + 2
]}>{`p.__jsx-style-dynamic-selector {color:${darken(color) + 2}}`}</_JSXStyle>
<_JSXStyle id={"281f7ed4d9150bac"}>{`@media (min-width:${mediumScreen}) {p.jsx-802e359ee0ab20c4 {color:green}
p.jsx-802e359ee0ab20c4 {color:${`red`}}}
p.jsx-802e359ee0ab20c4 {color:red}`}</_JSXStyle>
<_JSXStyle id={"d8950943ae4cf3dc"}>{`p.jsx-802e359ee0ab20c4 {-webkit-animation-duration:${animationDuration};
<_JSXStyle id={"bb5a8a5ee5cd36db"}>{`@media (min-width:${mediumScreen}) {p.jsx-843124768056a74c {color:green}
p.jsx-843124768056a74c {color:${`red`}}}
p.jsx-843124768056a74c {color:red}`}</_JSXStyle>
<_JSXStyle id={"99746edba785c617"}>{`p.jsx-843124768056a74c {-webkit-animation-duration:${animationDuration};
animation-duration:${animationDuration}}`}</_JSXStyle>
<_JSXStyle id={"1ee00865f92bdbe7"}>{`p.jsx-802e359ee0ab20c4 {-webkit-animation:${animationDuration} forwards ${animationName};
<_JSXStyle id={"62d69d091a270e9d"}>{`p.jsx-843124768056a74c {-webkit-animation:${animationDuration} forwards ${animationName};
animation:${animationDuration} forwards ${animationName}}
div.jsx-802e359ee0ab20c4 {background:${color}}`}</_JSXStyle>
div.jsx-843124768056a74c {background:${color}}`}</_JSXStyle>
<_JSXStyle id={"4925b8e0a7ab752a"} dynamic={[
<_JSXStyle id={"50cfd39d2a258beb"} dynamic={[
display ? "block" : "none"
]}>{`span.__jsx-style-dynamic-selector {display:${display ? "block" : "none"}}`}</_JSXStyle>
// TODO: causes bad syntax
{}
</div>
);
\ No newline at end of file
);
......@@ -6,18 +6,18 @@ bar.__hash = "aaed0341accea8f";
const baz = new String("div {font-size:3em}");
baz.__hash = "aaed0341accea8f";
const a = new String(`div {font-size:${size}em}`);
a.__hash = "611c3773b76f8ea3";
a.__hash = "f14cced97c082d2c";
export const uh = bar;
export const foo = new String(`div.jsx-e46da79e05d23fff {color:${color}}`);
foo.__hash = "e46da79e05d23fff";
export const foo = new String(`div.jsx-a0d126276b085021 {color:${color}}`);
foo.__hash = "a0d126276b085021";
({
styles: <_JSXStyle id={"12e2c41a8d37fe78"} dynamic={[
styles: <_JSXStyle id={"47e08c293b53f262"} dynamic={[
colors.green.light
]}>{`div.__jsx-style-dynamic-selector {color:${colors.green.light}}
a.__jsx-style-dynamic-selector {color:red}`}</_JSXStyle>,
className: _JSXStyle.dynamic([
[
"12e2c41a8d37fe78",
"47e08c293b53f262",
[
colors.green.light
]
......@@ -25,13 +25,13 @@ a.__jsx-style-dynamic-selector {color:red}`}</_JSXStyle>,
])
});
const b = {
styles: <_JSXStyle id={"d5617758481f82cd"} dynamic={[
styles: <_JSXStyle id={"47e08c293b53f262"} dynamic={[
colors.green.light
]}>{`div.__jsx-style-dynamic-selector {color:${colors.green.light}}
a.__jsx-style-dynamic-selector {color:red}`}</_JSXStyle>,
className: _JSXStyle.dynamic([
[
"d5617758481f82cd",
"47e08c293b53f262",
[
colors.green.light
]
......@@ -40,13 +40,13 @@ a.__jsx-style-dynamic-selector {color:red}`}</_JSXStyle>,
};
const dynamic = (colors)=>{
const b = {
styles: <_JSXStyle id={"a7ac579c753e9d90"} dynamic={[
styles: <_JSXStyle id={"79d79305fa1611e"} dynamic={[
colors.green.light
]}>{`div.__jsx-style-dynamic-selector {color:${colors.green.light}}
a.__jsx-style-dynamic-selector {color:red}`}</_JSXStyle>,
className: _JSXStyle.dynamic([
[
"a7ac579c753e9d90",
"79d79305fa1611e",
[
colors.green.light
]
......@@ -55,7 +55,7 @@ a.__jsx-style-dynamic-selector {color:red}`}</_JSXStyle>,
};
};
export default {
styles: <_JSXStyle id={"e4642e4164827181"}>{`div.jsx-e4642e4164827181 {font-size:3em}
p.jsx-e4642e4164827181 {color:${color}}`}</_JSXStyle>,
className: "jsx-e4642e4164827181"
};
\ No newline at end of file
styles: <_JSXStyle id={"d9cea503e39c5315"}>{`div.jsx-d9cea503e39c5315 {font-size:3em}
p.jsx-d9cea503e39c5315 {color:${color}}`}</_JSXStyle>,
className: "jsx-d9cea503e39c5315"
};
......@@ -2,7 +2,7 @@ import _JSXStyle from "styled-jsx/style";
export const Red = ({ Component ="button" })=>{
return <Component className={_JSXStyle.dynamic([
[
"ff8ee675a24f28ee",
"ab280f80c0d19763",
[
e1,
e2,
......@@ -23,8 +23,11 @@ export const Red = ({ Component ="button" })=>{
]
])}>
{}
<_JSXStyle id={"ff8ee675a24f28ee"} dynamic={[
<_JSXStyle id={"ab280f80c0d19763"} dynamic={[
e1,
e2,
e3,
......@@ -55,5 +58,6 @@ export const Red = ({ Component ="button" })=>{
--button-13:${e13};
--button-14:${e14};
--button-15:${e15}}`}</_JSXStyle>
</Component>;
};
......@@ -2,15 +2,17 @@ import _JSXStyle from "styled-jsx/style";
export default function Home({ fontFamily }) {
return <div className={_JSXStyle.dynamic([
[
"2566fdd7bc25c35",
"d64fed44dbc5d8df",
[
fontFamily
]
]
])}>
<_JSXStyle id={"2566fdd7bc25c35"} dynamic={[
<_JSXStyle id={"d64fed44dbc5d8df"} dynamic={[
fontFamily
]}>{`body {font-family:${fontFamily}}
code:before, code:after {content:'\`'}`}</_JSXStyle>
</div>;
}
\ No newline at end of file
};
......@@ -3,23 +3,26 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"8b268cf2c0a3f89b",
"8c1103276226be14",
[
inputSize ? "height: calc(2 * var(--a)) !important;" : ""
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"8b268cf2c0a3f89b",
"8c1103276226be14",
[
inputSize ? "height: calc(2 * var(--a)) !important;" : ""
]
]
])}>test</p>
<_JSXStyle id={"8b268cf2c0a3f89b"} dynamic={[
<_JSXStyle id={"8c1103276226be14"} dynamic={[
inputSize ? "height: calc(2 * var(--a)) !important;" : ""
]}>{`@media only screen {a.__jsx-style-dynamic-selector {${inputSize ? "height: calc(2 * var(--a)) !important;" : ""} }}`}</_JSXStyle>
</div>;
}
}
\ No newline at end of file
};
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"4dca1c13af6604d3",
"1a8c0e5c60018729",
[
a[b],
-1 * (c || 0),
......@@ -14,7 +14,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"4dca1c13af6604d3",
"1a8c0e5c60018729",
[
a[b],
-1 * (c || 0),
......@@ -23,7 +23,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"4dca1c13af6604d3"} dynamic={[
<_JSXStyle id={"1a8c0e5c60018729"} dynamic={[
a[b],
-1 * (c || 0),
d
......
......@@ -3,23 +3,26 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"1c633742f7a13f60",
"1dd34a5c235f087f",
[
a
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"1c633742f7a13f60",
"1dd34a5c235f087f",
[
a
]
]
])}>test</p>
<_JSXStyle id={"1c633742f7a13f60"} dynamic={[
<_JSXStyle id={"1dd34a5c235f087f"} dynamic={[
a
]}>{`@media only screen {a.__jsx-style-dynamic-selector {color:${a}}}`}</_JSXStyle>
</div>;
}
}
};
......@@ -3,7 +3,7 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"eb1d88515aa07b6b",
"35bb702eb335aa6f",
[
a || "var(--c)",
b || "inherit"
......@@ -13,7 +13,7 @@ export default class {
<p className={_JSXStyle.dynamic([
[
"eb1d88515aa07b6b",
"35bb702eb335aa6f",
[
a || "var(--c)",
b || "inherit"
......@@ -21,7 +21,7 @@ export default class {
]
])}>test</p>
<_JSXStyle id={"eb1d88515aa07b6b"} dynamic={[
<_JSXStyle id={"35bb702eb335aa6f"} dynamic={[
a || "var(--c)",
b || "inherit"
]}>{`.a:hover .b.__jsx-style-dynamic-selector {display:inline-block;
......
......@@ -3,27 +3,30 @@ export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"e9f85ed5d171a7cb",
"21ae2868f133bbf6",
[
a ? "100%" : "200px",
b ? "0" : "8px 20px"
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"e9f85ed5d171a7cb",
"21ae2868f133bbf6",
[
a ? "100%" : "200px",
b ? "0" : "8px 20px"
]
]
])}>test</p>
<_JSXStyle id={"e9f85ed5d171a7cb"} dynamic={[
<_JSXStyle id={"21ae2868f133bbf6"} dynamic={[
a ? "100%" : "200px",
b ? "0" : "8px 20px"
]}>{`.item.__jsx-style-dynamic-selector {max-width:${a ? "100%" : "200px"};
padding:${b ? "0" : "8px 20px"}}`}</_JSXStyle>
</div>;
}
}
};
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