fix(bundler): __esm 모듈 간 live binding 적용 (rolldown 방식)#744
Merged
Conversation
rolldown 방식으로 __esm 모듈 간 import를 live binding으로 변경: - function declaration을 __esm 밖으로 호이스팅 (canonical 변수 직접 참조) - __esm → __esm import에서 스냅샷 복사 대신 preamble init + canonical rename - init 함수는 의존 모듈 init 호출만 담당 (가벼움) - export_getter_overrides 맵으로 __export lazy getter가 올바른 이름 참조 효과: - RN 번들 크기 ~3.5% 감소 (스냅샷 복사 코드 제거) - es5-rn 통합 테스트 2/17 → 15/17 통과 (+13) - 순환 참조 시 live binding으로 TDZ 문제 자연 해결 Closes #741 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Smoke Test Results (CI)Smoke Test Results
Size Comparison (ZTS vs esbuild)
Average ratio: 0.94x | Smaller: 122 | Similar(±10%): 1 | Larger: 8
|
- deinit에 export_getter_overrides.deinit() 추가 (메모리릭 수정) - errdefer에 export_getter_overrides 해제 추가 (에러 경로 릭 방지) - live_binding_syms HashMap 제거 → export_getter_overrides.contains()로 대체 (중복 구조 제거) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Benchmark Results (CI)macos-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
ubuntu-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
windows-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
|
live binding 각 파트별 검증 테스트 6개 추가: - function 호이스팅 + canonical 변수 참조 (스냅샷 없음) - init에 의존 init 호출만 포함 (__toCommonJS 없음) - namespace import → exports_xxx 유지 - re-export → source module canonical name 참조 - class는 __esm init 안에 유지 (block-scoped) - RN platform __esm 래핑 + live binding 동작 simplify 수정: - export_getter_overrides deinit/errdefer 누락 수정 - live_binding_syms 중복 구조 제거 (export_getter_overrides로 통합) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Platform.js → Platform.js 같은 self-import(순환 자기 참조)에 live binding을 적용하면 변수가 선언되지 않아 ReferenceError 발생. self-import는 기존 require_rewrites 경로로 처리하도록 제외. Co-Authored-By: Claude Opus 4.6 (1M context) <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
__toCommonJS().default) 대신 preamble init + canonical renameexport_getter_overrides맵으로 namespace import 등의 __export getter 정합성 보장효과
__toCommonJS스냅샷 코드 제거)Test plan
zig build test전체 통과bundle-smoke.test.ts99/99 통과es5-rn.test.ts15/17 통과 (나머지 2개는 기존 이슈)__fbBatchedBridgeConfig— 정상)Closes #741
🤖 Generated with Claude Code