mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-26 08:32:26 +08:00
fix: use of wrong launchOptions type in public API (#385)
This commit is contained in:
parent
053c2f3d32
commit
95ca08fdb7
2
config.d.ts
vendored
2
config.d.ts
vendored
@ -40,7 +40,7 @@ export type Config = {
|
|||||||
*
|
*
|
||||||
* This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
|
* This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
|
||||||
*/
|
*/
|
||||||
launchOptions?: playwright.BrowserLaunchOptions;
|
launchOptions?: playwright.LaunchOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context options for the browser context.
|
* Context options for the browser context.
|
||||||
|
@ -175,7 +175,7 @@ function mergeConfig(base: Config, overrides: Config): Config {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (browser.browserName !== 'chromium')
|
if (browser.browserName !== 'chromium' && browser.launchOptions)
|
||||||
delete browser.launchOptions.channel;
|
delete browser.launchOptions.channel;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -374,7 +374,7 @@ async function createUserDataDir(browserConfig: Config['browser']) {
|
|||||||
cacheDirectory = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');
|
cacheDirectory = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');
|
||||||
else
|
else
|
||||||
throw new Error('Unsupported platform: ' + process.platform);
|
throw new Error('Unsupported platform: ' + process.platform);
|
||||||
const result = path.join(cacheDirectory, 'ms-playwright', `mcp-${browserConfig?.launchOptions.channel ?? browserConfig?.browserName}-profile`);
|
const result = path.join(cacheDirectory, 'ms-playwright', `mcp-${browserConfig?.launchOptions?.channel ?? browserConfig?.browserName}-profile`);
|
||||||
await fs.promises.mkdir(result, { recursive: true });
|
await fs.promises.mkdir(result, { recursive: true });
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ const install = defineTool({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handle: async context => {
|
handle: async context => {
|
||||||
const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.launchOptions.browserName ?? 'chrome';
|
const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.browserName ?? 'chrome';
|
||||||
const cliUrl = import.meta.resolve('playwright/package.json');
|
const cliUrl = import.meta.resolve('playwright/package.json');
|
||||||
const cliPath = path.join(fileURLToPath(cliUrl), '..', 'cli.js');
|
const cliPath = path.join(fileURLToPath(cliUrl), '..', 'cli.js');
|
||||||
const child = fork(cliPath, ['install', channel], {
|
const child = fork(cliPath, ['install', channel], {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user