Skip to content

refactor: use a single field for the on-disk transform location#10733

Merged
sheremet-va merged 1 commit into
mainfrom
refactor/unify-transform-tmp
Jul 8, 2026
Merged

refactor: use a single field for the on-disk transform location#10733
sheremet-va merged 1 commit into
mainfrom
refactor/unify-transform-tmp

Conversation

@sheremet-va

Copy link
Copy Markdown
Member

The path to a module's transformed code on disk is stored in two different fields on Vite's TransformResult:

  • __vitestTmp — a typed field, written by the experimental.fsModuleCache store (both on a fresh transform and when re-hydrating a cached module from disk).
  • _vitest_tmp — an untyped property read/written via Reflect, written by the forks pool's tmp copies (the makeTmpCopies path that avoids process.send-ing large buffers).

Both hold the same thing (a path to transformed code on disk) and every reader treats them identically. They also never coexist on the same module: the forks tmp path only runs when fsModuleCache produced no cache path (cachePath == null), while __vitestTmp is otherwise only ever the cache path. So this collapses them onto the single typed __vitestTmp field and drops the Reflect access.

No behaviour change.

The path to a module's transformed code on disk was stored in two
different fields on Vite's `TransformResult`: a typed `__vitestTmp`,
written by the `experimental.fsModuleCache` store, and an untyped
`_vitest_tmp` accessed via `Reflect`, written by the forks pool's tmp
copies. The two never coexist on a module (the forks tmp path only runs
when `fsModuleCache` produced no cache path) and every consumer treats
them identically, so unify on the typed `__vitestTmp` and drop the
`Reflect` access.
@netlify

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 73bcc3e
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a4d1b9a251716000851f82b
😎 Deploy Preview https://deploy-preview-10733--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@hi-ogawa hi-ogawa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! I almost forgot how these works, so needed deeper review but now all adds up.

@sheremet-va sheremet-va merged commit 325559e into main Jul 8, 2026
28 of 29 checks passed
@sheremet-va sheremet-va deleted the refactor/unify-transform-tmp branch July 8, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants