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

Update css parser (#29484)

Co-authored-by: 's avatartimneutkens <timneutkens@users.noreply.github.com>
parent 0f1a4fa6
This diff is collapsed.
......@@ -16,14 +16,14 @@ path-clean = "0.1"
regex = "1.5"
serde = "1"
serde_json = "1"
swc = "0.58.0"
swc = "0.59.1"
swc_atoms = "0.2"
swc_common = { version = "0.13.0", features = ["concurrent", "sourcemap"] }
swc_css = "0.8.0"
swc_css = "0.8.2"
swc_css_codegen = "0.6.0"
swc_ecmascript = { version = "0.66.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_ecma_preset_env = "0.45.0"
swc_node_base = "0.3"
swc_ecmascript = { version = "0.67.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_ecma_preset_env = "0.46.0"
swc_node_base = "0.4.0"
swc_stylis = "0.5.0"
fxhash = "0.2.1"
retain_mut = "0.1.3"
......@@ -36,7 +36,7 @@ tracing = { version = "0.1.28", features = ["release_max_level_off"] }
napi-build = "1"
[dev-dependencies]
swc_ecma_transforms_testing = "0.34.0"
swc_ecma_transforms_testing = "0.35.0"
testing = "0.14.0"
[profile.release]
......
......@@ -32,8 +32,13 @@ pub fn transform_css(
);
let mut ss = match result {
Ok(ss) => ss,
Err(_) => {
Err(err) => {
HANDLER.with(|handler| {
// Print css parsing errors
err.to_diagnostics(&handler).emit();
// TODO(kdy1): We may print css so the user can see the error, and report it.
handler
.struct_span_err(
style_info.css_span,
......
export default class {
render() {
return (
<div>
<p>test</p>
<style jsx>{`
:global(.a):hover .b {
a: ${a[b]}px !important;
b: translate3d(
0,
${-1 * (c || 0)}px,
-${d}px
)
scale(1) !important;
}
`}</style>
</div>
)
}
}
\ No newline at end of file
import _JSXStyle from "styled-jsx/style";
export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"4dca1c13af6604d3",
[
a[b],
-1 * (c || 0),
d
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"4dca1c13af6604d3",
[
a[b],
-1 * (c || 0),
d
]
]
])}>test</p>
<_JSXStyle id={"4dca1c13af6604d3"} dynamic={[
a[b],
-1 * (c || 0),
d
]}>{`.a .b.__jsx-style-dynamic-selector {a:${a[b]}px!important;
b:translate3d(0, ${-1 * (c || 0)}px, -${d}px) scale(1)!important}`}</_JSXStyle>
</div>;
}
}
\ No newline at end of file
export default class {
render() {
return (
<div>
<p>test</p>
<style jsx>{`
@media only screen {
a {
color: ${a};
}
}
`}</style>
</div>
)
}
}
\ No newline at end of file
import _JSXStyle from "styled-jsx/style";
export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"1c633742f7a13f60",
[
a
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"1c633742f7a13f60",
[
a
]
]
])}>test</p>
<_JSXStyle id={"1c633742f7a13f60"} dynamic={[
a
]}>{`@media only screen {a.__jsx-style-dynamic-selector {color:${a}}}`}</_JSXStyle>
</div>;
}
}
export default class {
render() {
return (
<div>
<p>test</p>
<style jsx>{`
:global(.a):hover .b {
display: inline-block;
padding: 0 ${a || 'var(--c)'};
color: ${b || 'inherit'};
}
`}</style>
</div>
)
}
}
\ No newline at end of file
import _JSXStyle from "styled-jsx/style";
export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"eb1d88515aa07b6b",
[
a || "var(--c)",
b || "inherit"
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"eb1d88515aa07b6b",
[
a || "var(--c)",
b || "inherit"
]
]
])}>test</p>
<_JSXStyle id={"eb1d88515aa07b6b"} dynamic={[
a || "var(--c)",
b || "inherit"
]}>{`.a .b.__jsx-style-dynamic-selector {display:inline-block;
padding:0 ${a || "var(--c)"};
color:${b || "inherit"}}`}</_JSXStyle>
</div>;
}
}
\ No newline at end of file
export default class {
render() {
return (
<div>
<p>test</p>
<style jsx>{`
.item {
max-width: ${a ? '100%' : '200px'};
padding: ${b ? '0' : '8px 20px'};
}
`}</style>
</div>
)
}
}
\ No newline at end of file
import _JSXStyle from "styled-jsx/style";
export default class {
render() {
return <div className={_JSXStyle.dynamic([
[
"e9f85ed5d171a7cb",
[
a ? "100%" : "200px",
b ? "0" : "8px 20px"
]
]
])}>
<p className={_JSXStyle.dynamic([
[
"e9f85ed5d171a7cb",
[
a ? "100%" : "200px",
b ? "0" : "8px 20px"
]
]
])}>test</p>
<_JSXStyle id={"e9f85ed5d171a7cb"} 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