Repository navigation
Conversation
A stylesheet without any rule is now emitted empty instead of as a bare license banner. The shared base devup-ui.css of a per-file build with no base rules held only the banner, and every per-file sheet @imports it, so the banner shipped twice in one stylesheet chain. The @import itself is kept: a per-file sheet can be produced before a later module adds base rules, and bundlers inline the import anyway. The banner version was read by splitting a package.json line on ':' and kept the JSON comma (v1.0.83,). It is now parsed from the manifest (@devup-ui/wasm's npm version; the Cargo crates stay at 0.1.0). The banner stays on by default. A new licenseBanner plugin option (vite, webpack, next for webpack and Turbopack, rsbuild, bun) turns it off through the new setLicenseBanner/isLicenseBanner engine functions, identical in the NAPI and WASM engines. The serialized-CSS cache keys on the setting. The Devup UI benchmark apps turn it off. 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:
|
…umer setLicenseBanner and isLicenseBanner bring the native package to 32 exported functions; the consumer e2e still expected 30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#963 keeps the CSS state of an engine session in CssState; carry the license banner there too (stored inverted so a fresh session keeps it on), so the test guard and session swaps restore it. #990 counts 46 validated argument positions; setLicenseBanner.enabled makes 47. Set the banner next to #962's project-root setup in Rsbuild and Bun, keep both README sections, and pass #928's inputs Set in #962's webpack project-root assertion. 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.
Summary
A benchmark investigation (webpack, per-file mode, Next fixture
benchmark/next-devup-ui, 494 B of CSS) found two wasted pieces of output, and the owner asked for an option to turn the banner off.1. The banner shipped twice
devup-ui.cssstill held the 68 B license banner. Every per-file sheet (devup-ui-23.css)@imports it, so the banner appeared twice in one stylesheet chain. Minifiers keep/*!comments.StyleSheet::create_cssnow emits a sheet with no rules as an empty string, banner included (without_bare_header). The base file is still written, so the injected and@imported paths keep resolving (Turbopackdevup-ui.css?fileNum=N, Vite/Bunimport 'devup-ui.css', HMR rewrites, the webpack stale-pass checks).@importis kept: dropping it when the base is empty is not safe. A per-file sheet can be built before a later module adds base rules, for example the Turbopack coordinator waits only for its own bucket, and that sheet would never pull the base in. Bundlers resolve and inline the@import(css-loader, Lightning CSS), so it costs no shipped bytes. Once the base file is empty, nothing is duplicated.2.
v1.0.83,had a trailing commalibs/sheet/src/lib.rsread the version by splitting the"version": "1.0.83",line on:, which kept the JSON comma.package_versionparses the manifest withserde_json, which the crate already depends on. The source staysbindings/devup-ui-wasm/package.json, because the published npm version lives there; the Cargo crates are all0.1.0, soCARGO_PKG_VERSIONwould be wrong. Both engines build this crate and therefore share the banner. The docs and READMEs that quotedv1.0.82,were corrected.3. New
licenseBanneroption (defaulttrue)licenseBanner?: booleansits onDevupUIBasePluginOptionsnext toprefix/singleCssand is threaded into Vite, webpack, Next (webpack viaDevupUIWebpackPlugin, Turbopack via the coordinator process; part of the production setup handoff key), Rsbuild and Bun.setLicenseBanner(enabled)/isLicenseBanner()exports exist in both NAPI (bindings/devup-ui-binding:src/lib.rs,adapter.cjs,index.mjs,index.d.cts, argument validation) and WASM. The flag lives incss::license_banner, mirroringdebug. TheTestStateGuardrestores it.script.js), the compiler facade 29 → 31, and argument validation 46 → 47 positions, 19 → 20 functions and 272 → 276 cases. The e2e host and validation export lists are updated.licenseBanner: false. That covers everybenchmark/*devup-ui*/next.config.*, including the turbo, wasm, single, collapse and hybrid stylex/tailwind/vanilla-extract variants, plusvinext-devup-ui/vite.config.ts. Page content is untouched.Byte effect on
benchmark/next-devup-ui(per-file, 494 B total = 68 B base + 426 Bdevup-ui-23.css)Computed from the emitted bytes; no full Next builds were run. The banner is 68 B before the fix and 67 B after (no comma).
devup-ui.cssdevup-ui-23.csslicenseBanneron)licenseBanner: false(benchmark config)singleCss(benchmark/next-devup-ui-single, one sheet): −1 B by default (comma), −68 B withlicenseBanner: false.Snapshot / test changes
instasnapshots are unchanged. Two assertions that pinned the old behaviour were updated:libs/sheettest_create_css_with_global_selector: afterrm_global_cssthe sheet is empty, so the output is now""rather than a bare banner. An explicitassert_eq!(…, "")was added, and the snapshot ("") still matches throughunwrap_or_default().libs/sheetanddevup-ui-wasmtest_code_extracthelper: an empty sheet now equals"", notcreate_header().package_versioncases: valid, pretty-printed, missing, non-string, invalid JSON.license_header(true/false).without_bare_header.create_css, including that the per-file@importstays.test_license_banner.wasm-abibanner on/off/default.trueandfalse: Vite, webpack, Rsbuild, Next Turbopack, Next webpack forwarding, and Bun with the real WASM engine.Test plan
cargo test -j 2 --workspace(withCARGO_TARGET_DIRset): all green except 3extractorsnapshots that already fail onmain. These arestyled_computed_tag_tests::computed_tag_keeps_the_numbers_emotion_reads_as_pixelsandstyled_theme_prop_testscases 5 and 6. fix(extractor): mark compiled styled components for isStyledComponent #958 added the__devupStyledwrapper without updating these snapshots. This PR does not touch extractor code.cargo clippy --all-targets -- -D warnings,cargo fmtbun test --coverage(root): 6867 pass, 0 fail, 100% lines/functionsbun --config=./bunfig.vite.toml test --coverage:plugin.ts100%.serve-coherence-prereq-native(theme/alias) fails locally only because the temp path is an 8.3 short name (DEVFIV~1) that never matches the long id. That is environment-specific and unrelated to this change.bun run build(export-count gate) and nativenode build.mjs --target x86_64-pc-windows-msvce2e/binding/identity.mjsPASS;e2e/binding/validation.mjs: 276 cases, 47 positions, 0 failedgetCsswith the banner on, off and on an empty sheet: identicaltscthrough each package build;prettier --checkon the changed files (README.md, README_ko.md, libs/extractor/README.md and bindings/devup-ui-wasm/AGENTS.md were already unformatted on main)요약
벤치마크 조사에서 낭비되는 CSS 출력 두 가지가 확인됐습니다. 조사 대상은 webpack 파일별 모드의 Next 픽스처
benchmark/next-devup-ui(CSS 494 B)입니다. 오너 결정에 따라 배너를 끄는 옵션도 추가합니다.1. 배너가 두 번 실림
devup-ui.css에 68 B 라이선스 배너만 남았습니다. 모든 파일별 시트(devup-ui-23.css)가 이 파일을@import하므로, 한 스타일시트 체인에 배너가 두 번 들어갔습니다. 압축기는/*!주석을 남깁니다.without_bare_header). 베이스 파일은 계속 쓰므로 주입된 import와@import경로는 그대로 해석됩니다. 해당 경로는 Turbopack?fileNum=N, Vite/Bun의import 'devup-ui.css', HMR, webpack stale pass입니다.@import를 유지하는 이유: 베이스가 비었을 때@import를 빼는 것은 안전하지 않습니다. 이후 모듈이 베이스 규칙을 추가하기 전에 파일별 시트가 만들어질 수 있고(예: Turbopack 코디네이터는 자기 버킷만 기다림), 그 시트는 베이스를 다시 가져오지 않습니다. 번들러가@import를 인라인하므로 실제로 전송되는 바이트는 없고, 베이스가 비어 있으면 중복도 없습니다.2.
v1.0.83,뒤의 쉼표package.json줄을:로 나눠 읽어 JSON 쉼표가 남았습니다.serde_json으로 매니페스트를 파싱합니다. 버전 출처는 npm 버전이 있는bindings/devup-ui-wasm/package.json그대로입니다. Cargo 크레이트는 모두0.1.0이라CARGO_PKG_VERSION은 맞지 않습니다. 두 엔진이 같은 크레이트를 빌드하므로 배너도 같습니다.v1.0.82,를 인용하던 문서도 고쳤습니다.3. 새
licenseBanner옵션 (기본값true)DevupUIBasePluginOptions에 추가해 Vite, webpack, Next(webpack 및 Turbopack 코디네이터), Rsbuild, Bun에 전달합니다.setLicenseBanner(enabled)/isLicenseBanner()를 추가했습니다.licenseBanner: false를 넣었습니다(페이지 내용은 건드리지 않음).바이트 효과 (
benchmark/next-devup-ui, 파일별 모드)licenseBanner: false: 358 B (−136 B, −27.5%)singleCss: 기본 −1 B, 배너 끔 −68 B전체 Next 빌드 없이 출력 바이트로 계산했습니다.
스냅샷 / 테스트
""가 된다는 점을 반영해 단언 두 곳을 고쳤습니다.테스트 계획
cargo test -j 2 --workspace,cargo clippy --all-targets -- -D warnings,cargo fmt.main에서 이미 실패하는extractor스냅샷 3개는 예외입니다. #958이__devupStyled래퍼를 추가하면서 스냅샷을 갱신하지 않았고, 이 PR은 extractor 코드를 건드리지 않습니다.bun test --coverage: 6867 통과, 0 실패, 커버리지 100%serve-coherence-prereq-native는 로컬 8.3 단축 경로(DEVFIV~1) 문제로만 실패하며 이번 변경과 무관합니다.e2e/bindingidentity PASS, validation 276 케이스 0 실패getCss출력이 바이트 단위로 동일함을 확인tsc, 변경 파일prettier --check🤖 Generated with Claude Code