-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(styled-jsx): Visit attributes (#292)
- Loading branch information
Showing
12 changed files
with
168 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,5 +1,11 @@ | ||
# @swc/plugin-styled-jsx | ||
|
||
## 2.0.1 | ||
|
||
### Patch Changes | ||
|
||
- c88bd51: Visit attributes | ||
|
||
## 2.0.0 | ||
|
||
### Major Changes | ||
|
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
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
40 changes: 40 additions & 0 deletions
40
packages/styled-jsx/transform/tests/fixture/next-65064/1/input.js
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,40 @@ | ||
import React from "react"; | ||
|
||
// This should error with https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// but does not. | ||
|
||
export default function SimplePage() { | ||
return ( | ||
<ComponentWithChildAsProp | ||
trigger={ | ||
<> | ||
<div className={"text animated"}>Text</div> | ||
|
||
<style jsx>{` | ||
.text { | ||
color: blue; | ||
// This should either get transpiled by SWC | ||
// or should cause a build error about | ||
// nested styled jsx tags. | ||
// https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// | ||
// Instead, it causes a hydration error, | ||
// because & gets replaced with an & | ||
// *Remove* to fix the hydration error. | ||
&:hover { | ||
color: red; | ||
} | ||
} | ||
`}</style> | ||
</> | ||
} | ||
/> | ||
); | ||
} | ||
|
||
const ComponentWithChildAsProp = ({ | ||
trigger, | ||
}) => { | ||
return <div>{trigger}</div>; | ||
}; |
18 changes: 18 additions & 0 deletions
18
packages/styled-jsx/transform/tests/fixture/next-65064/1/output.lightningcss.js
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,18 @@ | ||
import _JSXStyle from "styled-jsx/style"; | ||
import React from "react"; | ||
// This should error with https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// but does not. | ||
export default function SimplePage() { | ||
return <ComponentWithChildAsProp trigger={<> | ||
|
||
<div className={"jsx-68234eda9c798fae" + " " + "text animated"}>Text</div> | ||
|
||
|
||
|
||
<_JSXStyle id={"68234eda9c798fae"}>{".text.jsx-68234eda9c798fae{color:#00f}.text.jsx-68234eda9c798fae.jsx-68234eda9c798fae:hover{color:red}"}</_JSXStyle> | ||
|
||
</>}/>; | ||
} | ||
const ComponentWithChildAsProp = ({ trigger })=>{ | ||
return <div>{trigger}</div>; | ||
}; |
18 changes: 18 additions & 0 deletions
18
packages/styled-jsx/transform/tests/fixture/next-65064/1/output.swc.js
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,18 @@ | ||
import _JSXStyle from "styled-jsx/style"; | ||
import React from "react"; | ||
// This should error with https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// but does not. | ||
export default function SimplePage() { | ||
return <ComponentWithChildAsProp trigger={<> | ||
|
||
<div className={"jsx-68234eda9c798fae" + " " + "text animated"}>Text</div> | ||
|
||
|
||
|
||
<_JSXStyle id={"68234eda9c798fae"}>{".text.jsx-68234eda9c798fae{color:#00f}.text.jsx-68234eda9c798fae.jsx-68234eda9c798fae:hover{color:red}"}</_JSXStyle> | ||
|
||
</>}/>; | ||
} | ||
const ComponentWithChildAsProp = ({ trigger })=>{ | ||
return <div>{trigger}</div>; | ||
}; |
40 changes: 40 additions & 0 deletions
40
packages/styled-jsx/transform/tests/fixture/next-65064/2/input.js
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,40 @@ | ||
import React from "react"; | ||
|
||
// This should error with https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// but does not. | ||
|
||
export default function SimplePage() { | ||
return ( | ||
<ComponentWithChildAsProp | ||
trigger={ | ||
<div> | ||
<div className={"text animated"}>Text</div> | ||
|
||
<style jsx>{` | ||
.text { | ||
color: blue; | ||
// This should either get transpiled by SWC | ||
// or should cause a build error about | ||
// nested styled jsx tags. | ||
// https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// | ||
// Instead, it causes a hydration error, | ||
// because & gets replaced with an & | ||
// *Remove* to fix the hydration error. | ||
&:hover { | ||
color: red; | ||
} | ||
} | ||
`}</style> | ||
</div> | ||
} | ||
/> | ||
); | ||
} | ||
|
||
const ComponentWithChildAsProp = ({ | ||
trigger, | ||
}) => { | ||
return <div>{trigger}</div>; | ||
}; |
18 changes: 18 additions & 0 deletions
18
packages/styled-jsx/transform/tests/fixture/next-65064/2/output.lightningcss.js
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,18 @@ | ||
import _JSXStyle from "styled-jsx/style"; | ||
import React from "react"; | ||
// This should error with https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// but does not. | ||
export default function SimplePage() { | ||
return <ComponentWithChildAsProp trigger={<div className={"jsx-68234eda9c798fae"}> | ||
|
||
<div className={"jsx-68234eda9c798fae" + " " + "text animated"}>Text</div> | ||
|
||
|
||
|
||
<_JSXStyle id={"68234eda9c798fae"}>{".text.jsx-68234eda9c798fae{color:#00f}.text.jsx-68234eda9c798fae.jsx-68234eda9c798fae:hover{color:red}"}</_JSXStyle> | ||
|
||
</div>}/>; | ||
} | ||
const ComponentWithChildAsProp = ({ trigger })=>{ | ||
return <div>{trigger}</div>; | ||
}; |
18 changes: 18 additions & 0 deletions
18
packages/styled-jsx/transform/tests/fixture/next-65064/2/output.swc.js
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,18 @@ | ||
import _JSXStyle from "styled-jsx/style"; | ||
import React from "react"; | ||
// This should error with https://nextjs.org/docs/messages/nested-styled-jsx-tags | ||
// but does not. | ||
export default function SimplePage() { | ||
return <ComponentWithChildAsProp trigger={<div className={"jsx-68234eda9c798fae"}> | ||
|
||
<div className={"jsx-68234eda9c798fae" + " " + "text animated"}>Text</div> | ||
|
||
|
||
|
||
<_JSXStyle id={"68234eda9c798fae"}>{".text.jsx-68234eda9c798fae{color:#00f}.text.jsx-68234eda9c798fae.jsx-68234eda9c798fae:hover{color:red}"}</_JSXStyle> | ||
|
||
</div>}/>; | ||
} | ||
const ComponentWithChildAsProp = ({ trigger })=>{ | ||
return <div>{trigger}</div>; | ||
}; |