Repository navigation
Conversation
|
No actionable comments were generated in the recent review. WalkthroughThe CSS, ESM, and CJS resolvers now use a shared input file-system cache. The Severity of issue fixed: Medium Merge Risk:
|
[Medium impact] The PR appears safe to merge. Reviews (4) · Last reviewed commit: "Test that an `@import` fails again once ..." · Reviewed by Greptile |
ae61ade to
d3f9573
Compare
|
I rebased this PR on the latest Sent by an AI assistant on behalf of @RobinMalfait. |
The tests removed their temporary folder only after all assertions passed, so a failing test left it behind. Create and remove it in `beforeEach` and `afterEach`, as the `@tailwindcss/postcss` tests do.
A stale cache can also keep a removed file resolved. Without the purge, the next compile resolves the removed file and then fails with `ENOENT` when it reads it, instead of `Can't resolve`.
Summary
@tailwindcss/nodecreates its CSS and JS resolvers once at module load, each over aCachedInputFileSystemwith a 4 second cache. In a long-lived process (a dev server, the PostCSS plugin in watch mode) a failedstatfor an@importthat doesn't exist yet stays cached, so recompiling right after the file is created still fails withCan't resolveuntil the entry expires.The three resolvers now share one cached file system, and
compile()/compileAst()purge it before they start. Lookups within a single compile are still cached, but each compile sees the current state of the disk.Fixes #20638
Test plan
packages/@tailwindcss-node/src/compile.test.ts: compile an@importof a missing file (fails), write the file, compile again and expect it to resolve. It fails onmainwithCan't resolve './accent.css'and passes with this change.pnpm build && pnpm vitest run: all unit tests pass.