Repository navigation
Conversation
Add a Native target to ExtractOption that turns Devup UI elements into React Native components with their styles hoisted into one StyleSheet.create per file, and expose it as codeExtractNative in the WASM and NAPI bindings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tive into the ABI checks Snapshot every supported prop shape, platform and build error of the native target, list codeExtractNative in the binding ABI guards and the cross-engine corpus, document it and add its changepack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
…as literals are
A dynamic length such as p={x} reached React Native unscaled, so x = 2
gave padding 2 where the web build gives 8px for the constant. Wrap
values read at runtime in a file-local function that converts them as
the build converts a literal: numbers and numeric strings take the
property's scale (four pixels a unit for lengths), px lengths become
numbers and rem/em lengths become pixels. Colors, keywords and other
text pass through as they are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… conversion in the changepack 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.
Part of #411 — PR 1 of the React Native plan: core native target, static subset.
What
ExtractOptiongainstarget: ExtractTarget::{Web, Native(NativeTarget { platform, runtime })}.Webis the default and its path is untouched: no existing snapshot changed, and the full extractor suite (13,351 tests) passes as is.libs/extractor/src/native/emitter. Users keep importing from@devup-ui/react(no new package). The import is rewritten toreact-nativeunder the same local names, style props become style objects hoisted into oneStyleSheet.createper file, and they are passed throughstyle.Box→View,Text→Text,Image→Image(src→source),Input→TextInput,Button→Pressable, andFlex/VStack/Center→Viewwith their flex defaults.p={1}→padding: 4).%andautostay strings.m="1px 2px"→marginVertical/marginHorizontal;border→ width/style/color;gap→rowGap/columnGap;bg→backgroundColor/backgroundImage.const __u = (v, s) => …, no runtime import). It is emitted only when used:p={x}→{ padding: __u(x, 4) }, sox = 2gives 8 (same as web'sconst x = 2→8px);"3px"→ 3,"1rem"→ 16,"2"→ 8, while%/autoand anything else stay as they areopacity,flex,zIndex,aspectRatio):__u(x, 1), so numeric strings become numbersfontWeight: passed throughlineHeightnumber is a font-size multiple on the web but pixels on React Native ("24px"works). Units the build cannot resolve without the window (vw/vh) reach React Native as they are. For reference, a truly dynamic value on the web goes raw into a CSS variable, so a number is not scaled there either; this PR doesn't change the web.a ? x : y,a && x) are supported._ios/_android/_webresolve at build time fromplatform.file:line:col) with a reason and a fix. That includes responsive arrays, theme tokens and variants, and_pressed/_active. In this PR these need the runtime from later PRs, andruntime: falsenames itself in the message.codeExtractNative(filename, code, packageName, platform, runtime)is exposed in the WASM and NAPI bindings, returning the existingOutputwith nocss. The ABI guards, the validation oracle and the cross-engine corpus include it.Example
compiles for
iostoTests
native/tests.rs: every supported shape, each platform, and every build error message.react-native-targetcorpus scenario run on both engines.cargo clippy -D warnings,cargo fmtand ESLint are clean.#411의 일부입니다. React Native 계획의 PR 1(코어 native 타깃, 정적 부분집합)입니다.
내용
ExtractOption에target: ExtractTarget::{Web, Native(NativeTarget { platform, runtime })}를 추가했습니다. 기본값은Web이고 웹 경로는 그대로입니다. 기존 스냅샷은 하나도 바뀌지 않았고, extractor 전체 테스트(13,351개)도 수정 없이 통과합니다.libs/extractor/src/native/이미터를 새로 추가했습니다. 사용자는 계속@devup-ui/react에서 import합니다(새 패키지 없음). import는 같은 로컬 이름으로react-native로 바뀌고, 스타일 prop은 파일마다 하나의StyleSheet.create로 끌어올린 뒤style로 전달합니다.Box→View,Text→Text,Image→Image(src→source)Input→TextInput,Button→PressableFlex/VStack/Center→flex 기본값을 가진Viewp={1}→padding: 4)을 그대로 따릅니다.%와auto는 문자열로 남습니다.m="1px 2px"→marginVertical/marginHorizontal,border→ width/style/color,gap→rowGap/columnGap,bg→backgroundColor/backgroundImage로 바뀝니다.const __u = (v, s) => …, 런타임 import 없음)로 빌드 시점의 리터럴과 똑같이 런타임에 변환합니다. 이 함수는 쓰일 때만 넣습니다.p={x}→{ padding: __u(x, 4) }이므로x = 2이면 8입니다(웹에서const x = 2→8px과 같음)."3px"→ 3,"1rem"→ 16,"2"→ 8이 되고,%/auto와 그 밖의 값은 그대로 남습니다.opacity,flex,zIndex,aspectRatio):__u(x, 1)이므로 숫자 문자열이 숫자가 됩니다.fontWeight: 그대로 전달합니다.lineHeight숫자는 웹에서 글꼴 크기의 배수지만 React Native에서는 픽셀입니다("24px"는 정상 동작). 창 크기 없이는 풀 수 없는 단위(vw/vh)는 그대로 전달됩니다. 참고로 웹은 진짜 동적 값을 CSS 변수에 그대로 넣기 때문에 웹에서도 숫자는 배율이 적용되지 않습니다. 이 PR은 웹을 바꾸지 않습니다.a ? x : y,a && x)을 지원합니다._ios/_android/_web은 빌드 시점에platform으로 결정됩니다.file:line:col)가 됩니다. 반응형 배열, 테마 토큰과 변형,_pressed/_active도 여기에 포함됩니다. 이들은 이후 PR의 런타임이 필요하며,runtime: false이면 메시지에 그 사실이 표시됩니다.codeExtractNative(filename, code, packageName, platform, runtime)를 노출했습니다. 기존Output을css없이 반환합니다. ABI 가드, 검증 오라클, 두 엔진 비교 코퍼스에도 포함했습니다.테스트
native/tests.rs에 insta/rstest 101개 케이스(변환 함수를 Boa로 실행하는 테스트 포함)가 있습니다. 지원하는 모든 형태, 각 플랫폼, 모든 빌드 에러 메시지를 다룹니다.react-native-target코퍼스 시나리오를 추가했습니다.cargo clippy -D warnings,cargo fmt, ESLint 모두 통과합니다.🤖 Generated with Claude Code