cyperful 0.2.0 → 0.3.1
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.
- checksums.yaml +4 -4
- data/lib/cyperful/driver.rb +4 -2
- data/lib/cyperful/framework_injections.rb +22 -0
- data/lib/cyperful/ui_server.rb +0 -9
- data/public/assets/index-DQa6Blo_.js +51 -0
- data/public/assets/index-DqywWqA7.css +1 -0
- data/public/assets/syntax-highlighter-worker-BezFv5DT.js +12 -0
- data/public/frame-agent.js +171 -102
- data/public/index.html +2 -2
- metadata +8 -8
- data/public/assets/index-Bcd7GDsE.js +0 -42
- data/public/assets/index-D7cO27Pa.css +0 -1
- data/public/assets/syntax-highlighter-worker-Cumko8SL.js +0 -2798
data/public/frame-agent.js
CHANGED
@@ -1,123 +1,192 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
const m = __CYPERFUL_CONFIG__;
|
2
|
+
function L() {
|
3
|
+
if (!m)
|
4
|
+
throw new Error("Cyperful Agent config not initialized");
|
5
|
+
return m;
|
6
|
+
}
|
7
|
+
let _ = 0;
|
8
|
+
const u = (e, n, i = null) => {
|
9
|
+
const { CYPERFUL_ORIGIN: o } = L();
|
10
|
+
let r = null;
|
11
|
+
try {
|
12
|
+
const t = Date.now(), a = `${t}-${_++}`;
|
13
|
+
if ("url" in n && n.url != null)
|
14
|
+
try {
|
15
|
+
const s = new URL(n.url, window.location.origin);
|
16
|
+
if (s.origin === o) return null;
|
17
|
+
s.origin === window.location.origin && (n.url = s.pathname + s.search + s.hash);
|
18
|
+
} catch {
|
19
|
+
}
|
20
|
+
r = {
|
21
|
+
type: e,
|
22
|
+
data: n,
|
23
|
+
id: a,
|
24
|
+
timestamp: t,
|
25
|
+
start_id: i ? i.id : void 0
|
26
|
+
}, window.parent.postMessage(r, o);
|
27
|
+
} catch {
|
11
28
|
}
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
const o = new URL(e.url, window.location.origin);
|
20
|
-
if (o.origin === u)
|
21
|
-
return null;
|
22
|
-
o.origin === window.location.origin && (e.url = o.pathname + o.search + o.hash);
|
23
|
-
} catch {
|
24
|
-
}
|
25
|
-
i = {
|
26
|
-
type: t,
|
27
|
-
data: e,
|
28
|
-
id: c,
|
29
|
-
timestamp: r,
|
30
|
-
start_id: n ? n.id : void 0
|
31
|
-
}, window.parent.postMessage(i, u);
|
32
|
-
} catch {
|
33
|
-
}
|
34
|
-
return i;
|
35
|
-
};
|
36
|
-
for (const t of [
|
37
|
-
"log",
|
38
|
-
"error",
|
39
|
-
"warn",
|
40
|
-
"info",
|
41
|
-
"dir",
|
42
|
-
"debug"
|
43
|
-
]) {
|
44
|
-
const e = console[t];
|
45
|
-
e && (console[t] = (...n) => {
|
46
|
-
e.apply(console, n), s("log", { level: t, args: n });
|
47
|
-
});
|
29
|
+
return r;
|
30
|
+
};
|
31
|
+
function q(e) {
|
32
|
+
try {
|
33
|
+
if (typeof e == "string") return JSON.parse(e);
|
34
|
+
} catch {
|
35
|
+
return e;
|
48
36
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
37
|
+
}
|
38
|
+
function R(e) {
|
39
|
+
const n = {};
|
40
|
+
for (const [i, o] of e.entries())
|
41
|
+
o instanceof Blob ? n[i] = `[[ Blob: ${o.size} bytes ]]` : n[i] = o.toString();
|
42
|
+
return n;
|
43
|
+
}
|
44
|
+
const H = (e) => e instanceof ArrayBuffer;
|
45
|
+
function g(e, n) {
|
46
|
+
return e == null ? e : e instanceof FormData ? R(e) : e instanceof Blob ? `[[ ${e.constructor.name}: ${e.size} bytes ]]` : H(e) ? `[[ ${e.constructor.name}: ${e.byteLength} bytes ]]` : e instanceof URLSearchParams ? e.toString() : typeof e == "object" || typeof e == "function" ? `[[ ${e.constructor.name} ]]` : typeof e == "string" && (n != null && n.match(/[+/]json\b/)) ? q(e) : e;
|
47
|
+
}
|
48
|
+
const $ = () => {
|
49
|
+
const e = window.fetch;
|
50
|
+
window.fetch = (...n) => {
|
51
|
+
var y;
|
52
|
+
const [i, o = {}] = typeof n[0] == "string" || n[0] instanceof URL ? [n[0], n[1]] : [n[0].url, n[0]], r = ((y = o.method) == null ? void 0 : y.toUpperCase()) ?? "GET", t = o.body, s = new Headers(o.headers).get("content-type") || void 0;
|
53
|
+
let l;
|
55
54
|
try {
|
56
|
-
|
57
|
-
return JSON.parse(t);
|
55
|
+
l = g(t, s);
|
58
56
|
} catch {
|
59
|
-
return t;
|
60
57
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
-
|
86
|
-
window.XMLHttpRequest = m;
|
87
|
-
const L = window.fetch;
|
88
|
-
window.fetch = (...t) => {
|
89
|
-
const [e, n = {}] = typeof t[0] == "string" || t[0] instanceof URL ? [t[0], t[1]] : [t[0].url, t[0]], i = n.method ?? "GET", r = n.body, c = n.headers || {}, o = c["content-type"] || c["Content-Type"] || void 0, R = r instanceof FormData ? g(r) : o != null && o.includes("application/json") ? w(r) : r, p = s("fetch", {
|
90
|
-
method: i,
|
91
|
-
url: e.toString(),
|
92
|
-
body: R,
|
93
|
-
bodyType: o
|
94
|
-
}), h = L(...t);
|
95
|
-
return h.then(async (l) => {
|
96
|
-
const a = l.headers.get("content-type") || "", v = a.includes("application/json") ? await l.clone().json() : a.includes("text/") ? await l.clone().text() : `[[ Unhandled content-type: ${a || "<empty>"} ]]`;
|
97
|
-
p && s(
|
58
|
+
const p = u("fetch", {
|
59
|
+
method: r,
|
60
|
+
url: i.toString(),
|
61
|
+
body: l,
|
62
|
+
bodyType: s
|
63
|
+
}), h = e(...n);
|
64
|
+
return h.then(async (f) => {
|
65
|
+
const c = f.headers.get("content-type") || void 0, S = f.headers.get("content-length") || void 0;
|
66
|
+
let d;
|
67
|
+
try {
|
68
|
+
const w = f.clone();
|
69
|
+
c != null && c.match(/\bform-data|\bapplication\/x-www-form-urlencoded\b/) && (d = R(await w.formData())), c != null && c.match(/[+/]json\b/) ? d = await w.json() : c != null && c.match(/\btext[+/]/) ? d = await w.text() : d = `[[ Unhandled content-type ${c || "<empty>"} (size: ${S ?? "<unknown>"} bytes) ]]`;
|
70
|
+
} catch {
|
71
|
+
}
|
72
|
+
p && u(
|
73
|
+
"fetch:finished",
|
74
|
+
{
|
75
|
+
status: f.status,
|
76
|
+
responseType: c,
|
77
|
+
response: d
|
78
|
+
},
|
79
|
+
p
|
80
|
+
);
|
81
|
+
}).catch((f) => {
|
82
|
+
p && u(
|
98
83
|
"fetch:finished",
|
99
84
|
{
|
100
|
-
status:
|
101
|
-
|
102
|
-
response: v
|
85
|
+
status: 0,
|
86
|
+
response: `[caught error] ${f.message || "Unknown error"}`
|
103
87
|
},
|
104
88
|
p
|
105
89
|
);
|
106
|
-
}).catch(() => {
|
107
90
|
}), h;
|
108
91
|
};
|
109
|
-
|
92
|
+
}, B = () => {
|
93
|
+
const e = window.XMLHttpRequest.prototype.open, n = window.XMLHttpRequest.prototype.send, i = window.XMLHttpRequest.prototype.setRequestHeader;
|
94
|
+
window.XMLHttpRequest.prototype.open = function(...r) {
|
95
|
+
return this._requestMeta = {
|
96
|
+
method: r[0],
|
97
|
+
url: r[1].toString(),
|
98
|
+
headers: {}
|
99
|
+
}, e.apply(this, r);
|
100
|
+
}, window.XMLHttpRequest.prototype.setRequestHeader = function(r, t) {
|
101
|
+
const a = this._requestMeta;
|
102
|
+
return a && (a.headers[r.toLowerCase()] = t), i.apply(this, [r, t]);
|
103
|
+
}, window.XMLHttpRequest.prototype.send = function(r) {
|
104
|
+
const t = this._requestMeta, a = t == null ? void 0 : t.headers["content-type"];
|
105
|
+
let s;
|
106
|
+
try {
|
107
|
+
s = g(r, a);
|
108
|
+
} catch {
|
109
|
+
}
|
110
|
+
const l = t ? u("xhr", {
|
111
|
+
method: t.method,
|
112
|
+
url: t.url,
|
113
|
+
body: s,
|
114
|
+
bodyType: a
|
115
|
+
}) : null;
|
116
|
+
return this.addEventListener("load", async () => {
|
117
|
+
if (!l) return;
|
118
|
+
const p = this.getResponseHeader("content-type") || void 0;
|
119
|
+
let h;
|
120
|
+
try {
|
121
|
+
h = g(this.response, p);
|
122
|
+
} catch {
|
123
|
+
}
|
124
|
+
u(
|
125
|
+
"xhr:finished",
|
126
|
+
{
|
127
|
+
status: this.status,
|
128
|
+
response: h,
|
129
|
+
responseType: p
|
130
|
+
},
|
131
|
+
l
|
132
|
+
);
|
133
|
+
}), this.addEventListener("error", () => {
|
134
|
+
l && u(
|
135
|
+
"xhr:finished",
|
136
|
+
{
|
137
|
+
status: 0,
|
138
|
+
response: `[caught error] ${this.status ?? 0} - ${this.statusText || "Unknown error"}`
|
139
|
+
},
|
140
|
+
l
|
141
|
+
);
|
142
|
+
}), n.apply(this, [r]);
|
143
|
+
};
|
144
|
+
}, C = () => {
|
145
|
+
if (window.__cyperfulAgentInitialized) return;
|
146
|
+
window.__cyperfulAgentInitialized = !0;
|
147
|
+
const e = console.log, n = (...t) => e("[Cyperful Agent]", ...t);
|
148
|
+
n("Loading...");
|
149
|
+
const { CYPERFUL_ORIGIN: i } = L();
|
150
|
+
if (window.location.origin === i) {
|
151
|
+
n("Ignoring parent frame (Why are we here?)");
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
$(), B(), window.addEventListener("error", (t) => {
|
155
|
+
u("global_error", { message: t.error.toString() });
|
156
|
+
}), window.addEventListener("unhandledrejection", (t) => {
|
157
|
+
u("unhandledrejection", { message: t.reason.toString() });
|
158
|
+
});
|
159
|
+
const o = history.pushState;
|
110
160
|
history.pushState = (...t) => {
|
111
|
-
|
161
|
+
o.apply(history, t), u("client_navigate", {
|
112
162
|
url: location.href,
|
113
163
|
replace: !1
|
114
164
|
});
|
115
165
|
};
|
116
|
-
const
|
166
|
+
const r = history.replaceState;
|
117
167
|
history.replaceState = (...t) => {
|
118
|
-
|
168
|
+
r.apply(history, t), u("client_navigate", {
|
119
169
|
url: location.href,
|
120
170
|
replace: !0
|
121
171
|
});
|
122
|
-
}
|
123
|
-
|
172
|
+
};
|
173
|
+
for (const t of [
|
174
|
+
"log",
|
175
|
+
"error",
|
176
|
+
"warn",
|
177
|
+
"info",
|
178
|
+
"dir",
|
179
|
+
"debug"
|
180
|
+
]) {
|
181
|
+
const a = console[t];
|
182
|
+
a && (console[t] = (...s) => {
|
183
|
+
a.apply(console, s), u("log", { level: t, args: s });
|
184
|
+
});
|
185
|
+
}
|
186
|
+
n("Loaded.");
|
187
|
+
};
|
188
|
+
try {
|
189
|
+
C();
|
190
|
+
} catch (e) {
|
191
|
+
console.error("Cyperful Agent failed to load", e);
|
192
|
+
}
|
data/public/index.html
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
6
|
<link rel="icon" href="/assets/favicon-DMdBZQlK.ico" />
|
7
7
|
<title>Cyperful</title>
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
8
|
+
<script type="module" crossorigin src="/assets/index-DQa6Blo_.js"></script>
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DqywWqA7.css">
|
10
10
|
</head>
|
11
11
|
<body class="bg-stone-900 text-slate-100">
|
12
12
|
<div id="root"></div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyperful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wyatt Ades
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.0.
|
61
|
+
version: 0.0.4
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.0.
|
68
|
+
version: 0.0.4
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
executables: []
|
@@ -84,9 +84,9 @@ files:
|
|
84
84
|
- lib/cyperful/test_parser.rb
|
85
85
|
- lib/cyperful/ui_server.rb
|
86
86
|
- public/assets/favicon-DMdBZQlK.ico
|
87
|
-
- public/assets/index-
|
88
|
-
- public/assets/index-
|
89
|
-
- public/assets/syntax-highlighter-worker-
|
87
|
+
- public/assets/index-DQa6Blo_.js
|
88
|
+
- public/assets/index-DqywWqA7.css
|
89
|
+
- public/assets/syntax-highlighter-worker-BezFv5DT.js
|
90
90
|
- public/frame-agent.js
|
91
91
|
- public/index.html
|
92
92
|
homepage: https://github.com/stepful/cyperful
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.5.
|
111
|
+
rubygems_version: 3.5.16
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Interactive test debugger for Capybara tests
|