import { relative } from 'pathe'; import 'std-env'; import '@vitest/runner/utils'; import { g as getWorkerState } from './chunk-utils-global.fd174983.js'; import '@vitest/utils'; var _a; const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window; const isWindows = isNode && process.platform === "win32"; const getRunMode = () => getWorkerState().config.mode; const isRunningInBenchmark = () => getRunMode() === "benchmark"; const relativePath = relative; function resetModules(modules, resetMocks = false) { const skipPaths = [ /\/vitest\/dist\//, /\/vite-node\/dist\//, /vitest-virtual-\w+\/dist/, /@vitest\/dist/, ...!resetMocks ? [/^mock:/] : [] ]; modules.forEach((mod, path) => { if (skipPaths.some((re) => re.test(path))) return; modules.invalidateModule(mod); }); } function removeUndefinedValues(obj) { for (const key in Object.keys(obj)) { if (obj[key] === void 0) delete obj[key]; } return obj; } function getCallLastIndex(code) { let charIndex = -1; let inString = null; let startedBracers = 0; let endedBracers = 0; let beforeChar = null; while (charIndex <= code.length) { beforeChar = code[charIndex]; charIndex++; const char = code[charIndex]; const isCharString = char === '"' || char === "'" || char === "`"; if (isCharString && beforeChar !== "\\") { if (inString === char) inString = null; else if (!inString) inString = char; } if (!inString) { if (char === "(") startedBracers++; if (char === ")") endedBracers++; } if (startedBracers && endedBracers && startedBracers === endedBracers) return charIndex; } return null; } export { isNode as a, relativePath as b, removeUndefinedValues as c, isWindows as d, getCallLastIndex as g, isRunningInBenchmark as i, resetModules as r };