-
Notifications
You must be signed in to change notification settings - Fork 75
feat: Support autoPrefixTransformer #230
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
Conversation
Caution Review failedFailed to post review comments. Configuration used: CodeRabbit UI ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (33)
💤 Files with no reviewable changes (4)
🧰 Additional context used🧬 Code Graph Analysis (8)tests/keyframes.spec.tsx (1)
tests/util.spec.tsx (1)
docs/examples/first-render.tsx (1)
docs/examples/autoPrefix.tsx (3)
src/util/index.ts (1)
tests/css-variables.spec.tsx (2)
src/StyleContext.tsx (2)
docs/examples/components/Button.tsx (3)
🔇 Additional comments (87)
📝 WalkthroughWalkthrough本次更新大幅重构了 CSS-in-JS 样式系统,重点引入了自动前缀(autoPrefix)支持、CSS 变量(cssVar)体系强化、样式缓存和提取机制优化,并移除了对 React 17 兼容性(如 useInsertionEffect polyfill)的支持。相关文档、示例和测试文件均同步调整,部分旧特性和兼容性测试被移除。 Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant StyleProvider
participant useStyleRegister
participant Cache
participant Transformer (autoPrefix)
participant DOM
App->>StyleProvider: 包裹组件,传入 transformers
StyleProvider->>useStyleRegister: 提供 autoPrefix、hashId 等上下文
useStyleRegister->>Cache: 查询/注册样式缓存
useStyleRegister->>Transformer (autoPrefix): 若 autoPrefix 启用,自动前缀化样式
useStyleRegister->>DOM: 注入样式(含 CSS 变量、前缀)
App->>DOM: 渲染组件
sequenceDiagram
participant App
participant DesignTokenProvider
participant useToken
participant useCacheToken
participant useCSSVarRegister
participant DOM
App->>DesignTokenProvider: 传递 token、cssVar、hashed
DesignTokenProvider->>useToken: 提供 token 上下文
useToken->>useCacheToken: 获取/生成 token、hashId、cssVarKey
useCacheToken->>useCSSVarRegister: 注册 CSS 变量样式
useCacheToken->>DOM: 注入 CSS 变量样式
App->>DOM: 渲染依赖 token 的组件
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
docs/examples/components/Spin.tsxOops! Something went wrong! :( ESLint: 7.32.0 ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct. The config "prettier" was referenced from the config file in "/.eslintrc.js". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. docs/examples/autoPrefix.tsxOops! Something went wrong! :( ESLint: 7.32.0 ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct. The config "prettier" was referenced from the config file in "/.eslintrc.js". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. docs/examples/components/Button.tsxOops! Something went wrong! :( ESLint: 7.32.0 ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct. The config "prettier" was referenced from the config file in "/.eslintrc.js". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #230 +/- ##
==========================================
- Coverage 94.58% 94.53% -0.05%
==========================================
Files 31 32 +1
Lines 2786 2817 +31
Branches 440 445 +5
==========================================
+ Hits 2635 2663 +28
- Misses 151 154 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
新功能
功能优化
Bug 修复
文档
测试
依赖与脚本
本次更新为 2.0.0-alpha.6 版本,包含重要功能增强和兼容性提升。