Repository navigation
Conversation
[Medium impact] The PR appears safe to merge. Reviews (2) · Last reviewed commit: "fix: retain synchronous scanning on unsu..." · Reviewed by Greptile |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
91185c0 to
ba1f09f
Compare
|
I rebased this PR on the latest Sent by an AI assistant on behalf of @RobinMalfait. |
|
Thanks for the PR! It has the same fix as #20487, which was opened earlier and is now merged, so I close this one as a duplicate. Your test also covered a new nested file after an edit. That case is now in the test of #20487 as well. Sent by an AI assistant on behalf of @RobinMalfait. |
Summary
Fix incremental source discovery in the WASI scanner.
This surfaced in a Vite dev server running inside WebContainer, which uses the WASI binding. Changing a utility class in JSX (for example,
bg-red-600tobg-blue-600) updated the markup, but the new utility was missing from the generated CSS. The filesystem change event arrived and Vite reran the Tailwind CSS transform, yet the reused scanner no longer reported the source files or discovered the new class.Touching the stylesheet, even by adding a comment, made the missing styles appear because it caused Tailwind to recreate the scanner. A fresh production build also generated the expected CSS. The issue was reproduced independently of Vite and WebContainer by reusing the WASI scanner in a standalone Node.js process.
The first scan uses synchronous directory traversal, but subsequent scans switch to the parallel walker. In the vendored
ignorecrate, the parallel walker's directory-entry constructors returnunsupported platformon targets other than Unix and Windows. Those errors are skipped, so subsequent scans lose the discovered file list and fail to detect changed or newly added files while continuing to return cached candidates.Keep synchronous traversal on those targets. Unix and Windows retain the existing initial-synchronous/subsequent-parallel strategy. This changes directory traversal only; the scanner's other parallel processing paths are unchanged.
Add a WASI regression covering an unchanged rescan, an edited source file, and a newly added nested source file. Explicit modification times avoid depending on filesystem timestamp resolution or sleeps.
Test plan
cargo test -p tailwindcss-oxide— 196 tests passed.pnpm --filter @tailwindcss/oxide run build:wasm— rebuilt the release WASI binding.index.htmland later scans missed edits and additions. After the fix, all four scan states retained the expected files and candidates.cargo fmt --package tailwindcss-oxide -- --check— passed.pnpm exec prettier --check integrations/oxide/wasm.test.ts— passed.The new integration test follows the existing Linux-only WASI test gating. Its scanner lifecycle was exercised directly on macOS; the packaged integration suite was not run locally.