fix(shared): 修复已有目标值阻止单位替换的问题 - #49
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
默认
replace:true与skipDuplicate:true同时启用时,共享转换器发现已有目标属性/值就提前返回,导致源单位残留;已有声明不应阻止当前声明原位转换。例如 rem→rpx(rootValue=32)输入:
修复前输出
8rpx;64rpx;.25rem,修复后输出8rpx;64rpx;8rpx,保持三条声明的顺序和覆盖关系。replace:false的插入模式下生效;默认替换模式保留节点身份、顺序及!important,不删除重复声明。replace:false;零值转换测试现在要求源单位确实被转换。验证:新回归在旧实现中 51 条失败,修复后 78 条通过;完整测试 17 文件、347 条全部通过,无跳过。以下命令均通过:
pnpm install --frozen-lockfile CI=1 pnpm test --update=none pnpm lint pnpm build pnpm typecheck pnpm tsd pnpm check:cjs pnpm change status git diff --check本地为 macOS、Node 24.18.0、pnpm 12.5.1;跨平台结果以本 PR CI 为准。本 PR 不发布 npm。
此修复对应 weapp-tailwindcss 对 postcss-plugin-shared@1.1.6 的临时补丁;待上游正式发布并完成发布包复验后,下游再升级并移除补丁。
Related to sonofmagic/weapp-tailwindcss#1247