Update npm packages (73 packages including @jqhtml 2.3.36)
Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
node_modules/playwright/lib/mcp/browser/tools/runCode.js
generated
vendored
19
node_modules/playwright/lib/mcp/browser/tools/runCode.js
generated
vendored
@@ -33,10 +33,11 @@ __export(runCode_exports, {
|
||||
module.exports = __toCommonJS(runCode_exports);
|
||||
var import_vm = __toESM(require("vm"));
|
||||
var import_utils = require("playwright-core/lib/utils");
|
||||
var import_bundle = require("../../sdk/bundle");
|
||||
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
||||
var import_tool = require("./tool");
|
||||
const codeSchema = import_bundle.z.object({
|
||||
code: import_bundle.z.string().describe(`Playwright code snippet to run. The snippet should access the \`page\` object to interact with the page. Can make multiple statements. For example: \`await page.getByRole('button', { name: 'Submit' }).click();\``)
|
||||
const codeSchema = import_mcpBundle.z.object({
|
||||
code: import_mcpBundle.z.string().describe(`A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: \`async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }\``),
|
||||
filename: import_mcpBundle.z.string().optional().describe("Filename to save the result to. If not provided, result is returned as JSON string.")
|
||||
});
|
||||
const runCode = (0, import_tool.defineTabTool)({
|
||||
capability: "core",
|
||||
@@ -49,7 +50,7 @@ const runCode = (0, import_tool.defineTabTool)({
|
||||
},
|
||||
handle: async (tab, params, response) => {
|
||||
response.setIncludeSnapshot();
|
||||
response.addCode(params.code);
|
||||
response.addCode(`await (${params.code})(page);`);
|
||||
const __end__ = new import_utils.ManualPromise();
|
||||
const context = {
|
||||
page: tab.page,
|
||||
@@ -59,14 +60,16 @@ const runCode = (0, import_tool.defineTabTool)({
|
||||
await tab.waitForCompletion(async () => {
|
||||
const snippet = `(async () => {
|
||||
try {
|
||||
${params.code};
|
||||
__end__.resolve();
|
||||
const result = await (${params.code})(page);
|
||||
__end__.resolve(JSON.stringify(result));
|
||||
} catch (e) {
|
||||
__end__.reject(e);
|
||||
}
|
||||
})()`;
|
||||
import_vm.default.runInContext(snippet, context);
|
||||
await __end__;
|
||||
await import_vm.default.runInContext(snippet, context);
|
||||
const result = await __end__;
|
||||
if (typeof result === "string")
|
||||
await response.addResult({ text: result, suggestedFilename: params.filename });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user