browser-pilot 0.0.14 → 0.0.15
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 +81 -672
- package/dist/actions.cjs +1058 -41
- package/dist/actions.d.cts +11 -3
- package/dist/actions.d.ts +11 -3
- package/dist/actions.mjs +1 -1
- package/dist/browser-MEWT75IB.mjs +11 -0
- package/dist/browser.cjs +1021 -40
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.mjs +3 -3
- package/dist/cdp.cjs +5 -1
- package/dist/cdp.d.cts +1 -1
- package/dist/cdp.d.ts +1 -1
- package/dist/cdp.mjs +1 -1
- package/dist/{chunk-XMJABKCF.mjs → chunk-7YVCOL2W.mjs} +1058 -41
- package/dist/{chunk-KIFB526Y.mjs → chunk-BVZALQT4.mjs} +5 -1
- package/dist/chunk-DTVRFXKI.mjs +35 -0
- package/dist/{chunk-SPSZZH22.mjs → chunk-LCNFBXB5.mjs} +9 -33
- package/dist/{chunk-7NDR6V7S.mjs → chunk-USYSHCI3.mjs} +1369 -517
- package/dist/chunk-WPNW23CE.mjs +466 -0
- package/dist/{chunk-IN5HPAPB.mjs → chunk-ZAXQ5OTV.mjs} +6 -2
- package/dist/cli.mjs +2522 -1048
- package/dist/{client-Ck2nQksT.d.cts → client-B5QBRgIy.d.cts} +2 -0
- package/dist/{client-Ck2nQksT.d.ts → client-B5QBRgIy.d.ts} +2 -0
- package/dist/{client-3AFV2IAF.mjs → client-JWWZWO6L.mjs} +4 -2
- package/dist/index.cjs +1067 -42
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/page-XPS6IC6V.mjs +7 -0
- package/dist/{types-CjT0vClo.d.ts → types-C9ySEdOX.d.cts} +17 -3
- package/dist/{types-BSoh5v1Y.d.cts → types-Cvvf0oGu.d.ts} +17 -3
- package/package.json +1 -1
- package/dist/browser-LZTEHUDI.mjs +0 -9
|
@@ -168,7 +168,8 @@ function buildCDPClient(transport, options = {}) {
|
|
|
168
168
|
pending.delete(response.id);
|
|
169
169
|
clearTimeout(request.timer);
|
|
170
170
|
if (response.error) {
|
|
171
|
-
|
|
171
|
+
const error = typeof response.error === "string" ? { code: -32e3, message: response.error } : response.error;
|
|
172
|
+
request.reject(new CDPError(error));
|
|
172
173
|
} else {
|
|
173
174
|
request.resolve(response.result);
|
|
174
175
|
}
|
|
@@ -284,6 +285,9 @@ function buildCDPClient(transport, options = {}) {
|
|
|
284
285
|
get sessionId() {
|
|
285
286
|
return currentSessionId;
|
|
286
287
|
},
|
|
288
|
+
setSessionId(sessionId) {
|
|
289
|
+
currentSessionId = sessionId;
|
|
290
|
+
},
|
|
287
291
|
get isConnected() {
|
|
288
292
|
return connected;
|
|
289
293
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/cdp/protocol.ts
|
|
2
|
+
var CDPError = class extends Error {
|
|
3
|
+
code;
|
|
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
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/utils/json.ts
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return typeof value === "object" && value !== null;
|
|
16
|
+
}
|
|
17
|
+
function stringifyUnknown(value) {
|
|
18
|
+
if (typeof value === "string") return value;
|
|
19
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
20
|
+
return String(value);
|
|
21
|
+
}
|
|
22
|
+
if (value === null) return "null";
|
|
23
|
+
if (value === void 0) return "undefined";
|
|
24
|
+
try {
|
|
25
|
+
return JSON.stringify(value);
|
|
26
|
+
} catch {
|
|
27
|
+
return Object.prototype.toString.call(value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
CDPError,
|
|
33
|
+
isRecord,
|
|
34
|
+
stringifyUnknown
|
|
35
|
+
};
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
function stringifyUnknown(value) {
|
|
6
|
-
if (typeof value === "string") return value;
|
|
7
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
8
|
-
return String(value);
|
|
9
|
-
}
|
|
10
|
-
if (value === null) return "null";
|
|
11
|
-
if (value === void 0) return "undefined";
|
|
12
|
-
try {
|
|
13
|
-
return JSON.stringify(value);
|
|
14
|
-
} catch {
|
|
15
|
-
return Object.prototype.toString.call(value);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// src/cdp/protocol.ts
|
|
20
|
-
var CDPError = class extends Error {
|
|
21
|
-
code;
|
|
22
|
-
data;
|
|
23
|
-
constructor(error) {
|
|
24
|
-
super(error.message);
|
|
25
|
-
this.name = "CDPError";
|
|
26
|
-
this.code = error.code;
|
|
27
|
-
this.data = error.data;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
CDPError,
|
|
3
|
+
isRecord
|
|
4
|
+
} from "./chunk-DTVRFXKI.mjs";
|
|
30
5
|
|
|
31
6
|
// src/cdp/transport.ts
|
|
32
7
|
function createTransport(wsUrl, options = {}) {
|
|
@@ -176,7 +151,8 @@ function buildCDPClient(transport, options = {}) {
|
|
|
176
151
|
pending.delete(response.id);
|
|
177
152
|
clearTimeout(request.timer);
|
|
178
153
|
if (response.error) {
|
|
179
|
-
|
|
154
|
+
const error = typeof response.error === "string" ? { code: -32e3, message: response.error } : response.error;
|
|
155
|
+
request.reject(new CDPError(error));
|
|
180
156
|
} else {
|
|
181
157
|
request.resolve(response.result);
|
|
182
158
|
}
|
|
@@ -292,6 +268,9 @@ function buildCDPClient(transport, options = {}) {
|
|
|
292
268
|
get sessionId() {
|
|
293
269
|
return currentSessionId;
|
|
294
270
|
},
|
|
271
|
+
setSessionId(sessionId) {
|
|
272
|
+
currentSessionId = sessionId;
|
|
273
|
+
},
|
|
295
274
|
get isConnected() {
|
|
296
275
|
return connected;
|
|
297
276
|
}
|
|
@@ -300,9 +279,6 @@ function buildCDPClient(transport, options = {}) {
|
|
|
300
279
|
}
|
|
301
280
|
|
|
302
281
|
export {
|
|
303
|
-
CDPError,
|
|
304
|
-
isRecord,
|
|
305
|
-
stringifyUnknown,
|
|
306
282
|
createCDPClientFromTransport,
|
|
307
283
|
createCDPClient
|
|
308
284
|
};
|