Skip to content

feat(plugins): add native-default engine selection infrastructure - #884

Draft
owjs3901 wants to merge 8 commits into
feat/napi-bindingfrom
feat/native-plugin-engine
Draft

owjs3901 wants to merge 8 commits into
feat/napi-bindingfrom
feat/native-plugin-engine

Conversation

@owjs3901

@owjs3901 owjs3901 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Refs #686. #796 (feat/napi-binding) 위에 쌓인 draft PR입니다. 공통 기반과 Webpack/Rsbuild/Vite/Bun 전환을 포함하며, Next → 최종 교차 검증을 각각 별도 단위로 진행합니다. #796이 먼저 병합되어야 합니다.

변경 내용

  • 공통 engine?: 'wasm' | 'native'의 기본값은 native입니다. Webpack, Rsbuild, Vite, Bun이 설정·reservation·추출·CSS 공급·지연 callback에서 같은 선택 compiler를 사용합니다. engine: 'wasm'을 유지하며 자동 fallback은 없습니다.
  • Vite의 native 기본값과 명시적 WASM 선택을 실제 설치한 CJS/ESM 소비자에서 검증합니다. 잘못된 shorthand는 compiler 선택 전에 거절하고, native 로드 실패는 정확한 플랫폼 패키지명과 원래 cause를 보존합니다.
  • Vite singleCss의 theme 변경은 현재 compiler CSS를 디스크에 발행하고 관련 CSS query/cache 변형을 무효화합니다. 원래 CSS URL과 Accept: text/css를 그대로 사용해 17px → 29px 및 변경된 ETag를 검증합니다. main에서 발견한 (m)의 수정입니다.
  • Webpack/Rsbuild의 실제 번호 stylesheet bucket 발행과 Rsbuild 첫 수정의 JS/CSS 일관성 수정도 포함합니다. Rsbuild는 첫 unflagged publication의 새 JS와 CSS를 함께 검증하며 suppressed pass는 자산을 발행하지 않습니다.
  • Bun은 factory마다 선택한 물리적 compiler를 setup·theme·state·추출·reservation·CSS·지연 callback·Tailwind watcher까지 유지합니다. 실제 Bun.build와 runtime 등록, CJS/ESM의 ./register, awaited ESM root preload를 검증합니다. 등록 API는 await register(options)로 완료를 기다립니다.
  • 같은 changepack에 plugin-utils/Webpack/Rsbuild/Vite/Bun의 Patch key가 있습니다. 중복 WASM peer를 제거하되 명시적 WASM 선택을 위한 일반 dependency는 유지합니다. native ABI/8개 플랫폼 패키지와 WASM size budget은 변경하지 않습니다.
  • Next의 전환은 아직 포함하지 않습니다. Next는 F 단위까지 명시적으로 WASM을 사용합니다. 클라이언트 스타일링 runtime은 추가하지 않습니다.

비교와 오류 계약

  • 선택하지 않은 backend를 로드하지 않으며, public entry와 지연 callback은 설치 위치의 같은 물리적 compiler를 사용합니다. Windows native realpath는 EISDIR에만 ordinary realpath를 사용합니다.
  • Vite standalone은 C0 초기, C1 완료된 supplier 변경, C2 완료된 theme 변경, 최종 publication의 모든 명시적 transform 반환/map, HTTP 원본 header/body/ETag, 전체 생성 디스크와 9개 compiler 상태를 통째로 엄격 비교합니다. 필드 제외나 정규화가 없습니다. 각 실행 안에서도 HTTP/디스크/live compiler CSS와 CSS-as-JS의 내장 CSS가 일치해야 합니다.
  • standalone entry는 A/B dependency를 명시적으로 HMR accept하고 최신 A/B class를 각각 보존해 부분 notification에서도 DOM class를 갱신합니다. A/B의 no-op self-accept는 사용하지 않습니다. 실제 client CSS HMR은 유지하며 generated event를 무시하거나 지연하지 않습니다. 이 제어된 fixture topology의 검증이며, 임의의 미수락 entry graph에서 raw HMR timestamp가 결정적이라고 주장하지 않습니다.
  • Vite production의 모든 발행 asset/map/state/disk/call 및 추출 출력은 비교합니다. 시간 순서 observation은 원본 sidecar에 보존하고 실행 간 순서 비교에 넣지 않습니다. opposite singleCss만 중간 추출 반환 outputs[*].css를 비교에서 제외하며 raw에는 유지합니다. 나머지 출력 필드는 모두 비교합니다. 각 A/B의 실제 class와 매핑된 CSS asset에서 shorthand 규칙을 별도로 검사합니다.
  • Rsbuild만 기존 승인 목록 compilationProofs, generations[*].outputs[*].css를 실행 간 equality에서 제외합니다. 원본은 보존하고 필드 누락·목록 밖 변화·raw 불변성을 control로 검사합니다. 발행 CSS/HTTP/디스크는 제외하지 않습니다.
  • Bun의 같은 순서 35개 비교는 모든 필드를 비교합니다. 별도 opposite publication 6개만 phases[0].outputs[*].css를 비교에서 제외하며 원본과 전체 차이 sidecar 6개를 유지하고 필드 존재를 검사합니다. Output::new는 그 순간의 전체 sheet를 반환하지만 Bun 발행은 getCss를 사용합니다. 나머지 code/map/metadata·발행 asset·df/dist·9개 상태·call은 모두 엄격 비교합니다. 41개 전체 비교라고 주장하지 않습니다.
  • 동일 runtime/진입형식의 constructor/prototype, 모든 string/symbol own key, 비열거 descriptor/value와 cause를 비교합니다. stack 원문은 보존하고 형식과 prefix를 검사합니다. Bun이 부가하는 originalLine/originalColumn의 존재 차이만 허용하며, 존재하는 값의 숫자 형식과 descriptor를 검사합니다.
  • A의 InvalidEngineError, NativePlatformError, NativeCompilerLoadError, HostBuildTargetError를 사용하며 D는 새 public 오류 종류나 source 문법 제한을 추가하지 않습니다. 기존 resolver callback 예외가 메시지로 변환되어 identity/cause를 잃는 동작은 별도 main 후속이며 이 PR에서 바꾸지 않습니다.

