-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed label extraction crashing in some cases involving variable decl…
…arations with non-identifiers (#2585) * Fix babel emotion plugin crash when on object with multiple styles is returned by a function * Add changeset * Fix wrong snapshots * Fixed the actual underlying issue with label extraction Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
- Loading branch information
Showing
10 changed files
with
394 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@emotion/babel-plugin': patch | ||
--- | ||
|
||
author: @Andarist | ||
|
||
Fixed label extraction crashing in some cases involving variable declarations with array and object patterns. |
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,8 @@ | ||
--- | ||
'@emotion/babel-plugin': patch | ||
--- | ||
|
||
author: @kddc | ||
author: @Andarist | ||
|
||
Improved label extraction for named function expressions and anonymous functions used as object property values. |
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
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin/__tests__/css-macro/__fixtures__/label-arrow-as-obj-property.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,7 @@ | ||
import { css } from '@emotion/react/macro' | ||
|
||
export const styles = { | ||
colorFn1: () => css` | ||
color: hotpink; | ||
` | ||
} |
9 changes: 9 additions & 0 deletions
9
...abel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-as-obj-property.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,9 @@ | ||
import { css } from '@emotion/react/macro' | ||
|
||
export const styles = { | ||
colorFn1: function () { | ||
return css` | ||
color: hotpink; | ||
` | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin/__tests__/css-macro/__fixtures__/label-function-expression-named.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,7 @@ | ||
import { css } from '@emotion/react/macro' | ||
|
||
const thing = function someName() { | ||
return css` | ||
color: hotpink; | ||
` | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/babel-plugin/__tests__/css-macro/__fixtures__/no-label-array-pattern.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,9 @@ | ||
import { css } from '@emotion/react/macro' | ||
|
||
const [weirdo] = [ | ||
css` | ||
color: hotpink; | ||
` | ||
] | ||
|
||
export default weirdo |
11 changes: 11 additions & 0 deletions
11
...s/babel-plugin/__tests__/css-macro/__fixtures__/no-label-obj-pattern-computed-property.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,11 @@ | ||
import { css } from '@emotion/react/macro' | ||
|
||
const computed = 'weirdo' | ||
|
||
const { weirdo } = { | ||
[computed]: css` | ||
color: hotpink; | ||
` | ||
} | ||
|
||
export default weirdo |
Oops, something went wrong.