From 325559e94586bb7b1845308322b877b5138122f0 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 8 Jul 2026 10:59:59 +0200 Subject: [PATCH] refactor: use a single field for the on-disk transform location (#10733) --- packages/vitest/src/node/environments/fetchModule.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/vitest/src/node/environments/fetchModule.ts b/packages/vitest/src/node/environments/fetchModule.ts index cb0975721..ccbce1fb4 100644 --- a/packages/vitest/src/node/environments/fetchModule.ts +++ b/packages/vitest/src/node/environments/fetchModule.ts @@ -102,7 +102,7 @@ class ModuleFetcher { } const transformResult = moduleGraphModule.transformResult - const tmpPath = transformResult && Reflect.get(transformResult, '_vitest_tmp') + const tmpPath = transformResult?.__vitestTmp if (typeof tmpPath === 'string') { return getCachedResult(result, tmpPath) } @@ -118,7 +118,7 @@ class ModuleFetcher { const tmpFile = join(tmpDir, hash('sha1', result.id, 'hex')) return this.cacheResult(result, tmpFile).then((result) => { if (transformResult) { - Reflect.set(transformResult, '_vitest_tmp', tmpFile) + transformResult.__vitestTmp = tmpFile } return result }) @@ -569,6 +569,8 @@ export function handleRollupError(e: unknown): never { declare module 'vite' { export interface TransformResult { + // on-disk location of the transformed code, written by either the + // `experimental.fsModuleCache` store or the forks pool's tmp copies __vitestTmp?: string __vitestModuleType?: ModuleType } -- 2.51.2