Repository navigation
Oxide: a long-lived Scanner whose scan() forgets the classes of files that changed or were deleted #20702
Replies: 2 comments
|
Hi @YevheniiKotyrlo! You've highlighted an important architectural nuance in 1. Why
|
|
Hello @YevheniiKotyrlo Sir, I went through the discussion and the reproduction steps. This looks like a valid issue, especially for integrations that maintain a single A few points worth considering:
My recommendation: Per-file candidate tracking seems like the stronger long-term solution because it maintains an accurate relationship between source files and their extracted candidates, while also supporting incremental rebuilds efficiently. Thanks for providing a reproducible example. It makes the underlying issue much easier to understand. If this answer solves all your doubts, could you please mark my answer as solved? Or, if the issue is still unresolved, please let me know what doubts you have. |
Uh oh!
There was an error while loading. Please reload this page.
A long-lived
Scannerreturns from everyscan()each candidate it has extracted since it was created, sorted:scanreturns the whole ofself.candidates, whichextract_candidatesonly extends. A file that loses a class, or is deleted, keeps its classes in every later answer, so a Scanner kept across rebuilds answers with a list as long as the edit history rather than the files.Steps to reproduce
git clone https://gist.github.com/YevheniiKotyrlo/ebed2f5ec16d2fd1c70a14a3310df591 repro && cd repronode scan-growth.mjs. It installs@tailwindcss/oxide@insiders(built frommain) into a temporary folder, makes oneScannerover a folder holdingpage.html, rewritespage.htmlfive times to hold onlybox-Nwith ascan()after each, then deletes it and scans again. It exits 1 whilescan()returns classes no file holds any more.Expected: each
scan()returns the classes the files hold now,box-Nalone, and none oncepage.htmlis deleted.Seen:
The idea
An integration that keeps one Scanner across rebuilds, with each file's candidates of its own so that a removed class leaves the build, calls
scan()only forfilesandscannedFiles, and each call clones, sorts and copies across N-API a list that only grows. Either of these would serve it:scanvariant that walks the sources and updatesfilesandscannedFileswithout building the candidate list;All reactions