browser-pilot 0.0.11 → 0.0.13
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/README.md +44 -8
- package/dist/actions.cjs +686 -32
- package/dist/actions.d.cts +3 -3
- package/dist/actions.d.ts +3 -3
- package/dist/actions.mjs +2 -1
- package/dist/browser.cjs +3415 -2324
- package/dist/browser.d.cts +9 -3
- package/dist/browser.d.ts +9 -3
- package/dist/browser.mjs +4 -3
- package/dist/cdp.cjs +19 -4
- package/dist/cdp.d.cts +1 -1
- package/dist/cdp.d.ts +1 -1
- package/dist/cdp.mjs +4 -2
- package/dist/chunk-A2ZRAEO3.mjs +1711 -0
- package/dist/{chunk-BCOZUKWS.mjs → chunk-HP6R3W32.mjs} +22 -16
- package/dist/chunk-JXAUPHZM.mjs +15 -0
- package/dist/{chunk-JHAF52FA.mjs → chunk-VDAMDOS6.mjs} +1014 -738
- package/dist/cli.mjs +4998 -3259
- package/dist/{client-7Nqka5MV.d.ts → client-DRqxBdHv.d.cts} +1 -1
- package/dist/{client-7Nqka5MV.d.cts → client-DRqxBdHv.d.ts} +1 -1
- package/dist/index.cjs +4555 -3314
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +6 -4
- package/dist/{types-GWuQJs_e.d.cts → types-BXMGFtnB.d.cts} +96 -9
- package/dist/{types-DtGF3yGl.d.ts → types-CzgQjai9.d.ts} +96 -9
- package/package.json +6 -2
- package/dist/chunk-FAUNIZR7.mjs +0 -751
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
data;
|
|
5
|
-
constructor(error) {
|
|
6
|
-
super(error.message);
|
|
7
|
-
this.name = "CDPError";
|
|
8
|
-
this.code = error.code;
|
|
9
|
-
this.data = error.data;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
CDPError
|
|
3
|
+
} from "./chunk-JXAUPHZM.mjs";
|
|
12
4
|
|
|
13
5
|
// src/cdp/transport.ts
|
|
14
6
|
function createTransport(wsUrl, options = {}) {
|
|
@@ -39,13 +31,28 @@ function createTransport(wsUrl, options = {}) {
|
|
|
39
31
|
resolveClose();
|
|
40
32
|
return;
|
|
41
33
|
}
|
|
42
|
-
|
|
34
|
+
let settled = false;
|
|
35
|
+
let fallbackTimer;
|
|
36
|
+
const finish = () => {
|
|
37
|
+
if (settled) return;
|
|
38
|
+
settled = true;
|
|
39
|
+
if (fallbackTimer) clearTimeout(fallbackTimer);
|
|
43
40
|
ws.removeEventListener("close", onClose);
|
|
44
41
|
resolveClose();
|
|
45
42
|
};
|
|
43
|
+
const onClose = () => {
|
|
44
|
+
finish();
|
|
45
|
+
};
|
|
46
46
|
ws.addEventListener("close", onClose);
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
try {
|
|
48
|
+
if (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING) {
|
|
49
|
+
ws.close();
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
finish();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
fallbackTimer = setTimeout(finish, 200);
|
|
49
56
|
});
|
|
50
57
|
},
|
|
51
58
|
onMessage(handler) {
|
|
@@ -170,7 +177,7 @@ async function createCDPClient(wsUrl, options = {}) {
|
|
|
170
177
|
throw new Error("CDP client is not connected");
|
|
171
178
|
}
|
|
172
179
|
const id = ++messageId;
|
|
173
|
-
const effectiveSessionId = sessionId ?? currentSessionId;
|
|
180
|
+
const effectiveSessionId = sessionId === null ? void 0 : sessionId ?? currentSessionId;
|
|
174
181
|
const request = { id, method };
|
|
175
182
|
if (params !== void 0) {
|
|
176
183
|
request.params = params;
|
|
@@ -245,7 +252,6 @@ async function createCDPClient(wsUrl, options = {}) {
|
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
export {
|
|
248
|
-
CDPError,
|
|
249
255
|
createTransport,
|
|
250
256
|
createCDPClient
|
|
251
257
|
};
|