@cotestdev/mcp_playwright 0.0.58 → 0.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/mcp/browser/config.js +3 -3
  2. package/lib/mcp/browser/context.js +4 -2
  3. package/lib/mcp/browser/tools/common.js +2 -1
  4. package/lib/mcp/browser/tools/devtools.js +42 -0
  5. package/lib/mcp/browser/tools/dialogs.js +2 -1
  6. package/lib/mcp/browser/tools/evaluate.js +2 -1
  7. package/lib/mcp/browser/tools/files.js +2 -1
  8. package/lib/mcp/browser/tools/form.js +2 -1
  9. package/lib/mcp/browser/tools/keyboard.js +5 -4
  10. package/lib/mcp/browser/tools/navigate.js +5 -4
  11. package/lib/mcp/browser/tools/runCode.js +31 -2
  12. package/lib/mcp/browser/tools/screenshot.js +2 -1
  13. package/lib/mcp/browser/tools/snapshot.js +3 -2
  14. package/lib/mcp/browser/tools/tabs.js +2 -1
  15. package/lib/mcp/browser/tools/verify.js +5 -4
  16. package/lib/mcp/browser/tools/wait.js +2 -1
  17. package/lib/mcp/browser/tools.js +2 -0
  18. package/lib/mcp/extension/extensionContextFactory.js +2 -3
  19. package/lib/mcp/program.js +3 -4
  20. package/lib/mcp/sdk/tool.js +1 -1
  21. package/lib/mcp/terminal/cli.js +1 -23
  22. package/lib/mcp/terminal/commands.js +30 -2
  23. package/lib/mcp/terminal/devtoolsApp.js +248 -0
  24. package/lib/mcp/terminal/program.js +87 -435
  25. package/lib/mcp/terminal/registry.js +146 -0
  26. package/lib/mcp/terminal/session.js +309 -0
  27. package/lib/mcp/test/browserBackend.js +55 -13
  28. package/lib/mcp/test/testBackend.js +25 -25
  29. package/lib/mcp/test/testContext.js +6 -8
  30. package/lib/mcpBundleImpl/index.js +22 -22
  31. package/lib/transform/esmLoader.js +8 -6
  32. package/lib/transform/transform.js +1 -1
  33. package/package.json +1 -1
  34. package/lib/index.d.ts +0 -23
  35. package/lib/index.d.ts.map +0 -1
  36. package/lib/index.js +0 -24
  37. package/lib/index.js.map +0 -1
@@ -51,22 +51,24 @@ const kSupportedFormats = /* @__PURE__ */ new Map([
51
51
  [null, null],
52
52
  [void 0, void 0]
53
53
  ]);
54
- async function load(originalModuleUrl, context, defaultLoad) {
55
- const moduleUrl = originalModuleUrl.replace(esmPreflightExtension, "");
54
+ async function load(moduleUrl, context, defaultLoad) {
56
55
  if (!kSupportedFormats.has(context.format))
57
56
  return defaultLoad(moduleUrl, context, defaultLoad);
58
57
  if (!moduleUrl.startsWith("file://"))
59
58
  return defaultLoad(moduleUrl, context, defaultLoad);
60
59
  const filename = import_url.default.fileURLToPath(moduleUrl);
60
+ const isPreflight = moduleUrl.endsWith(esmPreflightExtension);
61
61
  if (!(0, import_transform.shouldTransform)(filename))
62
62
  return defaultLoad(moduleUrl, context, defaultLoad);
63
- const code = import_fs.default.readFileSync(filename, "utf-8");
64
- const transformed = (0, import_transform.transformHook)(code, filename, moduleUrl);
63
+ const originalModuleUrl = isPreflight ? moduleUrl.slice(0, -esmPreflightExtension.length) : moduleUrl;
64
+ const originalFilename = isPreflight ? import_url.default.fileURLToPath(originalModuleUrl) : filename;
65
+ const code = import_fs.default.readFileSync(originalFilename, "utf-8");
66
+ const transformed = (0, import_transform.transformHook)(code, originalFilename, originalModuleUrl);
65
67
  if (transformed.serializedCache)
66
68
  transport?.post("pushToCompilationCache", { cache: transformed.serializedCache });
67
69
  return {
68
- format: kSupportedFormats.get(context.format) || ((0, import_util.fileIsModule)(filename) ? "module" : "commonjs"),
69
- source: originalModuleUrl.endsWith(esmPreflightExtension) ? `void 0;` : transformed.code,
70
+ format: kSupportedFormats.get(context.format) || ((0, import_util.fileIsModule)(originalFilename) ? "module" : "commonjs"),
71
+ source: isPreflight ? `void 0;` : transformed.code,
70
72
  shortCircuit: true
71
73
  };
72
74
  }
@@ -219,7 +219,7 @@ async function requireOrImport(file) {
219
219
  if (isModule) {
220
220
  const fileName = import_url.default.pathToFileURL(file);
221
221
  const esmImport = () => eval(`import(${JSON.stringify(fileName)})`);
222
- await eval(`import(${JSON.stringify(fileName + ".esm.preflight")})`).finally(nextTask);
222
+ await eval(`import(${JSON.stringify(fileName + ".esm.preflight")})`).catch((error) => (0, import_util.debugTest)("Failed to load preflight for " + file + ", source maps may be missing for errors thrown during loading.", error)).finally(nextTask);
223
223
  return await esmImport().finally(nextTask);
224
224
  }
225
225
  const result = require(file);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cotestdev/mcp_playwright",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "description": "Playwright MCP (Model Context Protocol) tools for browser automation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/lib/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * @cotestdev/mcp_playwright
18
- * Standalone MCP package for Playwright browser automation
19
- * The actual CLI entry point is at lib/mcp/cli.js
20
- */
21
- declare const _default: {};
22
- export default _default;
23
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;GAIG;;AAEH,wBAAkB"}
package/lib/index.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- /**
18
- * @cotestdev/mcp_playwright
19
- * Standalone MCP package for Playwright browser automation
20
- * The actual CLI entry point is at lib/mcp/cli.js
21
- */
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.default = {};
24
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH;;;;GAIG;;AAEH,kBAAe,EAAE,CAAC"}