fix(extractor): read theme tokens, import objects and @layer blocks in globalCss - #699
Merged
Merged
Conversation
…n globalCss Global rules wrote $tokens raw instead of converting them, import objects with unquoted url/query keys were dropped, and a top-level @layer key flattened the selectors it held into invalid declarations. Refs #685. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
Changepacks@devup-ui/wasm@1.0.82 → 1.0.83 - bindings/devup-ui-wasm/package.jsonPatch
@devup-ui/bun-plugin@1.0.21 → 1.0.22 - packages/bun-plugin/package.jsonPatch
@devup-ui/components@0.1.59 → 0.1.60 - packages/components/package.jsonPatch
@devup-ui/next-plugin@1.0.89 → 1.0.90 - packages/next-plugin/package.jsonPatch
@devup-ui/rsbuild-plugin@1.0.66 → 1.0.67 - packages/rsbuild-plugin/package.jsonPatch
@devup-ui/vite-plugin@1.0.72 → 1.0.73 - packages/vite-plugin/package.jsonPatch
@devup-ui/webpack-plugin@1.0.70 → 1.0.71 - packages/webpack-plugin/package.jsonPatch
|
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
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.
전수조사 #682의 작업 묶음 E(#685) 중 globalCss 부분 FN-05, FN-06, FN-07을 해결합니다.
문제
$token을 변환하지 않고 그대로 출력했습니다(body{color:$text}). global 속성을 쓰는 함수(write_global_props)가 token 변환을 하는write_declaration을 거치지 않았기 때문입니다.'@layer utilities': { '.x': {...}, '.y': {...} }를 selector 하나로 취급했습니다. 그래서.x와.y가 사라지고@layer utilities{color:blue;color:red}라는 잘못된 CSS가 나왔습니다.imports: [{ url: 'a.css', query: 'screen' }]처럼 따옴표 없는 키를 쓴 객체 import가 조용히 사라졌습니다.변경
write_global_props가write_declaration을 사용해 class 규칙과 똑같이$token을 변환합니다.'@layer name'키는 그 안의 selector map을 해당 layer에 넣습니다.'@layer base': { '@layer reset': ... }는base.reset이 됩니다.'@layer a, b','@layer a b')은 위치가 표시되는 빌드 에러입니다.get_str_by_property_key로 읽어 식별자 키와 문자열 키를 모두 처리합니다.새로 생기는 오류
globalCss의'@layer ...'키에 식별자 하나가 아닌 이름을 쓴 경우. 오류 위치와 함께globalCss() cannot use ...로 보고합니다. 지금까지는 잘못된 CSS가 조용히 출력되던 경우입니다.검증
cargo clippy -D warnings와cargo test --workspace통과. 새 테스트: layer 블록·중첩·잘못된 이름, import 객체, global$token@import "a.css" screen;@import "b.css";…@layer b{body{background:var(--bg);color:var(--text)}}@layer utilities;@layer utilities{.x{color:blue}.y{color:red}}같은 묶음의 CSS-01(global CSS와 import의 작성 순서)과 CSS-02(layer 선언 순서)는 다음 PR에서 다룹니다. 추출 결과가 순서 없는 집합이라 순서 정보를 추가해야 하고, sheet 직렬화 호환도 따져야 하기 때문입니다.