docs(components): README §Setup 删掉 Tailwind 3 的 config 步骤,并修正预构建样式表的 specifier (#3780) - #3886
Merged
Merged
Conversation
…specifier (#3780) §Setup 第 1 步教读者写一个带 content 数组的 tailwind.config.js。该包是 Tailwind 4:它自己没有这个文件,postcss.config.js 加载 @tailwindcss/postcss,src/index.css 首行 @import 'tailwindcss' 且用 @theme / @custom-variant / @source。Tailwind 4 不经 CSS 里的 @config opt-in 不会加载 config 文件,所以照做的读者写出的是一个没人读的文件。 #3750 已把两行之上的 peer 行从 ^3.0.0 收窄到 ^4.2.1,底下这段散文没跟上。 先量再改,因为这一步的前提在 Tailwind 4 下是不可达而非拼错。对着真实安装 跑了四组消费者形状的 CSS 入口(Tailwind 4.3.3 + @tailwindcss/postcss,每组 一次真实编译):第 1 步原样 = 库的 utility 一条都没有;改写成 v4 的 @source 或补上显式 @config = 形状类 utility 回来了,主题类仍然全无。bg-primary / bg-background / border-input / ring-ring 只在声明其 token 的 @theme 块被 编译处存在,而该块在 src/index.css —— files 不发布它。所以「把第 1 步翻译成 @source」会是一条新的错指令,不是修好的旧指令:该步整步删除,替换它的段落 说清读者接下来最可能伸手去拿的 @source 行为什么也不是答案。 预构建样式表覆盖多少同样是量出来的:dist/index.js + dist/index.umd.cjs 里 所有 class 形状的 token(一个 node_modules glob 所能看到的全部表面)对着本包 自己的主题编译,产出 1331 条规则,全部已在发布的 dist/index.css 的 1410 条 之内 —— 零缺失。预构建 CSS 是扫描所能得到之物的严格超集。 存活下来的 import 步骤 specifier 也是错的:它写 dist/style.css,而 exports 映射里没有这个子路径(Node 报 ERR_PACKAGE_PATH_NOT_EXPORTED),该文件也不 存在(构建产物是 dist/index.css)。导出的拼法是 @object-ui/components/style.css —— 三个包的 demo、content/docs/guide/quick-start.md 以及 src/index.ts 里那句 把读者指向本 README 的注释,一直用的都是它。 Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Collaborator
Author
|
✅ 验收(PM,session 实物核验:头 裁定要点:
转 ready 并挂 auto-merge。越界 #3883(theming/troubleshooting 同根因两文件)、#3884(quick-start Generated by Claude Code |
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.
Fixes #3780
packages/components/README.md§Setup 第 1 步教读者写一个带content数组的tailwind.config.js。该包是 Tailwind 4:它自己没有这个文件,postcss.config.js加载@tailwindcss/postcss,src/index.css首行@import 'tailwindcss'并使用@theme/@custom-variant/@source。Tailwind 4 不经 CSS 里的@configopt-in 不会加载 config 文件,所以照第 1 步做的读者写出的是一个没人读的文件。#3750 已把两行之上的 peer 行从^3.0.0收窄到^4.2.1,底下这段散文没跟上。分支自
origin/main=56ff0916e09085a5430957d5c62a7e5dc1a80d82显式 sha 切出。先量再选:这一步不能翻译,只能删
issue 留了一格未定:第 1 步在 v4 下改写成
@source,还是整步删除。按分诊「先量再选」,对着真实安装测量而不是照着 v4 语法逐句翻译 —— 结论是这一步的前提在 Tailwind 4 下不可达,不只是拼错了。消费者形状的 fixture(
node_modules里装着本包,Tailwind 4.3.3 +@tailwindcss/postcss),四组 CSS 入口各跑一次真实编译。方向在跑之前先写进探针脚本头部,以便被证伪:@config)@source指向已安装包@configopt-inbg-primary/bg-background/border-input/ring-ring(整套 Shadcn 配色)只在声明其 token 的@theme块被编译处存在,而该块在packages/components/src/index.css——files只发布dist,不发布它。扫描已发布文件只能把形状类 utility(inline-flex/rounded-md/h-9)再生成一遍,永远补不回主题类。所以「改写为
@source」会是一条新的错指令:读者会得到一堆没有配色的组件,然后去排查一个不存在的路径问题。该步整步删除,替换它的段落明写读者接下来最可能伸手去拿的@source行为什么也不是答案。预构建样式表覆盖多少,也是量出来的
把
dist/index.js+dist/index.umd.cjs里所有 class 形状的 token 取出来(18099 个;这就是一个node_modulesglob 所能看到的全部表面),对着本包自己的主题编译,再与发布的dist/index.css逐选择器比对:零缺失 —— 预构建 CSS 是扫描所能得到之物的严格超集。
顺带修正:存活下来的 import 步骤 specifier 是错的
测量过程中发现第 2 步自己也不成立。它写
@object-ui/components/dist/style.css,而 manifest 的exports映射里没有这个子路径:而且
dist/style.css这个文件根本不存在(构建产物是dist/index.css)。导出的拼法是@object-ui/components/style.css—— 三个包的 demo(plugin-gantt/plugin-grid两处)、content/docs/guide/quick-start.md:57,以及packages/components/src/index.ts:14里那句把读者指向本 README 的注释,一直用的都是它;只有 README 自己是错的。这一条同 PR 修而不是另立,理由是它与本 issue 的裁决直接耦合:删掉第 1 步之后,第 2 步是 §Setup 里唯一剩下的样式指令,把一条
ERR_PACKAGE_PATH_NOT_EXPORTED的 specifier 留成唯一答案,比原来两步都错更糟。改后的 §Setup 是跑通过的
PR 里写给读者的那两行,按同一套 fixture 实测(180.27 kB,1447 条选择器):形状类、主题类、以及消费者自己源码里的 class 全部present。作为对照,
content/docs/guide/quick-start.md现行教法(同样两行再加一条@source node_modules)是 280.25 kB / 1461 条 —— 多 100 kB,换来 14 条没人用的选择器(已另立 #3884)。反向验证
doc 类改动没有可回装的谓词,可测等价物取三样,方向均在跑之前写定:
check-doc-links.mjs、check-control-bytes.mjs、doc-version-claims.test.ts(14 passed —— peer 行区块未动,restatement 断言仍在读同一行对同一 manifest)、check-changeset-presence.mjs、check-changeset-no-major.mjs、check-changeset-fixed.mjs、全仓turbo run type-check(78/78)。doc-version-claims的 inventory 无需联动:本次改动不新增版本字面量(新增散文只写不带点、不带运算符的Tailwind 4,该拼法被VERSION正则明确排除,test 自己的注释就记着这件事),peer 行区块一个字节没动。changeset
check-changeset-presence.mjs判定不欠(它只守每个包的src/**,README 在其守备面之外,header 里明写了这条边界)。仍按 #3749/PR3860 先例补一份空 frontmatter 的 changeset:不声明包,因为没有任何已发布产物改变形状、没有版本字面量移动,改好的 README 随该版本组的下一次发版一起出去。越界发现(均已查重后另立,本 PR 不碰)
content/docs/guide/theming.md§Tailwind Configuration 与troubleshooting.md§2 仍在教 v3tailwind.configcontent数组;后者尤其致命,它正是读者「class 没生效」之后落地的页面,而实测那个处方补不回主题类 utility。quick-start.md的两条@source node_modules行冗余:实测多 100 kB / 14 条无用选择器,且它补不回它看似要补的主题 utility。Generated by Claude Code