import { createRequire } from 'node:module'; import path from 'node:path'; const require = createRequire(import.meta.url); export function createBrowserInstallCommand(args) { const unsupported = args.filter(argument => argument !== '--with-deps'); const withDepsCount = args.filter(argument => argument === '--with-deps').length; if (unsupported.length > 0) throw new Error(`install-browser 不支持参数:${unsupported.join(' ')}`); if (withDepsCount > 1) throw new Error('install-browser 的 --with-deps 只能指定一次'); const packageJson = require.resolve('playwright-chromium/package.json'); const playwrightCli = path.join(path.dirname(packageJson), 'cli.js'); return { command: process.execPath, args: [ playwrightCli, 'install', ...(withDepsCount === 1 ? ['--with-deps'] : []), 'chromium', ], }; } //# sourceMappingURL=browser-install.js.map