Skip to content

feat(engine): 抽离 Tailwind CSS 引擎包#211

Merged
sonofmagic merged 2 commits into
mainfrom
feat/tailwindcss-engine
Jun 18, 2026
Merged

feat(engine): 抽离 Tailwind CSS 引擎包#211
sonofmagic merged 2 commits into
mainfrom
feat/tailwindcss-engine

Conversation

@sonofmagic

Copy link
Copy Markdown
Owner

背景

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 的适配函数:tailwindV4SourceOptionsFromPatchOptionsresolveTailwindV4SourceFromPatchOptions
  • tailwindcss-patch 的 Node.js 版本要求提升到 >=22.13.0,和新 engine 包保持一致。
  • 更新 package boundary 检查、workspace sync 脚本、packaged runtime dependency 测试和 changeset。

兼容性说明

下游目前从 tailwindcss-patch 入口使用的 splitCandidateTokens、候选提取、v3/v4 engine、v4 source 解析等 API 在本 PR 中仍保留导出;后续可以逐步迁移到 @tailwindcss-mangle/engine

验证

  • pnpm build
  • pnpm test
  • pnpm lint(仅有仓库既有 fs-extra / lodash-es warning)
  • pnpm lint:style
  • pnpm check:boundaries
  • pnpm --filter @tailwindcss-mangle/engine test
  • pnpm --filter @tailwindcss-mangle/engine test:types
  • pnpm --filter tailwindcss-patch test
  • pnpm --filter tailwindcss-patch test:types
  • pnpm --filter tailwindcss-patch exec vitest run test/packaged-runtime-dependency.test.ts

@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fd7bace

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@tailwindcss-mangle/engine Minor
tailwindcss-patch Minor
next-app Patch

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

@sonofmagic sonofmagic merged commit 2081f9e into main Jun 18, 2026
15 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 18, 2026
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