Repository navigation
feat: 支持可选的 var fallback 单位转换 - #53
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.
NutUI 等组件的
var(--nutui-48px,48px)当前会保留 fallback 中的48px,而普通48px已转换成小程序单位。本次给规则引擎和 pxtrans 新增默认关闭的transformVarFallbacks:开启后,designWidth: 375输出var(--nutui-48px,96rpx),并继续保护变量名、字符串、URL 与未闭合的var()。规则引擎使用 CSS token 和显式块栈识别任意深度 fallback,保留自定义
unitRegex的完整覆盖优先级;默认关闭路径继续使用原流式实现。pxtrans 保持平台单位大小写、阈值、Harmony 和rootValue无符号回调参数的兼容约定,完整处理符号与科学计数法。rem wrapper 不受此选项影响。已同步中英文 API、迁移说明、网站 recipes 和中文 release intent,未手工修改包版本。
本地验证:
pnpm lint、pnpm typecheck、pnpm build(含网站)、pnpm tsd全部通过。CI=1 pnpm test --update=none:25 个文件、420 条测试通过,新增 15 条行为回归;规则引擎代码语句覆盖率 100%。pnpm check:cjs:新增 NutUI 真实示例,验证两包 packed ESM/CJS 的 fallback 输出;全部入口与 subpath 通过。replace: false。Refs weapp-tailwindcss/weapp-tailwindcss#1318