D 검증

  • 최종 commit tree 40beb3890307de08a8374b75f86f4e7e6340d3bc: 47개 whole-file path, 1898 gross / 2032 churn입니다. standalone은 포맷 후 650행이며 전체 누적 예약은 8369 / 10282 / 96 path로 승인된 한도 안입니다.
  • frozen install, 새 native/WASM 및 전체 package dist build, dist 검증, strict cargo fmt/clippy와 전체 ESLint를 통과했습니다. 같은 제품 빌드에서 test-only fixture를 보정한 뒤 전체 ESLint와 fresh packed 검증을 다시 완료했습니다.
  • root 6864/0, 89 snapshots/24077 expectations, Vite 879/0이며 functions/lines 100%입니다. Node와 Bun의 focused control은 각각 117/0입니다. threshold나 coverage 제외 목록은 완화하지 않았습니다.
  • 새 packed 소비자에서 Node/Bun × default/native/wasm × CJS/ESM × per-file/single의 production/map 및 retained error/late/guard를 포함해 66 실행 / 36 비교가 통과했습니다. 두 CSS mode의 Node cut은 native/native/WASM/WASM 8 실행 / 6 전체 비교, 별도 Node defaults-on 초기·최종 control도 8 실행 / 6 비교를 통과했습니다.
  • 실제 RSC build/browser는 engine unset/native/wasm × singleCss 0/1의 여섯 조합 모두 29/29, 합계 174개가 통과했습니다. skip/flaky/unexpected는 0이며 각 foreground Job 종료 뒤 남은 프로세스는 0입니다.
  • D commit 207749ea의 정상 exact-tree hook이 1148.357초에 통과했고 push를 완료했습니다. hook에서도 root 6864/0·Vite 879/0 및 functions/lines 100%를 유지했습니다. 최종 Job active process는 0, limit/watchdog 실패는 없습니다. 이 commit의 exact-head hosted CI 41441251927는 성공으로 완료되었습니다. 전체 페이지의 27개 job을 확인했으며 기능 job 25개 모두 성공, deploy-pages/release 2개는 기존 조건에 따라 skip입니다.

E 검증

  • E는 13개 whole-file path, 645 gross / 733 churn이며 누적 예약은 9014 / 11015 / 105 path입니다. factory 기본 native 선택의 실제 코드와 native/WASM CSS를 assertion 전에 기록해 이전 D 제품에서 실패하고 E에서 성공하는 회귀 검증을 포함합니다.
  • frozen install, 새 native/WASM와 전체 dist build, dist 검증, strict fmt/clippy/ESLint를 통과했습니다. root 6869/0, 89 snapshots/24088 expectations와 Vite 879/0/2635 expectations 모두 functions/lines 100%입니다. Node/Bun engine control은 각각 117/0, built Bun regression은 10/0입니다.
  • 새 설치·이동한 packed Bun 소비자에서 45 실행, 35개 같은 순서 전체 비교 + 6개 opposite publication 비교가 통과했습니다. 실제 Bun.build 36회와 runtime/awaited preload source 실행 13회를 포함합니다. 두 source의 실제 class에 대응하는 left/right 19px, theme/supplier, 외부 map, 미사용 eligible source의 magenta 부재, residual 0, 오류/cause identity와 지연 callback의 미선택 backend 9개 상태 불변을 검사합니다.
  • 테스트 격리는 native와 WASM 상태·debug·resolver를 함께 복원합니다. 기존 snapshot·threshold·coverage 제외 설정은 바꾸지 않았습니다. packed fixture는 기존 지원 filter에 맞는 .ts를 사용하며 plain .js 지원 범위를 확대하지 않았습니다. 모든 완료 Job의 최종 active process는 0입니다.
  • E commit 340167b8, tree 71cdabf0e527cd1b8ab013827a416cfc4c2dd994의 정상 exact-tree hook이 1174.827초에 통과했고 push를 완료했습니다. hook에서도 root 6869/0·89 snapshots/24090 expectations, Vite 879/0 및 양쪽 functions/lines 100%를 유지했습니다. 최종 Job active process는 0, limit/watchdog 실패는 없습니다. 이 commit의 exact-head hosted CI 41456985109 attempt 2는 완료되었으며 25개 job 모두 성공했습니다. 첫 실행의 publish job은 제품 install/build/test 전에 Cargo cache 복원 중 runner 디스크 부족으로 실패했고, GitHub annotation은 runner _diag/Worker log 기록의 No space left on device를 명시했습니다. 해당 PR의 실패한 Cargo cache 한 개를 제거한 뒤 실패 job만 한 번 재실행했으며 source·workflow·threshold 변경이나 native producer 재실행은 없었습니다. 위 D CI 성공과 구분하며, F는 아직 private 검증 단계이고 이후 새 commit은 별도 exact-head CI 검증이 필요합니다.

