@cotestdev/mcp_playwright 0.0.15 → 0.0.17
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.
- package/lib/common/config.js +281 -0
- package/lib/common/configLoader.js +344 -0
- package/lib/common/esmLoaderHost.js +104 -0
- package/lib/common/expectBundle.js +43 -0
- package/lib/common/expectBundleImpl.js +407 -0
- package/lib/common/fixtures.js +302 -0
- package/lib/common/globals.js +58 -0
- package/lib/common/ipc.js +60 -0
- package/lib/common/poolBuilder.js +85 -0
- package/lib/common/process.js +132 -0
- package/lib/common/suiteUtils.js +140 -0
- package/lib/common/test.js +322 -0
- package/lib/common/testLoader.js +101 -0
- package/lib/common/testType.js +298 -0
- package/lib/common/validators.js +68 -0
- package/lib/mcp/browser/tools/script.js +1 -1
- package/lib/mcp/index.js +1 -1
- package/lib/mcp/test/seed.js +1 -1
- package/lib/mcp/test/testContext.js +4 -4
- package/lib/mcp/test/testTools.js +1 -1
- package/lib/mcp/vscode/host.js +1 -1
- package/lib/mcpBundle.js +84 -0
- package/lib/mcpBundleImpl/index.js +130 -0
- package/lib/third_party/pirates.js +62 -0
- package/lib/third_party/tsconfig-loader.js +103 -0
- package/lib/transform/babelBundle.js +43 -0
- package/lib/transform/babelBundleImpl.js +461 -0
- package/lib/transform/babelHighlightUtils.js +63 -0
- package/lib/transform/compilationCache.js +272 -0
- package/lib/transform/esmLoader.js +103 -0
- package/lib/transform/portTransport.js +67 -0
- package/lib/transform/transform.js +296 -0
- package/lib/utilsBundleImpl/index.js +218 -0
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var esmLoaderHost_exports = {};
|
|
30
|
+
__export(esmLoaderHost_exports, {
|
|
31
|
+
configureESMLoader: () => configureESMLoader,
|
|
32
|
+
configureESMLoaderTransformConfig: () => configureESMLoaderTransformConfig,
|
|
33
|
+
incorporateCompilationCache: () => incorporateCompilationCache,
|
|
34
|
+
registerESMLoader: () => registerESMLoader,
|
|
35
|
+
startCollectingFileDeps: () => startCollectingFileDeps,
|
|
36
|
+
stopCollectingFileDeps: () => stopCollectingFileDeps
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(esmLoaderHost_exports);
|
|
39
|
+
var import_url = __toESM(require("url"));
|
|
40
|
+
var import_compilationCache = require("../transform/compilationCache");
|
|
41
|
+
var import_portTransport = require("../transform/portTransport");
|
|
42
|
+
var import_transform = require("../transform/transform");
|
|
43
|
+
let loaderChannel;
|
|
44
|
+
function registerESMLoader() {
|
|
45
|
+
if (process.env.PW_DISABLE_TS_ESM)
|
|
46
|
+
return true;
|
|
47
|
+
if ("Bun" in globalThis)
|
|
48
|
+
return true;
|
|
49
|
+
if (loaderChannel)
|
|
50
|
+
return true;
|
|
51
|
+
const register = require("node:module").register;
|
|
52
|
+
if (!register)
|
|
53
|
+
return false;
|
|
54
|
+
const { port1, port2 } = new MessageChannel();
|
|
55
|
+
register(import_url.default.pathToFileURL(require.resolve("../transform/esmLoader")), {
|
|
56
|
+
data: { port: port2 },
|
|
57
|
+
transferList: [port2]
|
|
58
|
+
});
|
|
59
|
+
loaderChannel = createPortTransport(port1);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
function createPortTransport(port) {
|
|
63
|
+
return new import_portTransport.PortTransport(port, async (method, params) => {
|
|
64
|
+
if (method === "pushToCompilationCache")
|
|
65
|
+
(0, import_compilationCache.addToCompilationCache)(params.cache);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async function startCollectingFileDeps() {
|
|
69
|
+
if (!loaderChannel)
|
|
70
|
+
return;
|
|
71
|
+
await loaderChannel.send("startCollectingFileDeps", {});
|
|
72
|
+
}
|
|
73
|
+
async function stopCollectingFileDeps(file) {
|
|
74
|
+
if (!loaderChannel)
|
|
75
|
+
return;
|
|
76
|
+
await loaderChannel.send("stopCollectingFileDeps", { file });
|
|
77
|
+
}
|
|
78
|
+
async function incorporateCompilationCache() {
|
|
79
|
+
if (!loaderChannel)
|
|
80
|
+
return;
|
|
81
|
+
const result = await loaderChannel.send("getCompilationCache", {});
|
|
82
|
+
(0, import_compilationCache.addToCompilationCache)(result.cache);
|
|
83
|
+
}
|
|
84
|
+
async function configureESMLoader() {
|
|
85
|
+
if (!loaderChannel)
|
|
86
|
+
return;
|
|
87
|
+
await loaderChannel.send("setSingleTSConfig", { tsconfig: (0, import_transform.singleTSConfig)() });
|
|
88
|
+
await loaderChannel.send("addToCompilationCache", { cache: (0, import_compilationCache.serializeCompilationCache)() });
|
|
89
|
+
}
|
|
90
|
+
async function configureESMLoaderTransformConfig() {
|
|
91
|
+
if (!loaderChannel)
|
|
92
|
+
return;
|
|
93
|
+
await loaderChannel.send("setSingleTSConfig", { tsconfig: (0, import_transform.singleTSConfig)() });
|
|
94
|
+
await loaderChannel.send("setTransformConfig", { config: (0, import_transform.transformConfig)() });
|
|
95
|
+
}
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
configureESMLoader,
|
|
99
|
+
configureESMLoaderTransformConfig,
|
|
100
|
+
incorporateCompilationCache,
|
|
101
|
+
registerESMLoader,
|
|
102
|
+
startCollectingFileDeps,
|
|
103
|
+
stopCollectingFileDeps
|
|
104
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var expectBundle_exports = {};
|
|
20
|
+
__export(expectBundle_exports, {
|
|
21
|
+
DIM_COLOR: () => DIM_COLOR,
|
|
22
|
+
EXPECTED_COLOR: () => EXPECTED_COLOR,
|
|
23
|
+
INVERTED_COLOR: () => INVERTED_COLOR,
|
|
24
|
+
RECEIVED_COLOR: () => RECEIVED_COLOR,
|
|
25
|
+
expect: () => expect,
|
|
26
|
+
printReceived: () => printReceived
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(expectBundle_exports);
|
|
29
|
+
const expect = require("./expectBundleImpl").expect;
|
|
30
|
+
const EXPECTED_COLOR = require("./expectBundleImpl").EXPECTED_COLOR;
|
|
31
|
+
const INVERTED_COLOR = require("./expectBundleImpl").INVERTED_COLOR;
|
|
32
|
+
const RECEIVED_COLOR = require("./expectBundleImpl").RECEIVED_COLOR;
|
|
33
|
+
const DIM_COLOR = require("./expectBundleImpl").DIM_COLOR;
|
|
34
|
+
const printReceived = require("./expectBundleImpl").printReceived;
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
DIM_COLOR,
|
|
38
|
+
EXPECTED_COLOR,
|
|
39
|
+
INVERTED_COLOR,
|
|
40
|
+
RECEIVED_COLOR,
|
|
41
|
+
expect,
|
|
42
|
+
printReceived
|
|
43
|
+
});
|