Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stylis upgrade #2590

Merged
merged 5 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/slow-planes-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@emotion/babel-plugin': patch
'@emotion/cache': patch
'@emotion/css': patch
'@emotion/css-prettifier': patch
'@emotion/jest': patch
'@emotion/react': patch
---

Upgraded and pinned the version of Stylis - the CSS parser that Emotion uses under the hood.
2 changes: 1 addition & 1 deletion packages/babel-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"escape-string-regexp": "^4.0.0",
"find-root": "^1.1.0",
"source-map": "^0.5.7",
"stylis": "^4.0.10"
"stylis": "4.0.12"
},
"peerDependencies": {
"@babel/core": "^7.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@emotion/sheet": "^1.1.0",
"@emotion/utils": "^1.0.0",
"@emotion/weak-memoize": "^0.2.5",
"stylis": "^4.0.10"
"stylis": "4.0.12"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've decided to pin the version of this dependency as it's super crucial for Emotion and changes to it can affect our code in subtle ways. We want to keep this up-to-date with every release of Stylis - but we should always verify that our test suite passes before we can bump this dependency range

},
"devDependencies": {
"@emotion/hash": "*",
Expand Down
5 changes: 3 additions & 2 deletions packages/cache/src/stylis-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ export let compat = element => {
if (
element.type !== 'rule' ||
!element.parent ||
// .length indicates if this rule contains pseudo or not
!element.length
// positive .length indicates that this rule contains pseudo
// negative .length indicates that this rule has been already prefixed
element.length < 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes prefixed rules (like .css-hash::-webkit-input-placeholder {}) - with the latest stylis@4.0.11 and stylis@4.0.12 those were replaced with their non-prefixed versions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is stylis's prefixing of ::-webkit-input-placeholder incorrect as it stands?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, its prefixing it alright - we were screwing up the prefixed rules here though, before this change

) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion packages/css-prettifier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/css-prettifier",
"dependencies": {
"@emotion/memoize": "^0.7.4",
"stylis": "^4.0.10"
"stylis": "4.0.12"
},
"devDependencies": {},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@emotion/css-prettifier": "^1.0.0",
"chalk": "^4.1.0",
"specificity": "^0.4.1",
"stylis": "^4.0.10"
"stylis": "4.0.12"
},
"peerDependencies": {
"@types/jest": "^26.0.14 || ^27.0.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28143,10 +28143,10 @@ stylis@3.5.4:
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.4.tgz#f665f25f5e299cf3d64654ab949a57c768b73fbe"
integrity sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q==

stylis@^4.0.10:
version "4.0.10"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.10.tgz#446512d1097197ab3f02fb3c258358c3f7a14240"
integrity sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==
stylis@4.0.12:
version "4.0.12"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.12.tgz#cad79b30964de9a7e3ca92687a0e73718cbf0e17"
integrity sha512-eVXQEZqRRFRvl8Aor1kNWN7ViNss9tYhphVBFNxyCJWKdK+FO5sOVKEHk7Dg/vLAr1xYQBpUb+7weU4AlDUm8g==

sudo-prompt@^8.2.0:
version "8.2.5"
Expand Down