Repository navigation
Conversation
Every plugin takes `stylex: { styleResolution }`, StyleX's babel plugin
option, validated before setup (`StylexConfigError`) and handed to the
engine through the new `setStylexStyleResolution()` binding export.
- `property-specificity` (default) expands nothing: the sheet writes a
longhand after its shorthands (#974).
- `application-order` gives a static `create()` key the `null` resets
StyleX's table lists, and reads its aliases, so the key applied last wins
in `stylex.props()` and within a namespace.
- `legacy-expand-shorthands` splits a shorthand into its longhands as
StyleX's table does, `!important`, `containIntrinsicSize` and `listStyle`
included.
Both tables are generated from @stylexjs/babel-plugin 0.19.1. A later key
of a static namespace replaces an earlier one of the same name. Dynamic
namespaces and `float`/`clear` logical values stay as written. Devup UI's
own APIs ignore the option.
Refs #690
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in main through #974 and #978. In the vite, rsbuild, webpack and bun plugins, the setupWarning (#945) imports and main's createNodeModulesExcludeRegex sit beside normalizeStylexOptions, and styleResolution is still set next to registerShorthands wherever main configures the engine. The ABI now has 31 names: main's removeFile plus setStylexStyleResolution. Updated the count in script.js, the consumer, the native README and typings, and compiler-types (30 without Output). Validation covers 47 positions in 20 functions (276 cases), and the summary reports 20 functions. The e2e host lists both names and counts 27 corpus scenarios. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in main through the base branch. Its merge with main (0e409e3, 9f46158) already resolved property_order.rs, extract_style_from_expression.rs, the style_results_read_as_values snapshot and sheet/lib.rs against #974, so this merge applies cleanly and origin/main adds nothing beyond it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Supports the StyleX babel plugin's
styleResolutionoption (SX-13). Until now the docs only stated that the default (property-specificity) was used.Option
stylex: { styleResolution }.normalizeStylexOptions()in@devup-ui/plugin-utils→ new binding exportsetStylexStyleResolution()(both WASM and NAPI) → thecss::style_resolutionglobal → the extractor's StyleX path.registerShorthands. Next Turbopack passes the option in the coordinator process, and Next webpack passes it through the webpack plugin. It is also included in the production setup handoff key.'property-specificity'.StylexConfigErrorwhen the plugin is created, before a compiler is chosen. Passing it directly to the binding also produces an error for the same reason on the Rust side.resetBuildStatekeeps this setting, like shorthands.resetStateForTestingrestores the default.Behavior by policy (static
stylex.create()namespace)The
expansionstables of StyleX 0.19.1@stylexjs/babel-pluginwere generated from source and carried over as-is (libs/extractor/src/stylex_resolution_tables.rs).property-specificity(default): nothing is expanded. Thanks to fix(sheet): write a longhand after every shorthand that covers it #974's sheet order (longhands after shorthands), the longhand wins regardless of order. Existing output does not change.application-order: like StyleX, a shorthand key getsnullresets for the longhand keys it covers.stylex.props(s.top, s.pad), the laterpaddingclearspadding-top. In the reverse order both remain andpadding-topwins by sheet order. As a result, whatever is applied last wins.{ paddingTop, padding }onlypaddingremains.marginStart→margin-inline-start,blockSize→height,left/right↔insetInline*resets.legacy-expand-shorthands: shorthands are split into longhands at build time.padding: '1px 2px'→padding-top,padding-inline-end,padding-bottom,padding-inline-start.splitValue: the inside of functions and strings is not split, and a trailing!importantis attached to each part.containIntrinsicSize(combiningauto 10px) andlistStyle(type/position/image classification) are also handled by StyleX's rules.default,:hover,@media) are expanded per condition. Keys inside a top-level':hover': {...}object are expanded too.firstThatWorks()fallback on a shorthand,allunderapplication-order, and an unsplittablelistStyleunderlegacy-expand-shorthands. The StyleX default (propertyValidationMode: 'silent') silently drops these keys; here they are reported as errors.[stylex] WARNING: Shorthand propertywarning is printed only under property-specificity.Not covered
float/clearlogical values (inline-start, etc.): values are left as-is, because StyleX's polyfill relies on its own runtime variable (--stylex-logical-start).'padding-block'): like the StyleX tables, only camelCase keys are expanded. Keys spelled the same in both forms, like'padding', are expanded.':hover'object is merged as a single key, as before. StyleX merges per property, like:hover_paddingTop. Resets/replacement within the same object do apply.include()merging (fix(extractor): let later StyleX keys override an include() #975). Once fix(extractor): let later StyleX keys override an include() #975 is merged, it needs checking whether keys of included namespaces also go through the same tables.css(),styled, Box props) ignore the option and keep the [전수조사/A] 조합 우선순위: 뒤에 쓴 스타일이 이기게 (빌드 타임 정적 해결) #688/fix(extractor): let a later shorthand replace the longhands it covers #978 behavior.Docs, changepack
styleResolution" section todocs/migration/stylex. docs(landing): state StyleX resolution policy and legacy include() #969 also adds a resolution policy explanation to the same page. Whichever is merged later must combine those sections into one.@devup-ui/wasm,@devup-ui/binding,plugin-utils, vite/rsbuild/webpack/next/bun plugin (Patch)Overlapping PRs
extract_style_from_stylex.rs. This PR only changes the key collection inextract_stylex_namespacetoKeys/resolved_keys.Test plan
extractor::stylex_resolutionunit tests: per-policy tables,splitValue, box/pair defaults,!important,containIntrinsicSize,listStyleclassification and errors, and that every table name is camelCaseextractor::stylex_resolution_extract_tests: verified through real extractionstylex.props()merging in both directions: under all three policies:hoverobjects, kebab keysnullshorthand resets, the 3 build errors, longhand fallbacks keptcss::style_resolution: name parsing, an unknown value is an error and the existing policy is kept; the test-state guard saves and restores itdevup-ui-wasm:set_stylex_style_resolution_internalcargo test -p css -p extractor -p devup-ui-binding-core -p devup-ui-wasm --tests -j 2passescargo clippy -p css -p extractor -p devup-ui-binding-core -p devup-ui-wasm -p devup-ui-binding --all-targets -- -D warnings,cargo fmt --allplugin-utilsstylex-options.test.ts,wasm-abi.test.ts(export list and actual WASM behavior), setup/rejection tests for the five pluginshost.mjs), argument validation slot, valid/unknown/malformed scenarios added to the native/WASM comparison corpus요약
StyleX babel plugin의
styleResolution옵션을 지원합니다(SX-13). 지금까지는 기본값(property-specificity)만 쓴다고 문서에 적었을 뿐입니다.옵션
stylex: { styleResolution }을 받습니다.@devup-ui/plugin-utils의normalizeStylexOptions()→ 새 binding exportsetStylexStyleResolution()(WASM, NAPI 둘 다) →css::style_resolution전역 → extractor의 StyleX 경로.registerShorthands와 같은 시점에 설정합니다. Next Turbopack은 coordinator 프로세스에서, Next webpack은 webpack plugin으로 옵션을 넘깁니다. production setup handoff key에도 넣었습니다.'property-specificity'입니다.StylexConfigError를 던집니다. compiler를 고르기 전입니다. binding에 직접 넘겨도 Rust 쪽에서 같은 이유의 오류가 납니다.resetBuildState는 shorthands처럼 이 설정을 유지합니다.resetStateForTesting은 기본값으로 되돌립니다.정책별 동작 (static
stylex.create()namespace)StyleX 0.19.1
@stylexjs/babel-plugin의expansions표를 소스에서 생성해 그대로 옮겼습니다(libs/extractor/src/stylex_resolution_tables.rs).property-specificity(기본): 아무것도 펼치지 않습니다. #974의 sheet 순서(longhand가 shorthand 뒤) 덕분에 순서와 관계없이 longhand가 이깁니다. 기존 출력은 바뀌지 않습니다.application-order: StyleX처럼 shorthand key에 그것이 덮는 longhand key의nullreset을 붙입니다.stylex.props(s.top, s.pad)에서는 뒤의padding이padding-top을 지웁니다. 반대 순서면 둘 다 남고 sheet 순서로padding-top이 이깁니다. 결과적으로 마지막에 적용한 것이 이깁니다.{ paddingTop, padding }이면padding만 남습니다.marginStart→margin-inline-start,blockSize→height,left/right↔insetInline*reset.legacy-expand-shorthands: shorthand를 빌드 시점에 longhand로 나눕니다.padding: '1px 2px'→padding-top,padding-inline-end,padding-bottom,padding-inline-start.splitValue를 따릅니다: 함수·문자열 안은 나누지 않고, 끝의!important는 각 부분에 붙습니다.containIntrinsicSize(auto 10px결합)와listStyle(type/position/image 분류)도 StyleX 규칙대로 처리합니다.default,:hover,@media)은 조건별로 펼칩니다. 최상위':hover': {...}객체 안의 key도 펼칩니다.firstThatWorks()fallback,application-order의all,legacy-expand-shorthands에서 나눌 수 없는listStyle. StyleX 기본값(propertyValidationMode: 'silent')은 이 key를 조용히 버리는데, 여기서는 오류로 알립니다.[stylex] WARNING: Shorthand property경고를 찍습니다.다루지 않는 것
float/clear논리값(inline-start등): 값 그대로 둡니다. StyleX의 polyfill은 자체 런타임 변수(--stylex-logical-start)에 기대기 때문입니다.'padding-block'): StyleX 표처럼 camelCase key만 펼칩니다.'padding'처럼 둘의 철자가 같은 key는 펼칩니다.':hover'객체는 지금처럼 하나의 key로 병합합니다. StyleX는:hover_paddingTop처럼 속성별로 병합합니다. 같은 객체 안의 reset/대체는 적용됩니다.include()병합(fix(extractor): let later StyleX keys override an include() #975)과는 아직 엮지 않았습니다. #975가 merge되면 포함된 namespace의 key도 같은 표를 거치는지 확인해야 합니다.css(),styled, Box props)는 옵션을 무시하고 [전수조사/A] 조합 우선순위: 뒤에 쓴 스타일이 이기게 (빌드 타임 정적 해결) #688/fix(extractor): let a later shorthand replace the longhands it covers #978 동작을 유지합니다.문서, changepack
docs/migration/stylex에 "Shorthands andstyleResolution" 절을 추가했습니다. #969도 같은 페이지에 resolution 정책 설명을 추가합니다. 둘 중 나중에 merge되는 쪽에서 해당 절을 하나로 합쳐야 합니다.@devup-ui/wasm,@devup-ui/binding,plugin-utils, vite/rsbuild/webpack/next/bun plugin (Patch)겹치는 PR
extract_style_from_stylex.rs가 겹칩니다. 이 PR은extract_stylex_namespace의 key 수집만Keys/resolved_keys로 바꿨습니다.테스트 계획
extractor::stylex_resolution단위 테스트: 정책별 표,splitValue, box/pair 기본값,!important,containIntrinsicSize,listStyle분류와 오류, 표 이름이 모두 camelCase인지extractor::stylex_resolution_extract_tests: 실제 추출로 확인stylex.props()양방향 병합: 세 정책 모두:hover객체, kebab keynullshorthand reset, 빌드 오류 3종, longhand fallback 유지css::style_resolution: 이름 파싱, 알 수 없는 값은 오류이고 기존 정책 유지. test-state guard가 저장·복원하는지devup-ui-wasm:set_stylex_style_resolution_internalcargo test -p css -p extractor -p devup-ui-binding-core -p devup-ui-wasm --tests -j 2통과cargo clippy -p css -p extractor -p devup-ui-binding-core -p devup-ui-wasm -p devup-ui-binding --all-targets -- -D warnings,cargo fmt --allplugin-utilsstylex-options.test.ts,wasm-abi.test.ts(export 목록과 실제 WASM 동작), 다섯 plugin의 설정·거부 테스트host.mjs), argument validation slot, native/WASM 비교 corpus에 valid/unknown/malformed 시나리오 추가Refs #690
🤖 Generated with Claude Code