feat(engine): 抽离 Tailwind CSS 引擎包#211
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: fd7bace The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
Merged
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.
背景
tailwindcss-patch里有一批和 patch/install/CLI 无关的 Tailwind CSS 引擎能力,下游weapp-tailwindcss也会复用这些能力。这个 PR 将它们抽到独立包,方便tailwindcss-patch和下游直接消费,同时保留tailwindcss-patch现有入口的兼容导出。改动内容
@tailwindcss-mangle/engine包,承载候选类名提取、候选 token 分割、Tailwind v3 raw/style 生成、Tailwind v4 engine/source/source-scan/node-adapter/bare arbitrary values 等能力。tailwindcss-patch中对应 engine 文件改为从@tailwindcss-mangle/engine薄 re-export,原有公共 API 继续可用。tailwindcss-patch的 v4 source 文件保留 patch 配置到 engine source options 的适配函数:tailwindV4SourceOptionsFromPatchOptions、resolveTailwindV4SourceFromPatchOptions。tailwindcss-patch的 Node.js 版本要求提升到>=22.13.0,和新 engine 包保持一致。兼容性说明
下游目前从
tailwindcss-patch入口使用的splitCandidateTokens、候选提取、v3/v4 engine、v4 source 解析等 API 在本 PR 中仍保留导出;后续可以逐步迁移到@tailwindcss-mangle/engine。验证
pnpm buildpnpm testpnpm lint(仅有仓库既有fs-extra/lodash-eswarning)pnpm lint:stylepnpm check:boundariespnpm --filter @tailwindcss-mangle/engine testpnpm --filter @tailwindcss-mangle/engine test:typespnpm --filter tailwindcss-patch testpnpm --filter tailwindcss-patch test:typespnpm --filter tailwindcss-patch exec vitest run test/packaged-runtime-dependency.test.ts