File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
packages/vitest/src/node/pools Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1+ import { createHash } from 'node:crypto'
12import { mkdir , writeFile } from 'node:fs/promises'
23import type { RawSourceMap } from 'vite-node'
34import { join } from 'pathe'
@@ -30,14 +31,15 @@ export function createMethodsRPC(project: WorkspaceProject): RuntimeRPC {
3031 const code = result . code
3132 if ( result . externalize )
3233 return result
33- if ( 'id' in result )
34+ if ( 'id' in result && typeof result . id === 'string' )
3435 return { id : result . id as string }
3536
3637 if ( ! code )
3738 throw new Error ( `Failed to fetch module ${ id } ` )
3839
3940 const dir = join ( project . tmpDir , transformMode )
40- const tmp = join ( dir , id . replace ( / [ / \\ ? % * : | " < > ] / g, '_' ) . replace ( '\0' , '__x00__' ) )
41+ const name = createHash ( 'sha1' ) . update ( id ) . digest ( 'hex' )
42+ const tmp = join ( dir , name )
4143 if ( promises . has ( tmp ) ) {
4244 await promises . get ( tmp )
4345 return { id : tmp }
You can’t perform that action at this time.
0 commit comments