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>
…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>
Add @devup-ui/metro-plugin (experimental, private 0.x): withDevupUI() points babelTransformerPath at a transformer that runs codeExtractNative on files importing Devup UI and chains to the upstream transformer (the config's, else Expo's, else React Native's). Build errors carry loc and a code frame so Metro reports file:line:col, the upstream AST locations are moved back to the source through the engine's map, and the cache key covers the upstream key, devup.json, the engine version and the options. Add apps/expo (Expo SDK 58, RN 0.88) and a path-filtered CI job that exports iOS and Android bundles and checks no @devup-ui/react module or runtime placeholder is left. Part of #411. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 10 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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 2 of the React Native plan: Metro plugin + Expo example.
Builds on #1039 (now merged into
main).What
@devup-ui/metro-plugin(0.0.0,private: true, README marked experimental; nothing is published).withDevupUI(config, options)setstransformer.babelTransformerPathto its transformer. The transformer runscodeExtractNativethroughloadCompiler()(native engine by default,engine: 'wasm'as in the other plugins), then hands the code to the upstream transformer:upstreamTransformeroption → the config'sbabelTransformerPath(Expo's / RN'sgetDefaultConfigset it) →@expo/metro-config/babel-transformer→@react-native/metro-babel-transformer.package,devupFile,include,runtime(defaulttrue),engine,upstreamTransformer. The settings reach Metro's worker processes through one environment variable, since Metro passes Babel transformers no options.options.platform.node_modulesskipped except@devup-ui/*andinclude, the same rule as the other plugins); everything else goes upstream untouched without loading the engine.getCacheKey= upstream key + devup.json and itsextendschain + engine package version + settings.DevupUIBuildErrorwithlocand a code frame, so Metro shows file:line:col (verified withexpo export):StyleSheet.createabove the code, which shifts lines. The locations of the AST the upstream transformer returns are moved back through the engine's map, so Metro's source map points at the file as written (checked on the exported bundle:onPress,useState, ... map to their original lines)._pressedstay build errors (PRs 3–5).apps/expo: minimal Expo SDK 58 / React Native 0.88 (New Architecture) app usingBox,Flex,Text,Image,Input,Buttonfrom@devup-ui/reactwith static styles.native-changesdecides whether the change touches native code (libs/extractor/src/native/,libs/binding/, the two engine bindings,packages/metro-plugin/,packages/plugin-utils/,apps/expo/, the workflow);exporuns only then (D10).exporunsexpo export --platform ios --platform android --no-bytecode --source-mapson Linux andcheck-bundle.mjsasserts each bundle has noCannot run on the runtime, no module of@devup-ui/reactin its source map, and the compiledStyleSheetstyles.packages/metro-pluginMinor (private, so changepacks does not publish it).Install impact for web developers
apps/expois a workspace member (as D10 proposed), sobun installalso installs Expo/RN:bun.lock830 KB → 989 KB (+19%).bun installafter pulling this branch: ~17 s locally (warm cache, Windows). The install still succeeds without any native toolchain (Expo's postinstalls are blocked by Bun by default)."!apps/expo"inworkspaces(Bun supports negation) would move the app to its own install; the CI job would then install it separately.Tests
packages/metro-plugin(upstream transformer and engine mocked, plus one test through the real WASM engine and the module Metro loads).tscin the package build.expo exportfor iOS and Android + bundle check pass.#411의 일부입니다. React Native 계획의 PR 2(Metro 플러그인 + Expo 예제)입니다.
#1039(이제
main에 머지됨) 위에서 작업했습니다.내용
@devup-ui/metro-plugin(0.0.0,private: true, README에 experimental 표시, 배포하지 않음).withDevupUI(config, options)가transformer.babelTransformerPath를 자체 transformer로 바꿉니다. 이 transformer는loadCompiler()(기본 native 엔진, 다른 플러그인처럼engine: 'wasm'선택 가능)로codeExtractNative를 실행한 뒤 상위 transformer로 넘깁니다. 상위 transformer는upstreamTransformer옵션 → config의babelTransformerPath(Expo/RN의getDefaultConfig가 설정) →@expo/metro-config/babel-transformer→@react-native/metro-babel-transformer순서로 정합니다.package,devupFile,include,runtime(기본true),engine,upstreamTransformer. Metro는 Babel transformer에 옵션을 넘기지 않으므로 설정은 환경 변수 하나로 worker 프로세스에 전달합니다.options.platform을 씁니다.node_modules는 다른 플러그인과 같은 규칙으로@devup-ui/*와include만 포함). 나머지는 엔진을 로드하지 않고 그대로 상위로 넘깁니다.getCacheKey= 상위 키 + devup.json과extends체인 + 엔진 패키지 버전 + 설정.loc와 code frame을 가진DevupUIBuildError가 되어 Metro에 file:line:col로 표시됩니다(expo export로 확인, 위 예시 참고).StyleSheet.create를 코드 위로 끌어올려 줄이 밀리므로, 상위 transformer가 돌려준 AST의 위치를 엔진의 맵으로 원래 위치로 옮깁니다. 그래서 Metro 소스맵이 작성한 파일 그대로를 가리킵니다(export한 번들에서onPress,useState등이 원래 줄로 매핑되는 것을 확인)._pressed는 계속 빌드 에러입니다(PR 3–5).apps/expo:@devup-ui/react의Box,Flex,Text,Image,Input,Button을 정적 스타일로 쓰는 최소 Expo SDK 58 / React Native 0.88(New Architecture) 앱.native-changes가 native 관련 파일(libs/extractor/src/native/,libs/binding/, 두 엔진 바인딩,packages/metro-plugin/,packages/plugin-utils/,apps/expo/, 워크플로)이 바뀌었는지 판단하고, 그때만expo가 실행됩니다(D10).expo는 Linux에서expo export --platform ios --platform android --no-bytecode --source-maps를 실행하고,check-bundle.mjs로 각 번들에Cannot run on the runtime이 없고, 소스맵에@devup-ui/react모듈이 없으며, 컴파일된StyleSheet스타일이 있는지 확인합니다.packages/metro-pluginMinor(private이라 changepacks가 배포하지 않음).웹 개발자 설치 영향
apps/expo는 D10 제안대로 workspace 멤버라서bun install이 Expo/RN도 설치합니다.bun.lock830 KB → 989 KB(+19%).bun install: 로컬에서 약 17초(캐시 있음, Windows). native 툴체인 없이도 설치는 성공합니다(Expo의 postinstall은 Bun이 기본으로 막음).workspaces에"!apps/expo"(Bun이 부정 패턴 지원)를 넣어 앱을 별도 설치로 분리하고, CI job에서 따로 설치하면 됩니다.테스트
packages/metro-plugin라인/함수 coverage 100%(상위 transformer와 엔진 mock, 실제 WASM 엔진과 Metro가 로드하는 모듈을 거치는 테스트 1개 포함).tsc통과.expo export(iOS, Android)와 번들 검사 통과.🤖 Generated with Claude Code