Skip to content

chore: use utooland lightningcss patch#66

Closed
fireairforce wants to merge 1 commit intoutoofrom
ligntgning-patch
Closed

chore: use utooland lightningcss patch#66
fireairforce wants to merge 1 commit intoutoofrom
ligntgning-patch

Conversation

@fireairforce
Copy link
Copy Markdown
Member

用 utooland 的 lightning-css 用来做一些 css 特性的 patch,例如 css modules 支持 :global :

utooland/lightningcss#1

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @fireairforce, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在通过集成 utooland 维护的 lightningcss 的自定义补丁版本,来增强项目的 CSS 处理能力。此更改主要目的是为 CSS 模块提供额外的特性支持,例如 :global 语法,从而允许更灵活的样式定义。这涉及到更新项目的依赖配置,以从特定的 Git 仓库分支获取 lightningcss 及其相关组件。

Highlights

  • 依赖源变更: 将 lightningcss 及其相关依赖(lightningcss-derive, parcel_selectors, static-self, static-self-derive)的来源从 crates.io 注册表切换到 utooland/lightningcss 仓库的 support-css-module-global Git 分支。
  • CSS Modules 功能增强: 引入了对 CSS 模块中 :global 等特定 CSS 特性的支持,通过使用自定义的 lightningcss 补丁版本实现。
  • itertools 降级: 将 itertools 依赖的版本从 0.13.0 降级到 0.12.1
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

这个 PR 通过使用 lightningcss 的一个 fork (utooland/lightningcss) 来为 CSS 模块增加对 :global 的支持。这是一个合理的做法,可以快速获得所需功能。

主要的修改是在 Cargo.toml 中通过 [patch.crates-io] 来覆盖官方的 lightningcssparcel_selectors 包,并相应地更新了 Cargo.lock 文件。

虽然使用 fork 可以解决当前问题,但请注意长期维护的成本。这个 fork 可能会与上游 lightningcss 项目脱节,导致未来错过重要的更新或安全修复。建议团队内部讨论一个长期策略,例如:

  • 定期将上游的更新同步到 fork 中。
  • 尝试将这个 patch 贡献回上游 lightningcss 项目,以便未来可以直接使用官方版本。

我还有一个关于当前依赖管理的具体建议,以提高项目的稳定性和可维护性。请查看我对 Cargo.toml 文件的具体评论。

Comment on lines +462 to +463
lightningcss = { git = "https://github.com/utooland/lightningcss", branch = "support-css-module-global" }
parcel_selectors = { git = "https://github.com/utooland/lightningcss", branch = "support-css-module-global" }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

为了确保构建的可复现性并避免未来潜在的破坏性更新,建议将 [patch.crates-io] 中的 git 依赖从跟踪分支改为固定到具体的 commit hash。Cargo.lock 文件已经锁定了 cb37890ff8f5ddf17e90f2df486417bcb13fc001 这个 commit,在 Cargo.toml 中也明确指定可以提供更强的保障。

这样做可以防止当 support-css-module-global 分支更新时,cargo update 命令拉取到未经测试的新代码。

Suggested change
lightningcss = { git = "https://github.com/utooland/lightningcss", branch = "support-css-module-global" }
parcel_selectors = { git = "https://github.com/utooland/lightningcss", branch = "support-css-module-global" }
lightningcss = { git = "https://github.com/utooland/lightningcss", rev = "cb37890ff8f5ddf17e90f2df486417bcb13fc001" }
parcel_selectors = { git = "https://github.com/utooland/lightningcss", rev = "cb37890ff8f5ddf17e90f2df486417bcb13fc001" }

@xusd320 xusd320 deleted the ligntgning-patch branch November 25, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant