Repository navigation
perf(plugins): leave the runtime package out of the prepasses - #1029
Merged
Merged
Conversation
formatJson counted a trailing comma after every array, so an array that ends its object and fills exactly 80 columns was split over lines while Prettier keeps it on one. main's refresh wrote such a row (devup-ui-large-turbo-wasm), and `bun run lint` rejects history.json again. The comma now counts only when one follows, and history.json is rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared class-slot reservation and the Next production prewarm followed every import of @devup-ui/react into its own modules (23 on the benchmark app), read and resolved them, and extracted them before the bundler started, although extracting them yields no style. Both now skip the runtime package, from the app and from other Devup UI packages; a test pins that its modules add nothing to a sheet. The webpack reservation seeded file numbers for those modules ahead of the project's own files, so per-file class prefixes now start at `a-` on the benchmark app instead of `x-`; the styles are the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 19, 2026
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
Before the bundler starts, two passes read and extract source ahead of time: the shared class-slot reservation (webpack, Rsbuild, Vite, Bun) and the Next production prewarm (Turbopack and Next webpack). Both followed every import of
@devup-ui/reactinto the runtime package's own modules (23 files on the benchmark app:index.jsre-exporting every component, hooks, stores,stylex.js...). Resolving and extracting them goes through the JS module resolver for each re-export, but extracting them yields no style (checked on all 34 modules ofpackages/react/dist: no CSS, no stylesheet, no base-style update).Both passes now skip
@devup-ui/reactand its subpaths, from the app and from other Devup UI packages (@devup-ui/componentsstill is read and extracted).RUNTIME_PACKAGE/isRuntimePackagelive in plugin-utils, and a new test extracts every module ofpackages/react/srcinto one sheet and pins that it stays empty, so the assumption is checked.If an app keeps a runtime import of
@devup-ui/react(e.g.useTheme), the bundler's loader still extracts those modules on demand exactly as before; they just are no longer done ahead of time.Measurements (local, Windows, 4 alternating A/B runs, native engine)
next.setup(DEVUP_UI_PROFILE, single-turbo)next-devup-ui: CPU in Devup frames (--cpu-prof, all compilers)Turbopack: about -25 ms on the config step that runs before Turbopack starts (the Devup part of
Running next.configwent from ~45 ms to ~20 ms over Tailwind's). Webpack: about -105 ms of CPU per build (the reservation and prewarm run once per compiler: server, edge-server, client). The CI benchmark job of this PR shows the full table.Output
Byte-identical CSS and page JS (md5) for
next-devup-ui-single,next-devup-ui-single-turbo,next-devup-ui-turboandnext-devup-ui-collapse.next-devup-ui(webpack, per-file) has the same CSS bytes but a different class prefix: the webpack reservation seeds file numbers for its inputs in path order, and the runtime package's modules (../../packages/react/dist/...) used to take numbers 0-22 ahead ofsrc/app/page.tsx. Page classes werex-a...x-oindevup-ui-23.css; nowa-a...a-oindevup-ui-0.css. Numbers can only get smaller, so per-file names are never longer.Notes
reservation-discovery.ts); output re-checked against current main: same results as above.Test plan
@devup-ui/react(also@devup-ui/react/stylex, also when imported by@devup-ui/components) while still collecting@devup-ui/componentspackages/react/srcadds nothing to a single sheetbun test packages/plugin-utils packages/next-plugin packages/webpack-plugin: 4543 pass, 0 fail; 100% forruntime-package.ts,reservation-discovery.ts,prewarm.tstest:types(in its build)요약
번들러가 시작되기 전에 소스를 미리 읽고 추출하는 패스가 두 개 있습니다. 공유 class-slot 예약(webpack, Rsbuild, Vite, Bun)과 Next 프로덕션 prewarm(Turbopack, Next webpack)입니다. 둘 다
@devup-ui/react의 import를 런타임 패키지 내부 모듈까지 따라갔습니다(벤치마크 앱에서 23개: 모든 컴포넌트를 다시 내보내는index.js, hooks, stores,stylex.js...). 이들을 resolve하고 추출하면 다시 내보내기마다 JS 모듈 resolver를 거치지만, 추출해도 스타일이 하나도 나오지 않습니다(packages/react/dist의 34개 모듈 전부 확인: CSS 없음, 스타일시트 없음, base style 갱신 없음).이제 두 패스 모두
@devup-ui/react와 그 하위 경로를 앱에서든 다른 Devup UI 패키지에서든 건너뜁니다(@devup-ui/components는 여전히 읽고 추출).RUNTIME_PACKAGE/isRuntimePackage는 plugin-utils에 두었고, 새 테스트가packages/react/src의 모든 모듈을 한 시트로 추출해 비어 있음을 고정하므로 이 전제가 검증됩니다.앱이
@devup-ui/react를 런타임에 import하면(예:useTheme) 번들러 로더가 해당 모듈을 이전과 똑같이 필요할 때 추출합니다. 미리 하지 않을 뿐입니다.측정 (로컬, Windows, A/B 교대 4회, native 엔진)
next.setup(DEVUP_UI_PROFILE, single-turbo)next-devup-ui: Devup 프레임 CPU (--cpu-prof, 전체 컴파일러)Turbopack: Turbopack 시작 전 config 단계 약 -25 ms (
Running next.config에서 Tailwind 대비 Devup 몫이 약 45 ms에서 약 20 ms로). Webpack: 빌드당 CPU 약 -105 ms (예약과 prewarm은 컴파일러마다 실행: server, edge-server, client). 전체 표는 이 PR의 CI benchmark job에 나옵니다.출력
next-devup-ui-single,next-devup-ui-single-turbo,next-devup-ui-turbo,next-devup-ui-collapse의 CSS와 페이지 JS가 바이트 단위로 동일(md5).next-devup-ui(webpack, per-file)는 CSS 바이트는 같고 클래스 접두사만 다릅니다. webpack 예약은 입력 파일 번호를 경로 순으로 매기는데, 런타임 패키지 모듈(../../packages/react/dist/...)이src/app/page.tsx보다 앞에서 0-22번을 가져갔습니다. 페이지 클래스가devup-ui-23.css의x-a...x-o에서devup-ui-0.css의a-a...a-o가 됩니다. 번호는 작아지기만 하므로 per-file 이름이 길어지는 일은 없습니다.참고
reservation-discovery.ts의 같은 import 블록). 현재 main 기준으로 출력을 다시 확인했고 결과는 위와 같습니다.테스트
@devup-ui/react(그리고@devup-ui/react/stylex,@devup-ui/components가 import하는 경우도)를 건너뛰고@devup-ui/components는 계속 수집packages/react/src의 모든 모듈을 추출해도 단일 시트에 아무것도 추가되지 않음bun test packages/plugin-utils packages/next-plugin packages/webpack-plugin: 4543 pass, 0 fail;runtime-package.ts,reservation-discovery.ts,prewarm.ts100%test:types(빌드에 포함)🤖 Generated with Claude Code