Skip to content

fix(css): 修复跨资产变量 calc 透传并统一 CI 版本契约 - #1195

Open
sonofmagic wants to merge 18 commits into
mainfrom
codex/issue-1194-css-calc-regression
Open

fix(css): 修复跨资产变量 calc 透传并统一 CI 版本契约#1195
sonofmagic wants to merge 18 commits into
mainfrom
codex/issue-1194-css-calc-regression

Conversation

@sonofmagic

@sonofmagic sonofmagic commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Tailwind CSS v4 的主题变量和 utility CSS 分阶段生成时,calc 处理器拿不到变量上下文;数组和对象配置的透传也不一致,导致选定变量无法预计算。

本 PR 将生成阶段的变量映射传入 CSS 处理链,使用 value AST 处理变量引用与 fallback,并补充字符串、正则、对象、布尔配置及顶层/嵌套入口的回归测试。完整生成路径仅在 calc 需要变量时额外收集上下文,减少无用的 PostCSS 解析。

CI 的 pnpm 版本统一读取根 packageManager;fixture 工具链根据依赖声明和实际安装元数据校验,模板契约复用仓库版本来源。候选包切换后直接读取安装目录元数据,避免 require 缓存误报旧版本。保留冻结安装、release-age 策略和原有性能门槛。

中文 changeset 覆盖 weapp-tailwindcss、@weapp-tailwindcss/postcss 和 @weapp-tailwindcss/postcss-calc;工程 lesson 记录配置透传、版本契约和验证边界。

本地验证:

  • PostCSS:717 passed、3 skipped;postcss-calc:208 passed、3 skipped。
  • Tailwind v4 与 CI 定向测试:115 passed。
  • demo 矩阵及版本契约:72 passed。
  • 核心包及运行时依赖构建、定向 ESLint、agents:check、git diff --check 通过。
  • macOS 真实 Taro Webpack fixture:发布版/候选版各自的 development、production 构建和 static 基线比对通过。其他操作系统以当前提交的 CI 结果为准。

Related to #1194

@changeset-bot

changeset-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3f41010

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

PR 性能基准报告:部分结果

  • Commit:3f41010b9214
  • 生成时间:2026-09-12T19:08:52.219Z
  • Benchmark:success
  • Watch:未触发/无产物

总览

指标 结果
Build 稳态中位数平均变化 -0.90%
HMR 稳态 P95 平均变化 -1.10%
插件 Build 中位数平均变化 -1.69%
插件 HMR 门禁统计平均变化 -3.28%
Watch HMR p50 / p95 N/A / N/A ms
Watch RSS 峰值 / 最大增量 0.00 / 0.00 MB
Watch Heap 峰值 0.00 MB

Benchmark 项目矩阵

项目 平台 Base Build 冷/稳态(ms) Current Build 冷/稳态(ms) Build 变化 Base HMR median/P95(ms) Current HMR median/P95(ms) HMR 变化 状态
demo-mpx-tailwindcss-v4__mp-weixin mp-weixin 15786.84 / 15595.22 15495.30 / 15514.04 -0.70% 5310.23 / 6134.92 5251.10 / 6096.52 -0.63% ok
demo-taro-vite-react-tailwindcss-v4__mp-weixin mp-weixin 35343.94 / 35893.26 35876.48 / 35430.83 -0.54% 7899.71 / 8096.79 7733.96 / 7944.87 -1.88% ok
demo-taro-webpack-react-tailwindcss-v4__mp-weixin mp-weixin 31593.26 / 31827.78 31299.17 / 31212.56 -1.12% 5187.56 / 12047.23 5044.29 / 11698.87 -2.89% ok
demo-uni-app-vite-tailwindcss-v4__mp-weixin mp-weixin 7950.92 / 7973.07 7859.90 / 7842.17 -1.36% 970.08 / 2872.49 965.87 / 2869.86 -0.09% ok
demo-weapp-vite-tailwindcss-v4__mp-weixin mp-weixin 6291.95 / 6102.53 6135.61 / 6082.47 -0.79% 8207.13 / 8404.36 8188.98 / 8404.63 +0.00% ok

Benchmark 插件处理阶段

项目 Build Plugin base/current(ms) 变化 HMR Plugin base/current(ms) 变化
demo-mpx-tailwindcss-v4__mp-weixin 1437.00 / 1407.00 -2.09% 1502.00 / 1504.00 +0.13%
demo-taro-vite-react-tailwindcss-v4__mp-weixin 7395.00 / 7244.00 -2.04% 4009.00 / 3936.00 -1.82%
demo-taro-webpack-react-tailwindcss-v4__mp-weixin 9575.00 / 9379.00 -2.05% 9208.00 / 8093.00 -12.11%
demo-uni-app-vite-tailwindcss-v4__mp-weixin 2629.00 / 2614.00 -0.57% 913.00 / 919.00 +0.66%
demo-weapp-vite-tailwindcss-v4__mp-weixin N/A / N/A N/A N/A / N/A N/A

Benchmark 内存

项目 Build RSS base peak/steady(MB) Build RSS current peak/steady(MB) Peak 变化 HMR RSS base peak/steady(MB) HMR RSS current peak/steady(MB) Peak 变化
demo-mpx-tailwindcss-v4__mp-weixin 1246.40 / 1183.51 1252.57 / 1179.61 +0.49% 2236.30 / 2124.09 2206.52 / 2140.97 -1.33%
demo-taro-vite-react-tailwindcss-v4__mp-weixin 1643.16 / 1623.05 1604.69 / 1584.16 -2.34% 3038.39 / 3002.49 3043.65 / 3000.12 +0.17%
demo-taro-webpack-react-tailwindcss-v4__mp-weixin 1404.99 / 1308.43 1409.60 / 1390.41 +0.33% 1889.15 / 1793.55 1889.02 / 1810.19 -0.01%
demo-uni-app-vite-tailwindcss-v4__mp-weixin 764.50 / 764.50 759.50 / 759.48 -0.65% 1058.65 / 963.97 911.21 / 814.77 -13.93%
demo-weapp-vite-tailwindcss-v4__mp-weixin 593.27 / 568.01 618.41 / 579.70 +4.24% 1463.85 / 1413.09 1467.02 / 1390.40 +0.22%

Watch 明细

项目 平台 变更类型 样本数 ready(ms) avg/p50/p95/max(ms) 插件 p50/p95(ms) RSS peak/delta(MB) Heap peak(MB)

门禁与诊断

  • Benchmark 性能门禁:通过
  • Benchmark 缺失项目:无
  • Benchmark 错误:0
  • Watch 解析错误:0

运行链接

统计口径
  • Build/HMR 版本对照沿用现有 benchmark 的 base/current 和门禁统计。
  • Watch 仅报告当前提交的真实跨平台 watcher 结果,不额外运行 base;跨 shard 总览分位数按各报告摘要聚合,项目/平台行保留原始口径。
  • 未触发或缺失的场景显示为 N/A,不当作 0。

@sonofmagic sonofmagic changed the title test(postcss): cover Tailwind v4 spacing calc fix(css): 修复跨资产变量 calc 透传并统一 CI 版本契约 Sep 12, 2026
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