-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(css/modules): Fix
:global
selectors without preceding whitespace (
- Loading branch information
Showing
18 changed files
with
628 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.__local__a.b .c.__local__d { | ||
.__local__a.b.__local__d .c.__local__d { | ||
color: red; | ||
} |
1 change: 1 addition & 0 deletions
1
crates/swc_css_modules/tests/fixture/issue-8461/1/input.compiled.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.__local__foo.bar.__local__baz {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.foo:global(.bar).baz {} |
14 changes: 14 additions & 0 deletions
14
crates/swc_css_modules/tests/fixture/issue-8461/1/input.transform.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"baz": [ | ||
{ | ||
"name": "__local__baz", | ||
"type": "local" | ||
} | ||
], | ||
"foo": [ | ||
{ | ||
"name": "__local__foo", | ||
"type": "local" | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
crates/swc_css_modules/tests/fixture/issue-8461/2/input.compiled.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.__local__foo .bar.__local__baz {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.foo :global(.bar).baz {} |
14 changes: 14 additions & 0 deletions
14
crates/swc_css_modules/tests/fixture/issue-8461/2/input.transform.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"baz": [ | ||
{ | ||
"name": "__local__baz", | ||
"type": "local" | ||
} | ||
], | ||
"foo": [ | ||
{ | ||
"name": "__local__foo", | ||
"type": "local" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.foo:global(.bar).baz {} |
1 change: 1 addition & 0 deletions
1
crates/swc_css_parser/tests/fixture/issue-8461/1/leading-comments.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
151 changes: 151 additions & 0 deletions
151
crates/swc_css_parser/tests/fixture/issue-8461/1/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"type": "Stylesheet", | ||
"span": { | ||
"start": 1, | ||
"end": 25, | ||
"ctxt": 0 | ||
}, | ||
"rules": [ | ||
{ | ||
"type": "QualifiedRule", | ||
"span": { | ||
"start": 1, | ||
"end": 25, | ||
"ctxt": 0 | ||
}, | ||
"prelude": { | ||
"type": "SelectorList", | ||
"span": { | ||
"start": 1, | ||
"end": 22, | ||
"ctxt": 0 | ||
}, | ||
"children": [ | ||
{ | ||
"type": "ComplexSelector", | ||
"span": { | ||
"start": 1, | ||
"end": 22, | ||
"ctxt": 0 | ||
}, | ||
"children": [ | ||
{ | ||
"type": "CompoundSelector", | ||
"span": { | ||
"start": 1, | ||
"end": 22, | ||
"ctxt": 0 | ||
}, | ||
"nestingSelector": null, | ||
"typeSelector": null, | ||
"subclassSelectors": [ | ||
{ | ||
"type": "ClassSelector", | ||
"span": { | ||
"start": 1, | ||
"end": 5, | ||
"ctxt": 0 | ||
}, | ||
"text": { | ||
"type": "Ident", | ||
"span": { | ||
"start": 2, | ||
"end": 5, | ||
"ctxt": 0 | ||
}, | ||
"value": "foo", | ||
"raw": "foo" | ||
} | ||
}, | ||
{ | ||
"type": "PseudoClassSelector", | ||
"span": { | ||
"start": 5, | ||
"end": 18, | ||
"ctxt": 0 | ||
}, | ||
"name": { | ||
"type": "Ident", | ||
"span": { | ||
"start": 6, | ||
"end": 12, | ||
"ctxt": 0 | ||
}, | ||
"value": "global", | ||
"raw": "global" | ||
}, | ||
"children": [ | ||
{ | ||
"type": "PreservedToken", | ||
"span": { | ||
"start": 13, | ||
"end": 14, | ||
"ctxt": 0 | ||
}, | ||
"token": { | ||
"Delim": { | ||
"value": "." | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "PreservedToken", | ||
"span": { | ||
"start": 14, | ||
"end": 17, | ||
"ctxt": 0 | ||
}, | ||
"token": { | ||
"Ident": { | ||
"value": "bar", | ||
"raw": "bar" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "ClassSelector", | ||
"span": { | ||
"start": 18, | ||
"end": 22, | ||
"ctxt": 0 | ||
}, | ||
"text": { | ||
"type": "Ident", | ||
"span": { | ||
"start": 19, | ||
"end": 22, | ||
"ctxt": 0 | ||
}, | ||
"value": "baz", | ||
"raw": "baz" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"block": { | ||
"type": "SimpleBlock", | ||
"span": { | ||
"start": 23, | ||
"end": 25, | ||
"ctxt": 0 | ||
}, | ||
"name": { | ||
"type": "PreservedToken", | ||
"span": { | ||
"start": 23, | ||
"end": 24, | ||
"ctxt": 0 | ||
}, | ||
"token": "LBrace" | ||
}, | ||
"value": [] | ||
} | ||
} | ||
] | ||
} |
126 changes: 126 additions & 0 deletions
126
crates/swc_css_parser/tests/fixture/issue-8461/1/span.swc-stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
|
||
x Stylesheet | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x Rule | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x QualifiedRule | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x SelectorList | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x ComplexSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x CompoundSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x SubclassSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^ | ||
`---- | ||
|
||
x ClassSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^ | ||
`---- | ||
|
||
x Ident | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^ | ||
`---- | ||
|
||
x SubclassSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x PseudoClassSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x Ident | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^^^ | ||
`---- | ||
|
||
x PseudoClassSelectorChildren | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^ | ||
`---- | ||
|
||
x Delim { value: '.' } | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^ | ||
`---- | ||
|
||
x PseudoClassSelectorChildren | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^ | ||
`---- | ||
|
||
x Ident { value: "bar", raw: "bar" } | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^ | ||
`---- | ||
|
||
x SubclassSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^ | ||
`---- | ||
|
||
x ClassSelector | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^^ | ||
`---- | ||
|
||
x Ident | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^^ | ||
`---- | ||
|
||
x SimpleBlock | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^^ | ||
`---- | ||
|
||
x LBrace | ||
,-[$DIR/tests/fixture/issue-8461/1/input.css:1:1] | ||
1 | .foo:global(.bar).baz {} | ||
: ^ | ||
`---- |
1 change: 1 addition & 0 deletions
1
crates/swc_css_parser/tests/fixture/issue-8461/1/trailing-comments.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.foo :global(.bar).baz {} |
1 change: 1 addition & 0 deletions
1
crates/swc_css_parser/tests/fixture/issue-8461/2/leading-comments.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.