Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
5f72810d
Unverified
Commit
5f72810d
authored
Nov 03, 2021
by
Maia Teegarden
Committed by
GitHub
Nov 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lost combinator before global (#30771)
parent
2004d491
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
transform_css.rs
packages/next/build/swc/src/styled_jsx/transform_css.rs
+11
-1
input.js
...c/tests/fixture/styled-jsx/global-child-selector/input.js
+10
-0
output.js
.../tests/fixture/styled-jsx/global-child-selector/output.js
+9
-0
No files found.
packages/next/build/swc/src/styled_jsx/transform_css.rs
View file @
5f72810d
...
@@ -138,7 +138,7 @@ impl VisitMut for Namespacer {
...
@@ -138,7 +138,7 @@ impl VisitMut for Namespacer {
handler
handler
.struct_span_err
(
.struct_span_err
(
selector
.span
,
selector
.span
,
"Failed to
parse tokens inside
one off global selector"
,
"Failed to
transform
one off global selector"
,
)
)
.emit
()
.emit
()
});
});
...
@@ -187,6 +187,16 @@ impl Namespacer {
...
@@ -187,6 +187,16 @@ impl Namespacer {
.cloned
()
.cloned
()
.collect
::
<
Vec
<
_
>>
();
.collect
::
<
Vec
<
_
>>
();
if
v
.is_empty
()
{
bail!
(
"Failed to transform one off global selector"
);
}
if
node
.combinator
.is_some
()
&&
v
[
0
]
.combinator
.is_some
()
{
bail!
(
"Failed to transform one off global selector"
);
}
else
if
node
.combinator
.is_some
()
{
v
[
0
]
.combinator
=
node
.combinator
;
}
v
.iter_mut
()
.for_each
(|
sel
|
{
v
.iter_mut
()
.for_each
(|
sel
|
{
if
i
<
node
.subclass_selectors
.len
()
{
if
i
<
node
.subclass_selectors
.len
()
{
sel
.subclass_selectors
sel
.subclass_selectors
...
...
packages/next/build/swc/tests/fixture/styled-jsx/global-child-selector/input.js
0 → 100644
View file @
5f72810d
const
Test
=
()
=>
(
<
div
>
<
span
>
test
<
/span
>
<
style
jsx
>
{
`
div > :global(span) {
color: red;
}
`
}
<
/style
>
<
/div
>
)
\ No newline at end of file
packages/next/build/swc/tests/fixture/styled-jsx/global-child-selector/output.js
0 → 100644
View file @
5f72810d
import
_JSXStyle
from
"styled-jsx/style"
;
const
Test
=
()
=><
div
className
=
{
"jsx-5a206f122d1cb32e"
}
>
<
span
className
=
{
"jsx-5a206f122d1cb32e"
}
>
test
<
/span
>
<
_JSXStyle
id
=
{
"5a206f122d1cb32e"
}
>
{
"div.jsx-5a206f122d1cb32e >span {color:red}"
}
<
/_JSXStyle
>
<
/div
>
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment