fix(emitter): __esm 호이스팅 function 이름 충돌 방지 (Hermes)#687
Merged
Conversation
Smoke Test Results (CI)Smoke Test Results
Size Comparison (ZTS vs esbuild)
Average ratio: 0.94x | Smaller: 122 | Similar(±10%): 1 | Larger: 8
|
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)
|
class 선언을 bare function 대신 IIFE로 감싸서 이름 충돌 방지:
class X {...} → var X = (function() { function X() {...} return X; })()
이전 방식(bare function 선언)은 __esm 래핑에서 호이스팅되어
같은 이름의 named function expression과 충돌 가능 (Hermes Illegal constructor).
IIFE 스코프 안에 function 선언을 격리하여 외부 스코프에 누출 방지.
emitter의 문자열 치환 워크어라운드 제거 — transformer에서 근본 해결.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b0cefe1 to
6eab236
Compare
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
ES5 downlevel된
export default class Performance가function Performance()로 변환되면__esmfactory 밖에 호이스팅됨. factory 안의Performance_public = function Performance() { throw... }와 이름이 동일하여 Hermes에서Illegal constructor에러 발생.body에
= function NAME(패턴이 있으면 hoistedfunction NAME(을var NAME = function(으로 변환하여 이름 충돌 방지.Test plan
var Performance = function()변환 확인🤖 Generated with Claude Code