Skip to content

refactor(postcss): 迁出主包剩余 CSS AST 变换 - #1207

Merged
sonofmagic merged 2 commits into
codex/postcss-css-ownershipfrom
codex/postcss-css-transforms
Sep 15, 2026
Merged

sonofmagic merged 2 commits into
codex/postcss-css-ownershipfrom
codex/postcss-css-transforms

Conversation

@sonofmagic

@sonofmagic sonofmagic commented Sep 15, 2026

Copy link
Copy Markdown
Owner

摘要

#1206 之后把主包里剩余的 CSS AST 变换迁到 @weapp-tailwindcss/postcss

变更

  • 迁出 hoistUniAppXBorderPreflight / createUniAppXBorderPreflight
  • 迁出 Tailwind v4 preflight import 清理和 @theme 内厂商前缀 keyframes 清理
  • 迁出 legacy selector/unit 兼容、@apply 规则清理
  • 迁出空 CSS 块扫描与 finalizeMiniProgramCssStructure
  • 迁出 Harmony CSS class style value / @apply 展开
  • 主包只保留 Vue/SFC 注入、Vite marker 去重、@reference 路径解析和生成编排

验证

  • pnpm --filter @weapp-tailwindcss/postcss test
  • pnpm --filter weapp-tailwindcss exec vitest run test/bundlers/shared/generator-css/legacy-selectors.test.ts test/bundlers/shared/generator-css/legacy-compat.test.ts test/bundlers/final-css-cleanup.unit.test.ts test/uni-app-x/style-asset.test.ts test/uni-app-x/border-preflight.test.ts test/tailwindcss/v4-engine.test.ts test/ci/architecture-contract.test.ts

基于 #1206

把 hoist/create border preflight 和 preflight import / vendor keyframes
清理从主包挪到 @weapp-tailwindcss/postcss,主包只保留模板注入与生成编排。
@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

PR 性能基准报告:失败

  • Commit:87cbb2211be7
  • 生成时间:2026-09-15T09:58:44.875Z
  • Benchmark:failure
  • Watch:未触发/无产物

总览

指标 结果
Build 稳态中位数平均变化 +0.64%
HMR 稳态 P95 平均变化 +1.04%
插件 Build 中位数平均变化 +1.57%
插件 HMR 门禁统计平均变化 -0.26%
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 16336.30 / 16326.14 16766.23 / 16657.48 +2.63% 5598.42 / 6475.49 5414.33 / 6107.00 -5.69% ok
demo-taro-vite-react-tailwindcss-v4__mp-weixin mp-weixin 31924.49 / 31589.17 31862.17 / 31423.89 -0.57% 6539.53 / 7066.18 6856.05 / 7300.86 +3.32% ok
demo-taro-webpack-react-tailwindcss-v4__mp-weixin mp-weixin 24451.81 / 23906.52 24309.31 / 24638.45 +2.35% 4095.80 / 9097.50 4064.62 / 9315.32 +2.39% ok
demo-uni-app-vite-tailwindcss-v4__mp-weixin mp-weixin 7348.94 / 7317.23 7298.56 / 7328.14 -0.42% 901.11 / 2791.10 894.97 / 2824.38 +1.19% ok
demo-weapp-vite-tailwindcss-v4__mp-weixin mp-weixin 3670.17 / 3674.21 3641.20 / 3641.38 -0.79% 6964.22 / 7004.01 6969.28 / 7281.51 +3.96% ok

Benchmark 插件处理阶段

项目 Build Plugin base/current(ms) 变化 HMR Plugin base/current(ms) 变化
demo-mpx-tailwindcss-v4__mp-weixin 1498.00 / 1601.00 +6.88% 1546.00 / 1492.00 -3.49%
demo-taro-vite-react-tailwindcss-v4__mp-weixin 6545.00 / 6573.00 +0.43% 3821.00 / 3647.00 -4.55%
demo-taro-webpack-react-tailwindcss-v4__mp-weixin 7259.00 / 7236.00 -0.32% 6310.00 / 6444.00 +2.12%
demo-uni-app-vite-tailwindcss-v4__mp-weixin 2428.00 / 2411.00 -0.70% 857.00 / 899.00 +4.90%
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 1223.36 / 1148.13 1239.32 / 1165.19 +1.30% 2141.20 / 2005.58 2165.26 / 2019.83 +1.12%
demo-taro-vite-react-tailwindcss-v4__mp-weixin 1600.86 / 1496.78 1721.60 / 1516.65 +7.54% 3011.92 / 2931.68 3028.59 / 2988.05 +0.55%
demo-taro-webpack-react-tailwindcss-v4__mp-weixin 1283.83 / 1267.54 1496.60 / 1287.96 +16.57% 1881.18 / 1787.91 1817.44 / 1754.48 -3.39%
demo-uni-app-vite-tailwindcss-v4__mp-weixin 762.35 / 762.35 757.13 / 757.13 -0.69% 1077.88 / 987.79 1058.47 / 955.57 -1.80%
demo-weapp-vite-tailwindcss-v4__mp-weixin 592.15 / 569.56 588.35 / 573.42 -0.64% 1582.40 / 1479.59 1350.98 / 1323.58 -14.62%

Watch 明细

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

门禁与诊断

  • Benchmark 性能门禁:失败
  • Benchmark 缺失项目:无
  • Benchmark 错误:0
  • Watch 解析错误:0
  • 性能违规:demo-taro-vite-react-tailwindcss-v4__mp-weixin / hmrPluginP95:
  • 性能违规:demo-taro-webpack-react-tailwindcss-v4__mp-weixin / buildPeakRssMb:

运行链接

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

把 selector/unit 兼容、@apply 清理、空 CSS 块扫描以及 class style value
编译从主包挪到 @weapp-tailwindcss/postcss。Vite marker 去重仍留在主包。
@sonofmagic

Copy link
Copy Markdown
Owner Author

已继续迁出剩余 CSS 变换:

  • legacy selector / unit 兼容
  • @apply 规则清理
  • 空 CSS 块扫描与 finalizeMiniProgramCssStructure
  • Harmony CSS class style value / @apply 展开

Vite marker 去重、SFC <style> 拆分、@reference 路径解析仍留在主包。

@sonofmagic sonofmagic changed the title refactor(postcss): 迁出 uni-app x 边框与 v4 theme CSS 变换 refactor(postcss): 迁出主包剩余 CSS AST 变换 Sep 15, 2026
@sonofmagic
sonofmagic merged commit 87cbb22 into codex/postcss-css-ownership Sep 15, 2026
205 of 208 checks passed
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