남는 범위와 후속

  • 기존 lifecycle/repeat/opposite matrix의 dev-server cold/warm, supplier/config 변경, closed/restart 요청 workload는 제거했습니다. production 두 빌드와 map, opposite 최종 상태, error/late/guard/focused control은 유지합니다. dev 중간 parity는 위 Node cut이 담당합니다.
  • Vite의 Bun dev-cut, Bun defaults-on, defaults-on HMR 변경 조합은 검증하지 않았습니다. Bun adapter의 production/runtime/preload 검증을 Vite dev 검증으로 대신 주장하지 않습니다. Node standalone은 실제 브라우저에서 entry HMR callback을 실행하는 테스트가 아니며, 여섯 RSC browser 조합은 실제 정적 build의 소비 검증입니다.
  • 동일 프로세스에서 독립 build 동시 격리는 지원하지 않습니다. Windows 로컬 결과가 다른 플랫폼 delivery나 Linux Rust coverage를 대신하지 않습니다. WASM 크기 예외는 build-time 성능/benchmark 실패에 적용하지 않습니다. native host build cache는 G 뒤 실제 CI job 비용을 측정한 후 별도로 결정합니다.
  • main 675f7e20의 CI 41424526678는 10개 job 모두 성공했습니다. 현재 branch는 이를 parent에 임의 병합하지 않았으며, 안전한 commit 경계 뒤 별도 조율로 feat(binding): add native compiler and public platform packages #796 → 이 branch 순서의 통합과 검증을 진행합니다.
  • 기존 main 후속 기록은 보존합니다: (a)/(b) resolver 중복 호출·원래 cause 유실, (g) Webpack/Rsbuild stylesheet sentinel, (h) CJS/ESM별 ShorthandConfigError 혼합 instanceof, (i) production bucket 완료 write, (k) Rsbuild 첫 수정 publication, (l) output directory self-watch입니다. (m) Vite theme CSS/cache는 이번 D에서 회귀 검증과 제품 수정을 포함했습니다. 별도 main 포팅 상태를 이 PR의 전환 완료와 혼동하지 않습니다.
  • (j) 지정된 원래 main 범위는 아래와 같으며 이 PR은 해당 수집 설정을 수정하지 않습니다:

On main 81d6d92, the root playwright.config.ts uses testDir ./e2e with testIgnore only for landing-dev.spec.ts and the default testMatch, so Playwright also loads the five e2e/release/*.test.mjs Node-test modules (guarded-process-surface, guarded-process, process-memory, process-ownership, windows-process) and their node:test cases run as a side effect inside the landing Playwright run (seen in main CI 41276479109, landing-next-e2e job 124764917582). #796 added its own e2e/binding/package tests to testIgnore so they are not loaded; the main fix (Playwright collecting only its *.spec.ts files, the release Node tests run only by their own runner) is a separate main-based PR. It is not changed by #796 or #884.

owjs3901 and others added 4 commits October 31, 2026 06:49
Refs #686

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Refs #686

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Refs #686

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Refs #686

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
bun.setup.ts 100.00% <100.00%> (ø)
packages/bun-plugin/src/plugin.ts 100.00% <100.00%> (ø)
packages/next-plugin/src/plugin.ts 100.00% <100.00%> (ø)
packages/plugin-utils/src/compiler.ts 100.00% <100.00%> (ø)
packages/plugin-utils/src/index.ts 100.00% <100.00%> (ø)
packages/plugin-utils/src/native-platform.ts 100.00% <100.00%> (ø)
packages/plugin-utils/src/shared.ts 100.00% <ø> (ø)
packages/rsbuild-plugin/src/plugin.ts 100.00% <100.00%> (ø)
packages/rsbuild-plugin/src/reservation.ts 100.00% <100.00%> (ø)
...e-plugin/src/__tests__/plugin-lifecycle-fixture.ts 100.00% <100.00%> (ø)
... and 8 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

owjs3901 and others added 4 commits November 2, 2026 05:22
Refs #686

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Refs #686

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
Share the selected compiler across Vite configuration, reservation, transforms and delayed callbacks, and refresh published single CSS after theme changes.

Refs #686

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Retain the selected compiler across Bun setup, reservation, source extraction, CSS publication and delayed callbacks, with explicit WASM selection and no fallback.

Refs #686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant