Repository navigation
fix(plugins): forget the styles of source files deleted in watch mode - #951
Merged
Merged
Conversation
A deleted or renamed source file is never extracted again, so its globalCss, its own bucket and its class names stayed in the shared sheet for the rest of the session (and in webpack's persisted state). The engine gains removeFile(filename), exposed on NAPI and WASM: it drops the file's global CSS and global-selector atoms, its own bucket with its keyframes and class scope when no other file collapses into it, and its bucket membership. File numbers stay, since they are handed out by count. Atoms in buckets other files share stay: nothing records which file added them. Vite calls it on a `delete` watch change and writes the changed sheets again; webpack and Rsbuild call it for the removed files of a watch run (webpack watch mode also saves the pruned state); the Next.js Turbopack coordinator forgets the files gone since whenever an edited file is extracted again. Bun builds start from a reset engine and need nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
…amespace 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:
|
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
coordinator.ts: import both existsSync (main, deleted-source removal from #951) and statSync (theme stamps). The /extract handler refreshes the theme first, then records the source for deleted-file removal. coordinator.test.ts: keep both new describe blocks (theme reload, deleted sources) side by side. plugin.ts: keep registerProjectTheme, and write theme.d.ts inside it even when the interface is empty, as main now does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
Conflicts: - bun-plugin/src/plugin.ts: main (#916) kept the empty-theme fallback with a console.error; kept this branch's writeDataFiles, which rethrows on the first load and only clears the theme on a Tailwind CSS reload. - bun-plugin/src/__tests__/plugin.test.ts: replaced main's "registers an empty theme" expectation with this branch's rejection tests. - rsbuild-plugin/src/plugin.ts: kept registering the theme after reading the Tailwind CSS files and returning { tailwindFiles, themeError }. - webpack-plugin/src/plugin.ts: kept clearing themeError after a successful load; main's #945 warnings and #951 file removal merged cleanly around it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
Keep main's check_resolved_path/resolved_module re-exports beside the session re-exports in libs/binding. removeFile (#951) only touches the file map, canonical map, class map and global sheet, which CssState and EngineState already swap per session; a new session test pins that forgetting a file in one session leaves another session's styles alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
coordinator.ts: import both existsSync (main, deleted-source removal from #951) and statSync (dependency stamps). When main's removeDeletedSources forgets a deleted file, it now drops that file's transform cache entry too: the file's styles leave the sheet, so a restored file with the same source must extract again instead of answering from the cache. coordinator.test.ts: keep both new describe blocks (transform cache, deleted sources), and add a test that a deleted file restored unchanged is extracted again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
Brings in main through #963, including removeFile (#951). The ABI now holds 33 names: main's 30 plus createSession, selectSession and dropSession. Updated script.js, the native typings and README, the e2e ABI list and consumer, and compiler-types (32 without Output). Validation covers 48 positions in 21 functions (288 cases), and the summary reports 21 functions. The corpus keeps both new scenarios and adds remove-file-stays-in-its-session, which checks that removeFile only forgets the file in the live session (28 scenarios). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
No conflicts. openCompilerSession wraps every compiler function in a Proxy that selects the session first, so removeFile from main (#951) runs on the scoped session like every other call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
Conflicts: - rsbuild-plugin/src/plugin.ts: kept this branch's shared extractModule handler for the source and MDX post transforms, using main's hoisted excludeRegex (#914) in it. - vite-plugin/src/plugin.ts: kept both extractModule (this branch) and main's removeSource (#951); extractModule uses main's excludeRegex, and the pre transform stays a SOURCE_FILE_RE check plus extractModule. - webpack-plugin/src/__tests__/plugin.test.ts (no textual conflict): the MDX post-rule test now expects #914's exact package exclude regex. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
main's coordinator (#951) tracked deleted sources in a module-level extractedSources map, while this branch moved all extraction tracking into each app's CoordinatorState. extractedSources now lives in that state too, so each app forgets only its own deleted files. removeFile is read from the session-scoped compiler the plugin hands over, so it runs on the app's own engine session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
No conflicts. main's sheet changes (rm_file and the stylesheet stack from #951) merge beside the property_order sort in prop_cmp; the css, sheet, binding-core, wasm and extractor tests pass unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
Conflicts: - rsbuild-plugin/src/plugin.ts: imports keep both resolveDevupFile / resolveProjectPath (this branch) and setupWarning (#945). - webpack-plugin/src/__tests__/plugin.test.ts: kept both the "project root" describe and main's deleted-source tests (#951). Main's new paths now follow the project root, not the cwd: - webpack: removeFiles (#951) names deleted files relative to this.root, and the import graph warning (#945) checks this.root/src for a missing directory. Added a test for removeFiles with a context other than cwd. - Rsbuild: the import graph warning checks projectRoot/src. - Bun: the file numbering warning checks <root>/src. Vite's removeSource and Rsbuild's removeFiles use absolute ids already. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
4 of 6 tasks
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
…rent merges (#990) * test(rsbuild-plugin): expect the MDX post transform in the hook order #957 recorded the hook order before #960 added an order: post transform for .mdx modules. Both landed, so main registers two source transforms and the test failed. Label the MDX transform and expect it last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(wasm): count removeFile in the documented argument positions #952 counted 45 validated argument positions; #951, merged alongside it, added removeFile.filename, so main validates 46 and the ABI gate failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- 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
PLG-07 / NXT-09: watch·dev 모드에서 소스 파일을 삭제하거나 이름을 바꾸면 그 파일의 스타일이 시트에 계속 남았습니다. 삭제된 파일은 다시 추출되지 않기 때문에
globalCss(전역 규칙은 페이지 전체에 적용됨), 파일 자신의 버킷, 클래스 맵 항목이 세션이 끝날 때까지 남았고, webpack watch 모드는 이 상태를 디스크에 저장해 다음 실행에도 이어졌습니다.엔진 (
libs/*, NAPI, WASM)removeFile(filename): boolean을 NAPI와 WASM 양쪽에 추가했습니다. 시트가 바뀌었는지를 돌려줍니다.css/@import/@font-face/layer 순서)와 전역 셀렉터 atom을 공유 버킷과 자기 버킷 양쪽에서 지웁니다.libs/sheet:rm_global_css에서 전역 atom 정리를rm_global_atoms로 분리하고rm_file을 추가했습니다.script.js,consumer.mjs,host.mjs,wasm-abi.test.ts, 인자 검증 descriptor와 케이스, README).remove-file-drops-its-own-styles시나리오를 추가했습니다. 로컬에서 네이티브와 WASM의 기록이 같은 것을 확인했습니다.플러그인
watchChange의delete이벤트에서removeFile을 호출합니다. 시트가 바뀌면 base 시트와 지금까지 쓴 버킷 시트를 다시 씁니다(내용이 바뀐 파일만 디스크에 씀).compiler.removedFiles를 cwd 기준 이름으로removeFile합니다. watch 모드는 정리된 sheet/classMap/fileMap도 저장합니다. CSS 모듈은 매 컴파일마다 시트에서 다시 만들어집니다.removedFiles를 transform이 쓰는 이름(atom 모드는 POSIX)으로removeFile합니다. 오래된 스타일시트는 기존 finishModules 비교가 다시 빌드합니다.removeFile하고 base CSS와 상태 파일을 다시 씁니다. 파일을 지우면 그 파일을 import하던 파일이 수정되므로 이 시점에 정리됩니다.Bun.build는 매번 엔진을 리셋하고 시작하며(beginBuild), Bun 런타임에는 CSS를 쓰는 곳이 없고, 플러그인 API에 삭제 이벤트도 없습니다.겹치는 PR
libs/binding/src/lib.rs, WASMlib.rs를 같이 수정하지만 다른 부분입니다.Refs #686
Test plan
cargo test -p sheet --lib rm_,cargo test -p devup-ui-binding-core --test remove_file,cargo test -p devup-ui-wasm --lib remove_filecargo clippy -p css -p sheet -p devup-ui-binding-core -p devup-ui-binding -p devup-ui-wasm --all-targets -- -D warnings,cargo fmt --all -- --checke2e/binding/host.mjs를 돌려 새 시나리오 기록이 같은지 확인,removeFile인자 검증 케이스 통과bun test --coverage packages/webpack-plugin packages/rsbuild-plugin packages/next-plugin: 4398개 통과, 수정한 파일 커버리지 100%bunfig.vite.toml):plugin.ts100%. 실패한serve-coherence-prereq-native2개는origin/main에서도 같은 이유로 실패하고(로컬 환경 문제),serve-coherence-final-native는 따로 돌리면 통과합니다.wasm-abi.test.ts, 수정한 패키지의tsc --noEmit🤖 Generated with Claude Code