// The MFile shape and the content hash, kept free of Vite-specific APIs so // the render worker (and the Node harnesses) can import them without // touching import.meta.glob. export interface MFile { name: string; source: string; } // Cheap content hash (FNV-1a) so the worker can key its caches on the code. export function hashMFiles(files: MFile[]): string { let h = 0x811c9dc5; for (const f of files) { const s = f.name + ' ' + f.source + ''; for (let i = 0; i < s.length; i++) { h ^= s.charCodeAt(i); h = Math.imul(h, 0x01000193); } } return (h >>> 0).toString(36); }